# Integrate GCP Cloud Functions and omni-channel automation with FlowBuilder

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.

&#x20;

<figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-ff3693941373f47cae6889645b98876637faca36%2FSE_TUTS_Mongodb-FLB_20200429.gif?alt=media" alt=""><figcaption></figcaption></figure>

**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.&#x20;

&#x20;

**Why Cloud Functions?**<br>

**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.

&#x20;

**Requirements**

* [A MessageBird account](https://dashboard.messagebird.com/en/sign-up)
* [A WhatsApp for Business account](https://www.messagebird.com/whatsapp/)
* [Google Cloud Platform - GCP](https://cloud.google.com/free)

&#x20;

**Step 1: Sign up for GCP**

Make sure to sign up for a [MessageBird account](https://dashboard.messagebird.com/en/sign-up) and a [WhatsApp for Business account](https://www.messagebird.com/whatsapp/). Done? Awesome! Time to [sign up for GCP](https://cloud.google.com/free).&#x20;

1\. Complete free [GCP account signup](https://cloud.google.com/free)

2\. Create a [Cloud function](https://cloud.google.com/functions/docs/quickstart-console) by following these steps:&#x20;

* Open the [Functions Overview page](https://console.cloud.google.com/functions/list?_ga=2.178142822.277010062.1589934721-1232490777.1580424491) 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.&#x20;
* Use the Runtime dropdown and select **Node.js 8**
* **Overwrite Index.js** with [this content](https://drive.google.com/open?id=1vlfkKeY2qzLDAh_2LP9wLIu_I_Z9CbpS)**.**

Ready? When you finish these steps, your display should resemble the following:

&#x20;

<figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-65bf6c99618e2dea898b8080abe5b81287c260bc%2Fimage2.png?alt=media" alt=""><figcaption></figcaption></figure>

&#x20;

&#x20;

3\. And that’s it! Now just **deploy** the function

&#x20;

**Step 2: Connect it all in the MessageBird Dashboard**

1\. Log in to your [MessageBird Dashboard](https://dashboard.messagebird.com/en/login) and go to [Flow Builder](https://dashboard.messagebird.com/en/flow-builder).

2\. Import the [sample flow](https://drive.google.com/open?id=1O_hJIqyOS6n2Js4zdyFb0o3QbfCezvfi).

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](https://dashboard.messagebird.com/en/numbers). If this is not the case, please remove the **phone verification branch** from your flow.&#x20;

6\. **Publish** your flow in the top right corner of your screen, and you're good to go!&#x20;

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.

&#x20;

&#x20;
