Documents

Gmail Lead Desk

Try it

Gmail Lead Desk — standalone sales/CS Gmail skill via the AISA gateway: OAuth connect, scan unread leads, summarize threads, draft template replies (default...

What it does

Gmail Lead Desk — standalone sales/CS Gmail skill via the AISA gateway: OAuth connect, scan unread leads, summarize threads, draft template replies (default draft-only), archive with labels. Keywords: Gmail Lead Desk, Gmail, lead desk, sales, customer support, follow-up, unread, inquiry summary, draft reply, archive, OAuth, AISA, connected account, thread_id. Use when: the user needs this workflow's domain-specific automation or guidance.

The skill document

Gmail Lead Desk (gmail-lead-desk) 📧

Gmail Lead Desk — standalone sales and customer-support Gmail workflows via the AISA gateway.

One skill: connect Gmail, run whitelisted tools, triage inbox, draft replies, archive deals — no other skill required.

Quick start

export AISA_API_KEY="your-key"   # get at https://aisa.one

Pre-flight checks (do first, stop if fails):

  1. AISA_API_KEY is set — if not, ask the user to set it before any API call.
  2. user_id is known — use the Gmail address the user provides. If not yet known, ask: "What Gmail address should I use as your identity?"
  3. Gmail is ACTIVE — run Workflow 0 if connected_account_id is missing or not ACTIVE.
  • Base URL: https://api.aisa.one
  • Auth: Authorization: Bearer $AISA_API_KEY
  • Windows: use curl.exe

OAuth and tools/execute: references/connect_and_execute.md

When to use

  • Connect or reconnect Gmail via OAuth
  • Scan unread leads needing follow-up
  • Summarize inquiry/support threads (CRM format)
  • Draft replies from sales templates (default: do not send)
  • Archive won deals with labels
  • User mentions: unanswered, follow-up, inquiry, quote, draft, archive, lead, connect Gmail

When NOT to use

  • Non-Gmail apps (Slack, GitHub, etc.) — out of scope
  • Proactive new-mail automation — not MVP; see references/workflows.md § Future
  • Bulk permanent delete, filter creation — disabled unless user explicitly requests

Intent → Workflow Quick Reference

User intentWorkflowReference
Connect Gmail / OAuth / authorize0 Connect Gmailreferences/connect_and_execute.md
Unanswered / follow-up / unreadA Unread lead scanreferences/workflows.md § A
Summarize / summary / summarize threadB Thread summaryreferences/workflows.md § B
Reply for me / draft reply / write emailC Draft (no send)references/workflows.md § C
Confirm send / send nowC-send Send after confirmreferences/workflows.md § C-send
Archive / deal closedD Label and archivereferences/workflows.md § D

Run Workflow 0 first if Gmail is not connected (ACTIVE connected_account_id).


Workflow 0 — Connect Gmail (summary)

  1. GET /auth_configs?toolkit_slug=gmailauth_config_id
  2. GET /connected_accounts?toolkit_slugs=gmail&user_ids={user_id} — reuse ACTIVE if present
  3. Else confirm, then POST /connected_accounts/link → user opens redirect_url
  4. Poll every 3–5 s until status is ACTIVE; save connected_account_id
    • Timeout after ~2 min (24 polls): stop polling, tell user "OAuth not completed — please try again or check the browser tab."
    • DISCONNECTED / REVOKED: re-run from step 3.

Full steps: references/connect_and_execute.md


Core Workflows (summary)

A — Unread lead scan

  1. Resolve connected_account_id (Workflow 0).
  2. GMAIL_FETCH_EMAILS with sales default query — see workflows.md.
  3. Table: Sender | Subject | Days waiting | thread_id | Suggested action.
  4. Do not send at end of this workflow.

B — Thread summary (CRM-ready)

  1. GMAIL_FETCH_MESSAGE_BY_THREAD_ID; sort by internalDate.
  2. Fixed sections: customer, need, budget/timeline, next action, attachments (unverified when inferred).

C — Template draft (default: no send)

  1. Load thread (B); confirm recipient, tone, quote/link.
  2. GMAIL_REPLY_TO_THREAD or GMAIL_CREATE_EMAIL_DRAFT; empty subject when thread_id set.
  3. Return draft_id + preview.

C-send — Send only on explicit request

  • User says send / confirm send / send now.
  • Show full To/Cc/subject/body; confirm; then GMAIL_SEND_DRAFT or GMAIL_SEND_EMAIL.

D — Archive and label

  1. GMAIL_LIST_LABELSLabel_* IDs only.
  2. GMAIL_CREATE_LABEL if needed (confirm).
  3. Sample ≤5 messageIds + count → GMAIL_BATCH_MODIFY_MESSAGES.

Never guess tool_slug. Whitelist: references/tool_whitelist.md.


Safety

ActionRule
Default after A/B/CDraft only — no auto-send
OAuth link / create auth configConfirm with user
Create draftConfirm recipient and thread
SendExplicit user request + show To/Cc
Batch label/archive≤5 sample IDs + total count
Batch delete / filtersRefuse in MVP unless explicit cleanup request
PrivacyNo uploading full mailbox externally; attachments need consent
Rate limitsConcurrency ≤10; backoff on 429

Gmail pitfalls: references/gmail_gotchas.md.


Reference routing

NeedFile
API key, OAuth, executereferences/connect_and_execute.md
Sales workflows A–Dreferences/workflows.md
message_id, labels, draftsreferences/gmail_gotchas.md
Allowed tool slugsreferences/tool_whitelist.md

Lookup order: intent → Workflow 0 if needed → workflows.mdtool_whitelist.mdGET /tools/{tool_slug}POST /tools/execute/{tool_slug}.


Troubleshooting

SymptomAction
AISA_API_KEY not setAsk user to run export AISA_API_KEY="..." before any API call
user_id unknownAsk "What Gmail address should I use as your identity?"
No Gmail connectionWorkflow 0 in connect_and_execute.md
OAuth poll timeout (>2 min)Tell user to check browser tab; re-run Workflow 0 step 3
Invalid id valueSee gmail_gotchas.md
Label not appliedUsed display name — GMAIL_LIST_LABELS for id
New thread on replySubject set on draft — leave subject empty
successful: falseconnect_and_execute.md §4 + re-fetch tool schema
Deprecated GMAIL_LIST_MESSAGESUse GMAIL_FETCH_EMAILS

Related skills

Read, search, draft, reply to, and organize Gmail from chat using the Gmail API with OAuth.

by Jay

Privacy-first ecommerce Gmail customer-service skill for OpenClaw. It triages inbox messages, researches public storefront data, creates draft-first replies, learns approved patterns, and auto-replies only in owner-enabled categories. Private data needs an approved least-privilege connector.

2 installs1 stars

Gmail (workspace.google.com). Use this skill for ANY Gmail request — reading, creating, updating, and deleting data. Whenever a task involves Gmail, use this skill instead of calling the API directly.

8 installs

Read, send, and manage Gmail emails, threads, labels, and drafts via managed OAuth.

by byungkyu

summarize, triage, and draft actions for incoming email. use when the user wants chatgpt to check an inbox, identify important unread messages, group emails...

27 installs

Give AI agents Remember Gmail threads. using BlueColumn persistent memory. Use when an agent manages email and needs thread history; when the user wants to store, recall, or search gmail memory context. Requires a BlueColumn API key (bc_live_*).