
Setting Up Your Webhook Destination
Courier needs a destination URL to deliver webhook requests. You have two options:- Static destination: Go to Settings, scroll to Outbound Webhooks, and add a webhook with the URL and auth type.
- Dynamic destination: Pass the URL per recipient via the
webhookprofile property. See the Webhook integration docs for details.
Default Payload
If you don’t define a custom Jsonnet template, Courier sends this default payload:Available Functions and Variables
The Jsonnet editor provides these built-in functions for accessing your notification context:| Function | Description | Example |
|---|---|---|
data("path") | Access a value from the send request’s data object | data("order.total") |
profile("path") | Access a value from the recipient’s profile | profile("email") |
request("path") | Access request metadata (brand, message, event, recipient, data, profile, template) | request("message") |
t("key", default, locale) | Resolve a translation from the data object | t("greeting", "Hello") |
chunk(str, size) | Split a string into chunks of a given size | chunk(longText, 40) |
| Variable | Description |
|---|---|
brand | The brand ID |
message | The message ID |
recipient | The recipient ID |
event | The event associated with the notification |
template | The template name |
std library functions are also available (e.g., std.length(), std.join(), std.format()).
Writing a Custom Payload
Your Jsonnet template must evaluate to a JSON object. Usedata() and profile() to pull values from the send request.
Here’s an example that builds a custom payload for an order confirmation webhook:
Conditional Logic
Jsonnet supports conditionals, which let you vary the payload based on your data:Nested Path Access
Thedata() and profile() functions support dot-separated paths to access nested values:
null by default. You can provide a fallback as the second argument: