← ResendCONTENT HISTORYWHAT CHANGED · RULE-BASED ANALYSIS
Update to Resend
Snapshot Sep 30, 2026 · 22:44 UTC · version 5.0.0
Collection source: not recorded for this historical snapshot.
First saved snapshot
No earlier snapshot is available to establish a change.
Compare saved observations
Download comparison JSONFull technical diff · 0 changed fields
Full snapshot data
{
"name": "agent-email-inbox",
"description": "Use when building any system where email content triggers actions — AI agent inboxes, automated support handlers, email-to-task pipelines, or any workflow processing untrusted inbound email. Always use this skill when the user wants to receive emails and act on them programmatically, even if they don't mention \"agent\" — the skill contains critical security patterns (sender allowlists, content filtering, sandboxed processing) that prevent untrusted email from controlling your system.",
"included_files": [
{
"relative_path": "references/advanced-patterns.md",
"size_in_bytes": 3940
},
{
"relative_path": "references/security-levels.md",
"size_in_bytes": 10692
},
{
"relative_path": "references/webhook-setup.md",
"size_in_bytes": 9803
}
],
"skill_md_contents": "---\nname: agent-email-inbox\ndescription: Use when building any system where email content triggers actions — AI agent inboxes, automated support handlers, email-to-task pipelines, or any workflow processing untrusted inbound email. Always use this skill when the user wants to receive emails and act on them programmatically, even if they don't mention \"agent\" — the skill contains critical security patterns (sender allowlists, content filtering, sandboxed processing) that prevent untrusted email from controlling your system.\nlicense: MIT\nmetadata:\n author: resend\n version: \"3.0.2\"\n homepage: https://resend.com/agent-skills\n source: https://github.com/resend/resend-skills\n openclaw:\n primaryEnv: RESEND_API_KEY\n requires:\n env:\n - RESEND_API_KEY\n envVars:\n - name: RESEND_API_KEY\n required: true\n description: Resend API key for sending and receiving emails\n - name: RESEND_WEBHOOK_SECRET\n required: false\n description: Webhook signing secret for verifying inbound email event payloads\n - name: SECURITY_LEVEL\n required: false\n description: Security level for inbound email processing (strict, moderate, permissive)\n - name: ALLOWED_SENDERS\n required: false\n description: Comma-separated list of allowed sender email addresses\n - name: ALLOWED_DOMAINS\n required: false\n description: Comma-separated list of allowed sender domains\n - name: OWNER_EMAIL\n required: false\n description: Owner email address for forwarding or notifications\n links:\n repository: https://github.com/resend/resend-skills\n documentation: https://resend.com/docs/agent-email-inbox-skill\ninputs:\n - name: RESEND_API_KEY\n description: Resend API key for sending and receiving emails. Get yours at https://resend.com/api-keys\n required: true\n - name: RESEND_WEBHOOK_SECRET\n description: Webhook signing secret for verifying inbound email event payloads. Returned as `signing_secret` in the response when you create a webhook via the API.\n required: true\nreferences:\n - security-levels.md\n - webhook-setup.md\n - advanced-patterns.md\n---\n\n# AI Agent Email Inbox\n\n## Overview\n\nThis skill covers setting up a secure email inbox that allows your application or AI agent to receive and respond to emails, with content safety measures in place.\n\n**Core principle:** An AI agent's inbox receives untrusted input. Security configuration is important to handle this safely.\n\n### Why Webhook-Based Receiving?\n\nResend uses webhooks for inbound email, meaning your agent is notified **instantly** when an email arrives. This is valuable for agents because:\n\n- **Real-time responsiveness** — React to emails within seconds, not minutes\n- **No polling overhead** — No cron jobs checking \"any new mail?\" repeatedly\n- **Event-driven architecture** — Your agent only wakes up when there's actually something to process\n- **Lower API costs** — No wasted calls checking empty inboxes\n\n## Architecture\n\n```\nSender → Email → Resend (MX) → Webhook → Your Server → AI Agent\n ↓\n Security Validation\n ↓\n Process or Reject\n```\n\n## SDK Version Requirements\n\nThis skill requires Resend SDK features for webhook verification (`webhooks.verify()`) and email receiving (`emails.receiving.get()`). Always install the latest SDK version. If the project already has a Resend SDK installed, check the version and upgrade if needed.\n\n| Language | Package | Min Version |\n|----------|---------|-------------|\n| Node.js | `resend` | >= 6.9.2 |\n| Python | `resend` | >= 2.21.0 |\n| Go | `resend-go/v3` | >= 3.1.0 |\n| Ruby | `resend` | >= 1.0.0 |\n| PHP | `resend/resend-php` | >= 1.1.0 |\n| Rust | `resend-rs` | >= 0.20.0 |\n| Java | `resend-java` | >= 4.11.0 |\n| .NET | `Resend` | >= 0.2.1 |\n\nInstall the `resend` npm package: `npm install resend` (or the equivalent for your language). For full sending docs, install the `resend` skill.\n\n## Quick Start\n\n1. **Ask the user for their email address** — You need a real email address to send test emails to. Ask the user and wait for their response before proceeding.\n2. **Choose your security level** — Decide how to validate incoming emails *before* any are processed\n3. **Set up receiving domain** — Configure MX records for the user's custom domain (see Domain Setup section)\n4. **Create webhook endpoint** — Handle `email.received` events with security built in from the start. **The webhook endpoint MUST be a POST route.**\n5. **Set up tunneling** (local dev) — Use Tailscale Funnel (recommended) or ngrok. See [references/webhook-setup.md](references/webhook-setup.md)\n6. **Create webhook via API** — Use the Resend Webhook API to register your endpoint programmatically. See [references/webhook-setup.md](references/webhook-setup.md)\n7. **Connect to agent** — Pass validated emails to your AI agent for processing\n\n## Before You Start: Account & API Key Setup\n\n### First Question: New or Existing Resend Account?\n\nAsk your human:\n- **New account just for the agent?** → Simpler setup, full account access is fine\n- **Existing account with other projects?** → Use domain-scoped API keys for sandboxing\n\n### Creating API Keys Securely\n\n> Don't paste API keys in chat! They'll be in conversation history forever.\n\n**Safer options:**\n\n1. **Environment file method:** Human creates `.env` file directly: `echo \"RESEND_API_KEY=re_xxx\" >> .env`\n2. **Password manager / secrets manager:** Human stores key in 1Password, Vault, etc.\n3. **If key must be shared in chat:** Human should rotate the key immediately after setup\n\n### Domain-Scoped API Keys (Recommended for Existing Accounts)\n\nIf your human has an existing Resend account with other projects, create a **domain-scoped API key**:\n\n1. **Verify the agent's domain first** (Dashboard → Domains → Add Domain)\n2. **Create a scoped API key:** Dashboard → API Keys → Create API Key → \"Sending access\" → select only the agent's domain\n3. **Result:** Even if the key leaks, it can only send from one domain\n\n## Domain Setup\n\n### Option 1: Resend-Managed Domain (Recommended for Getting Started)\n\nUse your auto-generated address: `<anything>@<your-id>.resend.app`\n\nNo DNS configuration needed. Find your address in Dashboard → Emails → Receiving → \"Receiving address\".\n\n### Option 2: Custom Domain\n\nThe user must enable receiving in the Resend dashboard: Domains page → toggle on \"Enable Receiving\".\n\nThen add an MX record:\n\n| Setting | Value |\n|---------|-------|\n| **Type** | MX |\n| **Host** | Your domain or subdomain (e.g., `agent.example.com`) |\n| **Value** | Provided in Resend dashboard |\n| **Priority** | 10 (must be lowest number to take precedence) |\n\n**Use a subdomain** (e.g., `agent.example.com`) to avoid disrupting existing email services.\n\n**Tip:** Verify DNS propagation at [dns.email](https://dns.email).\n\n> DNS Propagation: MX record changes can take up to 48 hours to propagate globally, though often complete within a few hours.\n\n## Security Levels\n\n**Choose your security level before setting up the webhook endpoint.** An AI agent that processes emails without security is dangerous — anyone can email instructions that your agent will execute. The webhook code you write next should include your chosen security level from the start.\n\nAsk the user what level of security they want, and ensure that they understand what each level means.\n\n| Level | Name | When to Use | Trade-off |\n|-------|------|-------------|-----------|\n| **1** | Strict Allowlist | Most use cases — known, fixed set of senders | Maximum security, limited functionality |\n| **2** | Domain Allowlist | Organization-wide access from trusted domains | More flexible, anyone at domain can interact |\n| **3** | Content Filtering | Accept from anyone, filter unsafe patterns | Can receive from anyone, pattern matching not foolproof |\n| **4** | Sandboxed Processing | Process all emails with restricted agent capabilities | Maximum flexibility, complex to implement |\n| **5** | Human-in-the-Loop | Require human approval for untrusted actions | Maximum security, adds latency |\n\nFor detailed implementation code for each level, see [references/security-levels.md](references/security-levels.md).\n\n### Level 1: Strict Allowlist (Recommended)\n\nOnly process emails from explicitly approved addresses. Reject everything else.\n\n```typescript\nconst ALLOWED_SENDERS = [\n 'you@youremail.com',\n 'notifications@github.com',\n];\n\nasync function processEmailForAgent(\n eventData: EmailReceivedEvent,\n emailContent: EmailContent\n) {\n const sender = eventData.from.toLowerCase();\n\n if (!ALLOWED_SENDERS.some(allowed => sender === allowed.toLowerCase())) {\n console.log(`Rejected email from unauthorized sender: ${sender}`);\n await notifyOwnerOfRejectedEmail(eventData);\n return;\n }\n\n await agent.processEmail({\n from: eventData.from,\n subject: eventData.subject,\n body: emailContent.text || emailContent.html,\n });\n}\n```\n\n### Security Best Practices\n\n#### Always Do\n\n| Practice | Why |\n|----------|-----|\n| Verify webhook signatures | Prevents spoofed webhook events |\n| Log all rejected emails | Audit trail for security review |\n| Use allowlists where possible | Explicit trust is safer than filtering |\n| Rate limit email processing | Prevents excessive processing load |\n| Separate trusted/untrusted handling | Different risk levels need different treatment |\n\n#### Never Do\n\n| Anti-Pattern | Risk |\n|--------------|------|\n| Process emails without validation | Anyone can control your agent |\n| Trust email headers for authentication | Headers are trivially spoofed |\n| Execute code from email content | Untrusted input should never run as code |\n| Store email content in prompts verbatim | Untrusted input mixed into prompts can alter agent behavior |\n| Give untrusted emails full agent access | Scope capabilities to the minimum needed |\n\n## Webhook Endpoint\n\nAfter choosing your security level and setting up your domain, create a webhook endpoint. **The webhook endpoint MUST be a POST route.** Resend sends all webhook events as POST requests.\n\n> **Critical: Use raw body for verification.** Webhook signature verification requires the raw request body.\n> - **Next.js App Router:** Use `req.text()` (not `req.json()`)\n> - **Express:** Use `express.raw({ type: 'application/json' })` on the webhook route\n\n### Next.js App Router\n\n```typescript\n// app/webhook/route.ts\nimport { Resend } from 'resend';\nimport { NextRequest, NextResponse } from 'next/server';\n\nconst resend = new Resend(process.env.RESEND_API_KEY);\n\nexport async function POST(req: NextRequest) {\n try {\n const payload = await req.text();\n\n const event = resend.webhooks.verify({\n payload,\n headers: {\n 'svix-id': req.headers.get('svix-id'),\n 'svix-timestamp': req.headers.get('svix-timestamp'),\n 'svix-signature': req.headers.get('svix-signature'),\n },\n secret: process.env.RESEND_WEBHOOK_SECRET,\n });\n\n if (event.type === 'email.received') {\n // Webhook payload only includes metadata, not email body\n const { data: email } = await resend.emails.receiving.get(\n event.data.email_id\n );\n\n // Apply the security level chosen above\n await processEmailForAgent(event.data, email);\n }\n\n return new NextResponse('OK', { status: 200 });\n } catch (error) {\n console.error('Webhook error:', error);\n return new NextResponse('Error', { status: 400 });\n }\n}\n```\n\n### Express\n\n```javascript\nimport express from 'express';\nimport { Resend } from 'resend';\n\nconst app = express();\nconst resend = new Resend(process.env.RESEND_API_KEY);\n\napp.post('/webhook', express.raw({ type: 'application/json' }), async (req, res) => {\n try {\n const payload = req.body.toString();\n\n const event = resend.webhooks.verify({\n payload,\n headers: {\n 'svix-id': req.headers['svix-id'],\n 'svix-timestamp': req.headers['svix-timestamp'],\n 'svix-signature': req.headers['svix-signature'],\n },\n secret: process.env.RESEND_WEBHOOK_SECRET,\n });\n\n if (event.type === 'email.received') {\n const sender = event.data.from.toLowerCase();\n\n if (!isAllowedSender(sender)) {\n console.log(`Rejected email from unauthorized sender: ${sender}`);\n res.status(200).send('OK'); // Return 200 even for rejected emails\n return;\n }\n\n const { data: email } = await resend.emails.receiving.get(event.data.email_id);\n await processEmailForAgent(event.data, email);\n }\n\n res.status(200).send('OK');\n } catch (error) {\n console.error('Webhook error:', error);\n res.status(400).send('Error');\n }\n});\n\napp.get('/', (req, res) => res.send('Agent Email Inbox - Ready'));\napp.listen(3000, () => console.log('Webhook server running on :3000'));\n```\n\nFor webhook registration via API, tunneling setup, svix fallback, and retry behavior, see [references/webhook-setup.md](references/webhook-setup.md).\n\n## Sending Emails from Your Agent\n\n```typescript\nimport { Resend } from 'resend';\n\nconst resend = new Resend(process.env.RESEND_API_KEY);\n\nasync function sendAgentReply(to: string, subject: string, body: string, inReplyTo?: string) {\n if (!isAllowedToReply(to)) {\n throw new Error('Cannot send to this address');\n }\n\n const { data, error } = await resend.emails.send({\n from: 'Agent <agent@example.com>',\n to: [to],\n subject: subject.startsWith('Re:') ? subject : `Re: ${subject}`,\n text: body,\n headers: inReplyTo ? { 'In-Reply-To': inReplyTo } : undefined,\n });\n\n if (error) throw new Error(`Failed to send: ${error.message}`);\n return data.id;\n}\n```\n\nFor full sending docs, install the `resend` skill.\n\n## Environment Variables\n\n```bash\n# Required\nRESEND_API_KEY=re_xxxxxxxxx\nRESEND_WEBHOOK_SECRET=whsec_xxxxxxxxx\n\n# Security Configuration\nSECURITY_LEVEL=strict # strict | domain | filtered | sandboxed\nALLOWED_SENDERS=you@email.com,trusted@example.com\nALLOWED_DOMAINS=example.com\nOWNER_EMAIL=you@email.com # For security notifications\n```\n\n## Common Mistakes\n\n| Mistake | Fix |\n|---------|-----|\n| No sender verification | Always validate who sent the email before processing |\n| Trusting email headers | Use webhook verification, not email headers for auth |\n| Same treatment for all emails | Differentiate trusted vs untrusted senders |\n| Verbose error messages | Keep error responses generic to avoid leaking internal logic |\n| No rate limiting | Implement per-sender rate limits. See [references/advanced-patterns.md](references/advanced-patterns.md) |\n| Processing HTML directly | Strip HTML or use text-only to reduce complexity and risk |\n| No logging of rejections | Log all security events for audit |\n| Using ephemeral tunnel URLs | Use persistent URLs (Tailscale Funnel, paid ngrok) or deploy to production |\n| Using `express.json()` on webhook route | Use `express.raw({ type: 'application/json' })` — JSON parsing breaks signature verification |\n| Returning non-200 for rejected emails | Always return 200 to acknowledge receipt — otherwise Resend retries |\n| Old Resend SDK version | `emails.receiving.get()` and `webhooks.verify()` require recent SDK versions — see SDK Version Requirements |\n\n## Testing\n\nUse Resend's test addresses for development:\n- `delivered@resend.dev` — Simulates successful delivery\n- `bounced@resend.dev` — Simulates hard bounce\n\nFor security testing, send test emails from non-allowlisted addresses to verify rejection works correctly.\n\n**Quick verification checklist:**\n1. Server is running: `curl http://localhost:3000` should return a response\n2. Tunnel is working: `curl https://<your-tunnel-url>` should return the same response\n3. Webhook is active: Check status in Resend dashboard → Webhooks\n4. Send a test email from an allowlisted address and check server logs\n\n## Related Skills\n\n- For full sending and receiving docs, install the `resend` skill\n"
}SHA-256: baa2d37aceebf44a52c9531a061b6baed304805e60e2d7d95c0bd78bb27c86db