DocumentationFundamentals
Email webhook payload
Reference for the JSON payload Webhook Relay delivers for an inbound email: from, from_name, recipient, to, cc, subject, date, message_id, text, html, headers, spf, dkim, dmarc and attachments (with base64 content).
Each inbound email is parsed server-side and delivered as a JSON POST with Content-Type: application/json and an X-Webhookrelay-Source: email header. Empty fields are omitted, so a plain-text email with no attachments won't include html, cc or attachments.
Example (HTML email with an attachment)
{
"from": "[email protected]",
"from_name": "Jon Snow",
"recipient": "[email protected]",
"to": ["[email protected]"],
"cc": ["[email protected]"],
"subject": "Invoice #1042",
"date": "Fri, 26 Jun 2026 11:27:41 +0400",
"message_id": "[email protected]",
"text": "Hi, your invoice is attached.\r\n",
"html": "<p>Hi, your invoice is <b>attached</b>.</p>",
"headers": {
"From": "Jon Snow <[email protected]>",
"To": "[email protected]",
"Subject": "Invoice #1042",
"Content-Type": "multipart/mixed; boundary=...",
"Return-Path": "<[email protected]>"
},
"spf": "pass",
"dkim": "pass",
"dmarc": "pass",
"attachments": [
{
"name": "invoice.pdf",
"content_type": "application/pdf",
"size": 48213,
"content": "JVBERi0xLjQKJ..."
}
]
}
Fields
| Field | Type | Notes |
|---|---|---|
from | string | Sender address, lower-cased (e.g. [email protected]). |
from_name | string | Sender display name, if present (e.g. Jon Snow). Omitted when empty. |
recipient | string | The inbound address that matched — your email input's <uuid>@in.webhookrelay-mail.com. |
to | string | All To addresses. |
cc | string | All Cc addresses. Omitted when empty. |
subject | string | The email subject. |
date | string | The Date header, as sent (RFC 2822, e.g. Fri, 26 Jun 2026 11:27:41 +0400). |
message_id | string | The Message-ID, useful for de-duplication. |
text | string | Plain-text body. Omitted when the email has no text part. |
html | string | HTML body. Omitted when the email has no HTML part. |
headers | object | All parsed headers as a string map (From, To, Return-Path, Received-Spf, DKIM signatures, etc.). |
spf | string | SPF result: pass, fail, softfail, neutral, none, … |
dkim | string | DKIM result: pass, fail, none, … |
dmarc | string | DMARC result: pass, fail, none, … |
attachments | object | Attachments. Omitted when there are none, or when attachments are dropped. |
Attachment object
| Field | Type | Notes |
|---|---|---|
name | string | The attachment filename. |
content_type | string | MIME type, e.g. application/pdf, image/png. |
size | number | Size in bytes. |
content | string | The attachment bytes, base64-encoded, inlined in the JSON. Omitted when dropped or truncated. |
truncated | boolean | true when the content was stripped or the per-message attachment cap was exceeded — the metadata (name, content_type, size) is still present, but content is omitted. See policy. |
Using the fields in a transform
Attach a function to reshape the email before it reaches your endpoint — for example to extract just what you need, or to build a chat message:
const email = JSON.parse(r.body);
const slack = {
text: `:email: *${email.subject}* from ${email.from_name || email.from}\n${email.text}`
};
r.setBody(JSON.stringify(slack));
r.setHeader("Content-Type", "application/json");
See the webhook → Slack/Discord/Teams formatter to build that message visually and copy the function.
