# Payload templates

Reshape an event before it reaches a destination without writing a proxy. Templates render per delivery and can mix normalized event fields, raw payload paths, headers, and constants.

## Variables

| Variable                       | Resolves to                                                     |
| ------------------------------ | --------------------------------------------------------------- |
| `{{event.id}}`                 | Relay event ID.                                                 |
| `{{event.type}}`               | Unified event type, for example `issues.opened`.                |
| `{{event.source}}`             | Source id: `github`, `stripe`, `slack`, `linear`, or `generic`. |
| `{{event.actor.login}}`        | Actor login/handle.                                             |
| `{{event.subject.title}}`      | Subject title.                                                  |
| `{{event.subject.labels.0}}`   | Array index into subject labels.                                |
| `{{event.raw.issue.html_url}}` | Any path in the original parsed payload.                        |
| `{{event.payload}}`            | Raw inbound body text.                                          |
| `{{delivery.id}}`              | Delivery ID, safe to use as an idempotency key.                 |

## Filters

| Filter     | Example                                      | Result                             |
| ---------- | -------------------------------------------- | ---------------------------------- |
| `default`  | `{{event.actor.login \| default:"unknown"}}` | Fallback when the path is missing. |
| `truncate` | `{{event.subject.title \| truncate:60}}`     | First 60 characters.               |
| `join`     | `{{event.subject.labels \| join:", "}}`      | Joins arrays.                      |

Missing variables resolve to an empty string by default. Strict mode turns a missing path into a failed delivery with the missing paths named, which is useful while building a template.

## JSON bodies

When the destination body is JSON, resolved values are escaped so a title containing quotes or newlines stays valid JSON. Templates apply to the body, URL, headers, query parameters, and auth values.

> Use a test event before enabling a template in production.
