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.
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.
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 (ACTIVE connected_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_idDISCONNECTED / 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 |
共 2 个版本