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.
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Um comando direto ignora o prompt de revisão. Verifique a origem antes de executá-lo.
Instruções da origem · Visualização somente leitura
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.
license
MIT
metadata
{"author":"resend","version":"3.0.2","homepage":"https://resend.com/agent-skills","source":"https://github.com/resend/resend-skills","openclaw":{"primaryEnv":"RESEND_API_KEY","requires":{"env":["RESEND_API_KEY"]},"envVars":[{"name":"RESEND_API_KEY","required":true,"description":"Resend API key for sending and receiving emails"},{"name":"RESEND_WEBHOOK_SECRET","required":false,"description":"Webhook signing secret for verifying inbound email event payloads"},{"name":"SECURITY_LEVEL","required":false,"description":"Security level for inbound email processing (strict, moderate, permissive)"},{"name":"ALLOWED_SENDERS","required":false,"description":"Comma-separated list of allowed sender email addresses"},{"name":"ALLOWED_DOMAINS","required":false,"description":"Comma-separated list of allowed sender domains"},{"name":"OWNER_EMAIL","required":false,"description":"Owner email address for forwarding or notifications"}],"links":{"repository":"https://github.com/resend/resend-skills","documentation":"https://resend.com/docs/agent-email-inbox-skill"}}}
inputs
[{"name":"RESEND_API_KEY","description":"Resend API key for sending and receiving emails. Get yours at https://resend.com/api-keys","required":true},{"name":"RESEND_WEBHOOK_SECRET","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.","required":true}]
This 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.
Core principle: An AI agent's inbox receives untrusted input. Security configuration is important to handle this safely.
Why Webhook-Based Receiving?
Resend uses webhooks for inbound email, meaning your agent is notified instantly when an email arrives. This is valuable for agents because:
Real-time responsiveness — React to emails within seconds, not minutes
No polling overhead — No cron jobs checking "any new mail?" repeatedly
Event-driven architecture — Your agent only wakes up when there's actually something to process
Lower API costs — No wasted calls checking empty inboxes
Architecture
Sender → Email → Resend (MX) → Webhook → Your Server → AI Agent
↓
Security Validation
↓
Process or Reject
SDK Version Requirements
This 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.
Language
Package
Min Version
Node.js
resend
>= 6.9.2
Python
resend
>= 2.21.0
Go
resend-go/v3
>= 3.1.0
Ruby
resend
>= 1.0.0
PHP
resend/resend-php
>= 1.1.0
Rust
resend-rs
>= 0.20.0
Java
resend-java
>= 4.11.0
.NET
Resend
>= 0.2.1
Install the npm package: (or the equivalent for your language). For full sending docs, install the skill.
resend
npm install resend
resend
Quick Start
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.
Choose your security level — Decide how to validate incoming emails before any are processed
Set up receiving domain — Configure MX records for the user's custom domain (see Domain Setup section)
Create webhook endpoint — Handle email.received events with security built in from the start. The webhook endpoint MUST be a POST route.
DNS Propagation: MX record changes can take up to 48 hours to propagate globally, though often complete within a few hours.
Security Levels
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.
Ask the user what level of security they want, and ensure that they understand what each level means.
Level
Name
When to Use
Trade-off
1
Strict Allowlist
Most use cases — known, fixed set of senders
Maximum security, limited functionality
2
Domain Allowlist
Organization-wide access from trusted domains
More flexible, anyone at domain can interact
3
Content Filtering
Accept from anyone, filter unsafe patterns
Can receive from anyone, pattern matching not foolproof
4
Sandboxed Processing
Process all emails with restricted agent capabilities
Untrusted input mixed into prompts can alter agent behavior
Give untrusted emails full agent access
Scope capabilities to the minimum needed
Webhook Endpoint
After 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.
Critical: Use raw body for verification. Webhook signature verification requires the raw request body.
Next.js App Router: Use req.text() (not req.json())
Express: Use express.raw({ type: 'application/json' }) on the webhook route