Route Gmail to Slack with Make.com and OpenAI, including moderation, rate-limit handling, and audit logging for reliable support and sales triage.
Introduction
You handle high volumes of inbound email and you need the right messages in the right Slack channel without a human triage step. Manually scanning, labelling, and forwarding email wastes time and risks slow responses for sales and support. This automation uses Gmail, Make.com, OpenAI, and Slack to classify inbound messages as support, sales, or spam, run moderation checks, and post the result to the appropriate Slack channel with an audit row in Google Sheets.
By the end you will have a production-ready Make.com scenario that includes deterministic prompts, moderation guardrails, retry handling for OpenAI rate limits, and a simple audit trail.
What You'll Need
- Gmail account with API access (Google account with OAuth allowed for Make.com). A Gmail label for inbound filtering is recommended.
- Make.com account (paid plan recommended for advanced modules, webhooks, and higher execution limits).
- OpenAI API key with access to moderation and classification endpoints. Choose a paid tier appropriate for expected TPM/RPM.
- Slack workspace with channels for sales, support, and moderation issues, plus a bot token usable from Make.com.
- Google Sheets for audit logging (or Airtable if preferred).
- Basic permissions: create Make.com scenarios, connect Gmail/Slack/Google Sheets, and call external HTTP/OpenAI endpoints.
How It Works (The Logic)
When a new Gmail message matching your inbound label appears, Make.com pulls the message, runs content through OpenAI Moderation, then runs a structured classification prompt against OpenAI. A Router in Make.com sends the message to #support-tickets, #sales-inbound, or #spam-quarantine depending on intent and confidence. Each result is logged to Google Sheets. If OpenAI moderation flags the content, route to a private moderation Slack channel and skip public posting.
Step-by-Step Setup
- Prepare Slack and Gmail
- Create Slack channels: #support-tickets, #sales-inbound, #spam-quarantine, #moderation-issues.
- In Gmail, create a label such as "inbound-ai" and ensure messages you want processed are labelled or can be filtered into that label.
- Create a new Scenario in Make.com and add the Gmail trigger
- Module: Gmail, trigger "Watch Emails".
- Set the label filter to the Gmail label "inbound-ai" and set "Only unread" if you want single-pass processing.
- Map the fields you will need downstream: message id, subject, from, date, and a trimmed body snippet (first 1,200 characters).
- Add an optional pre-filter step
- Module: Tools > Filter or Make filter after Gmail module.
- Use it to ignore known domains (newsletters, internal systems) or messages with specific headers to reduce API calls and costs.
- Moderation step with OpenAI
- Module: OpenAI (or HTTP) call to Moderation endpoint.
- Input: pass subject + trimmed body.
- Evaluation: if moderation returns flagged = true or categories above threshold, route to the moderation branch.
- Moderation branch actions: Slack post to #moderation-issues with the email metadata and store a row in Google Sheets marking "moderation_flagged=true". Do not proceed to public channels.
- Classification step with OpenAI
- Module: OpenAI (Chat Completion or Text Generation) or HTTP call to your chosen classification model.
- Prompt structure (send only required fields):
- System instruction: Define taxonomy: support, sales, spam.
- User content: "Subject: {{subject}}\nFrom: {{from}}\nBody: {{body_trimmed}}"
- Task: "Return JSON only: {"intent":<support|sales|spam>,"confidence":<0-1>,"rationale":}".
- Keep body_trimmed to first 1,000–1,500 chars to control token use.
- Add a parsing step (JSON parse) in Make to extract intent and confidence.
- Router and routing rules
- Module: Router.
- Branch 1 filter: intent == "support" and confidence >= 0.55 -> Slack "Post message" to #support-tickets.
- Branch 2 filter: intent == "sales" and confidence >= 0.55 -> Slack "Post message" to #sales-inbound.
- Branch 3 fallback: intent == "spam" or confidence < 0.55 -> Slack "Post message" to #spam-quarantine with note "low confidence, please review".
- Each Slack message should include: subject, sender, received time, confidence, and a short snippet. Use Slack message formatting fields in Make.
- Audit log to Google Sheets
- Module: Google Sheets, action "Add a row".
- Map fields: email_id, subject, from, received_at, moderation_flagged (true/false), intent, confidence, slack_channel, classification_prompt_version, make_scenario_run_id, timestamp.
- Storing prompt_version helps audit model drift and makes debugging easier.
- Rate-limit and error handling
- Wrap the OpenAI calls in a Make iterator or webhook-based queue if you expect bursts.
- Implement retry on 429s: exponential backoff with jitter (1s, 2s, 4s), limit to 3 attempts, then flag to ops channel and save to a retry sheet.
- If classification fails or returns malformed JSON, route the message to #spam-quarantine with a label "classification_failed" and log the raw response.
- Post-processing in Gmail
- Optional: After successful routing, mark the Gmail message as read and add a label such as "processed-ai". Use Gmail module action "Modify message".
Common gotchas
- Prompt returns not-strict-JSON. Enforce JSON-only in the instruction and add a small cleanup step that extracts the first JSON object from text.
- Token cost spikes. Trim the body and only include necessary fields. Monitor usage and adjust model or prompt length.
- Permissions. Slack bot needs permission to post to channels, Google OAuth must allow Make to write sheets, and Gmail needs access to modify labels.
Real-World Business Scenario
A SaaS support team receives 400 inbound emails daily. After deploying this automation, they reduced manual triage time by 6 hours per week. Support email with order numbers and clear troubleshooting language went to #support-tickets; sales outreach landed in #sales-inbound; low-confidence or likely spam went into #spam-quarantine for a human reviewer. The Google Sheets audit allowed the ops team to measure classification confidence trends and adjust the prompt or thresholds monthly.
Common Variations
- Route to a ticketing system instead of Slack: replace the Slack module with an API call to Zendesk or Freshdesk and create a ticket with the email metadata.
- Add CRM enrichment: after classification, call your CRM API to attach the email to a lead or contact if the sender domain matches.
- Batch classification: for peak periods, push Gmail payloads to a Make webhook queue and process in controlled batches to avoid OpenAI TPM limits.
A practical closing note
You now have a complete blueprint to route Gmail to Slack using Make.com and OpenAI, with moderation, robust error handling, and an audit trail. If you want this built for your inbox, the team at Olmec Dynamics implements these workflows and can adapt the prompt schema and retry logic to your traffic profile, see what we do at Olmec Dynamics for automation services.