· 9 min read

Setting Up OpenClaw for Email and Calendar Automation

Connect Gmail and Google Calendar to an OpenClaw assistant, set up triggers, and avoid the auth and rate-limit friction that trips up first-time users.

openclaw email calendar automation tutorial

The first useful thing most people want from a long-running AI assistant is the same: triage the inbox, surface what matters today, and keep the calendar from collapsing into back-to-back conflicts. Email and calendar automation through OpenClaw can handle that, but the setup has more friction than the marketing screenshots suggest.

This walkthrough covers a working configuration end to end — what you install, how authentication actually works, what triggers look like in practice, and the parts that will surprise you the first time.

What email and calendar automation means in this context

It means OpenClaw runs in a long-lived process, watches your mail and calendar, and acts on a defined set of rules without you opening a chat window.

That is different from asking a chatbot to draft a reply. Here the assistant has standing access, a memory of prior decisions, and a schedule for when to check things. The model is not doing the watching — a small set of background tasks polls the APIs and hands matches to the model only when a rule triggers.

If you are still deciding what an assistant should own day to day, the capabilities guide is a more general starting point before committing to a specific automation.

Prerequisites before you start

You need a running OpenClaw process, OAuth credentials for the accounts you want to connect, and a place to store refresh tokens that survives restarts.

  • OpenClaw 0.6 or later — earlier versions did not ship the Google connector.
  • A Google Cloud project with the Gmail API and Calendar API enabled.
  • OAuth client credentials of type Desktop app or Web application, depending on where the process runs.
  • A persistent volume or secrets store for refresh tokens — losing these means re-authorizing on every restart.
  • An LLM API key, or a connection to a hosted model.

Step 1: Install the connectors

The Gmail and Calendar connectors are separate plugins, both installed through the standard plugin command.

openclaw plugin add gmail
openclaw plugin add gcal

Confirm with openclaw plugin list. Both should appear with status ready. If either says needs auth, that is expected — auth is the next step.

Step 2: Connect your accounts

You connect each account with an OAuth flow that runs once and stores a refresh token locally.

openclaw auth gmail --client-id ./gmail-client.json
openclaw auth gcal  --client-id ./gcal-client.json

Each command opens a browser window, prompts for the Google sign-in, and writes the resulting refresh token to ~/.openclaw/credentials/. Two friction points show up here:

  • If the OAuth consent screen is in Testing mode, refresh tokens expire after seven days. For anything beyond a quick demo, move the consent screen to Production.
  • The Gmail scope you grant determines what the assistant can do. Read-only is safer to start with. The gmail.modify scope is required for archive, label, and reply actions, and gmail.send is required for sending new mail.

If you want to think about credential storage more broadly before granting write scopes, the security guide covers token handling and what to log versus what to suppress.

Step 3: Define triggers and write rules

Triggers are the only thing that decide when the model runs, so this is where most of the configuration work goes.

OpenClaw expects rules in a YAML file at ~/.openclaw/rules/. A minimal email rule:

- name: morning-triage
  trigger:
    type: schedule
    cron: "0 8 * * *"
  action:
    plugin: gmail
    task: summarize_unread
    output: slack#triage

And a calendar rule:

- name: conflict-watch
  trigger:
    type: calendar.event_created
  action:
    plugin: gcal
    task: detect_conflicts
    notify_on: conflict

Rules can chain. A common pattern is a calendar rule that detects a new external meeting, then triggers a Gmail rule that drafts a confirmation reply against the meeting context.

Step 4: Test before you trust it

Run the rules against a sandbox account first, because a misfiring archive rule on a real inbox is hard to undo.

OpenClaw has a --dry-run flag that logs the actions a rule would have taken without performing them. Watch it for an hour or two against live traffic:

openclaw rules run --dry-run --watch

Review the log, adjust thresholds, and only then enable writes. Keep the dry-run output for a few days afterward — most rule mistakes are about edge cases that show up once a week, not once a minute.

Comparison: trigger types and what they cost you

Different trigger types have meaningful tradeoffs in latency, API quota use, and reliability.

Trigger typeLatencyAPI quota useReliable for
Schedule (cron)Up to interval lengthLow — one poll per runDaily summaries, batched triage
Polling (every N min)0 to N minutesMedium — N polls per hourInbox watching, near-realtime rules
Push (webhook)SecondsLow after setupCalendar events, urgent mail
ManualInstantPer callAd-hoc "what is on my plate" queries

Push triggers are the right answer for calendar work, but they require a publicly reachable HTTPS endpoint to receive Google's pub/sub notifications. That requirement is the main reason most first-time setups end up running on a server rather than a laptop.

What to watch out for

The setup steps are the easy part; the surprises come after a week or two of real use.

Token expiry on testing scopes. Already mentioned, but worth restating — it accounts for most "it stopped working overnight" reports.

Quota exhaustion on polling rules. Gmail allows about a billion quota units per day, but a poorly written watcher that calls messages.list every thirty seconds will burn through it on a busy account. Use history-based fetches or push notifications instead.

Time-zone bugs in calendar rules. Google Calendar stores events in the creator's time zone. Conflict-detection rules that assume UTC will produce false positives at DST boundaries.

Reply storms. A rule that auto-replies based on subject-line matches will eventually find a way to reply to itself. Always include a header check that excludes mail you sent.

Process supervision. OpenClaw is a long-lived process. If it crashes at 2am and nobody restarts it, the morning triage rule silently does not fire. systemd, launchd, or a managed host is non-negotiable.

When managed hosting removes most of the friction

Self-hosting works if you already run a Linux server and know your way around systemd; for everyone else, the supervision and webhook requirements add up faster than the original automation work.

Clowdbot runs OpenClaw assistants on always-on infrastructure with the public webhook endpoint handled for you, OAuth refresh tokens stored in a managed secrets store, and crash recovery built in. Your rule files and connector configs are the same as a self-hosted setup — what changes is that you are not also running the operations side of an always-on process at home.

For the broader self-host versus managed tradeoffs, the local vs cloud breakdown and the hosting comparison walk through the cost and reliability differences in detail.

Frequently asked questions

Does the assistant read every email?

No. The connector fetches metadata under the configured scope, and full message bodies are only retrieved when a rule's trigger matches. You can also restrict the Gmail label or query that the watcher operates on, so the rule only sees a slice of the inbox.

Can OpenClaw send replies on my behalf?

Yes, with the gmail.modify or gmail.send scope, but most operators start in draft-only mode where the assistant writes replies and saves them as drafts for human review before the first send-enabled run.

What happens if the OAuth token expires?

The connector marks itself as needs auth and stops firing rules until the token is refreshed. Consent screens in Production mode issue long-lived refresh tokens; consent screens in Testing mode do not, which is the usual cause of overnight failures.

How is this different from a Zapier or Make automation?

Zapier executes a pre-built action on a trigger; OpenClaw runs a model that can decide what action to take based on the email content itself. The cost profile is also different — see the cost breakdown for typical monthly numbers across both approaches.

Will this work with Outlook or iCloud?

Outlook is supported through a separate Microsoft Graph connector with the same rule syntax. iCloud has no documented API for mail; iCloud Calendar works through CalDAV but is not officially supported and tends to break on schema updates.

Email and calendar are the canonical first use cases for a reason — they sit at the center of most knowledge work, and they reward small, reliable automations more than ambitious ones. Start with read-only scopes, dry-run for a day, and add write actions one rule at a time.