# @kody/resend — agent notes Human setup and intent live in [`README.md`](./README.md). This file is for agents: imports, smoke/dryRun execute snippets, and edge cases. Secrets by **name** only — never paste key values. Do not disable live webhooks or jobs (this package declares none). ## Auth | Lane | Credential | Notes | | --- | --- | --- | | A (default) | User secret `resend` | API key to `api.resend.com`. `account: "work"` → `resend-work`; or pass `secretName`. | | B | Integration `resend` (or `integration: "resend-work"`) | OAuth 2.1 + PKCE. Scope `full_access` for management; `emails:send` is send-only. | Host: `api.resend.com`. Placeholder: `{{secret:resend|scope=user}}`. ## Import paths | Export | Import | | --- | --- | | root dispatcher (default `smoke-test`) + helpers | `kody:@kody/resend` | | emails | `kody:@kody/resend/emails` | | domains | `kody:@kody/resend/domains` | | contacts | `kody:@kody/resend/contacts` | | templates | `kody:@kody/resend/templates` | | broadcasts | `kody:@kody/resend/broadcasts` | | account | `kody:@kody/resend/account` | | smoke-test | `kody:@kody/resend/smoke-test` | Prefer static `kody:@kody/resend/...` imports from `execute`. Do not lead with `packages.invoke`. Import the official package as `kody:@kody/resend` — do not invoke a personal `resend` kody id. Low-level transport (`resendRequest`, `resendCall`, `ResendApiError`) stays pinned to `https://api.resend.com`. Deprecated `/audiences` routes are not wrapped — use contacts + segments. ## Smoke test (read-only) ```js import { smokeTest } from 'kody:@kody/resend' export default async function main() { return await smokeTest() // without creds => { ok: true, live: false, ...setup URLs } // with creds => domains + recent sent email page (no writes) } ``` Or: ```js import smokeTest from 'kody:@kody/resend/smoke-test' export default async function main() { return await smokeTest() } ``` ## Common snippets ```js import resend from 'kody:@kody/resend' export default async function main() { return await resend({ action: 'list-domains' }) } ``` ```js import { sendEmail } from 'kody:@kody/resend/emails' export default async function main() { const preview = await sendEmail({ from: 'Name ', to: 'person@example.com', subject: 'Hello from Kody', html: '

It works!

', dryRun: true, }) return preview } ``` ## dryRun / confirm (writes) - Pass `dryRun: true` on any mutation to return `{ dryRun: true, method, path, body }` without contacting Resend. - `sendEmail`, `sendBatch`, `sendBroadcast`, `cancelScheduledEmail`, `publishTemplate`, and every `delete*` helper also throw unless `confirm: true`. - Broadcasts are draft-first: `createBroadcastDraft` never sends. - POST helpers accept optional `idempotencyKey` so a retried send cannot double-deliver. ```js import { sendEmail } from 'kody:@kody/resend/emails' export default async function main() { return await sendEmail({ from: 'Name ', to: 'person@example.com', subject: 'Hello from Kody', html: '

It works!

', confirm: true, idempotencyKey: 'welcome/user-123', }) } ``` ## Edge cases / fork notes - `from` must belong to a verified domain (or Resend’s `onboarding@resend.dev` test sender to your own account email). - 403 `insufficient_scope` → reconnect OAuth with `full_access`. - 429 → back off (default ~2 rps) or use `sendBatch`. - `resendCall` writes default to dry-run until you pass `dryRun: false`. - Never paste Resend API keys or OAuth tokens into chat or logs.