Install
openclaw skills install gmail-lead-deskGmail 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.
openclaw skills install gmail-lead-deskgmail-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.
export AISA_API_KEY="your-key" # get at https://aisa.one
Pre-flight checks (do first, stop if fails):
AISA_API_KEYis set — if not, ask the user to set it before any API call.user_idis 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 ifconnected_account_idis missing or notACTIVE.
https://api.aisa.oneAuthorization: Bearer $AISA_API_KEYcurl.exeOAuth and tools/execute: references/connect_and_execute.md
references/workflows.md § Future| 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 (
ACTIVEconnected_account_id).
GET /auth_configs?toolkit_slug=gmail → auth_config_idGET /connected_accounts?toolkit_slugs=gmail&user_ids={user_id} — reuse ACTIVE if presentPOST /connected_accounts/link → user opens redirect_urlstatus is ACTIVE; save connected_account_id
DISCONNECTED / REVOKED: re-run from step 3.Full steps: references/connect_and_execute.md
connected_account_id (Workflow 0).GMAIL_FETCH_EMAILS with sales default query — see workflows.md.GMAIL_FETCH_MESSAGE_BY_THREAD_ID; sort by internalDate.GMAIL_REPLY_TO_THREAD or GMAIL_CREATE_EMAIL_DRAFT; empty subject when thread_id set.draft_id + preview.GMAIL_SEND_DRAFT or GMAIL_SEND_EMAIL.GMAIL_LIST_LABELS → Label_* IDs only.GMAIL_CREATE_LABEL if needed (confirm).messageIds + count → GMAIL_BATCH_MODIFY_MESSAGES.Never guess tool_slug. Whitelist: references/tool_whitelist.md.
| 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.
| 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}.
| 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 |