Connect Your Google Form Using Generic Webhook

Google Forms is a versatile tool for gathering data. By integrating it with BizMagnets using webhook, you can automate the process of sending form responses directly to BizMagnets for further actions.

This guide outlines the steps to establish this integration smoothly.

Steps to Set Up Google Forms Integration:

Create Your Form

Start by creating a new Google Form or use an existing one. Add all the required questions to capture the necessary information.

Ensure your Google Form includes a field to collect the WhatsApp number. Without this, sending WhatsApp messages via BizMagnets won’t be possible.

  • If both you and the customer are based in India:

    • The phone number can be entered with or without the country code (e.g., +91).

  • For customers outside India:

    • Always include the appropriate country code in the phone number field.

Obtain Your Endpoint URL

To send webhook data to BizMagnets, you need an endpoint URL. Here's how to get it:

  1. Log in to your BizMagnets account and navigate to Integrations.

  2. Click on Connect under Generic Webhooks.

  3. Provide a name for the integration and click Confirm.

  4. A webhook URL will be generated—save this URL for the next step.

Integrate the Script

To integrate Google Forms with BizMagnets, follow these steps:

  1. Open your Google Form and click on the three dots in the top-right corner (next to the Send button).

  2. Select Script Editor from the dropdown menu.

  3. Delete any existing code and replace it with the following script:

javascriptCopy codevar 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);
}
  1. Click Save. The onSubmit function will automatically execute whenever the form receives a submission, sending the data to BizMagnets for further processing.

Ensure you replace "Enter your endpoint URL here" with the actual webhook URL generated in your BizMagnets account.

Test Your Script

  1. Share the Google Form link with one of your teammates to gather a response.

  2. Once a response is submitted, go to your BizMagnets account and click on Capture Webhook Response.

  3. In the Script Editor, click Run to test your script. The response should now appear in your BizMagnets account.

After receiving the webhook response, click Update Configuration to set up workflows that send WhatsApp messages to those who filled out your Google Form.

Add a Trigger

  1. In the Script Editor, click on the alarm clock icon in the sidebar (labeled Trigger when hovered over).

  2. Click on the Add Trigger button.

  3. Configure the trigger:

    • Select the onSubmit function to run.

    • Choose the deployment (use Head if it hasn't been deployed yet).

    • Set the event source as from form and select On form submit as the event type.

  4. Click Save to finalize the trigger setup.

Deploy the Script

  1. Click the Deploy button at the top-right corner and choose New Deployment.

  2. Select Web app as the deployment type.

  3. Optionally, add a description for the deployment.

  4. Under Who has access, choose Anyone to enable execution.

  5. Click Deploy to publish your script.

Create a Workflow in BizMagnets

  1. Log in to your BizMagnets account and click on Create New Workflow.

  2. Name your workflow and add conditions (if needed).

  3. Select the WhatsApp template, map the variables, and add any tags you wish to attach to the contact.

  4. Save the workflow by clicking Create Workflow.

Google Forms Webhook Integration Logs

Once the workflow is set up, test the integration:

  1. Have someone fill out and submit the Google Form.

  2. Check the Logs in your BizMagnets account to review the workflow status. Verify that the workflow was executed successfully.

By following these steps, you can ensure a successful connection between your Google Form and BizMagnets for automating WhatsApp communications.

Last updated