Articles in this section

Set up a webhook to start a flow when a Google Form is submitted

You can use a webhook to immediately import the questionnaire data from a submitted Google Form to a destination application, as described below:

  1. Create a webhook flow and verify that you have the public URL value that will be used to export data from Google Forms to integrator.io.
  2. Create the destination import flow step and turn the flow on.
  3. Create a Google Form, keeping mind that the form submissions will also be integrated with you destination application.
  4. Link the form to a Google Sheet that stores all data submitted by those who use the form.
    1. Open the form you created.
    2. Click the Google Sheets icon in the Responses tab.
      LinkToGoogleSheet.png
    3. Verify that Create a new spreadsheet is selected, give the spreadsheet a recognizable name,  and then click Create.
      CreateASpreadsheet.png
    4. Verify that each of your questions maps to a column in the spreadsheet.
  5. Add an Apps Script to your Google Sheet.
    1. Open the Google Sheet.
    2. In the Extensions tab, click Apps Script.
    3. Open the Code.gs page and paste the following:
      function onFormSubmit(e) {
      var namedValues = JSON.parse(JSON.stringify(e.namedValues));
      for (let key in namedValues) {
      if (JSON.stringify(namedValues[key]) == '[""]') {
      namedValues[key] = null;
      } else {
      namedValues[key] = namedValues[key][0];
      }
      }
      var url = "https://api.integrator.io/v1/exports/<URL-ID-for-webhook>/data";
      var options = {
      "method": "post",
      "headers": {
      "content-type": "application/json"
      },
      "payload": JSON.stringify(namedValues)
      };
      var response = UrlFetchApp.fetch(url, options);
      }
    4. Replace the value for var url with the public URL.
      AppsScript.png
    5. Click the Triggers tab.
      AddTrigger.png
    6. Click +Add Trigger.
      TriggerSettings.png
    7. Configure the trigger with the following settings:
      • Choose which function to run: onFormSubmit
      • Which runs at deployment: Head
      • Select event source: From spreadsheet
      • Select event type: On form submit
    8. Click Save.

Now, when a respondent submits the form, Google Forms collects the response and initiates your real-time flow, integrating the data according to the logic in your flow. Test your flow by adding information to your Google Form to verify that the data triggers the flow when you click Submit.

Was this article helpful?
0 out of 1 found this helpful

Comments

0 comments

Please sign in to leave a comment.