Webhook
What you can do with this integration
This integration allows you to call Krenalis APIs and import events and users directly from your application, regardless of the technology and programming language you use, since it allows you to interact directly via HTTP calls with Krenalis APIs.
This integration is useful in those cases where Krenalis does not provide a dedicated SDK for your language. It can also be used in those cases where you want to interact with Krenalis directly via the command line, making the calls with tools like curl.
In this regard, it is therefore useful to see the API reference documentation.
Once events are received, you can:
- Send events to destinations: These are applications or services capable of processing the events.
- Store events in the workspace's data warehouse: Ideal for data analysis and reporting purposes.
- Extract user data for identification: Helps in identifying both authenticated and anonymous users, facilitating unification within the workspace's data warehouse.
To use this integration, you will need any language or application that can make HTTP calls.
How to send events
1. Add source connection for Webhook
First of all, you need a connection in Krenalis that can receive events from your application that sends HTTP requests. To do so:
- From the Krenalis Admin console, go to Connections → Sources.
- On the Sources page, click Add a new source ⊕ .
- Search Webhook; you can use the search bar at the top or filter by category.
- Click on the connection for Webhook. A panel will open on the right.
- Click on Add source.... The
Add source connection for Webhookpage will appear. - In the Name field, enter a name for the source to easily recognize it later.
- Click Add.
2. Add a pipeline
Now you can choose to collect only the events, or import the users, or both:
- Go to the Webhook connection you just created and click on Pipelines.
- Choose Import events into warehouse (to import event data) or Import users into warehouse (to import user data from events).
- Fill in the necessary information in the pipeline.
- Confirm by clicking Add.
- Enable the pipeline by toggling the switch in the Enabled column.
3. Open the Live events page
- Go to the source connection for Webhook created at step 1 and click on Event debugger.
- Go on with the next step for sending events; you will see the incoming events in the Live events view.
4. Send some events
You can use any tool or language you like for sending HTTP requests containing the events to the Webhook integration.
For example, if you're using curl:
curl <KRENALIS ENDPOINT> \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <YOUR_WRITE_KEY>" \
-d '[
{
"type": "track",
"anonymousId": "2ab4facf-ca73-4361-b1b2-4472ce053122",
"event": "page",
"properties": {
"answer": 42
}
}
]
'
You can get the values for <KRENALIS ENDPOINT> and <YOUR_WRITE_KEY> by clicking on the Webhook connection you created → Settings → Event write keys.
So, for example, you can send an event with curl like this:
curl http://localhost:2022/v1/events \
-H "Content-Type: application/json" \
-H "Authorization: Bearer 4qwwvXGRa0R2PeJsUwSv1juy2MRrY8bA" \
-d '[
{
"type": "track",
"anonymousId": "2ab4facf-ca73-4361-b1b2-4472ce053122",
"event": "page",
"properties": {
"answer": 42
}
}
]
'
Refer to the Learn events spec for more information on the supported event types.