How to send purchase Webhooks from ThriveCart to Funnelytics using Integromat
Create a Scenario in Integromat and add the Trigger
Select the ThriveCart module as a trigger. Choose the New Event option as the trigger event.
Step 1. Click the Add button.
Step 2. Give it a name in the "Add a hook" window that comes up. Then click Save.
Step 3. Once the endpoint URL is generated click Copy address to clipboard. We will use this URL to configure the webhook inside ThriveCart.
Having copied the URL, close the window of the module either clicking on OK or by clicking outside of it and then save the scenario by clicking on the SAVE icon on the bottom of the page.
Create the Webhook request in ThriveCart
Log into your ThriveCart account, click on your profile picture (upper-right angle of the screen), and then on Settings.
On the page that will open up click on API & webhooks.
Then click on View Settings next to the Webhook & notification element.
On the page that pops up (if this is not your first webhook the video will not be present) follow these steps:
Step 1. Type a name for the webhook in the Name field.
Step 2. Paste the link copied during the Setup of the Integromat trigger in the Webhook URL field,
Step 3. Check the Receive results as JSON box
Step 4. Then hit Save this webhook.
Add the Iterator tool module
The Iterator tool allows your Integromat scenario to read multiple products' info nested inside your data coming from ThriveCart.
Step 1. Click on the green "Cog" icon at the bottom of your scenario page.
Step 2. Select "Iterator".
Step 3. Go ahead and connect it to your ThriveCart trigger. Once done, you will be able to select the element that contains the products purchased so that Integromat can collect the information and send it to Funnelytics. The element you have to look for is named Charges.
Once added, it will be displayed in the Iterator window as 1. Order: Charges [] element.
Note: The numbers you will see on the elements once selected, are there to make it easier to understand where that data is coming from.
These numbers correspond to the number you see under each module.
Add the Aggregate to JSON module
Now that you have made all the purchased products' data available to Integromat, let's ask it to put them in a way that the Funnelytics endpoint will easily digest.
To do this you will have to add an Aggregate to JSON module.
Step 1. Click on the little "+" icon on the bottom of the scenario page.
Step 2. Type JSON in the window that pops up,
Step 3. Select the JSON icon
Step 4. Then hit Aggregate to JSON.
Configure the Aggregate to JSON module
Configuring this module is quite easy thanks to the built-in generator, which lets you create the layout by making it read the structure of the final code we want to create.
Step 1. Start by selecting the Source of the data from the dropdown menu, which will be the Iterator.
Step 2. Then click on the Add button to create a new data structure.Step 3. Give it a name.
Step 4. Click on Generator.
Step 5. In the new window, select JSON in the "Content-type" dropdown menu.
Step 6. Paste the following code in the "Sample Data" field.
{
"product_name": "my product name",
"product_id": "my product id",
"total": 0
}
Integromat will read the JSON code and will populate the "Specification" section with the three elements we need and their value type.
The last step needed is to go back to the first window of the Aggregate to JSON module and select which values shall fill those fields.
To do this just click on the field that needs to be filled and select the value from the pop-up window.
Element | Value |
product_id | Item Identifier |
product_name | Name |
total | Unit Price Str (The item price without the taxes paid by the user) |
Note: Every Integromat module output value will inherit the module's color so that it will be easier to spot the correct element when recalling them in a further step.
Add the HTTP Request
Let's get to the last piece of our puzzle, the HTTP Request module.
To add the module, we will once again click the little "+" icon that appears at the bottom of the scenario page, however, in this case, we will search for "HTTP", and the action will be Make a Request.
Configure the HTTP Request module
Step 1. Add https://track-v3.funnelytics.io/events/commerce to the URL field.
Step 2. Select POST as the Method.
Step 3. Add two headers as detailed in the table below:
Header | Name | Value |
1 | Content-Type | application/json |
2 | Authorization | Your Funnelytics API key (you can find it in your workspace settings tab) |
Step 4. Select Raw as "Body Type"Step 5. Set JSON (application/json) as the "Content type".
Step 6. Lastly, in "Request content" paste the following code and enter your data between the empty quotes ""
{
"email": "",
"datetime": "",
"items":
}
Click the "Request Content" field to reveal the data mapping pop-up.
Step 1. In the ThriveCart elements look for the one named Email nested in Customer (1. Customer: Email) and add it between the empty quotation marks in the "email": line.
Step 2. Again, in the ThriveCart elements, look for the element named Date Iso 8601 nested in Order (1. Order: Date Iso 8601) and add it between the empty quotation marks in the "datetime": line.
Step 3. Add the Aggregate to JSON output in the "items": line.
Something missing?
if something is missing in the documentation or if you found some part confusing, please reach out to support team, with your suggestions for improvement.
We love hearing from you!