> ## Documentation Index
> Fetch the complete documentation index at: https://docs.runconverge.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Converge Webhook

> Connect your Server-side data to Converge

## Installation instructions

<Steps>
  <Step title="Create a new Webhook Source in Converge">
    1. In Converge, click on **Create a new source**
    2. Pick *Server-side* from the modal
    3. Name your server-side source: e.g. `{Storename} Store Backend`
    4. Click on **Create Source**.
  </Step>

  <Step title="Send a test event">
    4. Click on your newly created source. You'll see a webhook endpoint URL and webhook token under the source configuration tab.
           <img src="https://mintcdn.com/converge/126BCCPQQ49NNNIt/images/sources/webhooks/webhook-1.png?fit=max&auto=format&n=126BCCPQQ49NNNIt&q=85&s=47d1ece223d1f0b4f569e09d87291ab6" alt="webhook_config" width="2810" height="346" data-path="images/sources/webhooks/webhook-1.png" />

    <Note>
      The webhook token was added recently to improve error messaging for easier issue diagnosis. Existing integrations that don't use a webhook token remain unaffected.
    </Note>

    5. The webhook endpoint is the URL where you'll send the events.
    6. Ensure the webhook token is included as a header using the header key `X-Webhook-Token`.
    7. Verify that your webhook source is working by sending a test [Placed Order](/sources/converge-spec#placed-order) event request. Ensure the request meets the parameters outlined in [Manually instrumenting events](/sources/server-integrations/webhook#manually-instrumenting-events).

    <Accordion icon="code" title="Code example">
      <Note>Include the webhook token from the Converge UI in the code example below.</Note>

      <CodeGroup>
        ```cURL cURL theme={null}
        curl -X POST \
        "https://app.runconverge.com/api/webhooks" \
        -H "Content-Type: application/json" \
        -H "X-Webhook-Token: {YOUR_WEBHOOK_TOKEN}" \
        -d '{
         "event_name": "Placed Order",
         "event_id": "order-1",
         "properties": {
             "id" : "order-1",
             "total_price": 42,
             "total_tax": 3.5,
             "total_shipping": 2.4,
             "currency": "USD",
             "items": [
                 {
                     "product_id": "123456",
                     "variant_id": "654321",
                     "sku": "MY_SKU",
                     "name": "My Product",
                     "price": 42,
                     "currency": "USD",
                     "quantity": 1,
                     "vendor": "My Store"
                 }
             ],
             "$is_new_customer": false,
             "$sales_channel_type": "web"  # important, see supported sales channels
         },
         "profile_properties": {
             "$first_name": "John",
             "$last_name": "Smith",
             "$email": "john.smith@apple.com",
             "$phone_number": "+199999999",
             "$city": "San Francisco",
             "$country_code": "US",
             "$state": "California",
             "$zip_code": "94103"
         },
         "aliases": ["urn:email:john.smith@apple.com"]
        }'

        ```
      </CodeGroup>
    </Accordion>
  </Step>

  <Step title="Verify that your event arrived in Converge">
    8. Click on your newly created source and choose the **Logs** tab. You should see the event you just sent there.
  </Step>
</Steps>

***

## Manually instrumenting events

If the pre-built server integrations do not cover the applicable conversions from the [Converge event spec](/sources/converge-spec); or if you want to add custom events from your website then you will need to manually instrument these using the Converge Pixel.
You can use the Webhook source to manually instrument these events.

<Info> As a general rule, you should always **aim to pass as many `properties`, `profile_properties`, and `aliases` as possible** </Info>

The webhook body has the following parameters:

| Parameter            | Type            |            | Description                                                                                                                                                                                                                                                                                |
| :------------------- | :-------------- | :--------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `event_name`         | `string`        | *Required* | The name of the event                                                                                                                                                                                                                                                                      |
| `event_id`           | `string`        | *Required* | The ID of the event, used for [deduplication](/sources/source-concepts#deduplication)                                                                                                                                                                                                      |
| `properties`         | `object`        | *Required* | The event properties you want to pass, covering the [Converge Spec](/sources/server-integrations/webhook#event-spec) and possibly your own custom properties.                                                                                                                              |
| `profile_properties` | `object`        | *Required* | The [profile properties](/sources/source-concepts#profile-properties)                                                                                                                                                                                                                      |
| `aliases`            | `array[string]` | *Required* | Any [aliases](/sources/source-concepts#aliases). Must contain at least one alias, with a maximum of 10 aliases allowed.                                                                                                                                                                    |
| `timestamp`          | `datetime`      | *Optional* | The date and time when the event occurred. If not provided, the current time will be used. The timestamp can be expressed as a string in ISO 8601 format (e.g., `"2024-09-02T12:34:56+00:00"`) or a UTC timestamp (e.g., `1725312229`). The string representation must specify a timezone. |

***

## Event spec

This integration does not auto-track any events by default.
All events should be instrumented manually according to the Converge event spec.

<Note> You should typically implement [Placed Order](/sources/converge-spec#placed-order) and [Started Subscription](/sources/converge-spec#started-subscription) events server-side. You can find a full list in the [Converge Spec here](/sources/converge-spec) </Note>

### Sales channels

Due to the events being instrumented manually, particular importance is placed on sales channels because of concepts like deduplication and session stitching.
When choosing a sales channel type for an event, if you expect a conversion (e.g., Placed Order) to have a corresponding web journey, then you'll want to typically categorize them as "web".
If the event is automated, say, a recurring subscription order, then you'll want to use "subscription\_contract".
If you're selling your products on a marketplace like Amazon, for example, and you intend to forward these Placed Order events to Converge via the webhook, you'll want to categorize them as "marketplace".

More on sales channels can be found [here](/sources/concepts/sales-channels).

<Note>If no sales channel type is provided, Converge falls back to "web".</Note>

The following supported sales channel types are:

| Name           | Property Value         | Description                                                          |
| -------------- | ---------------------- | -------------------------------------------------------------------- |
| Web            | web                    | Events occurring via browser-based interactions and actions          |
| Subscriptions  | subscription\_contract | Automated events related to subscription renewals or contracts.      |
| SMS            | sms                    | Events or interactions triggered via SMS/Text communication.         |
| Mobile App     | mobile\_app            | User interactions occurring within mobile applications.              |
| POS            | pos                    | Point of Sale transactions taking place in physical stores.          |
| Marketplace    | marketplace            | Sales and interactions through third-party marketplaces like Amazon. |
| Offline        | offline                | Offline events such as amended orders, manual orders, or calls.      |
| Facebook Shop  | facebook\_shop         | Purchases and interactions through the Facebook Shop channel.        |
| Pinterest Shop | pinterest\_shop        | Sales and activity through the Pinterest Shop channel.               |
| TikTok Shop    | tiktok\_shop           | Orders and interactions made via the TikTok Shop channel.            |
