See llms.txt for all machine-readable content.

Back to Templates

Triage email complaints and track SLA breaches with Gmail, OpenAI and Slack

Quick overview

This workflow monitors unread Gmail inbox emails, uses OpenAI to detect and classify customer complaints, stores them in n8n Data Tables with SLA deadlines, and notifies Slack, then escalates breached SLAs, supports resolution via webhook, and posts a daily Slack summary.

How it works

  1. Polls Gmail every minute for unread inbox emails and extracts the sender, subject, and message into a normalized complaint record.
  2. Sends the email content to OpenAI (gpt-5.4-mini) to decide whether it is a complaint and to return severity, root cause, sentiment, summary, and confidence as structured JSON.
  3. Keeps only messages classified as complaints with confidence ≥ 0.7, looks up the responsible manager and Slack channel from an n8n Data Table, calculates an SLA due date based on severity, saves the complaint to an n8n Data Table, and posts a Slack notification to the assigned channel.
  4. Runs every 15 minutes to fetch open complaints from the complaints Data Table, filters for items past sla_due_at that are not yet escalated, posts an SLA breach alert to Slack, and marks the complaint as escalated in the Data Table.
  5. Exposes a POST webhook endpoint (/complaint-resolve) that looks up a complaint by complaint_id, marks it resolved with resolved_at and sla_met, posts a resolution confirmation to Slack, and returns a JSON response (or a 404 if not found/already resolved).
  6. Runs daily at 9 AM to load all complaint records, computes key SLA and volume statistics, asks OpenAI to write a five-line escalation summary, and posts the summary to a Slack escalation channel.

Setup

  1. Create and connect credentials for Gmail Trigger, OpenAI, and Slack.
  2. Create two n8n Data Tables: one for complaints and one for complaint manager routing, then replace REPLACE_WITH_COMPLAINTS_DATA_TABLE_ID and REPLACE_WITH_COMPLAINT_MANAGERS_DATA_TABLE_ID with your table IDs.
  3. Populate the manager routing Data Table with rows keyed by root_cause (Product Defect, Billing, Delivery, Support Quality, Account Access, Other) and include manager_name and slack_channel values.
  4. Replace the placeholder Slack channel IDs (REPLACE_WITH_SLACK_CHANNEL_ID) for breach alerts/daily summaries and ensure the workflow has access to post in those channels.
  5. If you use the resolution flow, copy the production webhook URL for /complaint-resolve and call it from your ticketing/support process with a JSON body containing complaint_id.

Requirements

  • Gmail account (to read customer emails)
  • OpenAI API key (for AI complaint analysis)
  • Slack workspace and channels (for notifications and alerts)
  • Two data tables: "complaints" (stores all complaint data) and "complaint_managers" (maps problem types to manager names and Slack channels)

Additional info

Connect with us:
Website: https://www.intuz.com/n8n-workflow-automation-templates/
Email: [email protected]
LinkedIn: https://www.linkedin.com/company/intuz

For Custom Workflow Automation

Get Started: https://n8n.partnerlinks.io/intuz