30 nodes

WhatsApp AI Customer Support Bot

Workflow Preview

Description

โญ **If this workflow helped you, please leave a review on n8n Basket!** --- # ๐Ÿค– WhatsApp AI Customer Support Bot ### Fully Automated AI-Powered Customer Support for WhatsApp Business **Workflow ID:** `e0yLrzmWqsWlRcZE` **Webhook URL:** `https://YOUR-N8N-INSTANCE/webhook/whatsapp-ai-support` **Total Nodes:** 30 (22 functional + 8 sticky notes) **AI Model:** Groq llama-3.3-70b-versatile **Status:** Production-Ready --- ## ๐Ÿ“Œ Overview This workflow turns your WhatsApp Business number into a fully automated, AI-powered customer support agent. When a customer sends your business a WhatsApp message, the bot reads the message, understands what the customer needs, finds the best answer from your FAQ knowledge base, and replies instantly โ€” all without any human involvement. If the bot is unsure or the customer needs a real person, it automatically escalates the conversation to you with a Telegram alert and creates a task in Notion so nothing falls through the cracks. **Who is this for?** - ๐Ÿ• **Restaurants & food businesses** โ€” handle order questions, menu inquiries, and booking requests - ๐Ÿช **Retail shops** โ€” answer price questions, stock availability, and return policies - ๐Ÿฅ **Clinics & healthcare** โ€” manage appointment requests and general FAQs - ๐Ÿ’‡ **Salons & spas** โ€” handle booking requests and service inquiries - ๐Ÿ“ฆ **Any WhatsApp-based business** โ€” if your customers message you on WhatsApp, this bot works for you **Key Benefits:** - โœ… **24/7 customer support** โ€” your bot never sleeps, never takes a day off - โœ… **Zero human effort for FAQs** โ€” common questions are answered instantly by AI - โœ… **Instant escalation** โ€” complex issues reach you within seconds via Telegram - โœ… **Complete conversation logging** โ€” every message is tracked in Google Sheets - โœ… **Anti-spam protection** โ€” prevents abuse from message flooding - โœ… **Task management** โ€” escalated issues automatically create Notion tasks --- ## โœจ Features ### ๐Ÿง  AI Message Classification - Every incoming message is analyzed by the AI and classified into one of **6 categories:** - `ORDER_INQUIRY` โ€” questions about existing or new orders - `PRICE_QUESTION` โ€” asking about costs, pricing, or fees - `COMPLAINT` โ€” customer complaints or negative feedback - `BOOKING_REQUEST` โ€” appointment or reservation requests - `GENERAL_FAQ` โ€” general questions about your business - `HUMAN_NEEDED` โ€” customer explicitly asks for a human, or message is abusive/threatening - Extracts the **customer's name** if mentioned in the message - Determines the **intent** (what the customer actually wants) - Assigns an **urgency level** (low / medium / high) - Calculates a **confidence score** (0.0 to 1.0) for routing decisions ### ๐Ÿ“š TF-IDF Knowledge Base Matching - Reads your FAQ spreadsheet from Google Sheets automatically - Uses **TF-IDF similarity scoring** to find the **top 3 most relevant answers** from your knowledge base - Removes common stop words for better matching accuracy - Falls back gracefully if the FAQ sheet is empty or unavailable ### ๐Ÿค– GPT-Powered Personalized Reply Generation - Powered by **Groq llama-3.3-70b-versatile** (blazing fast, high quality) - System prompt: *"You are a friendly, professional customer support agent. Answer concisely in under 100 words."* - Uses the classified intent + top 3 FAQ matches to generate accurate replies - **Personalizes replies** using the customer's name when available - Automatically escalates if the AI is not confident in its answer ### ๐Ÿ›ก๏ธ Anti-Spam Protection - Built-in **rate limiter**: maximum **5 messages per 10 minutes** per phone number - Uses n8n's persistent workflow static data โ€” no external database needed - Rate-limited users receive a polite message automatically ### โœ… Auto-Reply Branch (Confident Answers) - Sends AI-generated reply back to customer via **WhatsApp Business API** - Logs the full conversation to **Google Sheets** - Sends a real-time **Telegram notification** to you ### ๐Ÿšจ Escalation Branch (Uncertain or Complex Queries) - Triggers when category is `HUMAN_NEEDED` **OR** confidence score is below `0.7` - Sends the customer a hold message - Logs escalation details to a separate **Google Sheets tab** - Sends an **urgent Telegram alert** to you - Creates a **Notion task** in your "Support Tasks" database ### โš ๏ธ Full Error Handling - Built-in **Error Trigger** node catches any errors across the entire workflow - Sends a **Telegram alert** with error details --- ## ๐Ÿ› ๏ธ Required Credentials You need **5 credentials** to run this workflow: | # | Credential Name | Service | Cost | |---|----------------|---------|------| | 1 | Groq_HTTP_Auth | Groq AI API | Free tier available | | 2 | WhatsApp account | WhatsApp Business API | Free (Meta for Developers) | | 3 | Google_Sheets_OAuth | Google Sheets | Free (Google account) | | 4 | Telegram account | Telegram Bot API | Free | | 5 | Notion_API | Notion API | Free (Notion account) | --- ### 1๏ธโƒฃ Groq API Key (AI Engine) 1. Go to [https://console.groq.com](https://console.groq.com) 2. Click **"Sign Up"** โ†’ create a free account 3. Click **"API Keys"** โ†’ **"Create API Key"** 4. Copy the key (starts with `gsk_`) 5. In n8n, create a new **HTTP Header Auth** credential named `Groq_HTTP_Auth` 6. Set Header Name: `Authorization`, Header Value: `Bearer YOUR_KEY_HERE` > ๐Ÿ’ก **Free tier:** Groq offers generous free usage. Most small businesses will never need to pay. --- ### 2๏ธโƒฃ WhatsApp Business API 1. Go to [https://developers.facebook.com](https://developers.facebook.com) 2. Log in โ†’ **"My Apps"** โ†’ **"Create App"** โ†’ Select **"Business"** 3. Add **WhatsApp** product โ†’ follow setup steps 4. Go to **WhatsApp โ†’ API Setup** โ†’ copy your **Phone Number ID** and access token 5. For permanent access: **Business Settings โ†’ System Users** โ†’ generate permanent token with `whatsapp_business_messaging` permission 6. In n8n, open the **"WhatsApp account"** credential โ†’ paste your permanent access token > โš ๏ธ You need a verified Meta Business Account. Verification can take 1โ€“3 business days. --- ### 3๏ธโƒฃ Google Sheets OAuth 1. Go to [https://console.cloud.google.com](https://console.cloud.google.com) 2. Create a new project โ†’ **APIs & Services โ†’ Library** โ†’ Enable **Google Sheets API** 3. Go to **Credentials** โ†’ **Create Credentials** โ†’ **OAuth client ID** 4. Configure OAuth consent screen first (External, add yourself as test user) 5. Application type: **Web application** 6. Authorized redirect URI: `https://YOUR-N8N-INSTANCE/rest/oauth2-credential/callback` 7. Copy **Client ID** and **Client Secret** 8. In n8n, open **"Google_Sheets_OAuth"** โ†’ paste credentials โ†’ **"Sign in with Google"** --- ### 4๏ธโƒฃ Telegram Bot Token 1. Open Telegram โ†’ search **@BotFather** โ†’ send `/newbot` 2. Enter a display name and username (must end in `bot`) 3. Copy the bot token (looks like `7123456789:AAHx8kLmN-abc123`) 4. In n8n, open **"Telegram account"** โ†’ paste token in the **"Access Token"** field --- ### 5๏ธโƒฃ Notion API Key 1. Go to [https://www.notion.so/my-integrations](https://www.notion.so/my-integrations) 2. Click **"+ New Integration"** โ†’ name it โ†’ select your workspace 3. Copy the **Internal Integration Token** (starts with `ntn_`) 4. In n8n, open **"Notion_API"** โ†’ paste token in **"API Key"** field 5. **Important:** Go to your Notion database โ†’ **"..." โ†’ "Connections"** โ†’ connect your integration --- ## ๐Ÿ“‹ Google Sheets Setup Create **one Google Spreadsheet** with **three tabs:** ### Tab 1 โ€” `FAQ_Knowledge_Base` | Column A | Column B | |----------|----------| | **Question** | **Answer** | Example rows to get started: | Question | Answer | |----------|--------| | What are your business hours? | We're open Monday to Saturday, 9:00 AM to 6:00 PM. Closed Sundays and public holidays. | | How can I place an order? | Send us a message with the items you'd like. We'll confirm availability and total. | | What payment methods do you accept? | We accept cash on delivery, bank transfer, and all major credit/debit cards. | | How long does delivery take? | Standard delivery takes 30โ€“60 minutes within our delivery zone. | | What is your return/refund policy? | Full refunds for defective or incorrect items within 24 hours. Contact us with your order details. | | Do you offer discounts for bulk orders? | Yes! Contact us for a custom quote on large orders. | | Where are you located? | We're at [Your Address Here]. Walk-ins welcome during business hours! | | How can I book an appointment? | Send your preferred date, time, and service. We'll confirm within minutes. | > ๐Ÿ’ก Add at least 15โ€“20 FAQ rows for best results. ### Tab 2 โ€” `Conversations` | Timestamp | Customer Phone | Customer Name | Message | Bot Reply | Category | Urgency | Confidence | Resolution | |---|---|---|---|---|---|---|---|---| ### Tab 3 โ€” `Escalations` | Timestamp | Customer Phone | Customer Name | Message | Category | Urgency | Confidence | Reason | Status | |---|---|---|---|---|---|---|---|---| --- ## ๐Ÿ—ƒ๏ธ Notion Database Setup Create a database called **Support Tasks** with these exact properties: | Property Name | Type | Options | |---------------|------|---------| | **Customer Phone** | Title | Default first column โ€” just rename it | | **Message** | Rich Text | โ€” | | **Priority** | Select | `Low` (green), `Medium` (yellow), `High` (red) | | **Status** | Select | `Open` (red), `In Progress` (yellow), `Closed` (green) | | **Category** | Select | `ORDER_INQUIRY`, `PRICE_QUESTION`, `COMPLAINT`, `BOOKING_REQUEST`, `GENERAL_FAQ`, `HUMAN_NEEDED` | --- ## ๐Ÿ“ฒ WhatsApp Business API Setup 1. Go to [https://developers.facebook.com](https://developers.facebook.com) โ†’ open your app 2. Navigate to **WhatsApp โ†’ Configuration** 3. Under **Webhook**, click **"Edit"** 4. **Callback URL:** `https://YOUR-N8N-INSTANCE/webhook/whatsapp-ai-support` 5. **Verify Token:** any secret string you choose (e.g., `my-support-bot-2024`) 6. Click **"Verify and Save"** 7. Under **Webhook Fields**, click **"Subscribe"** next to **messages** > โš ๏ธ The workflow must be **Active** in n8n for webhook verification to succeed. --- ## ๐Ÿค– Telegram Bot Setup โ€” Getting Your Chat ID 1. Open Telegram โ†’ search **@userinfobot** โ†’ send any message 2. It replies with your **Chat ID** (a number like `123456789`) 3. Add this Chat ID to **4 nodes** in the workflow: | Node Name | Purpose | |-----------|---------| | **Notify Owner** | Auto-handled message summaries | | **Alert Owner** | Urgent escalation alerts | | **Error Telegram Alert** | Error notifications | | **Send Daily Summary** *(in summary workflow)* | Daily report | --- ## โ–ถ๏ธ How to Import & Activate 1. Open your n8n instance in your browser 2. Click **"Add workflow"** โ†’ **"..."** menu โ†’ **"Import from File..."** 3. Select the downloaded `.json` file 4. Double-click each โš ๏ธ node and select the matching credential: | Node | Credential | |------|------------| | WhatsApp nodes | WhatsApp account | | Google Sheets nodes | Google_Sheets_OAuth | | Telegram nodes | Telegram account | | HTTP Request (Groq) nodes | Groq_HTTP_Auth | | Notion node | Notion_API | 5. Click the **toggle switch** top-right โ†’ turn **Active** (green) --- ## ๐Ÿงช How to Test ### Test 1: Basic FAQ Question Send to your WhatsApp Business number: > *"What are your business hours?"* Expected: AI reply within 5โ€“10 seconds + Telegram notification + Google Sheets row logged ### Test 2: Trigger Escalation Send: > *"I want to speak to a human agent please"* Expected: Hold message on WhatsApp + urgent Telegram alert + Notion task created + Escalations sheet row ### Test 3: Anti-Spam Send **6 messages in quick succession** โ€” the 6th should receive: > *"โณ Please wait, our system is processing your previous messages."* ### Test 4: Low-Confidence Escalation Send: > *"asdfjkl what do I do about the thing from last time"* Expected: escalation branch triggered (confidence below 0.7) --- ## โ“ Troubleshooting ### Problem 1: Webhook Not Receiving Messages - โœ… Workflow must be **Active** - โœ… Webhook URL in Meta Dashboard must be exactly: `https://YOUR-N8N-INSTANCE/webhook/whatsapp-ai-support` - โœ… Must be subscribed to the **"messages"** webhook field - โœ… Check Meta App Dashboard โ†’ Webhooks for delivery errors ### Problem 2: Google Sheets Permission Denied - โœ… Re-authorize: open **Google_Sheets_OAuth** โ†’ **"Sign in with Google"** - โœ… Confirm Google Sheets API is enabled in Google Cloud Console - โœ… Make sure your Google account has **edit access** to the spreadsheet ### Problem 3: Groq API Rate Limit - โœ… Check usage at [https://console.groq.com/usage](https://console.groq.com/usage) - โœ… Verify the credential value starts with `Bearer gsk_...` - โœ… Free tier limits reset quickly โ€” wait a few minutes and retry ### Problem 4: Telegram Chat ID Not Working - โœ… Send `/start` to your bot first - โœ… Chat ID must be a **number**, not a username - โœ… Group Chat IDs start with `-100` - โœ… All **4 Telegram nodes** must have the Chat ID set ### Problem 5: Anti-Spam Triggering Incorrectly - โœ… Deactivate โ†’ wait 10 seconds โ†’ reactivate to reset all counters - โœ… Default: 5 messages per 10 minutes per phone โ€” adjust in **"Rate Limit Check"** node ### Problem 6: Notion Task Not Created - โœ… Connect your integration to the database: Notion DB โ†’ **"..." โ†’ Connections** - โœ… Database must have exact property names: `Customer Phone`, `Message`, `Priority`, `Status`, `Category` - โœ… Priority options must include: `Low`, `Medium`, `High` - โœ… Status options must include: `Open` --- ## ๐Ÿ’ก Customization Tips ### Add More FAQ Rows Open your Google Sheet โ†’ **FAQ_Knowledge_Base** tab โ†’ add rows. No restart needed. ### Change the AI Reply Tone Open **"Generate AI Reply"** node โ†’ edit the system prompt: - **Casual:** *"You are a fun, casual support agent. Use emojis."* - **Formal:** *"You are a formal, corporate customer support representative."* - **Sales-focused:** *"You are a helpful agent who also suggests additional products when relevant."* ### Change the Spam Threshold Open **"Rate Limit Check"** node โ†’ find: ```javascript const WINDOW_MS = 10 * 60 * 1000; // 10 minutes const MAX_MESSAGES = 5;

Loading demo...

What's Included

Downloadable JSON file
Sanitized credentials
Ready to import into n8n
Lifetime access

Reviews (0)

0.0

0 reviews

5 star
0
4 star
0
3 star
0
2 star
0
1 star
0
โ‚น5000.00

One-time purchase

Seller

plenvara

plenvara

Workflow Creator

Details

CreatedMarch 8, 2026
Nodes30
Version1.0.0