Our new Webhook endpoint allows you to easily send any action event, including purchases, to your Funnelytics account.
This will allow you to use any automation tool to send data to Funnelytics
Make
Pabbly
Integromat
SureTriggers
Procesio
N8N
Postman
Your Custom Application
You name It!
How Does It Work?
Step1: Dynamic URL for the POST Request
The new endpoint accepts POST requests with the following structure:
https://events.funnelytics.io/api/v1/webhook/{actionName}
Where {actionName} can be anything you want.
For example, to create an action called Demo I will send a request to the following endpoint:
https://events.funnelytics.io/api/v1/webhook/Demo
🚨IMPORTANT: To pass a Purchase or Revenue action that will be shown as a purchase on the Funnelyics canvas the URL to use for the requests is ONLY the following
https://events.funnelytics.io/api/v1/webhook/__commerce_action__
Step 2: Headers
The Headers are what will inform our endpoint that your request is legit and in which workspace it should direct that data.
The Content-Type header has to be always set as application/json
Content-Type: application/json
Information like the X-API-KEY and X-PROJECT-ID can be easily found in the integrations tab in your account.
X-PROJECT-ID: Webhook Account ID
X-API-KEY: Webhook Secret Key
Here’s how it should look like if you use Postman (the order of the Headers is not important as long as the are all there)
Step 3: Formatting Your Data
When you send data to the new Endpoint it needs to be in a specific format as explained in the steps below.
Rules
For successful data processing:
The payload needs to be flat, except for the purchase_data element. Any other nested object will make the request fail
To send multiple purchases or items in a single request, use the purchase_data array as shown in Example 2 below (array of multiple objects [{…},{…},{…}]) .
You can add as many key-value pairs as parameters as you want.
Use the dateTime parameter to specify the date of the event in ISO-8601 format.
Duplicated requests will be rejected. In case you have the necessity of sending the same information multiple times, adding the dateTime of the event it will let you avoid getting rejected
If you are storing or are able to pass the Funnelytics ID for your users (available in the browser console with the window.funnelytics.session command) you can pass it as session and the event will be tied to a specific user
If you are identifying users using emails you will be able to pass the user email as email and the action will be tied to the user with that email - If no users with that email are found in our DB a new user will be create
If no session or email is passed every event received will create a new user.
Example 1: Custom Action - Lead
For non-revenue-related actions
Endpoint
Headers
Content-Type: application/json
X-PROJECT-ID: Webhook Account ID
X-API-KEY: Webhook Secret Key
Payload Structure
The payload must be flat (no indentation) and may include:
session (optional but recommended): Funnelytics ID
email (optional but recommended): Email associated with Funnelytics ID
dateTime (optional): Specify the event date in ISO8601 format (example: 2023-11-05T21:18:04+00:00)
Additional key-value pairs for custom attributes.
Payload Example:
{
"email": "[email protected]",
"session": 12345678,
"carBrand": "Lamborghini",
"carModel": "Urus",
"productionYear": "2021"
}
Example 2: Commerce/Revenue Actions
For commerce/revenue actions, follow these additional rules.
Endpoint ( For Commerce/Revenue actions cannot be changed)
Headers
Content-Type: application/json
X-PROJECT-ID: Webhook Account ID
X-API-KEY: Webhook Secret Key
Payload Structure
session (optional but recommended): Funnelytics ID
email (optional but recommended): Email associated with Funnelytics ID
dateTime (optional): Specify the event date in ISO8601 format (example: 2023-11-05T21:18:04+00:00)
Additional key-value pairs for custom attributes.
purchase_data: an array that could include various objects and iterate through them. Each object should include
__sku__: Product ID
__label__: Product Name
__total_in_cents__: Total amount in cents
__order__: Order number
__currency__: Currency (e.g., 'USD')
Additional key-value pairs for custom attributes specific to the product.
Payload Example with Single Purchase Info:
{
"email": "[email protected]",
"session": 12345678,
"carBrand": "Lamborghini",
"carModel": "Urus",
"productionYear": "2021",
"purchase_data": [
{
"__sku__": "LAMBO007",
"__label__": "LAMBO Urus",
"__total_in_cents__": "30000000",
"__order__": "123456",
"__currency__": "USD"
}
]
}
Payload Example with Multiple Purchase Info:
{
"email": "[email protected]",
"dateTime": "2023-11-05T21:18:04+00:00",
// ... other key-value pairs
"purchase_data": [
{
"__sku__": "LAMBO007",
"__label__": "LAMBO Urus",
"__total_in_cents__": 30000000,
"__order__": "Order 123456",
"__currency__": "USD"
"quantity": 3
},
{
"__sku__": "LAMBO008",
"__label__": "LAMBO Urus1",
"__total_in_cents__": 60000000,
"__order__": "Order 654321",
"__currency__": "USD"
}
]
}