Coding

TinkerClaw Outlook

Try it

Read and search Outlook, inspect attachments, and create or edit drafts without any send endpoint. Uses one short-lived Microsoft Graph access token supplied on stdin for one run; it never stores credentials. Bulk mailbox export is opt-in.

What it does

**Your AI agent won't email the CEO at 3am.**

The skill document

Outlook Hack

Your AI agent won't email the CEO at 3am.

Not because there's a setting. Not because there's a policy. Because the code physically cannot send emails. We removed that capability the way you'd remove a chainsaw from a toddler — completely and without negotiation.

What It Does

  • 📧 Read, search, and bulk-fetch emails across all folders
  • 📎 Index all attachments (name, type, size) per message
  • 📊 Generate digest summaries with top senders, unread counts, full body text
  • ✏️ Create email drafts (lands in Drafts folder — never sends)
  • 📅 Access calendar events, 👥 Browse contacts

Quick Start

1. Token Extraction (one-time, ~30 seconds)

Extract from the Teams tab, NOT Outlook. Classic Outlook no longer exists in most orgs, and new Outlook uses PoP tokens that can't be extracted. The Teams tab provides an MSAL refresh token (90-day, auto-rotating) that powers both this skill and the teams-hack skill.

Open Microsoft Teams (teams.cloud.microsoft) in Chrome with the OpenClaw browser relay attached. Then run this in-browser evaluation:

(() => {
  const keys = Object.keys(localStorage).filter(
    (k) => k.includes("refreshtoken") || k.includes("RefreshToken"),
  );
  const parsed = JSON.parse(localStorage.getItem(keys[0]));
  const accountKeys = Object.keys(localStorage).filter((k) => {
    try {
      return JSON.parse(localStorage.getItem(k)).tenantId;
    } catch {
      return false;
    }
  });
  let tenantId = null;
  for (const k of accountKeys) {
    try {
      tenantId = JSON.parse(localStorage.getItem(k)).tenantId;
      break;
    } catch {}
  }
  return { secret: parsed.secret, tenantId };
})();

Save the token via the teams CLI (NOT the outlook-mail-fetch script):

teams token store --refresh-token "" --tenant-id ""

2. Verify Access

node {baseDir}/scripts/outlook-mail-fetch.mjs --test

3. Bulk Fetch

# Last 6 months (default)
node {baseDir}/scripts/outlook-mail-fetch.mjs --fetch-all

# Custom range
node {baseDir}/scripts/outlook-mail-fetch.mjs --fetch-all --months 12

Output: ~/.openclaw/workspace/data/outlook-emails/

  • raw-emails.jsonl — full email data (subject, from, to, body text, preview)
  • attachments-index.jsonl — every attachment per message
  • email-summary.md — readable digest with stats and per-email summaries

Critical: Teams is the Token Source

SourceToken TypeExtractable?Lifetime
Teams (teams.cloud.microsoft)MSAL refresh token✅ Yes90 days, auto-rotates
New Outlook (outlook.cloud.microsoft)PoP token (Proof-of-Possession)❌ NoCrypto-bound to browser
Classic Outlook (outlook.office.com)Bearer access token⚠️ Deprecated/goneMost orgs migrated

Always extract from the Teams tab. New Outlook uses Proof-of-Possession tokens that cannot be extracted or replayed. Classic Outlook is deprecated and no longer available in most orgs.

How It Works (Technical)

  1. Share your Microsoft Teams tab with OpenClaw via the Browser Relay
  2. The agent reads localStorage to extract the MSAL refresh token
  3. Token is stored and exchanged for a Graph API access token via teams token store
  4. Both this skill and teams-hack share ~/.openclaw/credentials/outlook-msal.json (0600)
  5. The outlook-mail-fetch.mjs script uses the Graph API access token for mail operations
  6. Refresh token lasts 90 days and auto-rotates on each use

The skill is NOT scraping the page. It speaks Outlook's own REST API, authenticated through your existing browser session.

Token Lifetime & Refresh

  • Refresh token: 90 days, auto-rotates on each use (shared with teams-hack)
  • Access token: ~1 hour, automatically refreshed by the scripts
  • Any cron job using either skill keeps the refresh token alive
  • When expired: re-extract from Teams tab (one browser relay session)

Architecture Notes

  • Zero external dependencies — pure Node.js (v18+), no npm packages
  • Send-blocked — the script has no send/reply/forward functions. They don't exist.
  • Rate-limited — fetches 50 emails per page with automatic pagination
  • Body text cleaned — HTML stripped, whitespace normalized, truncated to 3000 chars per email

The Full Stack

Pair with whatsapp-ultimate for messaging and jarvis-voice for voice.

👉 Clone it. Fork it. Break it. Make it yours.

Related skills

Generate and edit Draw.io, Mermaid, and Excalidraw diagrams from natural language using a structured JSON spec.

by nssa.io1.0k installs47 stars

Query Twitter/X profiles, tweets, follower events, and KOL data through the 6551 REST API.

by infra403840 installs27 stars

Read and write Excel workbooks, worksheets, ranges, tables, and charts in OneDrive through Microsoft Graph with managed OAuth.

by byungkyu800 installs42 stars

Post videos, photos, text, and documents to 10 social platforms through a single REST API call.

by victorcavero14375 installs50 stars

Stores durable facts in a categorized, plain-markdown vault on disk, alongside your agent's built-in memory.

by Iván555 installs18 stars

Trade crypto, manage a multi-chain wallet, and query an AI analyst from one CLI.

by lowesyang162 installs109 stars

More from globalcaos

Browse all skills

Give your OpenClaw agent a JARVIS-style British voice with matching dry humor, audio plus a purple chat bubble in one call.

by globalcaos190 installs4 stars

Native WhatsApp channel for OpenClaw with 22 messaging/group actions plus Protocol v2 multi-agent coordination.

by globalcaos116 installs3 stars

One dashboard tracking Anthropic, Gemini, OpenAI, and Manus token usage with budget alerts and a local REST API.

by globalcaos59 installs

Stop sending 'format this JSON' to Opus. Stop sending 'cron job' to GPT. Billing-aware routing guide for choosing among the models already configured in your OpenClaw setup when assigning an agent, sub-agent or cron task — flat-rate first, metered only when justified, budget pressure respected. Not for picking models outside your configuration, and not a runtime proxy.

by globalcaos16 installs

Your agent says 'done' — but did it check? Superpowers turns any OpenClaw agent into a disciplined engineer. Verification iron law (evidence before claims), three-agent code review (build → verify spec → verify quality), systematic debugging (4-phase root cause, three-strike rule), brainstorming gates (design before code), and anti-over-engineering rules. Use when: (1) coding tasks of any complexity, (2) debugging failures, (3) about to claim work is complete, (4) spawning sub-agents, (5) planning features, (6) reviewing code. Inspired by top coding agent methodologies, adapted for OpenClaw multi-agent architecture.

by globalcaos14 installs

12 humor patterns for AI agents based on embedding space bisociation theory. Operational reference for generating contextually appropriate humor during conve...

by globalcaos26 installs