Webhooks
Intray sends a signed HTTPS POST to your URL when new mail arrives or a conversation enters Todo. Use it to start work the moment an email lands, such as a bot that drafts replies, instead of checking the inbox on a timer.
A webhook says what happened and where. It carries ids, not message content. Your code reads the conversation through the Conversation API or the MCP server with its own credentials.
Add an endpoint
There are two ways to add an endpoint.
- In settings. A workspace owner opens Settings → Developers → Webhooks and selects Add endpoint. Enter an
https://URL and pick the events. - From an MCP client. A client with the Get notified when new mail arrives permission calls
create_webhookwith its URL. Its endpoints receivemessage.received. It manages only the endpoints it added, and they stop receiving events when its connection is revoked or expires. Owners see these endpoints in settings, marked with the client's name.
Intray shows the signing secret (whsec_…) once. Store it with your receiver. If you lose it, rotate it in settings: the old secret stops working at once.
Select Send test event in the endpoint's menu to send a webhook.test event.
Events
| Event | Sent when |
|---|---|
message.received | A new email arrives in any inbox of the workspace: hosted, forwarded, or new mail in a connected mailbox's Inbox. Mail filed as spam, imported history, and the Sent folder send nothing. |
conversation.todo | A conversation enters Todo: new mail starts it, new mail reopens it from Done, someone moves it to Todo from Done, Snoozed, or Spam, or the API creates it in Todo. New mail on a conversation already in Todo sends nothing. |
webhook.test | You select Send test event. Endpoints cannot subscribe to it. |
Payload
The body is JSON in the Standard Webhooks shape.
{
"type": "message.received",
"timestamp": "2026-11-04T19:14:03.512Z",
"data": {
"workspaceId": "k57c9g4f2y4b1m0n3x8z6w5v7d8e9a1b",
"conversationId": "jd7f3h2k9m1n4p6q8r0s2t5v7w9x1y3z",
"messageId": "js8a1c3e5g7i9k2m4o6q8s0u2w4y6a8c",
"inboxId": "kh3m5o7q9s1u3w5y7a9c1e3g5i7k9m1o"
}
}conversationIdis the idget_conversationtakes in MCP.inboxIdis the idlist_inboxesreturns, so a receiver can act on one inbox only.timestampis when the event happened. Retries send the same body.
{
"type": "conversation.todo",
"timestamp": "2026-11-11T09:14:03.512Z",
"data": {
"workspaceId": "k57c9g4f2y4b1m0n3x8z6w5v7d8e9a1b",
"conversationId": "jd7f3h2k9m1n4p6q8r0s2t5v7w9x1y3z",
"inboxId": "kh3m5o7q9s1u3w5y7a9c1e3g5i7k9m1o",
"previousStatus": "done",
"group": "inbox",
"appUrl": "https://intray.ai/w/acme/inbox/jd7f3h2k9m1n4p6q8r0s2t5v7w9x1y3z"
}
}previousStatusisdone,snoozed,spam,trash, ornullfor a new conversation.groupisinboxfor a conversation with a person andotherfor Other mail. Dropotherto hear only about mail from people.appUrlopens the conversation in Intray for a signed-in member.- Read the subject and sender with
GET /conversations/{id}. Each entry into Todo is one event. A conversation that leaves Todo before the event is sent, for example when a rule archives it, sends nothing.
Verify the signature
Each request has three headers.
| Header | Value |
|---|---|
webhook-id | The event id. The same on every retry of the event. |
webhook-timestamp | Unix seconds when this attempt was sent. |
webhook-signature | v1, followed by the base64 HMAC-SHA256 of {webhook-id}.{webhook-timestamp}.{body}. The key is the secret after whsec_, base64-decoded. |
Verify against the raw request body. Parsing and re-serializing the JSON changes the bytes and breaks the signature. Refuse a timestamp more than five minutes from your clock.
import { createHmac, timingSafeEqual } from "node:crypto";
export function verifyIntrayWebhook(
secret: string,
headers: Headers,
rawBody: string
): boolean {
const id = headers.get("webhook-id");
const timestamp = headers.get("webhook-timestamp");
const signatures = headers.get("webhook-signature");
if (!id || !timestamp || !signatures) return false;
if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 5 * 60) return false;
const key = Buffer.from(secret.replace(/^whsec_/, ""), "base64");
const expected = createHmac("sha256", key)
.update(`${id}.${timestamp}.${rawBody}`)
.digest();
return signatures.split(" ").some((entry) => {
const [version, value] = entry.split(",");
if (version !== "v1" || !value) return false;
const given = Buffer.from(value, "base64");
return given.length === expected.length && timingSafeEqual(given, expected);
});
}Any Standard Webhooks library also works, such as standardwebhooks on npm or PyPI.
Respond
Return any 2xx status within 10 seconds. Do slow work after you respond, for example by putting the event on a queue. Intray does not follow redirects: a 3xx counts as a failure.
Retries
A failed attempt is retried after 30 seconds, 2 minutes, 10 minutes, 30 minutes, 1 hour, 3 hours, 6 hours, and 12 hours. After the ninth attempt the delivery is marked failed. Recent deliveries in the endpoint's menu lists each delivery with its status, the last response code, and the error. Send again sends a delivery's event again under the same webhook-id.
Plan for two things:
- Duplicates. A retry can arrive after your receiver already handled the event, for example when your response was lost. Store
webhook-idand skip ids you have seen. - Order. Events can arrive out of order, especially after retries. Use the
timestampin the body, or read the current state through the API.
An endpoint whose deliveries all fail for 3 days is turned off. Turn it back on in settings when your receiver works again.
Security
- Intray sends only to
https://URLs on public domain names. URLs with an IP address, credentials, or a private host name such aslocalhostare refused. - When it connects, Intray checks every address the host resolves to and refuses private network addresses.
- Payloads carry ids only, so a leaked request reveals no message content.
Limits
| Limit | Value |
|---|---|
| Endpoints per workspace | 20 |
| Endpoints per MCP connection | 3 |
| Response time | 10 seconds |
| Delivery history | 30 days |