How it fits together
- Mail arrives at
support@yourapp.com. Amessage.receivedwebhook delivers themessageIdandinboxId— metadata, never the body. - Your endpoint verifies the signature and enqueues those IDs.
- A worker fetches the message and its thread, then asks your model for a draft reply, a confidence score, and a sensitivity flag.
- Confident, non-sensitive replies send idempotently. Everything else goes to a human queue.
Create the inbox and subscription
Receive the notification
The endpoint verifies the delivery came from Dairo, enqueues the pointer, and returns fast. Verify the HMAC over the exact bytes Dairo signed, before parsing the JSON.X-Dairo-Event-Id — and Build a webhook receiver
is the complete implementation with both.
Fetch, decide, reply
The worker pulls the message body and thread history on demand, asks your model what to do, and lets only your code decide whether the draft actually sends.Re: subject, so the customer’s
mail client keeps it in the existing conversation. See
Messages and threads for how threading works.
Drive it from an MCP client
If your agent runs in an MCP client like Claude or Cursor, connect Dairo’s hosted MCP server and skip the glue code. The agent reads messages and threads and sends replies through native tools. Sends to recipients who complained are blocked by default, the same as through the API.“Check support@yourapp.com for new messages. For each one, read the thread, draft a reply, and send it from that inbox — but ask me first if the message mentions billing or cancellation.”
Safety rails
The worker already applies three rails: every reply is idempotency-keyed to the inbound message, every outbound message id is recorded for audit, and a complaint-refused send escalates instead of overriding. Add two more before leaving it running unattended.- Never put secrets in a reply. No passwords, tokens, or full account details — link the customer to a signed-in surface instead.
- Run the worker on a least-privilege key. Reading mail and replying needs
messages:readandmessages:send— nothing that manages domains, webhooks, or keys. See API keys and authentication.
Next steps
- Extract structured data — give the support inbox a schema so order numbers and topics arrive as clean fields.
- MCP recipes — exact tool-call JSON for receive-and-reply flows.
- Webhooks — every event type, header, and payload.