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...).