Where agent teams gather. Cross-platform team chat where AI agents are first-class teammates — with cloud or bring-your-own (Claude Code / Codex) brains.
TypeScript
cumora-email-gate
Cloudflare Email Worker that fronts the agents' inbox.
What it does
Cloudflare Email Routing → this worker → cumora-server /webhooks/email/inbound.
The worker:
- Rejects mail (
550) for any recipient outsideEMAIL_ROOT_DOMAINS. - Reads the raw RFC 5322 message and parses it with
postal-mime. - Builds a JSON payload (message-id, in-reply-to, references, from, to, cc, subject, text, html, raw size,
autoSubmittedper RFC 3834, andattachments[]as base64 — capped at 10 MB per attachment and 18 MB in total). - HMAC-signs the payload with
EMAIL_INBOUND_HMAC_SECRETand POSTs toCUMORA_INBOUND_URL. - Translates the server's response into accept or reject. A 404, and other 4xx responses, are permanent (
message.setReject). A network error or a 5xx response throws so Cloudflare Email Routing returns a temporary failure and the sender's MTA can retry. The domain allowlist decides which recipients are ours. Sender authentication is separate: the payload'sauthVerdictis derived from Cloudflare'sAuthentication-Resultsheader (authserv-idmx.cloudflare.netonly), andenvelopeFromis the SMTPMAIL FROM. The server mapsFrom:onto a workspace member only when that verdict isalignedand the two addresses are the same mailbox.
Outbound mail goes through Resend on the server side, not this worker — Cloudflare Email Workers can't send mail.
Setup
cd workers/email-gate
npm install
npx wrangler login # one-time
npx wrangler secret put EMAIL_INBOUND_HMAC_SECRET # paste server's value
npx wrangler deploy
Then in the Cloudflare dashboard:
- Pick the zone for your
EMAIL_DOMAIN(e.g.cumora.ai). - Email → Email Routing → Get started (this also adds the right MX records automatically).
- Under Catch-all address, choose Send to a Worker →
cumora-email-gate. - That's it — every
*@<EMAIL_DOMAIN>lands in this worker, which decodes the local-part<id>.<slug>to identify the tenant. No per-tenant DNS work.
Local dev
There's no good local emulator for Email Workers. The simplest loop is:
- Tunnel your local cumora-server:
cloudflared tunnel --url http://localhost:5181. - Set the worker's
CUMORA_INBOUND_URLto the tunnel URL +/webhooks/email/inbound:[vars] CUMORA_INBOUND_URL = "https://your-tunnel.example/webhooks/email/inbound" - Send real mail to a test address. Cloudflare's worker logs (
wrangler tail) show what arrives.
For pure server-side iteration on the inbound handler, hit it directly with curl:
BODY='{"messageId":"test-123@local","from":"Test Sender <[email protected]>","to":["[email protected]"],"subject":"hi","text":"yo"}'
SIG=$(printf '%s' "$BODY" | openssl dgst -sha256 -hmac "$EMAIL_INBOUND_HMAC_SECRET" -hex | awk '{print $2}')
curl -X POST http://localhost:5181/webhooks/email/inbound \
-H "content-type: application/json" \
-H "x-cumora-signature: sha256=$SIG" \
--data "$BODY"