Connect your Google Form using Generic Webhook

Set up Google Forms with Gallabox to send WhatsApp Messages. This step-by-step guide will help you integrate webhooks into your Google Form and capture responses effortlessly.

Google Forms Webhook Integration

If you want to set up Google Forms to send webhooks after every submission, you can do so by following these steps:

Create Your Form

Begin by creating a new form or using an existing one. Add the necessary questions to your form to collect the information you need. This step also helps in testing the webhook functionality by submitting some responses.

Obtain Your Endpoint URL

You'll require an endpoint URL to send the webhook data to. Go to Integrations in your Gallabox Account, click on Connect for Generic Webhooks. Provide a Name for the Integration and click confirm. A Webhook URL will be generated and has to be used in the next step.

Integrate the Script

Access your Google Form and click on the three dots located in the top right corner, situated between the Send button and your profile picture. Then, select "Script Editor." Delete any existing code and replace it with the provided script:

var ENDPOINT_URL = "Enter your endpoint URL here";

function onSubmit(e) {
    var form = FormApp.getActiveForm();
    var allResponses = form.getResponses();
    var latestResponse = allResponses[allResponses.length - 1];
    var response = latestResponse.getItemResponses();
    var payload = {};
    for (var i = 0; i < response.length; i++) {
        var question = response[i].getItem().getTitle();
        var answer = response[i].getResponse();
        payload[question] = answer;
    }

    var options = {
        "method": "post",
        "contentType": "application/json",
        "payload": JSON.stringify(payload)
    };
    UrlFetchApp.fetch(ENDPOINT_URL, options);
};

Click on Save. The onSubmit function will execute whenever the form receives a submission. Save your changes.

Ensure to replace "Enter your endpoint URL here" with your actual endpoint URL generated in the previous step in your Gallabox account.

Test Your Script

Send the link to one of your teammates to capture the response for your Google Form. Once you get a response, click on "Capture Webhook Response" in Gallabox Account and then click "Run" in Script Editor to test your script. You should be able to capture a response in your Gallabox Account.

Once you receive a Webhook Response, click on update configuration to create workflows to send WhatsApp Messages to those who responded on your Google Form.

Add a Trigger

Click on the alarm clock icon in the sidebar, which should display "Trigger" when hovered over. Then, click the "Add Trigger" button. Select the onSubmit function as the function to run, choose the deployment (if not deployed yet, choose "Head"), set the event source as "from form," and select "On form submit" as the event type. Click "Save."

Deploy the Script

Click on the "Deploy" button at the top right and choose "New Deployment." Select the deployment type as "Web app." Optionally, add a description. Under "Who has access," choose "Anyone" to allow execution. Click "Deploy."

Create Workflow in Gallabox

Go to your Gallabox account and click on "Create New Workflow". Enter the name of the workflow, add conditions (if any), select the WhatsApp Template, map the variables, and add the tags you would like to attach with the contact. To save the workflow, click on "Create Workflow".

Google Forms Webhook Integration Logs

Once your workflow is created, it is time to test it. When you fill the Google form and click on submit, you will be able to see the logs. Here you can look for Status to ensure if the workflow is successful or not.

Congratulations! Your Google Form is now configured. You can send automated WhatsApp Messages for every submission.

Last updated