Email Management with OpenClaw
Complete tutorial to automate email processing, filtering, and responses
Complete tutorial to automate email processing, filtering, and responses
This walkthrough gets OpenClaw talking to your email: process messages, filter and prioritize, send automated replies, and (with Gmail) react to new mail in real time via Pub/Sub instead of polling. Allow 20–30 minutes. The examples use Gmail; the ideas apply to other providers if you have a skill or integration for them.
By the end you’ll have OpenClaw wired to your inbox (we use Gmail as the example). The assistant can read and summarize mail, filter by sender or importance, send replies on your behalf, and—if you set up Gmail Pub/Sub—process new messages as they arrive instead of on a schedule. You can drive it from chat (“Check my emails”, “Summarize the last 24 hours”) or from cron and webhooks.
You need OpenClaw installed and running (if not, do the Getting Started tutorial first) and at least one channel connected so you can talk to the assistant. A Gmail account is enough for the examples here; other email access works if there’s a skill for it. Familiarity with automation (cron, webhooks) helps when you add scheduled or event-driven email tasks—see the Automation tutorial for that.
OpenClaw reaches your email through skills—add-ons that give the agent tools to read, send, and organize mail. Two main options:
npx skills add https://github.com/googleworkspace/cli after running gws auth setup and gws auth login.
Or use a standalone Gmail skill for email-only access. From your project or OpenClaw environment:
npx clawdhub@latest install gmail
That pulls the skill and wires it in. Alternatively you can ask the assistant in chat: e.g. “Set up Gmail integration for email management”, “Create a skill to read and process my emails”, or “Help me automate email filtering”. It will walk you through setup and, for Gmail, OAuth when needed. Once the skill is installed, the agent can query and send mail (after you complete OAuth in the next step).
Gmail (and most Google APIs) use OAuth so OpenClaw can access your mailbox without your password. You create a project in Google Cloud, enable the Gmail API, create OAuth client credentials, and add them to your OpenClaw configuration. Then you complete a one-time sign-in in the browser; after that the skill can read and send mail on your behalf.
You can do this manually or ask OpenClaw in chat: “Help me set up Gmail OAuth”. It will prompt you for the right steps and where to paste credentials.
With the skill and OAuth in place, you can run email tasks on a schedule (cron) or in real time (Gmail Pub/Sub). Scheduled runs are simple: you trigger the agent at a fixed time with a message like “Check my emails and summarize”. Real time needs Gmail Pub/Sub so Google pushes a notification when mail arrives; OpenClaw then processes it without polling. Both are described in the Automation reference; below are minimal examples.
Run the agent every morning to summarize the last 24 hours and flag what needs attention. Example cron config (adjust schedule and message to taste):
{
"cron": {
"jobs": [
{
"schedule": "0 9 * * *",
"command": "agent --message 'Check my emails from the last 24 hours. Summarize important messages and flag any that need my attention.'"
}
]
}
}
To react as soon as mail arrives, set up Gmail Pub/Sub: create a topic and subscription in Google Cloud, point Gmail to push to that topic, and configure OpenClaw to receive those pushes (via a webhook or the hooks config). Then new mail triggers your agent immediately instead of waiting for the next cron run. Example hooks config (fill in your topic and subscription):
{
"hooks": {
"gmail": {
"enabled": true,
"topic": "your-pubsub-topic",
"subscription": "your-subscription-name"
}
}
}
Full Pub/Sub and webhook setup is in the Automation guide (webhooks, Gmail push).
Beyond “check my inbox” and scheduled summaries, you can define rules the agent follows: filter by sender or keyword, auto-respond, categorize and move mail, or handle attachments. You don’t have to write code—you describe what you want in chat and the assistant can create or adjust a skill or automation rule. For example:
OpenClaw will propose or generate the logic (skills, cron jobs, or webhook handlers) and you refine from there. See Skills and Automation tutorial for how skills and scheduled/event-driven tasks fit together.
Confirm that the agent can see and act on your mail. Send yourself a test message, then in chat ask OpenClaw to check your inbox or summarize recent mail. If it can read and summarize, the skill and OAuth are working. Then test any automation you added: either wait for the next cron run (e.g. the morning summary) or trigger the same command manually so you see the agent’s output. If you set up Pub/Sub, send another test email and check that the agent runs when the push arrives—see Automation and your Gateway logs if pushes aren’t firing.
Once read, summarize, and basic automation work, you can layer on smarter behavior. Use the agent to separate important mail from noise, draft or send context-aware replies, summarize long threads, or process attachments (e.g. extract text from PDFs, save to a folder). To tie email to your calendar, pull meeting requests from messages and create events—Calendar integration walks through that. The same Automation reference (cron, webhooks, Pub/Sub) supports more complex email workflows.