# Integrate Google signup form with WhatsApp through Flow Builder

In this guide, you will learn how to link your Google Signup Form with WhatsApp by using Flow Builder. By creating a flow using a webhook as a trigger, you’ll be able to link any Google Form to your WhatsApp Templates.&#x20;

&#x20;

**Requirements**

* [A MessageBird account](https://dashboard.messagebird.com/en/sign-up)
* [A WhatsApp for Business account](https://www.messagebird.com/whatsapp/)
* [A Google Account](https://myaccount.google.com/intro)

&#x20;

**Before you begin**

* Create a business account by signing up with [MessageBird - WhatsApp Business Plan](https://www.messagebird.com/whatsapp/).&#x20;
* Submit your [pre-approved Message Templates](https://docs.bird.com/connectivity-platform/getting-started/working-with-whatsapp-message-templates) via the [WhatsApp Template Manager](https://dashboard.messagebird.com/en/whatsapp-template-manager/) in your MessageBird Dashboard. You can use the following example as a guide:

E.g. *Hi **{{1}}**,*

*This is an automated system that helps facilitate your registration process through WhatsApp. Visit this link to find out what documents you need before we get started:* [*https://www.messagebird.com/en/*](https://www.messagebird.com/en/)

*Reply with Start when you're ready to proceed.*

* Create a [Google signup form](https://docs.google.com/forms/u/0/) like the following:

#### &#x20;

&#x20;

**Step 1: Create a webhook trigger flow**&#x20;

1\. Go to [Flow Builder](https://dashboard.messagebird.com/en/flow-builder) and **create a new flow**.&#x20;

2\. Select **Webhook** as the trigger.

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

3\. Add **embeds\[0].fields\[0].value** and **embeds\[0].fields\[1].value** as your **webhook variables**.

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

4\. Done? Awesome! Add a **Send WhatsApp HSM** step below your Webhook.  Choose your template, add **embeds\[0].fields\[0].value** as the **Recipient**, and **embeds\[0].fields\[1].value** as **variable 1**.

&#x20;

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

&#x20;

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

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

#### &#x20;

**Step 2: Set up your Google Form**&#x20;

1\. Create a [Google Signup Form](https://docs.google.com/forms/u/0/) for use with this script.&#x20;

2\. Go to the top-right corner of your screen and select **Script editor**. Done? Now paste the following scripts.&#x20;

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

&#x20;

```

var POST_URL = "https://flows.messagebird.com/flows/c60a5eaa-f68b-417e-b6e4-3a024f48d1a7/invoke";

function onSubmit(e) {
    var form = FormApp.getActiveForm();
    var allResponses = form.getResponses();
    var latestResponse = allResponses[allResponses.length - 1];
    var response = latestResponse.getItemResponses();
    var items = [];

    for (var i = 0; i < response.length; i++) {
        var question = response[i].getItem().getTitle();
        var answer = response[i].getResponse();
        try {
            var parts = answer.match(/[\s\S]{1,1024}/g) || [];
        } catch (e) {
            var parts = answer;
        }

        if (answer == "") {
            continue;
        }
        for (var j = 0; j < parts.length; j++) {
            if (j == 0) {
                items.push({
                    "name": question,
                    "value": parts[j],
                    "inline": false
                });
            } else {
                items.push({
                    "name": question.concat(" (cont.)"),
                    "value": parts[j],
                    "inline": false
                });
            }
        }
    }

    var options = {
        "method": "post",
        "headers": {
            "Content-Type": "application/json",
        },
        "payload": JSON.stringify({
            "content": "‌", // This is not an empty string
            "embeds": [{
                "title": "TOP TEXT CHANGE THIS IN SCRIPT",
                "fields": items,
                "footer": {
                    "text": "BOTTOM TEXT CHANGE THIS IN SCRIPT"
                }
            }]
        })
    };

    UrlFetchApp.fetch(POST_URL, options);
};

```

&#x20;

2\. Replace the red highlighted webhook with your **Flow Builder Webhook URL** you just created. To get your URL, open your flow, click on the **Webhook** step and tap **copy**.&#x20;

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

4\. Add a trigger into the current project. Click the clock icon below, the page of the project trigger will open. Press **Add Trigger** button, set it up per the screengrab below.

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

&#x20;

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

5\. And that's it! Click the **Save** button to add a trigger to the current project.

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

And that’s it! 🎉 Now you know how to integrate a Google Form with WhatsApp. Check out [this demo video](https://www.youtube.com/watch?v=_XzLRolqH1Y) to see them in action!

&#x20;

&#x20;
