Quick Overview
This workflow receives customer support requests via a webhook, validates and deduplicates them using Google Sheets, classifies and drafts replies with Google Gemini, escalates high-risk cases to Slack, logs every interaction back to Google Sheets, and posts a daily operations summary to Slack.
How it works
- Receives a POST request on the
/support/incoming webhook and normalizes key fields like customer details, message text, and generated ticket/conversation IDs.
- Validates required fields and immediately returns an HTTP 400 response for invalid payloads.
- Checks Google Sheets for the incoming
event_id to ignore duplicates, then loads conversation history and customer records from the same spreadsheet.
- Uses Google Gemini to extract structured intent, sentiment, urgency, required context, and a recommended action, then applies deterministic rules to set customer priority and choose the best routing outcome.
- Pulls only the needed order and/or policy rows from Google Sheets based on the required context and evaluates decision rules to auto-resolve, request more information, or escalate to a human.
- Uses Google Gemini to generate a customer-facing reply that follows the chosen route and only uses the retrieved order/policy context.
- If escalation is required (or AI analysis errors occur), posts a formatted high-priority alert to a Slack channel.
- Appends the ticket, classification, decision, and response to Google Sheets (support logs and conversation history) and returns a JSON response to the original webhook caller.
Setup
- Create Google Sheets service account credentials in n8n and update the spreadsheet/document ID and sheet/tab names (customers, orders, policies, support_logs, support_history) to match your database.
- Add a Google Gemini (Google PaLM) API credential and ensure the Gemini chat model nodes are set to a model available in your account.
- Add Slack credentials, select the target Slack channel(s) for escalations, daily summaries, and error alerts, and confirm the bot has permission to post there.
- Configure your support intake source to send POST requests to the n8n webhook URL at
/support/incoming with the expected fields (customer, message, and optional order identifiers).
- Review and adjust routing thresholds and escalation rules (for example confidence, sentiment/urgency, and VIP handling) to fit your support policy.