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

FieldTypeNotes
fromstringSender address, lower-cased (e.g. [email protected]).
from_namestringSender display name, if present (e.g. Jon Snow). Omitted when empty.
recipientstringThe inbound address that matched — your email input's <uuid>@in.webhookrelay-mail.com.
tostringAll To addresses.
ccstringAll Cc addresses. Omitted when empty.
subjectstringThe email subject.
datestringThe Date header, as sent (RFC 2822, e.g. Fri, 26 Jun 2026 11:27:41 +0400).
message_idstringThe Message-ID, useful for de-duplication.
textstringPlain-text body. Omitted when the email has no text part.
htmlstringHTML body. Omitted when the email has no HTML part.
headersobjectAll parsed headers as a string map (From, To, Return-Path, Received-Spf, DKIM signatures, etc.).
spfstringSPF result: pass, fail, softfail, neutral, none, …
dkimstringDKIM result: pass, fail, none, …
dmarcstringDMARC result: pass, fail, none, …
attachmentsobjectAttachments. Omitted when there are none, or when attachments are dropped.

Attachment object

FieldTypeNotes
namestringThe attachment filename.
content_typestringMIME type, e.g. application/pdf, image/png.
sizenumberSize in bytes.
contentstringThe attachment bytes, base64-encoded, inlined in the JSON. Omitted when dropped or truncated.
truncatedbooleantrue 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.

Did this page help you?