gmail-lead-desk
Skill0 starsChanged 7 months agoMITView on GitHub
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.
- Reads credentials
In this repository59 other files it gives its agents.
- aisa-multi-search-engineSkill
- aisa-providerSkill
- aisa-tavilySkill
- aisa-twitter-apiSkill
- aisa-twitter-command-centerSkill
- aisa-twitter-engagement-suiteSkill
- aisa-twitter-post-engageSkill
- aisa-youtube-searchSkill
- aisa-youtube-serp-scoutSkill
- cn-llmSkill
- crypto-market-dataSkill
- kol-creator-discoverySkill
- last30daysSkill
- last30days-zhSkill
- llm-routerSkill
- marketpulseSkill
- marketSkill
- media-genSkill
- multi-searchSkill
- multi-source-searchSkill
- notion-workspaceSkill
- openclaw-aisa-youtube-aisaSkill
- openclaw-media-genSkill
- openclaw-searchSkill
- openclaw-twitter-post-engageSkill
- openclaw-twitterSkill
- openclaw-youtubeSkill
- perplexity-researchSkill
- perplexity-searchSkill
- prediction-market-arbitrage-apiSkill
- prediction-market-arbitrageSkill
- prediction-market-arbitrage-zhSkill
- prediction-market-dataSkill
- prediction-market-data-zhSkill
- prediction-marketSkill
- saas-gatewaySkill
- scholar-searchSkill
- searchSkill
- seo-keyword-researchSkill
- smart-searchSkill
- stock-analysisSkill
- stock-dividendSkill
- stock-hotSkill
- stock-portfolioSkill
- stock-rumorsSkill
- stock-watchlistSkill
- tavily-extractSkill
- tavily-searchSkill
- trend-forecastSkill
- twitter-autopilotSkill
- twitter-command-center-search-post-interactSkill
- twitter-command-center-search-postSkill
- twitterSkill
- us-stock-analystSkill
- web-searchSkill
- x-intelligence-automationSkill
- youtube-searchSkill
- youtube-serpSkill
- youtubeSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 76
Timeout after ~2 min (24 polls): stop polling, tell user "OAuth not completed — please try again or check the browser tab."
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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.onePre-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.
- 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 (
ACTIVEconnected_account_id).
Workflow 0 — Connect Gmail (summary)
GET /auth_configs?toolkit_slug=gmail→auth_config_idGET /connected_accounts?toolkit_slugs=gmail&user_ids={user_id}— reuseACTIVEif present- Else confirm, then
POST /connected_accounts/link→ user opensredirect_url - Poll every 3–5 s until
statusisACTIVE; saveconnected_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_EMAILSwith sales default query — seeworkflows.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 byinternalDate.- 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_THREADorGMAIL_CREATE_EMAIL_DRAFT; empty subject whenthread_idset.- 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_DRAFTorGMAIL_SEND_EMAIL.
D — Archive and label
GMAIL_LIST_LABELS→Label_*IDs only.GMAIL_CREATE_LABELif 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 |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

