Openclaw

Give your Openclaw agent its own email inbox

Getting started

Openclaw (formerly Moltbot) is an open-source AI personal assistant that runs on your own devices and integrates with messaging platforms like WhatsApp, Telegram, Discord, and Slack. By adding AgentMail to Openclaw, your agent gains the ability to send and receive emails, enabling two-way email conversations alongside your existing chat channels.

There are two ways to integrate AgentMail with Openclaw: using the official AgentMail skill or creating a custom skill.

The easiest way to add email capabilities to Openclaw is by installing the official AgentMail skill from skills.sh. This skill is maintained by the AgentMail team and provides comprehensive email functionality.

Installation

Install the skill using the Openclaw CLI:

$openclaw skills install agentmail-to/agentmail-skills/agentmail

Or install via ClawHub:

$npx clawhub@latest install agentmail

Configuration

Add your AgentMail API key to the skill configuration in ~/.openclaw/openclaw.json:

1{
2 "skills": {
3 "entries": {
4 "agentmail": {
5 "enabled": true,
6 "env": {
7 "AGENTMAIL_API_KEY": "your-api-key-here"
8 }
9 }
10 }
11 }
12}

Get your API key from the AgentMail Console.

Features

The official skill includes:

  • Inbox management: Create scalable inboxes on-demand with unique email addresses
  • Message operations: Send emails with text and HTML content for best deliverability
  • Thread management: Group related messages in conversations
  • Attachments: Send and receive attachments with Base64 encoding
  • Drafts: Create drafts for human-in-the-loop approval before sending
  • Pods: Multi-tenant isolation for SaaS platforms
  • Idempotency: Safe retries on create operations
  • Real-time events: WebSocket and webhook support for notifications

Verify installation

Check that the skill is loaded:

$openclaw skills list --eligible

You should see agentmail in the list of available skills.

Option 2: Custom Skill

For more control over the integration, you can create a custom AgentMail skill. Skills are directories containing a SKILL.md file with instructions for Openclaw.

Create the skill directory

Create a new skill in your Openclaw workspace:

$mkdir -p ~/.openclaw/skills/agentmail

Create the skill file

Create ~/.openclaw/skills/agentmail/SKILL.md with the following content:

1---
2name: agentmail
3description: Send and receive emails using AgentMail
4requires:
5 env:
6 - AGENTMAIL_API_KEY
7---
8
9# AgentMail Skill
10
11You can send and receive emails using the AgentMail API. Use the `exec` tool to run curl commands against the AgentMail API.
12
13## API Base URL
14
15```
16https://api.agentmail.to/v0
17```
18
19## Authentication
20
21Include your API key in the Authorization header:
22
23```
24Authorization: Bearer $AGENTMAIL_API_KEY
25```
26
27## Common Operations
28
29### List inboxes
30
31```bash
32curl -s -H "Authorization: Bearer $AGENTMAIL_API_KEY" \
33 https://api.agentmail.to/v0/inboxes
34```
35
36### Create an inbox
37
38```bash
39curl -s -X POST -H "Authorization: Bearer $AGENTMAIL_API_KEY" \
40 -H "Content-Type: application/json" \
41 -d '{"display_name": "My Agent"}' \
42 https://api.agentmail.to/v0/inboxes
43```
44
45### Send an email
46
47```bash
48curl -s -X POST -H "Authorization: Bearer $AGENTMAIL_API_KEY" \
49 -H "Content-Type: application/json" \
50 -d '{
51 "to": ["recipient@example.com"],
52 "subject": "Hello from Openclaw",
53 "text": "This email was sent by my AI assistant."
54 }' \
55 https://api.agentmail.to/v0/inboxes/{inbox_id}/messages
56```
57
58### List messages in an inbox
59
60```bash
61curl -s -H "Authorization: Bearer $AGENTMAIL_API_KEY" \
62 https://api.agentmail.to/v0/inboxes/{inbox_id}/messages
63```
64
65### Reply to a message
66
67```bash
68curl -s -X POST -H "Authorization: Bearer $AGENTMAIL_API_KEY" \
69 -H "Content-Type: application/json" \
70 -d '{"text": "Thanks for your email!"}' \
71 https://api.agentmail.to/v0/inboxes/{inbox_id}/messages/{message_id}/reply
72```

Configure the skill

Add your AgentMail API key to the skill configuration in ~/.openclaw/openclaw.json:

1{
2 "skills": {
3 "entries": {
4 "agentmail": {
5 "enabled": true,
6 "env": {
7 "AGENTMAIL_API_KEY": "your-api-key-here"
8 }
9 }
10 }
11 }
12}

Verify the skill

Check that the skill is loaded:

$openclaw skills list --eligible

You should see agentmail in the list of available skills.

Example use cases

Once AgentMail is integrated with Openclaw, you can ask your agent to:

  • “Create a new email inbox for my project”
  • “Check my inbox for new emails”
  • “Send an email to john@example.com about the meeting tomorrow”
  • “Reply to the latest email from Sarah”
  • “Forward the invoice email to accounting@company.com

Real-time email notifications

For proactive email handling, you can combine AgentMail webhooks with Openclaw’s webhook support. This allows Openclaw to notify you immediately when new emails arrive.

  1. Set up a webhook endpoint in Openclaw (see Openclaw webhook documentation)

  2. Register the webhook with AgentMail:

$curl -X POST -H "Authorization: Bearer $AGENTMAIL_API_KEY" \
> -H "Content-Type: application/json" \
> -d '{
$ "url": "https://your-openclaw-webhook-url",
$ "events": ["message.received"]
$ }' \
> https://api.agentmail.to/v0/webhooks

Now Openclaw will be notified whenever a new email arrives, allowing it to proactively inform you or take action.

Resources