Dittofeed provides a Webhook template editor for rendering webhook request configurations.

Configuration

{
    "config": {...},
    "secret": {...}
}

The config object and secret object accept the same values, modeled after axios request configuration.

ParameterExampleDescription
url"https://api.com/users"url is the server URL that will be used for the request
method"POST"method is the request method to be used when making the request
headers{ "Authorization": "Basic abc123" }headers are custom headers to be sent
params{ "id": 123 }params are the URL parameters to be sent with the request
data{ "firstName": "fred" }data is the data to be sent as the request body
responseType"json"Allowed options are “json” and “text”

The difference between config and seceret is that the secret values:

  1. Override the config values.
  2. Are not rendered into the stored DFInternalMessageSent events, ensuring that sensitive information is not leaked to Dittofeed’s event store.

These features of the secret object are useful for storing sensitive information, such as API keys. API keys for the webhook channel can be set on the settings page, at /dashboard/settings#webhook-channel.

Identifier Key

The webhook template editor also allows you to configure an identifier key. This key serves several purposes, including managing subscriptions, handling webhook based delivery updates, and more.

This value should be the user property which identifies the user with respect to the channel you are contacting them on e.g. the users email, their phone number, or their device token in the case of mobile push.

Tags

When sending a message rendered from a webhook template, the message can include tags. These tags include metadata about the context in which the template was rendered, and message was sent. Rendering tags into webhook templates can be useful for reporting and attribution purposes.

{
  "config": {
    "url": "https://httpbin.org/post",
    "method": "POST",
    "headers": {
      "Content-Type": "application/json"
    },
    "data": {
      "tagValues": {
        "workspaceId": "{{ tags.workspaceId }}",
        "runId": "{{ tags.runId }}",
        "messageId": "{{ tags.messageId }}",
        "userId": "{{ tags.userId }}",
        "templateId": "{{ tags.templateId }}",
        "nodeId": "{{ tags.nodeId }}",
        "journeyId": "{{ tags.journeyId }}"
      }
    }
  }
}
Tag NameDescription
workspaceIdThe unique identifier for the workspace.
runIdThe identifier for the specific run or execution of a journey.
messageIdThe identifier for the individual message.
userIdThe identifier for the user receiving the message.
templateIdThe identifier for the template used to send the webhook.
nodeIdThe identifier for the node within the journey from which the message was sent.
journeyIdThe identifier for the journey within which the message was sent.

Example Use case - Render Product Recommendations

Imagine that you want to email users with a list of their top 5 most highly recommended products. Let’s say you have an API that returns product recommendations for a user. It would be infeasible to eagerly update Dittofeed every time any user’s recommended products change.

Instead, we can use a webhook request to your recommendations API, and use the response to render an email.

See the documentation on the Synchronize Properties journey message node configuration option for more information.

Webhook Implementation Walkthrough Videos

Slack

WhatsApp