# 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](https://www.krenalis.com/docs/api/). 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: 1. From the Krenalis Admin console, go to **Connections → Sources**. 2. On the **Sources** page, click **Add a new source ⊕** . 3. Search **Webhook**; you can use the search bar at the top or filter by category. 4. Click on the connection for **Webhook**. A panel will open on the right. 5. Click on **Add source...**. The `Add source connection for Webhook` page will appear. 6. In the **Name** field, enter a name for the source to easily recognize it later. 7. Click **Add**. ### 2. Add a pipeline Now you can choose to collect only the events, or import the users, or both: 1. Go to the Webhook connection you just created and click on **Pipelines**. 2. Choose **Import events into warehouse** (to import event data) or **Import users into warehouse** (to import user data from events). 3. Fill in the necessary information in the pipeline. 4. Confirm by clicking **Add**. 4. Enable the pipeline by toggling the switch in the **Enabled** column. ### 3. Open the Live events page 1. Go to the source connection for Webhook created at step 1 and click on **Event debugger**. 2. 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`: ```sh curl \ -H "Content-Type: application/json" \ -H "Authorization: Bearer " \ -d '[ { "type": "track", "anonymousId": "2ab4facf-ca73-4361-b1b2-4472ce053122", "event": "page", "properties": { "answer": 42 } } ] ' ``` You can get the values for `` and `` by clicking on the Webhook connection you created → **Settings → Event write keys**. So, for example, you can send an event with `curl` like this: ```sh 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](https://www.krenalis.com/docs/collect-events/spec.md) for more information on the supported event types.