π§ Gmail Hub
Communication Β· Automation Assistant Β· Email
Turn the world's largest email network into your AI agent's mailroom! Zero-friction integration between your internal LLM and external collaborators, granting it powerful autonomous capabilities to read, draft, and even auto-reply to correspondence.
OpenClaw Team
π Quick Install
Run the following command in your terminal to install:
npx clawhub install gmail
π Stats Overview
| β Stars | βοΈ Total Calls | π₯ Active Users | π― Stable Version |
|---|---|---|---|
| 890 | 234k | 3,210 | v1.6.0 |
ποΈ How It Works
After connecting to the official Gmail API, we've rewritten it into a toolkit perfectly suited for LLM parsing logic:
- π¨ Bi-directional Email Read/Write Pipeline: Not only can it leverage the LLM's excellent writing skills for outbound delivery, but it also monitors specific inbox unread states. The Agent can read lengthy incoming emails and summarize them into a single sentence for your terminal.
- π§ Intent-aware Auto-archiving & Drafts: Supports creating pending drafts rather than just sending immediately. When handling important replies involving finances or business, the bot can leave traces in Drafts, waiting for human confirmation via mobile.
- π§Ή Dehydrated MIME Parsing: Raw email source code is often filled with massive Base64 signatures, table styles, and invisible characters. This module includes a powerful sanitizer that strips everything clean, delivering only semantically rich plain text to the LLM β dramatically saving precious token budget.
- π Multi-layer OAuth2 Authentication & Privacy Compliance: Uses Google's highest-standard User-Consent authorization pipeline, ensuring runtime credentials are protected at the hardware level.
π§ Typical Use Cases
πΌ Scenario 1: T+0 Business Inquiry Auto-reply Pipeline
When external clients send product pricing inquiries via your website contact. Your agent can capture the email within 10 seconds, read the context to find the corresponding SKU pricing database, then draft a polite reply with detailed price tables β it can even auto cc your Sales Director.
ποΈ Scenario 2: Daily Marketing Spam Cleanup
If you're drowning in promotional emails, let AI help you "clear the noise" every morning at 8 AM. It batch-fetches your INBOX, uses its powerful semantic understanding to distinguish "ads" from "real human emails," then directly moves useless promotions to Trash and marks them as read.
π» Command Reference
After installation, you can let AI call these autonomously via conversation, or manually trigger operations from the CLI:
Auto-fetch the top 5 unread emails from inbox with key topic summaries:
clawhub execute gmail action="read" \
query="is:unread in:inbox" max-results=5 \
intent="Summarize the core topics for me"
Have the LLM draft a polite investment decline letter based on your thinking:
clawhub execute gmail action="draft" \
to="[email protected]" \
intent="Politely decline their 1M funding offer but keep in touch for next round"
Send targeted notifications directly (can be combined with monitoring tools):
clawhub execute gmail action="send" \
to="[email protected]" subject="Daily Server Report" \
body="$(cat report.txt)"
π‘οΈ Requirements & Authentication
- π Credential Setup: First-time use requires a browser redirect in your local terminal. After running
npx clawhub install gmail, the console generates an OAuth link β log in with your Google account and grant full read/write access tohttps://mail.google.com/. - π Encrypted Credential Cache: The generated
token.jsonis stored in your machine's~/.clawhub/credentialsdirectory. Never push this file to any public repository.
Β© 2026 OpenClaw. All rights reserved.
