How to connect Google Forms to Tape

Google Forms is a popular tool for creating online forms and surveys. Users can easily create their forms via a drag-and-drop editor. In this guide, we will build a simple workflow to save the responses of a Google form in Tape using the webhook trigger.

Create a new automation​

The first step is to create a new automation in Tape with the webhook trigger and to copy the webhook URL:

Head over to Google Forms and create your online form with the form builder. Once you are satisfied with your form, you need to register a webhook.

Register a webhook in Google Forms​

To register a webhook in Google Forms, you need to open the Script editor from the settings:

Once you opened the script editor, replace https://tapeapp.com/api/catch/YOUR_WEBHOOK_URL_HERE
with the URL of your webhook trigger in the code below and copy&paste the resulting code into the editor:

var POST_URL = 'https://tapeapp.com/api/catch/YOUR_WEBHOOK_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()
      .replace(/[^a-zA-Z0-9]/g, '_');
    var answer = response[i].getResponse();
    payload[question] = answer;
  }

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

Hit the save icon and the Deploy button to activate your webhook script. You might need to grant permissions to yourself under the “Advanced” option:

Lastly, you have to create a Google Forms Trigger under the Triggers menu option on the left. Choose “onSubmit”, “Head”, “From form” and “On form submit” as the options:

Create a new record for each submission​

Now that we have set up the Google forms webhook, we can submit a response to our form and head back to the Tape automation. After hitting the “Refresh” button, one variable for each form question will be available inside the automation:

That’s it! You can use this guide to connect pretty much any online form provider that offers webhooks (and hofepully makes them easier to set up…).

Update from 09/2023: Handling Files

An avid Tape user and expert reached a point where they needed to collect files from a Google form, intending to use them further down the process inside Tape.

As Google does not send the file itself, but only a file ID refering to the file stored in Google Drive, one needs to leverage that ID to make the file accessible.

The procedure is as follows:

  • Collect the File ID from the webhook and store it inside a single text field
  • Have a calculation field that creates the link to access the file directly

The calculation would look similar to this:

Screenshot 2023-09-29 at 17.29.20

Kudos to @joschkalang who came up with this solution. :tada:

1 Like