In this guide, you will learn how to Integrate GCP Cloud Functions and omni-channel automation with MessageBird’s FlowBuilder. This tutorial covers the setup of an OTP generator using Cloud Functions — as well as integration into a user-initiated Omni-Channel flow.
2FA for Voice and WhatsApp
We’ll learn how to create a Cloud Function for generating OTP passcodes and use it to authenticate users’ access across any omni-channel service.
Why Cloud Functions?
Cloud Functions works as a connective layer allowing you to weave logic between GCP services and third-party platforms by listening and responding to events. With just a few lines of code, developers can enrich their use of any services and create high-level combinations without the need to provision or manage servers.
Step 1: Sign up for GCP
1. Complete free GCP account signup
2. Create a Cloud function by following these steps:
- Open the Functions Overview page in the Cloud Console and make sure that the project for which you enabled Cloud Functions is selected.
- Choose Create function.
- Name your function.
- Select HTTP Trigger from the trigger field
- Record the URL of the function
- Choose Allow Unauthenticated Invocations — this is for initial testing only.
- In the source code field, select Inline editor. In this tutorial, we’ll use the default function provided by the editor.
- Use the Runtime dropdown and select Node.js 8
- Overwrite Index.js with this content.
Ready? When you finish these steps, your display should resemble the following:
3. And that’s it! Now just deploy the function
Step 2: Connect it all in the MessageBird Dashboard
2. Import the sample flow.
3. Select WhatsApp as the trigger of your flow.
4. Look for steps Cloud Function 1/2 and 2/2, and replace the URL with the newly created Cloud Function URL.
5. If you are looking to provide voice 2FA, simply purchase a MessageBird Number. If this is not the case, please remove the phone verification branch from your flow.
6. Publish your flow in the top right corner of your screen, and you're good to go!
7. Done! Initiate a conversation with your channel to start authenticating your customers.
And that’s it! 🎉 Now you know how to integrate GCP Cloud Functions and omni-channel automation with FlowBuilder.