Groq-powered Gmail triage with HubSpot tickets and Slack alerts

Every 15 minutes, Groq reads new Gmail messages, tags intent and urgency, opens HubSpot tickets for support, and pings Slack about hot sales leads.

Agentic Task
GroqGmailHubSpotSlackOperationsSalesEmail AutomationNotifications & Alerts
PromptCreate

Every 15 minutes, run a fast Gmail triage pass. The whole point is speed: Groq classifies each email in a fraction of a second so the loop can keep up with a live inbox and nothing waits around.

Trigger: cron, every 15 minutes.

Step 1 — pull new mail. Use Gmail's List Messages with the query "in:inbox is:unread newer_than:20m". The 20-minute window is intentionally wider than the 15-minute cadence so a message never falls through the crack between runs.

Step 2 — dedupe. Before doing any work on a message, check the Gmail message ID against the list of IDs already handled by previous runs and skip anything already seen. After you finish handling a message, record its ID so the next run won't touch it again. This rule is non-negotiable — the same email must never be processed twice.

Step 3 — classify with Groq. For each new message, call Groq's Create Chat Completion using llama-3.3-70b. Ask the model to return, in a single structured response: (a) intent, one of support, sales, vendor, internal, or spam; (b) urgency, one of low, medium, or high; and (c) a two-sentence draft reply when a quick response is appropriate, or an empty string when it isn't. Keep the prompt tight so the round trip stays snappy — this loop should feel instant.

Step 4 — route based on the classification.

If intent is "support": create a HubSpot ticket via Create Ticket. Use the Gmail subject as the ticket subject, and put a short summary of the email body plus the sender's address into the description. Set a sensible default pipeline stage.

If intent is "sales" AND urgency is "high": post a Slack alert via Send a Message to the sales channel. Tag the account owner (configurable — default to a channel-wide mention if no owner is set), include the sender, a one-line summary of what they want, and paste the AI-drafted two-sentence reply as a suggested response the human can copy, edit, and send.

For vendor, internal, spam, and lower-urgency sales messages, do nothing beyond recording the message ID as handled.

Latency matters throughout: prefer parallel classification for the batch of new messages, keep the Groq prompt short, and avoid extra tool calls when the classification is already enough to decide the route. If the batch is empty, exit quietly without any downstream calls.

Additional information

What does this prompt do?
  • Checks Gmail every 15 minutes for new unread messages so nothing sits in the inbox.
  • Uses a fast Groq model to classify each email by intent (support, sales, vendor, internal, spam) and score urgency as low, medium, or high.
  • Drafts a two-sentence reply for the messages where a quick response makes sense.
  • Opens a HubSpot support ticket automatically for support emails, with the subject and a short summary of the request.
  • Pings Slack with the suggested reply and a mention of the account owner whenever a high-urgency sales email lands.
  • Remembers which messages it has already handled so the same email is never processed twice.
What do I need to use this?
  • A Gmail inbox connected to Geni
  • A HubSpot account where the agent can create tickets
  • A Slack workspace so the agent can post alerts
  • A Groq account for the fast classification model
How can I customize it?
  • Change how often the triage runs (every 5, 10, 15, or 30 minutes).
  • Adjust the list of intent categories or the urgency thresholds to match how your team thinks about the inbox.
  • Route Slack alerts to a different channel and tag whichever account owner should see hot sales leads.
  • Send extra categories like billing or partnerships to their own destinations instead of just support and sales.

Frequently asked questions

Why use Groq for this instead of a bigger model?
Speed. Inbox triage runs many times an hour, and Groq classifies each email in a fraction of a second so the workflow keeps pace with a live inbox instead of falling behind.
Will this send replies to customers automatically?
No. The agent drafts a suggested two-sentence reply and includes it in the Slack alert so a human can review and send it. Nothing leaves the inbox without you.
What stops the same email from being processed twice?
The agent tracks every Gmail message ID it has already handled and skips anything it has seen before, even if the same message shows up on a later run.
Can I use this on a shared team inbox?
Yes. Connect whichever Gmail account receives the messages you want triaged, whether it is a personal inbox or a shared support address.
Does this work with the free tier of HubSpot?
Yes, as long as your HubSpot account has the tickets object available. The agent uses the standard ticket creation flow that works on both free and paid plans.

Stop letting hot emails sit in the inbox.

Classify, ticket, and alert the team within minutes of every new message so nothing important slips past the noise.