How to receive journey form submissions into a Google spreadsheet with Zavvy webhooks
In this document, we will go through the process of setting up webhooks on Zavvy and a Google Spreadsheet to update the spreadsheet with data submitted in Forms on Zavvy.
Overview
The setup overview is as following:
- Create a Google Apps Script for a Spreadsheet that can receive HTTP POST requests and deploy it.
- Configure Webhook endpoint on Zavvy to send events to the Apps Script’s endpoint.
Prepare Google Spreadsheet to receive Webhooks
Create an Apps Script for the spreadsheet
- Create a new empty spreadsheet or open an existing spreadsheet.
- Go to extensions and click “Apps Script”
- Here, write your code to receive the Zavvy Webhook payload, transform the data as required and insert it into the spreadsheet.
- The documentation from Google is here.
- We created a sample script for you to get started with if you need help. https://github.com/zavvy-io/sample-zavvy-webhook-to-google-spreadsheet-appscript
NOTE: It is important that you don’t use Content Service to return any response to doPost. Otherwise, the webhook requests will fail to deliver efficiently. This is because of the redirects behaviour of Apps Script’s Content Service. Please always just return nothing in the doPost. See our sample scripts for example.
Deploy the Apps Script
- Once you finish editing your code, select “Deploy > New Deployment”.
- In type, select “Web app”.
- Under configuration:
- Give a description or leave it empty.
- “Execute as”: Select yourself.
- “Who has access”: Select “Anyone”.
NOTE: This will make the endpoint public and anyone can post to this endpoint. Securing the endpoint is not covered in this guide. A quick solution could be set a secret key and make the Zavvy webhook set a header with the same secret key and accept requests only matching that key. - Deploy
- Once deployed, you will receive a URL for the endpoint. Make a note of this.
Setup Zavvy Webhook to send data to Apps Script
- On Zavvy, navigate to People Data > Integrations > Webhooks.
- Click a “Add new Endpoint” with the URL you copied from the Apps Script deployment.
- Under Message Filtering, enable journey.form_submission.submitted events.
- Create!
Enable Webhooks on a Journey step
To receive webhooks, you need to also enable webhooks on a Form on the Journey step that you are interested in receiving the events for.
- Navigate to the Journey builder
- Find the Step and enable Webhooks on Form.
Testing with a sample Submission
- Assign the Journey to yourself and submit the step.
- In a minute or so, you will be able to see the data populate into your Spreadsheet
Debugging
If you don’t see the data in your spreadsheet, make sure:
- Webhooks are enabled on the Form in the Journey step.
- If you created a new deployment of Apps Script, the endpoint URL will change. Make sure the webhook is configured to the most recent deployment URL of your Apps Script.
- make sure you have not hard-coded a sample webhook payload in the Apps Script for testing.
On the webhooks management portal on Zavvy, you can see a log of all the events that are triggered and the attempts to deliver those events to the endpoint configured. Take a look at the logs and see if you find anything that can help you debug the issue further.
If you need help, please reach out to us.