Agent Email Setup for Openclaw

Set up autonomous email sending, webhook-driven inbound receiving, and local inbox storage for AI agents using Resend.

di5cip1e
v1.0.0
Jun 18, 2026
0
429
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install director-email-setup

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install director-email-setup using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Agent Email Setup?

The Agent Email Setup skill provides a robust architectural framework for giving your AI agents their own fully functional, autonomous email addresses. By integrating Resend with an Express/Node.js backend, your agent can securely send outgoing messages, receive inbound emails via real-time webhooks, verify external account links, and manage transactional flows without manual intervention.

As part of the Openclaw Skills ecosystem, this setup bridges the gap between static LLMs and dynamic web-based communication. It allows agents to act as independent communicators with custom domains, enabling automated workflows such as account registration, processing incoming user requests, and managing notifications programmatically.

Agent Email Setup Use Cases

  • Agent Identity Creation: Establishing a dedicated, branded email address for an AI agent to communicate with human users.
  • Autonomous Account Verifications: Enabling agents to handle automated sign-up steps, OTP code retrieval, and verification loops.
  • Inbox Ingest Operations: Allowing external services to send reports, documents, or instructions directly to the agent's parsing pipeline.
  • Automated Customer Support: Setting up a loop where users email the agent, and the agent processes queries and responds autonomously.

How Agent Email Setup Works

  1. Email Arrival: An external sender sends an email to the agent's custom address (e.g., agent@yourdomain.com).
  2. Webhook Ingestion: Resend processes the inbound message and forwards the raw email data as an email.received event payload to your configured Express backend.
  3. Security Validation: The Node.js backend verifies the Resend HMAC-SHA256 signature to prevent spoofing and ensure request integrity.
  4. Local Staging: The backend parses the payload and persists it as a JSON file inside the mail/inbox/ server directory.
  5. Cron Monitoring: A scheduled 5-minute cron job checks the inbox, flags unprocessed JSON payloads, triggers the agent loop to analyze incoming text, and marks messages as completed.

Agent Email Setup Setup

1. DNS Domain Verification

Configure your custom domain on Resend to enable sending and receiving:

RESEND_KEY="re_xxxxx"

# Add domain
curl -s -X POST -H "Authorization: Bearer $RESEND_KEY" \
  -H "Content-Type: application/json" \
  https://api.resend.com/domains \
  -d '{"name": "yourdomain.com", "region": "us-east-1"}'

# Get DNS records to configure
curl -s -H "Authorization: Bearer $RESEND_KEY" \
  https://api.resend.com/domains/yourdomain.com | jq '.records'

Add the returned DNS records (TXT, MX, CNAME) to your DNS provider. Wait for verification (usually minutes).

Verify status:

curl -s -H "Authorization: Bearer $RESEND_KEY" \
  https://api.resend.com/domains/yourdomain.com | jq '{status, capabilities}'

Both sending and receiving capabilities must be enabled on Resend.

2. Create Webhook Endpoint

Create routes/inboundEmail.js in your Express backend. Key requirements:

  • Accept POST at /api/inbound-email
  • Verify Resend webhook signature using RESEND_WEBHOOK_SECRET
  • Save emails as JSON to mail/inbox/
  • Provide GET endpoint to list/read emails
  • Provide ACK endpoint to mark processed

Mount in your server:

const inboundEmailRoutes = require('./routes/inboundEmail');
app.use('/api/inbound-email', inboundEmailRoutes);

3. Register Webhook on Resend

curl -s -X POST -H "Authorization: Bearer $RESEND_KEY" \
  -H "Content-Type: application/json" \
  https://api.resend.com/webhooks \
  -d '{
    "endpoint": "https://yourdomain.com/api/inbound-email",
    "events": ["email.received"],
    "enabled": true
  }' | jq '{id, signing_secret}'

Save the returned signing_secret — you will need it for webhook verification.

4. Create Inbox Directory & Configure Secrets

mkdir -p mail/inbox
touch mail/inbox/.lastcheck

Store these credentials in your secrets configuration:

  • RESEND_API_KEY
  • RESEND_WEBHOOK_SECRET
  • AGENT_EMAIL

Agent Email Setup Data Schema & Taxonomy

This skill stores inbound emails as localized JSON objects and uses state variables to track processing pipelines.

File Directory Taxonomy

Path Description Format
mail/inbox/ Directory where raw incoming email payloads are stored. Folder
mail/inbox/[id].json Raw structured email object matching Resend's schema. JSON file
mail/inbox/.lastcheck State file storing timestamp marker of the last cron run. File

Local JSON Email Model Schema

{
  "id": "email_id_xxxxx",
  "from": "[email protected]",
  "to": ["[email protected]"],
  "subject": "Verification Code: 4920",
  "text": "Your verification code is 4920.",
  "html": "<p>Your verification code is 4920.</p>",
  "processed": false
}

Agent Email Setup Advanced Features

  • HMAC Webhook Verification: High-grade security verifying signatures on inbound JSON payloads using a raw express payload buffer before saving files.
  • Automated Processing Extension: Supports automated hook-ups to cron jobs that analyze body structures via LLMs and programmatically fire trigger callbacks.
  • Dual Inbound-Outbound Integration: Standardized javascript utilities for developers to quickly scale multi-agent team communication patterns using plain text or HTML layouts.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*