AI support inbox triage with Gmail drafts and Slack alerts
Every 10 minutes, an agent reads new support emails, drafts a reply in your brand voice, and pings Slack when something looks urgent.
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.
Additional information
What does this prompt do?
- Polls your shared Gmail support inbox every 10 minutes and processes every new unread email.
- Classifies each message into billing, bug, how-to, sales handoff, or spam, reads the sentiment, and pulls the customer context out of the body.
- Writes a first-draft reply in your brand voice and saves it as a draft on the original Gmail thread, so a teammate just opens Gmail and hits send.
- Pings a Slack triage channel the moment a bug, an angry customer, or a churn-risk keyword lands, with a direct link to the draft so someone picks it up fast.
What do I need to use this?
- A Google account that can read and draft email in your shared support inbox.
- A Slack workspace with a channel you want the escalation alerts to land in.
- A short description of your brand voice and the reply rules you want the agent to follow.
How can I customize it?
- Change the polling cadence from every 10 minutes to whatever your team can actually react to.
- Tune the brand voice, signature, and never-promise list so drafts sound like your team wrote them.
- Decide what gets escalated to Slack: only bugs, only angry customers, or any message that mentions cancel, refund, or churn.
- Swap the Gmail label or search filter that defines what counts as the support inbox.
Frequently asked questions
Will this send emails automatically?
What if the agent misclassifies an email?
Does it work with a shared Google Group or only a regular inbox?
Can I change which Slack channel gets the alerts?
What stops it from drafting the same email twice?
Stop manually sorting your support inbox.
Connect Gmail and Slack once, and Geni handles classification, drafts, and escalation every 10 minutes.