guide~15 min read

How to Automate Email with OpenClaw

The average person spends 20+ minutes every morning deciding which emails deserve attention. This guide shows you how to hand that job to your OpenClaw agent. Setup takes about 15 minutes. After that, you stop scanning your inbox yourself.

What you are building

The Email Triage Bot is an OpenClaw agent that runs every morning at 8am. It scans your inbox, applies your priority rules, and sends you a structured report via Telegram (or any connected channel). You see what matters. The rest is summarized.

It uses the gog skill to connect to Gmail via the Google Workspace API. You define the priority rules in a SOUL.md file. The agent reads the rules each session and applies them consistently.

What you end up with:

  • • Morning inbox summary sent to Telegram at 8am every weekday
  • • Immediate alerts for flagged emails (clients, urgent keywords)
  • • Calendar invites surfaced if they are today or tomorrow
  • • Receipts and invoices logged but not alerted
  • • Everything else batched into a single summary

Before you start

You need three things:

  1. 1OpenClaw installed and running with a Telegram (or other channel) connected.
  2. 2The gog skill installed. This is what gives your agent access to Gmail.
  3. 3A Google account with Gmail. The gog skill uses OAuth — you authorize it once.
# Install the gog skill
clawhub install gog

# Authenticate with your Google account
gog auth add your@gmail.com

# Verify it works
gog gmail list "in:inbox" -a your@gmail.com

Step 1: Write your SOUL.md

SOUL.md defines who your agent is and how it behaves. For the email triage agent, it defines the priority rules. Copy the template below into ~/.openclaw/workspace/SOUL.md.

SOUL.md
You are an email triage assistant. Every morning at 8am, scan the inbox for important messages. Flag anything from clients, partners, or with urgent keywords. Summarize the rest in a single message. Skip newsletters, marketing, and automated notifications.

Priority rules:
- Client emails: always flag
- Calendar invites: flag if today or tomorrow
- Receipts/invoices: log but don't flag
- Everything else: daily summary

Customize the priority rules to match your inbox. Add specific domains for clients, keywords you care about, and anything that should never interrupt you.

Step 2: Add a HEARTBEAT.md

HEARTBEAT.md defines the schedule. The email triage agent runs once each morning. Copy this into ~/.openclaw/workspace/HEARTBEAT.md.

HEARTBEAT.md
Every morning at 8am:
1. Scan inbox: gog gmail list "in:inbox is:unread" -a your@email.com
2. For each unread email:
   a. Check sender against your client/partner list
   b. Scan subject and body for urgent keywords (deadline, urgent, ASAP, payment)
   c. Check for calendar invites with today or tomorrow dates
3. Flagged emails: send individual Telegram notifications with sender, subject, snippet
4. Everything else: compile a single summary message
5. Send summary: "X emails today. Flagged: [list]. Summary: [digest]"

How gog works

The gog skill is a Google Workspace CLI that gives your agent access to Gmail, Calendar, Drive, Sheets, and Docs. For email triage, you need the Gmail part.

Your agent will call gog commands internally. Here are the ones it uses most:

# List unread inbox emails
gog gmail list "in:inbox is:unread" -a your@email.com

# Search for specific senders
gog gmail list "from:client@domain.com is:unread" -a your@email.com

# Get full email content
gog gmail get MESSAGE_ID -a your@email.com

# Search for calendar invites
gog gmail list "in:inbox has:attachment filename:invite" -a your@email.com

The agent reads your SOUL.md priority rules and uses these commands to find the relevant emails. You do not need to write any code. The SOUL.md is the config.

Customizing your priority rules

The template above is a starting point. Customize it by editing the priority rules section in your SOUL.md. Here are some examples:

Flag emails from specific domains

Priority rules:
- Emails from @client1.com: always flag
- Emails from @client2.com: always flag
- Emails from @yourbank.com: log only

Add urgency keywords

Urgent keywords (always flag):
- "urgent", "URGENT", "deadline", "EOD", "ASAP"
- "invoice due", "payment overdue"
- "critical", "down", "outage"

Adjust the timing

Schedule:
- Weekdays at 8am: full triage scan
- Weekdays at 1pm: quick scan for new urgent emails only
- Weekends: skip unless subject contains "urgent"

Multiple email accounts

If you have more than one Gmail account, you can add them all to gog and have your agent scan each one separately.

# Add a second account
gog auth add work@company.com

# Verify both accounts are authenticated
gog auth list

# List accounts in SOUL.md
Accounts to scan:
- personal@gmail.com (personal account)
- work@company.com (work account, higher priority)

In your SOUL.md, specify which account each priority rule applies to. The agent passes the right -a flag to gog automatically.

What the morning report looks like

Here is an example of what your agent sends each morning:

Agent:

Morning inbox — Tuesday March 11

28 unread emails. 3 flagged.

Flagged:

  • Sarah @ Acme — "Re: contract renewal" (10 min ago)
  • noreply@stripe.com — "Payment failed: $299.00" (2h ago)
  • Calendar — "Design review @ 2pm today" (invite)

Summary (25 emails):

3 newsletters, 8 GitHub notifications, 7 receipts logged to sheet, 4 Jira updates, 3 misc.

Cost breakdown

The Email Triage Bot runs on Claude Sonnet once per morning. A typical inbox scan uses 500-800 input tokens (email headers and snippets) plus 300-500 output tokens for the summary. At current Sonnet pricing, that is roughly $0.005-$0.008 per run.

ItemCost
ModelClaude Sonnet
Runs per day1 (weekdays) / 0 (weekends)
Tokens per run~1,200 (input + output)
Cost per run~$0.007
Daily cost (5 days/week)~$0.007
Monthly cost~$0.15-$0.30

Costs depend on inbox size. A busy inbox with 100+ emails per day will use more tokens. Use Clawback to model your exact cost.

Pair it with other runbooks

Email triage works best as part of a broader daily workflow. These templates combine well with it:

All four of these templates together form the Freelancer Stack in the packs collection.

See the Freelancer Stack →

Ready to set it up?

The Email Triage Bot template has everything pre-written. Copy the SOUL.md, install gog, and your agent handles the morning inbox scan from tomorrow.

Get the Email Triage Bot template →

Quick facts

TemplateEmail Triage Bot
File typeSOUL.md
Skill requiredgog (Gmail)
ModelSonnet
Cost~$0.30/day
Setup time~15 min

Spending too much?

Model token usage before enabling a workflow.

Try Clawback →

Related guides