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.
bash
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 § FutureUser intentWorkflowReferenceConnect Gmail / OAuth / authorize0 Connect Gmailreferences/connect_and_execute.mdUnanswered / follow-up / unreadA Unread lead scanreferences/workflows.md § ASummarize / summary / summarize threadB Thread summaryreferences/workflows.md § BReply for me / draft reply / write emailC Draft (no send)references/workflows.md § CConfirm send / send nowC-send Send after confirmreferences/workflows.md § C-sendArchive / deal closedD Label and archivereferences/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.
ActionRuleDefault after A/B/CDraft only — no auto-sendOAuth link / create auth configConfirm with userCreate draftConfirm recipient and threadSendExplicit user request + show To/CcBatch label/archive≤5 sample IDs + total countBatch delete / filtersRefuse in MVP unless explicit cleanup requestPrivacyNo uploading full mailbox externally; attachments need consentRate limitsConcurrency ≤10; backoff on 429
Gmail pitfalls: references/gmail_gotchas.md.
NeedFileAPI key, OAuth, executereferences/connect_and_execute.mdSales workflows A–Dreferences/workflows.mdmessage_id, labels, draftsreferences/gmail_gotchas.mdAllowed tool slugsreferences/tool_whitelist.md
Lookup order: intent → Workflow 0 if needed → workflows.md → tool_whitelist.md → GET /tools/{tool_slug} → POST /tools/execute/{tool_slug}.
SymptomActionAISA_API_KEY not setAsk user to run export AISA_API_KEY="..." before any API calluser_id unknownAsk "What Gmail address should I use as your identity?"No Gmail connectionWorkflow 0 in connect_and_execute.mdOAuth poll timeout (>2 min)Tell user to check browser tab; re-run Workflow 0 step 3Invalid id valueSee gmail_gotchas.mdLabel not appliedUsed display name — GMAIL_LIST_LABELS for idNew thread on replySubject set on draft — leave subject emptysuccessful: false``connect_and_execute.md §4 + re-fetch tool schemaDeprecated GMAIL_LIST_MESSAGESUse GMAIL_FETCH_EMAILS