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):
AISA_API_KEY is set — if not, ask the user to set it before any API call.
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?"
- 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 intent |
Workflow |
Reference |
| Connect Gmail / OAuth / authorize |
0 Connect Gmail |
references/connect_and_execute.md |
| Unanswered / follow-up / unread |
A Unread lead scan |
references/workflows.md § A |
| Summarize / summary / summarize thread |
B Thread summary |
references/workflows.md § B |
| Reply for me / draft reply / write email |
C Draft (no send) |
references/workflows.md § C |
| Confirm send / send now |
C-send Send after confirm |
references/workflows.md § C-send |
| Archive / deal closed |
D Label and archive |
references/workflows.md § D |
Run Workflow 0 first if Gmail is not connected (ACTIVE connected_account_id).
Workflow 0 — Connect Gmail (summary)
GET /auth_configs?toolkit_slug=gmail → auth_config_id
GET /connected_accounts?toolkit_slugs=gmail&user_ids={user_id} — reuse ACTIVE if present
- Else confirm, then
POST /connected_accounts/link → user opens redirect_url
- 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
- Resolve
connected_account_id (Workflow 0).
GMAIL_FETCH_EMAILS with sales default query — see workflows.md.
- Table: Sender | Subject | Days waiting | thread_id | Suggested action.
- Do not send at end of this workflow.
B — Thread summary (CRM-ready)
GMAIL_FETCH_MESSAGE_BY_THREAD_ID; sort by internalDate.
- Fixed sections: customer, need, budget/timeline, next action, attachments (unverified when inferred).
C — Template draft (default: no send)
- Load thread (B); confirm recipient, tone, quote/link.
GMAIL_REPLY_TO_THREAD or GMAIL_CREATE_EMAIL_DRAFT; empty subject when thread_id set.
- 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
GMAIL_LIST_LABELS → Label_* IDs only.
GMAIL_CREATE_LABEL if needed (confirm).
- Sample ≤5
messageIds + count → GMAIL_BATCH_MODIFY_MESSAGES.
Never guess tool_slug. Whitelist: references/tool_whitelist.md.
Safety
| Action |
Rule |
| Default after A/B/C |
Draft only — no auto-send |
| OAuth link / create auth config |
Confirm with user |
| Create draft |
Confirm recipient and thread |
| Send |
Explicit user request + show To/Cc |
| Batch label/archive |
≤5 sample IDs + total count |
| Batch delete / filters |
Refuse in MVP unless explicit cleanup request |
| Privacy |
No uploading full mailbox externally; attachments need consent |
| Rate limits |
Concurrency ≤10; backoff on 429 |
Gmail pitfalls: references/gmail_gotchas.md.
Reference routing
| Need |
File |
| API key, OAuth, execute |
references/connect_and_execute.md |
| Sales workflows A–D |
references/workflows.md |
| message_id, labels, drafts |
references/gmail_gotchas.md |
| Allowed tool slugs |
references/tool_whitelist.md |
Lookup order: intent → Workflow 0 if needed → workflows.md → tool_whitelist.md → GET /tools/{tool_slug} → POST /tools/execute/{tool_slug}.
Troubleshooting
| Symptom |
Action |
AISA_API_KEY not set |
Ask user to run export AISA_API_KEY="..." before any API call |
user_id unknown |
Ask "What Gmail address should I use as your identity?" |
| No Gmail connection |
Workflow 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 value |
See gmail_gotchas.md |
| Label not applied |
Used display name — GMAIL_LIST_LABELS for id |
| New thread on reply |
Subject set on draft — leave subject empty |
successful: false |
connect_and_execute.md §4 + re-fetch tool schema |
Deprecated GMAIL_LIST_MESSAGES |
Use GMAIL_FETCH_EMAILS |
1---2name: gmail-lead-desk-43description: '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.'4license: MIT5compatibility: Designed for Agent Skills compatible clients such as OpenClaw, Claude Code, Hermes, and GitHub-backed skill catalogs. Requires system binaries curl, environment variables AISA_API_KEY and internet access to api.aisa.one.6metadata:7 source: https://skillmd.com/skills/baofeng-tech/gmail-lead-desk-48 author: AIsa9 version: 1.0.010 homepage: https://aisa.one11 repository: https://github.com/baofeng-tech/agent-skills-so12 tags: aisa13 platforms: agentskills.io,agentskills.so,github14 primary_env: AISA_API_KEY15allowed-tools: Read16---1718# Gmail Lead Desk (`gmail-lead-desk`) 📧1920**Gmail Lead Desk** — standalone sales and customer-support Gmail workflows via the AISA gateway.2122One skill: connect Gmail, run whitelisted tools, triage inbox, draft replies, archive deals — no other skill required.2324## Quick start2526```bash27export AISA_API_KEY="your-key" # get at https://aisa.one28```2930> **Pre-flight checks (do first, stop if fails):**31> 1. `AISA_API_KEY` is set — if not, ask the user to set it before any API call.32> 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?"33> 3. Gmail is `ACTIVE` — run Workflow 0 if `connected_account_id` is missing or not `ACTIVE`.3435- **Base URL:** `https://api.aisa.one`36- **Auth:** `Authorization: Bearer $AISA_API_KEY`37- **Windows:** use `curl.exe`3839OAuth and `tools/execute`: [`references/connect_and_execute.md`](./references/connect_and_execute.md)4041## When to use4243- Connect or reconnect **Gmail** via OAuth44- Scan **unread leads** needing follow-up45- **Summarize** inquiry/support threads (CRM format)46- **Draft** replies from sales templates (default: do not send)47- **Archive** won deals with labels48- User mentions: unanswered, follow-up, inquiry, quote, draft, archive, lead, connect Gmail4950## When NOT to use5152- Non-Gmail apps (Slack, GitHub, etc.) — out of scope53- Proactive new-mail automation — not MVP; see `references/workflows.md` § Future54- Bulk permanent delete, filter creation — disabled unless user explicitly requests5556## Intent → Workflow Quick Reference5758| User intent | Workflow | Reference |59|-------------|----------|-----------|60| Connect Gmail / OAuth / authorize | **0** Connect Gmail | `references/connect_and_execute.md` |61| Unanswered / follow-up / unread | **A** Unread lead scan | `references/workflows.md` § A |62| Summarize / summary / summarize thread | **B** Thread summary | `references/workflows.md` § B |63| Reply for me / draft reply / write email | **C** Draft (no send) | `references/workflows.md` § C |64| Confirm send / send now | **C-send** Send after confirm | `references/workflows.md` § C-send |65| Archive / deal closed | **D** Label and archive | `references/workflows.md` § D |6667> Run **Workflow 0** first if Gmail is not connected (`ACTIVE` `connected_account_id`).6869---7071## Workflow 0 — Connect Gmail (summary)72731. `GET /auth_configs?toolkit_slug=gmail` → `auth_config_id`742. `GET /connected_accounts?toolkit_slugs=gmail&user_ids={user_id}` — reuse `ACTIVE` if present753. Else **confirm**, then `POST /connected_accounts/link` → user opens `redirect_url`764. Poll every 3–5 s until `status` is `ACTIVE`; save `connected_account_id`77 - **Timeout after ~2 min (24 polls):** stop polling, tell user "OAuth not completed — please try again or check the browser tab."78 - `DISCONNECTED` / `REVOKED`: re-run from step 3.7980Full steps: [`references/connect_and_execute.md`](./references/connect_and_execute.md)8182---8384## Core Workflows (summary)8586### A — Unread lead scan87881. Resolve `connected_account_id` (Workflow 0).892. `GMAIL_FETCH_EMAILS` with sales default query — see `workflows.md`.903. Table: **Sender | Subject | Days waiting | thread_id | Suggested action**.914. **Do not send** at end of this workflow.9293### B — Thread summary (CRM-ready)94951. `GMAIL_FETCH_MESSAGE_BY_THREAD_ID`; sort by `internalDate`.962. Fixed sections: customer, need, budget/timeline, next action, attachments (**unverified** when inferred).9798### C — Template draft (default: no send)991001. Load thread (B); confirm recipient, tone, quote/link.1012. `GMAIL_REPLY_TO_THREAD` or `GMAIL_CREATE_EMAIL_DRAFT`; **empty subject** when `thread_id` set.1023. Return `draft_id` + preview.103104### C-send — Send only on explicit request105106- User says **send / confirm send / send now**.107- Show full To/Cc/subject/body; confirm; then `GMAIL_SEND_DRAFT` or `GMAIL_SEND_EMAIL`.108109### D — Archive and label1101111. `GMAIL_LIST_LABELS` → `Label_*` IDs only.1122. `GMAIL_CREATE_LABEL` if needed (confirm).1133. Sample ≤5 `messageIds` + count → `GMAIL_BATCH_MODIFY_MESSAGES`.114115**Never guess `tool_slug`.** Whitelist: [`references/tool_whitelist.md`](./references/tool_whitelist.md).116117---118119## Safety120121| Action | Rule |122|--------|------|123| Default after A/B/C | **Draft only** — no auto-send |124| OAuth link / create auth config | Confirm with user |125| Create draft | Confirm recipient and thread |126| Send | Explicit user request + show To/Cc |127| Batch label/archive | ≤5 sample IDs + total count |128| Batch delete / filters | **Refuse** in MVP unless explicit cleanup request |129| Privacy | No uploading full mailbox externally; attachments need consent |130| Rate limits | Concurrency ≤10; backoff on 429 |131132Gmail pitfalls: [`references/gmail_gotchas.md`](./references/gmail_gotchas.md).133134---135136## Reference routing137138| Need | File |139|------|------|140| API key, OAuth, execute | `references/connect_and_execute.md` |141| Sales workflows A–D | `references/workflows.md` |142| message_id, labels, drafts | `references/gmail_gotchas.md` |143| Allowed tool slugs | `references/tool_whitelist.md` |144145**Lookup order:** intent → Workflow 0 if needed → `workflows.md` → `tool_whitelist.md` → `GET /tools/{tool_slug}` → `POST /tools/execute/{tool_slug}`.146147---148149## Troubleshooting150151| Symptom | Action |152|---------|--------|153| `AISA_API_KEY` not set | Ask user to run `export AISA_API_KEY="..."` before any API call |154| `user_id` unknown | Ask "What Gmail address should I use as your identity?" |155| No Gmail connection | Workflow 0 in `connect_and_execute.md` |156| OAuth poll timeout (>2 min) | Tell user to check browser tab; re-run Workflow 0 step 3 |157| `Invalid id value` | See `gmail_gotchas.md` |158| Label not applied | Used display name — `GMAIL_LIST_LABELS` for `id` |159| New thread on reply | Subject set on draft — leave subject empty |160| `successful: false` | `connect_and_execute.md` §4 + re-fetch tool schema |161| Deprecated `GMAIL_LIST_MESSAGES` | Use `GMAIL_FETCH_EMAILS` |