Connect Google Forms with Webhook event in NetHunt Workflows

OZ
Written by Olia Zhovniriv
Updated 1 day ago

The Webhook feature in Google Forms becomes available with this Email Notifications add-on. Once you install it, you can go to Google Forms and open one of your already existing Forms or create a new one.

There you will see this “puzzle piece” extension and add-on icon:

  • Click on it, and select the option to “Open App”:

  • Once it opens, tap on “Create” > choose the "Webhook Notification" option:

  • Give a name to your Webhook (e.g. NetHunt)

  • From there you can already go to NetHunt Workflows and create a “Webhook event occurs” trigger, copy the link and paste it in Google Forms.

Once that is done, here is how the set-up looks like inside Google Forms:

  1. Request URL: the one you copy from NetHunt "Webhook event occurs" trigger

  2. Method: “Post”

  3. Click on Request Body

  4. Content type: application/json

  5. Delete all the unnecessary fields [Form ID/Name/URL, Response Number/Date/URL/ID, Submitted at]

  6. Click Test

In NetHunt you should click Refresh fields, and you will see the rendered field from the Google Form:

You might see blank fields, but that is totally how it should be, if you haven’t yet got a response on your form.

Now you need to Save the Webhook in Google Forms and in NetHunt.

Then you can add a Workflow action in NetHunt “Create a new record” and map all the fields accordingly.

Connect your Google form to NetHunt using AppsScript

Having a form in your website or sending it to your prospects by e-mail is a very good way to start communicating with them and also get some extra information from the form. There are two ways to achieve this, the easiest is through zapier integration and the second one which would involve a bit of technical and programming skills through webhooks. In case you or anybody in your team is not tech savvy enough, we strongly recommend you to consider zapier first since they also have a free plan for less than a 100 zaps per month.

The first thing you need is of course your Google form as well as the Google Spreadsheet where you are getting the responses.

In the google spreadsheet go to Tools > Script editor:

Now you need to write a simple script composed mainly of two parts. In the first part of the script you need to define:

  1. First you need to name the script, for this example we'll go for the default one "mainscript". Specify the spreadsheet where the information is going to be taken from. To achieve this you need the open by ID command, this way SpreadsheetApp.openById('spreadsheetId') and replace the spreadsheetId for the actual ID you find in the URL of the spreadsheet (the ID is not the whole spreadsheet URL but the value between '/d/' and '/edit').

2. The sheet in the spreadsheet needs to be activated by the command activate command as follows SpreadsheetApp.getActiveSpreadsheet().

3. The range where to look for the information with the following command sheet.getDataRange() (please keep in mind in the previous command, sheet stands for a variable defining the active spreadsheet from the previous point).

4. Retrieve the values allocated in a certain range with the command rangeName.getValues() (Please keep in mind that rangeName is a variable assigned after executing the previous command).

5. The next step is to iterate through the values in the range with the following command for (var row = 0; row < data.length; row++) {. While doing so, you can assign the values to variables that will be used later on as payload like this for example var Email = (data[row][2]). This last command assigns a value taken from a cell (in this case the row 0 which would correspond to the column A in the spreadsheet, to a variable that we are naming Email in this case. You need to do the same for all the data you need in the CRM, for example if you need all the values from column A to D, you'd need to define all the variables as row[0] to row[4].

In the second part of the script, you need to:

  1. Define the information that you need to pass to the system and include it into the request. The best way to do it is to create a variable that you can call for example data and include all the variables created in the first part of the script.

  2. You need to make an HTTP request to the Webhook URL that is generated at the beginning as the trigger, specifying the kind request and the data to be included in it.

Once your script is ready, you need to set up a trigger for it. You can do it from Edit > Current project's triggers

Click on Add trigger

Select the function you have just created (the default one is mainscript) and Select the event type as on form submit

And that should do it! All the information included in the form can be used and included in the record:

More information on creating a Workflow for sending leads straight to NetHunt can be found in this article.


Haven’t found the answers you’re looking for? Ask our Users Community.

Did this answer your question?