What are webhooks?
A webhook is a way for an app to provide other applications with real-time information. When an event occurs in the app that the webhook is associated with, the webhook sends a message to the specified URL, which can then trigger an action in the other application. Webhooks are often used to enable communication between different apps and services, allowing them to share information and perform actions in real time.
For example, a webhook could automatically send data to an Email Service Provider when a new user signs up for a service to trigger an automated campaign.
Cool! How can I create and send webhooks with Datatrics?
Datatrics can send triggered-based webhooks to endpoints to send and enrich data from known profiles. To create a triggered webhook, you must head to the "Campaigns" section and create a Hybrid Campaign.
To perform webhooks in the Hybrid Campaign, you need at least a Website Trigger, Webhook, and a Stop (which can have a custom restart timeout!).
Now create a Website Trigger that targets users based on their website behaviour, like visiting a specific (kind of) page or item. Besides that, we recommend targeting known profiles to keep the campaign data clean of unknown profiles that cannot be sent.
In the Webhook Trigger, you should submit the URL and choose between POST or GET. Next, you can specify the profile fields that you want to be triggered in the webhook, as well as any additional data that you want to include in the webhook payload. This means that you can send both profile fields like ‘profileid’, email, or if it exists, ‘gender’, but also static, non-existing fields in profiles like ‘automationid’. The latter is especially used when triggering campaigns in systems.
Next, you can use the Request headers tab. Some endpoints, especially when using personal information, need extra information like API keys or other data for identification.
For example, the server can check the API key included in the request headers to determine whether the user has access to the data returned by the endpoint. This is important to prevent unauthorized users from accessing certain data or functions. It is therefore recommended to consult documentation to see which request headers are required for a specific endpoint.
Before production, we recommend testing the webhooks. Testing webhooks is an important step in the development process, as it helps ensure that the webhook is working properly and sending the correct data in a safe way.