message.* events you want delivered there.
When an event fires, Inkbox sends a signed POST request to every subscription URL whose event_types list includes that event. The request includes headers you can use to verify the payload’s authenticity.
Event types
Payload shape
Every event uses the same envelope. Itsid stays the same across retries and replays; use it to deduplicate events. data.message carries the message payload, including the owning mailbox’s email_address. Two peer-resolution lists accompany it:
data.contacts— address-book matches.data.agent_identities— internal-agent matches (other agents in your organization that match a recipient).
message.received, a subscription that configures conversation context also receives an additive data.context block; it is absent otherwise.
Both lists are always present and possibly empty, never null. Each entry is tagged with the bucket (from / to / cc / bcc) it came from. A peer that’s both a contact and an internal agent appears once in each list. See Peer resolution below for the full pairing rules.
Inbound example — message.received
JSON
Outbound example — message.sent
JSON
data.contacts and data.agent_identities are always present on the wire and sparse — only matched recipients appear. An empty list means nothing matched. The same recipient can appear in both lists (when a peer is both a contact and an internal agent in your org); receivers decide precedence per row.
data.message.bcc_addresses is symmetric with to_addresses and cc_addresses and is populated on outbound events only. Inbound payloads always carry "bcc_addresses": null, since BCC headers are not visible to recipients.
Message body
Inboundmessage.received events include a plain-text body when one is available. The body is limited to 16 KiB of UTF-8 text, with truncation at a complete character boundary.
These five fields are present as
null on outbound and delivery-status events. A delivery notice received as message.received may also have all five fields set to null. For inbound mail without usable text, body_state is unavailable, body_truncated is false, and the body and character counts are null.
When body_state is truncated or unavailable, get the message using data.message.email_address and data.message.id to retrieve its stored text and HTML parts.
Peer resolution
data.contacts and data.agent_identities are parallel lists of address-book and internal-agent matches respectively — one entry per matched recipient per list. Each entry is self-describing about which recipient bucket it pairs back to.
contactsentry shape:{ "bucket": "from" | "to" | "cc" | "bcc", "address": <wire-form recipient>, "id": <uuid>, "name": <preferred name> | null }.nameisnullwhen the contact has no name on file. An automatically created contact uses the sender’s display name when provided, but never falls back to the email address, so check the field before addressing someone by name.agent_identitiesentry shape:{ "bucket": "from" | "to" | "cc" | "bcc", "address": <wire-form recipient>, "id": <uuid>, "agent_handle": <handle>, "display_name": <preferred name> | null }.- Match coverage per direction:
- Inbound (
message.received) —from_addressplus every entry ofcc_addresses. - Outbound (
message.sent,message.delivered,message.forwarded,message.bounced,message.failed) — every entry ofto_addresses,cc_addresses, andbcc_addresses.
- Inbound (
- Scope. Contact matches follow the receiving identity’s permissions. Profile controls whether a match is included; Memories can further hide memory text. Agent-identity matches include active identities in the same organization.
- Pair on
(bucket, address), not onaddressalone. The same address can appear in multiple buckets on a single send (e.g. the same recipient in bothto_addressesandcc_addresses). When that happens, the matched entry appears twice in the list — once per bucket. Pairing onaddressalone produces phantom duplicates or attributes the match to the wrong recipient slot. - Intra-bucket dedupe. Duplicate addresses inside the same bucket collapse to a single entry. Case-only intra-bucket duplicates also collapse, with the first occurrence’s wire form preserved in
address. - Address casing.
addressechoes the original wire form of the matched recipient — the same casing that appears in the correspondingdata.message.{from_address|to_addresses|cc_addresses|bcc_addresses}field. Resolution itself runs against the lowercased canonical form, so receivers parsing arbitrary inbound mail may want to use a case-insensitive compare when pairing. - Sparse lists. Only matched recipients appear — there is no placeholder entry for unmatched recipients.
"contacts": []and"agent_identities": []each mean nothing matched in that list. - Wire ordering.
from→to→cc→bcc, and within each bucket the order matches the source field’s order (first occurrence wins on intra-bucket dedupe). - Per-event cap. Up to 50 distinct normalized addresses are resolved per event. Over-cap inputs and transient resolver failures fall back to empty lists; the message webhook itself still fires unchanged.
- Tiebreak. If multiple contacts share the same email, the oldest by
created_atwins. Receivers needing disambiguation can callGET /contacts/lookup. Agent-identity matches are 1:1 on the canonical email. - Hydration. Feed
contacts[i].idintoGET /api/v1/contacts/{contact_id}to fetch the full contact record — see Manage contacts. Agent-scoped credentials can discover peer identities throughGET /api/v1/identities/a2a/directory;GET /api/v1/identities/{agent_handle}resolves only the caller’s own identity for those credentials.
Conversation context
When a subscription setscontext_config, message.received payloads gain an additive data.context object keyed by the configured classes (email, texts, calls), so a handler can act on recent history without a follow-up API call. Delivery-status events never carry it.
Each class is a block:
Item shapes by class:
email—id,direction,from_address,to_addresses,subject,snippet,created_at(metadata and snippet only; fetch full bodies via the messages API).texts—id,channel(smsorimessage),direction,sender,text(capped at 4,096 chars, withtext_truncated),status,media,created_at.calls—call_id,direction,remote_number,duration,started_at,abridged, andtranscript. Each transcript entry is a turn (party,text,ts_ms) or, past 12,000 chars, an abridgment marker{"marker": "abridged", "omitted_turns": N, "omitted_ms": M}replacing the omitted middle — discriminate onmarker.
null, not omitted. The whole block is capped at 256 KB; over the cap, the oldest items are dropped class by class (at least one per configured class survives) and that class’s truncated is set.
JSON
Configuring webhooks
Mail webhook delivery is configured via the Webhook Subscriptions API. Two steps:- Have a mailbox provisioned (it’s created atomically with its agent identity).
- Create a subscription naming that mailbox, the HTTPS destination URL, and the subset of
message.*event types you want delivered.
Request example
JSON
Code examples
Verifying webhook signatures
Inkbox signs every webhook payload with the agent identity’s signing key. The secret used is the one for the identity that owns the mailbox the subscription is on. Create or rotate a key via the Signing Keys guide. Each webhook request includes three signature headers:
When the subscription sets an
auth_token, each request additionally carries Authorization: Bearer <token> — the bearer token authenticates Inkbox to your endpoint, while the signature headers prove the payload. See Authenticating to your endpoint.
The signature input is constructed as:
Verification steps
- Check the timestamp — reject the request if
X-Inkbox-Timestampis more than 300 seconds from the current time. - Reconstruct the message — concatenate
{X-Inkbox-Request-ID}.{X-Inkbox-Timestamp}.{raw_body}. - Compute the HMAC — use HMAC-SHA256 with your signing key over the reconstructed message.
- Compare digests — the resulting hex digest should match the value after
sha256=in theX-Inkbox-Signatureheader.
Python verification example
Python

