email.received
email.received fires once per inbound message, already matched onto its thread. The event most AI Inbx applications are built around.
Inbound mail. The one most applications are built around — it fires once per received message, with the thread it belongs to already resolved.
Payload
Every field, with an example body, is in the email.received reference, generated from the API contract.
Handling it
The payload carries a snippet, not the body — fetch the email when you need the full content.
if (event.type === "email.received" && event.data.category === "human") {
const email = await aiinbx.emails.retrieve(event.data.email_id)
await queueReply(event.data.thread_id, email.text)
}
Or have it sent along. An endpoint created with payload: "full" gets the email as data.email — bodies, stripped text, headers, and every attachment with its signed URLs and prepared text — read when the delivery is sent, so a retry carries fresh URLs. The summary fields stay as they are. Fall back to the retrieve when it is null:
if (event.type === "email.received" && event.data.category === "human") {
const email =
event.data.email ?? (await aiinbx.emails.retrieve(event.data.email_id))
await queueReply(event.data.thread_id, email.stripped_text)
}
Receiving
Getting mail to arrive in the first place — a domain’s MX record, or a connected mailbox.