Payload Transforms
Transforms allow you to reshape the event payload before it is formatted and delivered. Transforms use JSONata expressions.
How Transforms Work
- An event is received and stored with its original payload
- During delivery, if the endpoint-destination link has a
transform_idset, the associated JSONata expression is evaluated against the original payload - The transformed result becomes the payload used for template rendering and delivery
- If the transform fails for any reason, the original payload is used (fail-open behavior)
To disable a transform on a link, remove the transform_id assignment. The original payload will pass through unchanged.
Configuring Transforms
Transforms are created and managed from the Transforms page in the dashboard, then assigned to endpoint-destination links by selecting them from the link editor. Each link can reference a different transform, allowing different destinations to receive different views of the same event. See Dashboard: Transforms for details.
JSONata Examples
Extract specific fields
{
"action": action,
"repo": repository.full_name,
"sender": sender.login,
"url": pull_request.html_url
}
Flatten nested structures
{
"commit_count": $count(commits),
"branch": $substringAfter(ref, "refs/heads/"),
"pusher": pusher.name,
"messages": commits.message
}
Conditional values
{
"status": action = "opened" ? "New" : action = "closed" ? "Done" : "Updated",
"priority": $exists(labels[name = "critical"]) ? "high" : "normal"
}
Array operations
{
"files_changed": $count(commits.($count(added) + $count(modified) + $count(removed))),
"authors": $distinct(commits.author.name),
"latest_message": commits[-1].message
}
Fail-Open Behavior
Transforms are designed to be safe:
- If the JSONata expression has a syntax error, the original payload is used
- If the expression produces
nullorundefined, the original payload is used - If the expression throws a runtime error, the original payload is used
- Transform errors are logged but do not block delivery
This ensures that a misconfigured transform does not prevent events from being delivered.
Transform vs. Template
| Feature | Transform | Template |
|---|---|---|
| Language | JSONata | Template expressions |
| Purpose | Reshape payload structure | Format message for delivery |
| Input | Raw event payload | Transformed payload (or original) |
| Output | New JSON object | Discord embed / Slack Block Kit / Telegram HTML |
| Timing | Before formatting | After transform |
Transforms and templates work together: the transform reshapes the data, then the template formats it for display.