Automating5 Min.

Use raw response data in webhooks (experts only)

You can easily connect Tripetto to a webhook, as we described in this article, but it's also possible to use the raw response data, which we will describe in the article below. This is for experts only!


Important! Experts only!

Please be aware the article below is for experts only. It does NOT describe how to use the default webhook connection.

If you just want to send response data to a webhook, please have a look at this article.

The goal

This article describes how to use the raw response data of Tripetto entries in a webhook connection. The raw data contains the plain JSON data that is stored with each form entry.

Once again: this is NOT the default way to send your data to a webhook! Please have a look at this article for the default method.

The basis

We use the default webhook article as the basis for describing what you need to modify to let it work with the raw data. Please also have a look at that basis article.

Modifications

In the basis article we kept the Raw response data option in Tripetto disabled. On top of the steps that we describe in the basis article, these are the steps to process the raw data of Tripetto entries.

Enable raw response data

First step is to enable the option in Tripetto to send raw response data. In the Automate pane in Tripetto, go to the webhook settings and enable the option Send raw response data to webhook.

Edit first step

In the basis article we used the Catch Hook in Zapier. If you enabled the Raw response data option in Tripetto, you must change this to Catch Raw Hook. Now Zapier will receive the raw JSON response data from Tripetto.

Add extra step - Make your data useable

If you enabled the Raw response data option in Tripetto, you have to add another step in Zapier to make your data usable. This step comes after step 1 in your Zap. This part might be a bit complicated, because we have to manipulate the response data a bit before we can use it the way we want in Zapier. But no worries, we'll help you through.

Add a code block

After the first Zapier block (Catch Raw Hook), you can click the button. This will insert a new Zapier block.

Choose App

In this step we want to add a code block, so search for the app Code by Zapier and click the corresponding app button in the search results.

Choose Action Event

Next step, select the action. From the dropdown, select Run Javascript.

The settings of the Code block.

Click Continue.

Insert code

We're now going to add a code snippet to make the response data readable for Zapier.

First we see the Input Data. This determines what data should be used inside the code we're going to add. This containes two fields:

  • In the first field enter: tripettoResult;
  • In the second field click the icon on the right and select Raw Body.

Now we're going to add the code that needs to be executed. Just copy-paste the below code into the Code field in Zapier:

output = {};

var input = inputData.tripettoResult;

if (input.indexOf("\"") === 0) {
  input = JSON.parse(`{"data":${input}}`).data;
}

var tripettoFields = JSON.parse(input).fields;

for (var nField = 0; nField < tripettoFields.length; nField ++) {
   output["tripettoField" + nField] = tripettoFields[nField].string;
}
The result of the script settings.

Click Continue.

Test code

Zapier will now show a summary of your code block and you can test it by clicking Test & Review. This will result in Zapier showing the test data you entered in your test response, with each question labeled with tripettoField{number}.

The result of the test of the script.

Edit last step

In the basis article we could just select the data we needed in the spreadsheet column right away. If you use the raw data, you can also do this, but your data is in the JavaScript variables we described in the Code block in Zapier.

The settings of the Google Sheets file.
In this article

    Help us improve