# @kody/resend ## Intent Reusable Resend helpers so Kody agents can send transactional email and manage sending domains, audiences/contacts, templates, and draft-first broadcasts on **the caller's** Resend account — not a shared platform inbox. Auth is a saved API key by default, or an optional OAuth integration. Reads are free-form; mutations support `dryRun: true`, and sends or deletes also require `confirm: true`. This listing is meant to be forked. After you fork, save your own `resend` credential and call the helpers in your account. Share this package as https://kody.codes/@kody/resend (never a `/community/{listing_id}` URL). ## What it does - Send, batch, schedule, or cancel transactional email - Manage sending domains (create, verify, tracking, delete) - Maintain contacts, segments, and topic preferences - Create broadcast **drafts** for human review; send only with explicit confirm - Manage templates; read API key metadata, webhooks, and logs - Escape-hatch transport pinned to `https://api.resend.com` This package declares no package-owned jobs. ## Prerequisites / setup Default auth is a **Resend API key** (secret-backed). There is no built-in platform OAuth app. Do not paste the key into chat. 1. Create an API key at [resend.com/api-keys](https://resend.com/api-keys). Prefer a key limited to the permissions you need. Sending also needs a [verified domain](https://resend.com/domains) (or Resend's `onboarding@resend.dev` test sender, which only delivers to your account email). 2. Save it in Kody: https://kody.codes/account/secrets/new?name=resend&description=Resend%20API%20key%20(re_)%20for%20transactional%20email%2C%20domains%2C%20audiences%2C%20and%20templates&allowedHosts=api.resend.com&scope=user 3. In the account secrets UI, approve host **`api.resend.com`**. Saving the secret does not approve hosts by itself. 4. Agents: see [`AGENTS.md`](./AGENTS.md) for import paths, smoke checks, and mutation snippets. ### Optional OAuth Resend supports OAuth 2.1 + PKCE with Dynamic Client Registration — no dashboard app is required. Redirect URI must be exactly `https://kody.codes/connect/oauth`. 1. Register a public client (`registerOauthClient` in this package) or follow [Building a Resend OAuth client](https://resend.com/docs/guides/building-a-resend-oauth-client). 2. Open the hosted connect flow while signed in, enter the `client_id`, and approve: https://kody.codes/connect/oauth?provider=resend&authorizeUrl=https%3A%2F%2Fapi.resend.com%2Foauth%2Fauthorize&tokenUrl=https%3A%2F%2Fapi.resend.com%2Foauth%2Ftoken&scopes=full_access&allowedHosts=api.resend.com&apiBaseUrl=https%3A%2F%2Fapi.resend.com&dashboardUrl=https%3A%2F%2Fresend.com 3. Pass `integration: "resend"` on every call. `emails:send` only covers sending routes; domains, contacts, templates, and logs need `full_access`. ### Multi-account There are no hard-coded account aliases: - Token lane: `account: "work"` reads secret `resend-work`, or pass `secretName: "resend-work"`. - OAuth lane: pass `integration: "resend-work"`. https://kody.codes/account/secrets/new?name=resend-work&description=Resend%20API%20key%20for%20the%20work%20account&allowedHosts=api.resend.com&scope=user ### Hosts, 401, and 403 | Status | Meaning | Next step | | --- | --- | --- | | 401 | Missing or invalid API key / expired OAuth token | Save `resend` at the secrets URL, or reconnect OAuth | | 403 + domain | `from` is not on a verified sending domain | `listDomains()`, add DNS, `verifyDomain` | | 403 + scope | OAuth connected with `emails:send` but a management route was called | Reconnect with `full_access` | | 429 | Rate limit (default 2 req/s) | Back off, or use `sendBatch` | Approve **`api.resend.com`** on the secret or integration. Host approval lives in the account security UI. ## Done when - Secret `resend` is saved (or `resend` OAuth is connected); `api.resend.com` is approved - Smoke test returns `{ ok: true, live: false }` plus setup URLs without credentials, or lists domains / recent sent email with credentials (no writes) - Mutations preview with `dryRun: true`; sends and deletes also need `confirm: true` after you approve the exact payload ## Branding `community-icon.svg` uses Resend's official lettermark path from [cdn.resend.com/brand/resend-icon-white.svg](https://cdn.resend.com/brand/resend-icon-white.svg) on black. The path is unmodified. Resend® is a trademark of Resend. This package is not affiliated with or endorsed by Resend. ## Docs - [Resend API](https://resend.com/docs/api-reference/introduction) - [API keys](https://resend.com/docs/dashboard/api-keys/introduction) - [OAuth clients](https://resend.com/docs/guides/building-a-resend-oauth-client) - [Brand kit](https://resend.com/brand)