Webhook Template Editor
Dittofeed provides a Webhook template editor for rendering webhook request configurations.
Configuration
The config
object and secret
object accept the same values, modeled after axios request configuration.
Parameter | Example | Description |
---|---|---|
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:
- Override the config values.
- 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.
Tag Name | Description |
---|---|
workspaceId | The unique identifier for the workspace. |
runId | The identifier for the specific run or execution of a journey. |
messageId | The identifier for the individual message. |
userId | The identifier for the user receiving the message. |
templateId | The identifier for the template used to send the webhook. |
nodeId | The identifier for the node within the journey from which the message was sent. |
journeyId | The 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.