Letterbox.Ingress.Resend (Letterbox v0.1.0-rc.0)

Copy Markdown View Source

Resend's inbound emails.

config :letterbox, ingresses: [resend: [secret: "whsec_…", api_key: "re_…"]]

In Resend, a webhook for the email.received event, to its route (https://<app>/inbound/webhooks/resend, as mix letterbox.install writes it), and its signing secret as :secret. :api_key is a key of the account, which reads its emails.

The webhook carries an email's id and envelope, not the email: Letterbox answers it at once, then fetches the email (GET /emails/receiving/:id) and its raw message (raw.download_url) out of the request, tried again while Resend has not got it. The recipients are Resend's received_for, the addresses it took the email for (Bcc included).

The request is signed by Svix (svix-id, svix-timestamp, svix-signature): an HMAC-SHA256 of "<id>.<timestamp>.<body>" with the secret (Base64, after whsec_), and one more than five minutes away is refused.

Options: :secret, :api_key, :base_url (https://api.resend.com), and :req_options, given to Req (for tests, plug:).