Webhooks (Beta)

This topic describes how to manage webhooksHTTPS callback for sending event data in real time. to export event data in real time. With webhooks, when events such as opens and clicks occur, you immediately receive the corresponding event data.

Prerequisite: You must set up the REST API in your client and authorize for each API request. See the REST API documentation on Episerver World.

Creating webhooks

  1. Open the operation Create a webhook and click Try it out.

    Image: Try it out

  2. Enter the following information in the corresponding mandatory fields:
  3. Optionally, enter the following information if you want to submit credentials for Basic HTTP Authentication:
    • basicAuthUsername. User name.
    • basicAuthPassword. Password.
  4. Click Execute. If the creation was successful, you receive the HTTP response status code 201.

Retrieving webhook information

To retrieve information about a webhook, such as webhook ID, target URL, and event type, do the following:

  1. Open the operation Get information about all webhooks and click Try it out.
  2. In the clientId mandatory field, enter your client ID. To see the client ID, open the start menuMain screen in Episerver Campaign, where the available options are grouped together. and select Administration > API overview > REST API.
  3. Click Execute.

You need the webhook ID for activating, deactivating and deleting the webhook.

Activating webhooks

To export event data in real time, you must activate the corresponding webhook. Do the following:

  1. Open the operation Activate a webhook and click Try it out.
  2. Enter the following information in the corresponding mandatory fields:
  3. Click Execute. If the activation was successful, you receive the HTTP response status code 200.

As soon as a mailing recipient performs an action, Episerver Campaign sends the corresponding event data via a HTTP POST request to the target URL. The event data is sent in batches (lists) consisting of a maximum of 100 events each.

After successful data receiving, the target URL must return the HTTP response status code 200. Otherwise the export is retried every 10 seconds. If no data can be delivered three days after the event is created, the event is discarded.

Example of a list with event data (opens) in JSON format:

[
  {
    "type":"open",
    "recipientId":"123456789005",
    "userListId":123456789003,
    "remoteAddress":"0.0.0.0",
    "clientId":123456789001,
    "mailingId":123456789004,
    "created":1564590054000,
    "subscriptionId":1234567,
    "mailId":"3IHQ2XT8-38PY7WFQ-XKNQSY",
    "device":"desktop",
    "operatingSystem":"Windows 10",
    "browser":"Firefox 64.1"
  },
  {
    "type":"open",
    "recipientId":"123456789005",
    "userListId":123456789003,
    "remoteAddress":"0.0.0.0",
    "clientId":123456789001,
    "mailingId":123456789004,
    "created":1564590054000,
    "subscriptionId":1234567,
    "mailId":"3IHQ2XT8-38PY7WFQ-XKNQSY",
    "device":"desktop",
    "operatingSystem":"Windows 10",
    "browser":"Firefox 64.1"
  }
]

Deactivating webhooks

If you no longer want to export event data, you must deactivate the webhook. The webhook still exists and you can reactivate it later. Do the following:

  1. Open the operation Dectivate a webhook and click Try it out.
  2. Enter the following information in the corresponding mandatory fields:
  3. Click Execute.

Deleting webhooks

For example, if you no longer need a webhook or want to create new webhooks, but the creation limit per client is reached, you can delete webhooks. Do the following:

You can only delete deactivated webhooks. See Deactivating a webhook.

  1. Open the operation Delete a webhook and click Try it out.
  2. Enter the following information in the corresponding mandatory fields:
  3. Click Execute.