AI support inbox triage with Gmail drafts and Slack alerts

By General Input

Every 10 minutes, an agent reads new support emails, drafts a reply in your brand voice, and pings Slack when something looks urgent.

Integrations

  • Gmail
  • AI Generation
  • Slack Bot

Type

Agentic Task

Categories

  • Customer Support
  • Operations

I want an agent that watches my shared Gmail support inbox and clears the easy stuff so my team only has to touch the hard or urgent emails. It should run on a cron trigger every 10 minutes.

On each run, the agent should:

1. Use Gmail's List Messages to fetch new unread messages in the support inbox. Use a Gmail search like `in:inbox is:unread newer_than:1h` by default, but expose the search query as a parameter so I can scope it to a label like `Support`. Cap each run at the 20 newest unread messages so a backlog can't blow things up.

2. For each message, call Gmail Get a Message to pull the full body, subject, sender, and thread ID. Decode the body to plain text before sending it to the model.

3. Send the email to AI Generation (chat-completion) with one structured prompt that does all of the following in a single call and returns JSON: (a) classify the email as one of `billing`, `bug`, `how_to`, `sales_handoff`, or `spam`; (b) score the sentiment as `positive`, `neutral`, or `angry`; (c) extract customer context (sender name, sender email, account or plan tier if mentioned, what they are actually asking for, urgency cues); (d) write a first-draft reply in our brand voice that either answers the question or asks the right clarifying follow-up. The brand voice description, the signature, the never-promise list, and the reply length cap should all be workflow parameters so we can tune them without editing code.

4. If the classification is `spam`, skip it entirely. Do not create a draft and do not alert Slack. Optionally archive the message.

5. For everything else, use Gmail Create a Draft to attach the AI's reply as a draft on the original thread (set the In-Reply-To and References headers and the threadId so it threads correctly). A human will open Gmail and hit send. Never auto-send.

6. If the message is classified as `bug` OR sentiment is `angry` OR the body matches a configurable escalation keyword list (defaults: cancel, refund, churn, lawyer, chargeback), also call Slack Bot Send a Message to post an alert in our triage channel. The Slack message should include the customer's name and email, the subject line, the classification, the sentiment, a one-line summary of the issue, and a direct link to the Gmail thread so the on-call teammate can jump straight to the draft. The triage channel ID is a workflow parameter.

7. After drafting (and alerting if applicable), tag the original message with an internal Gmail label like `AI-Drafted` so the next run's search filter excludes it. The label name should be parameterized and the agent should create the label on first run if it does not exist.

Configurable inputs to expose at the top of the workflow:

- Gmail search query or label that defines the support inbox - Brand voice description, signature, reply length cap, and never-promise list - Max messages processed per run (default 20) - Slack triage channel ID - Escalation rules: which classifications trigger Slack, which sentiments trigger Slack, and the escalation keyword list - Internal label name used to mark processed messages

Guardrails: never auto-send a reply, never delete or modify the customer's original message (only label and draft), and if the model is uncertain about classification or context the agent should still create a draft but flag uncertainty in the Slack alert so a human knows to look closely.

Related prompts

Explore more prompts
Win back LiveChat visitors whose chats went unansweredA brand asset library your marketing team actually searchesTurn Mailjet email clicks into ranked HubSpot follow-upsClean out the Looker dashboards and Looks nobody opensLiveKit live operations console for room moderationWake up dormant Keap leads with a researched reasonLiveChat coverage board for planning next week's shiftsPhone routing control panel for LiveKit voice agentsLinkedIn Ads budget pacing dashboard for every client accountGive your team Looker numbers without buying more seats