Traitement des consultations clients WhatsApp avec l'IA et le routage des intentions

Avancé

Ceci est unSupport Chatbot, AI Chatbotworkflow d'automatisation du domainecontenant 20 nœuds.Utilise principalement des nœuds comme Code, Switch, WhatsApp, GoogleDocsTool, Agent. Traitement des demandes clients WhatsApp avec IA et routage des intentions

Prérequis
  • Clé API Google Gemini
Aperçu du workflow
Visualisation des connexions entre les nœuds, avec support du zoom et du déplacement
Exporter le workflow
Copiez la configuration JSON suivante dans n8n pour importer et utiliser ce workflow
{
  "id": "2awBbs4kwz2DghoQ",
  "meta": {
    "instanceId": "e46a00fdf674c6a717d1781ab876c72daac39cdddf1349ff176b416ee5840ee5",
    "templateCredsSetupCompleted": true
  },
  "name": "Handle WhatsApp customer inquiries with AI and intent routing",
  "tags": [],
  "nodes": [
    {
      "id": "18ede450-1342-4afc-ae8a-e77cd6e0f5b3",
      "name": "Note adhésive - Explication principale",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        1104
      ],
      "parameters": {
        "color": 4,
        "width": 566,
        "height": 960,
        "content": "## 💬 WhatsApp Customer Support Bot\n### ✨ Universal Template for ANY Business\n\n**What it does:**\n- Receives WhatsApp messages automatically\n- Classifies customer intent (product, contact, support)\n- Routes to pre-built responses (fast) or AI agent (smart)\n- Sends professional replies with product info & prices\n- Remembers conversation context\n\n**Works for:** Fashion | Electronics | Food | Furniture | Beauty | ANY store!\n\n**Requirements:**\n- WhatsApp Business API (Twilio/360Dialog/Meta)\n- Google Gemini API key\n- n8n instance\n\n**Quick Setup:**\n\n1️⃣ **Connect WhatsApp** - Add API credentials to WhatsApp nodes\n\n2️⃣ **Customize Products** - Edit \"Classify User Intent\" node with YOUR categories\n\n3️⃣ **Add Product List** - Update \"Generate Product Response\" with YOUR items & prices\n\n4️⃣ **Company Info** - Fill YOUR details in \"Build AI System Prompt\" node\n\n5️⃣ **Test & Launch** - Send test messages, verify, activate!\n\n**Customize (No Coding!):**\n- Products: Edit \"Generate Product Response\"\n- Categories: Update \"Classify User Intent\"\n- Store info: Modify \"Generate Contact Info Response\"\n- AI behavior: Adjust \"Build AI System Prompt\"\n\n**Hybrid Approach = Cost Savings:**\n- 80% queries → Pre-built responses (instant, free)\n- 20% queries → AI agent (smart, low cost)\n\n**Result:** Save 80% on AI costs while maintaining quality!\n\n💡 **Pro Tip:** Start with pre-built FAQs, let AI handle the rest!"
      },
      "typeVersion": 1
    },
    {
      "id": "bcd03e0f-491a-4403-9415-1cbebb03990c",
      "name": "Note adhésive - Étape 1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160,
        1072
      ],
      "parameters": {
        "color": 7,
        "width": 324,
        "height": 401,
        "content": "## 📱 Step 1: Receive WhatsApp Message\n\nWhatsApp Business API triggers the workflow when a customer sends a message.\n\nCaptures:\n- Chat ID\n- User ID\n- User name\n- Message text\n- Timestamp\n\nSupports text messages (media handling can be added)."
      },
      "typeVersion": 1
    },
    {
      "id": "1dd7b535-b77a-43e3-a0c8-8ea2c5ef6f10",
      "name": "Note adhésive - Étape 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        544,
        1072
      ],
      "parameters": {
        "color": 7,
        "width": 324,
        "height": 443,
        "content": "## 🧠 Step 2: Intent Classification\n\nAnalyzes the message to determine what the customer wants:\n\n**Intents Recognized:**\n- 🛍️ Product inquiry (monitors, CPUs, GPUs, etc.)\n- 📞 Contact information\n- 👋 Greeting\n- 🙏 Thanks\n- 💰 Price inquiry\n- 🆘 Support request\n- ❓ General inquiry\n\nUses keyword matching and pattern recognition for fast, accurate classification."
      },
      "typeVersion": 1
    },
    {
      "id": "9d8b4954-a7ed-44d1-b0f5-722f129450b3",
      "name": "Note adhésive - Étape 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1040,
        1072
      ],
      "parameters": {
        "color": 7,
        "width": 314,
        "height": 378,
        "content": "## 🔀 Step 3: Intelligent Routing\n\nRoutes to the best response handler based on intent:\n\n**Route 1**: Product inquiries → Pre-built catalog responses (fast, cost-effective)\n\n**Route 2**: Contact/hours → Static information response\n\n**Route 3**: Complex questions → AI agent with full context\n\nThis hybrid approach balances speed, cost, and intelligence."
      },
      "typeVersion": 1
    },
    {
      "id": "185a07f9-2406-4ff8-9e26-c7897dc483e7",
      "name": "Note adhésive - Étape 4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1536,
        1056
      ],
      "parameters": {
        "color": 7,
        "width": 334,
        "height": 393,
        "content": "## 🤖 Step 4: AI Agent (For Complex Queries)\n\nGoogle Gemini AI handles:\n- Custom product recommendations\n- Comparison questions\n- Technical specifications\n- Build suggestions\n- Multi-step conversations\n\nFeatures:\n- Conversation memory (remembers context)\n- Company knowledge (products, policies)\n- Natural language understanding\n- Markdown-formatted responses"
      },
      "typeVersion": 1
    },
    {
      "id": "9c249b38-41a9-4446-befb-a07aaa1076c4",
      "name": "Note adhésive - Étape 5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2000,
        1056
      ],
      "parameters": {
        "color": 7,
        "width": 324,
        "height": 354,
        "content": "## 📤 Step 5: Send WhatsApp Response\n\nFormats and sends the response back to the customer via WhatsApp.\n\nSupports:\n- Markdown formatting (bold, italic, lists)\n- Emojis for engagement\n- Links to products\n- Multi-line messages\n\nResponses are friendly, professional, and on-brand."
      },
      "typeVersion": 1
    },
    {
      "id": "7fb04cfb-53c6-4424-96a4-0a28d0e2c551",
      "name": "WhatsApp Trigger - Receive Messages",
      "type": "n8n-nodes-base.whatsAppTrigger",
      "position": [
        176,
        1664
      ],
      "webhookId": "whatsapp-webhook-id",
      "parameters": {
        "options": {},
        "updates": [
          "messages"
        ]
      },
      "credentials": {
        "whatsAppTriggerApi": {
          "id": "UHBhPoQG2bNZKkzc",
          "name": "WhatsApp OAuth account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "06578f8a-5296-4b4e-a8d8-5757a5a346ca",
      "name": "Parse WhatsApp Message Data",
      "type": "n8n-nodes-base.code",
      "position": [
        384,
        1664
      ],
      "parameters": {
        "jsCode": "// Extract and structure message data\nconst message = $input.item.json.message;\nconst chatId = message.chat.id;\nconst userId = message.from.id;\nconst userName = message.from.first_name || 'Customer';\nconst userText = message.text || '';\nconst messageId = message.message_id;\n\n// Store session data for downstream nodes\nconst sessionData = {\n  chatId: chatId,\n  userId: userId,\n  userName: userName,\n  messageText: userText.toLowerCase(), // Lowercase for intent matching\n  originalText: userText, // Keep original for AI\n  messageId: messageId,\n  timestamp: new Date().toISOString()\n};\n\nreturn [sessionData];"
      },
      "typeVersion": 2
    },
    {
      "id": "d5e00bfe-a374-46f6-a058-e5c6d9bab965",
      "name": "Classify User Intent",
      "type": "n8n-nodes-base.code",
      "position": [
        608,
        1664
      ],
      "parameters": {
        "jsCode": "// Intent Classification with Pattern Matching\nconst text = $input.item.json.messageText;\nconst originalText = $input.item.json.originalText;\n\nlet intent = 'general_inquiry';\nlet entities = {\n  category: null,\n  brand: null,\n  priceRange: null\n};\n\n// Priority 1: Contact/Location queries (check first)\nif (/where.*store|store.*locat|address|location|contact|phone|email|visit.*store|shop.*address/i.test(text)) {\n  intent = 'contact_info';\n  return [{...($input.item.json), intent, entities}];\n}\n\n// Priority 2: Greetings (only exact greetings)\nif (/^(hi|hello|hey|good morning|good evening|good afternoon|start|greetings)$/i.test(text)) {\n  intent = 'greeting';\n  return [{...($input.item.json), intent, entities}];\n}\n\n// Priority 3: Thanks\nif (/thank|thanks|appreciate|grateful/i.test(text)) {\n  intent = 'thanks';\n  return [{...($input.item.json), intent, entities}];\n}\n\n// Priority 4: Product categories\n// CUSTOMIZE THESE PATTERNS FOR YOUR BUSINESS TYPE\nconst categories = [\n  // Electronics/Tech Store Examples:\n  { pattern: /(monitor|display|screen|tv)/i, category: 'monitors' },\n  { pattern: /(laptop|notebook|computer)/i, category: 'laptops' },\n  { pattern: /(phone|mobile|smartphone)/i, category: 'phones' },\n  { pattern: /(headphone|earphone|earbuds|airpods)/i, category: 'audio' },\n  \n  // Fashion Store Examples:\n  { pattern: /(shirt|tshirt|top|blouse)/i, category: 'clothing' },\n  { pattern: /(jeans|pants|trousers)/i, category: 'bottomwear' },\n  { pattern: /(dress|gown|saree)/i, category: 'ethnic' },\n  { pattern: /(shoe|footwear|sneaker|sandal)/i, category: 'footwear' },\n  { pattern: /(bag|purse|wallet)/i, category: 'accessories' },\n  \n  // Home/Furniture Examples:\n  { pattern: /(sofa|couch|chair|seating)/i, category: 'furniture' },\n  { pattern: /(bed|mattress|bedroom)/i, category: 'bedroom' },\n  { pattern: /(table|desk|dining)/i, category: 'tables' },\n  { pattern: /(decor|decoration|wall art)/i, category: 'decor' },\n  \n  // Beauty/Cosmetics Examples:\n  { pattern: /(skincare|cream|serum|moisturizer)/i, category: 'skincare' },\n  { pattern: /(makeup|lipstick|foundation)/i, category: 'makeup' },\n  { pattern: /(perfume|fragrance|cologne)/i, category: 'fragrance' },\n  \n  // Food/Grocery Examples:\n  { pattern: /(grocery|groceries|food)/i, category: 'groceries' },\n  { pattern: /(vegetable|fruit|produce)/i, category: 'fresh' },\n  { pattern: /(snack|chips|biscuit)/i, category: 'snacks' },\n  \n  // Add YOUR business-specific categories here\n  // { pattern: /YOUR_KEYWORD/i, category: 'YOUR_CATEGORY' },\n];\n\nfor (const cat of categories) {\n  if (cat.pattern.test(text)) {\n    intent = 'product_inquiry';\n    entities.category = cat.category;\n    break;\n  }\n}\n\n// Priority 5: Order tracking\nif (/track.*order|order.*status|where.*order|order.*id/i.test(text)) {\n  intent = 'order_tracking';\n}\n\n// Priority 6: Price queries (if not already classified)\nif (intent !== 'contact_info' && /price|cost|how much|budget|expensive|cheap|rate/i.test(text)) {\n  intent = 'price_inquiry';\n}\n\n// Priority 7: Shipping/Delivery\nif (/shipping|delivery|courier|dispatch|arrive|reach/i.test(text)) {\n  intent = 'shipping_inquiry';\n}\n\n// Priority 8: Return/Refund\nif (/return|refund|exchange|replace|cancel/i.test(text)) {\n  intent = 'return_request';\n}\n\n// Priority 9: Support queries\nif (/help|support|problem|issue|complaint|not working/i.test(text)) {\n  intent = 'support_request';\n}\n\nreturn [{...($input.item.json), intent, entities}];"
      },
      "typeVersion": 2
    },
    {
      "id": "7445df59-15a2-4734-a871-2d1559546523",
      "name": "Route by Intent",
      "type": "n8n-nodes-base.switch",
      "position": [
        848,
        1648
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "product_inquiry",
              "conditions": {
                "options": {
                  "caseSensitive": false
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.intent }}",
                    "rightValue": "product_inquiry"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "contact_info",
              "conditions": {
                "options": {
                  "caseSensitive": false
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.intent }}",
                    "rightValue": "contact_info"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {
          "fallbackOutput": "extra"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "81f8deee-e06b-496d-9c3b-b7edde36a79a",
      "name": "Generate Product Response",
      "type": "n8n-nodes-base.code",
      "position": [
        1120,
        1488
      ],
      "parameters": {
        "jsCode": "// Generate Product Catalog Response\nconst category = $input.item.json.entities.category;\nconst userName = $input.item.json.userName;\n\nlet response = '';\n\n// ========================================\n// CUSTOMIZE WITH YOUR ACTUAL PRODUCTS\n// ========================================\n// The examples below show different business types\n// Replace with YOUR products, prices, and categories\n\n// EXAMPLE 1: Electronics Store\nif (category === 'monitors') {\n  response = `Great choice, ${userName}! Check out our *MONITORS*:\\n\\n`;\n  response += `1. *24\" Full HD Monitor*\\n   💰 ₹8,999\\n   ✅ In Stock\\n   🔗 https://yourstore.com/monitors\\n\\n`;\n  response += `2. *27\" 4K Professional Display*\\n   💰 ₹22,999\\n   🎉 20% OFF!\\n   🔗 https://yourstore.com/monitors\\n\\n`;\n}\n\n// EXAMPLE 2: Fashion Store\nelse if (category === 'clothing') {\n  response = `Hi ${userName}! Here are our trending *CLOTHING* items:\\n\\n`;\n  response += `👕 *Men's Cotton T-Shirts*\\n   💰 Starting at ₹399\\n   🔗 https://yourstore.com/mens-tshirts\\n\\n`;\n  response += `👗 *Women's Summer Dresses*\\n   💰 ₹1,299 - ₹2,999\\n   🎉 Buy 2 Get 10% OFF\\n   🔗 https://yourstore.com/dresses\\n\\n`;\n}\n\n// EXAMPLE 3: Home Decor Store\nelse if (category === 'furniture') {\n  response = `Wonderful choice, ${userName}! Our *FURNITURE* collection:\\n\\n`;\n  response += `🛋️ *3-Seater Sofa Set*\\n   💰 ₹24,999\\n   🚚 Free Delivery\\n   🔗 https://yourstore.com/sofas\\n\\n`;\n  response += `🪑 *Dining Table (6-Seater)*\\n   💰 ₹15,999\\n   ✅ Solid Wood\\n   🔗 https://yourstore.com/dining\\n\\n`;\n}\n\n// EXAMPLE 4: Beauty & Cosmetics\nelse if (category === 'skincare') {\n  response = `Great selection, ${userName}! Our *SKINCARE* products:\\n\\n`;\n  response += `✨ *Vitamin C Face Serum*\\n   💰 ₹599\\n   🌿 100% Natural\\n   🔗 https://yourstore.com/skincare\\n\\n`;\n  response += `💆 *Anti-Aging Night Cream*\\n   💰 ₹899\\n   ⭐ Bestseller!\\n   🔗 https://yourstore.com/skincare\\n\\n`;\n}\n\n// EXAMPLE 5: Food & Grocery\nelse if (category === 'groceries') {\n  response = `Perfect, ${userName}! Check our *GROCERIES*:\\n\\n`;\n  response += `🌾 *Organic Rice (5kg)*\\n   💰 ₹450\\n   🌱 Chemical-free\\n   🔗 https://yourstore.com/groceries\\n\\n`;\n  response += `🫘 *Mixed Nuts Pack (500g)*\\n   💰 ₹299\\n   💪 High Protein\\n   🔗 https://yourstore.com/dry-fruits\\n\\n`;\n}\n\n// Default: Show all categories\nelse {\n  response = `Hi ${userName}! Browse our categories:\\n\\n`;\n  response += `📱 [Category 1]\\n`;\n  response += `👕 [Category 2]\\n`;\n  response += `🏠 [Category 3]\\n`;\n  response += `💄 [Category 4]\\n\\n`;\n  response += `🌐 Visit: https://yourstore.com/`;\n}\n\n// Add universal call-to-action\nresponse += `\\n\\n✨ Special Offer: [Your Current Promotion]`;\nresponse += `\\n📞 Questions? Call: +91 XXXXXXXXXX`;\nresponse += `\\n💬 Or just reply here!`;\n\nreturn [{\n  chatId: $input.item.json.chatId,\n  response: response,\n  parseMode: 'Markdown'\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "8edafb90-588a-40ca-93b5-366fa5cbcf71",
      "name": "Generate Contact Info Response",
      "type": "n8n-nodes-base.code",
      "position": [
        1120,
        1664
      ],
      "parameters": {
        "jsCode": "// Generate Contact Information Response\nconst userName = $input.item.json.userName;\n\n// CUSTOMIZE THIS WITH YOUR COMPANY DETAILS\nconst response = `📍 *Your Company Name - Contact Details*\\n\\n🏢 *Address:*\\nYour Street Address\\nCity, State - PIN Code\\n\\n📞 *Phone:*\\n+91 XXXXXXXXXX (Main)\\n+91 XXXXXXXXXX (Sales)\\n+91 XXXXXXXXXX (Support)\\n\\n📧 *Email:*\\ninfo@yourcompany.com\\nsupport@yourcompany.com\\n\\n🌐 *Website:*\\nhttps://yourcompany.com/\\n\\n⏰ *Store Hours:*\\nMon-Sat: 10 AM - 8 PM\\nSunday: 11 AM - 6 PM\\n\\nFeel free to visit us, ${userName}! 😊`;\n\nreturn [{\n  chatId: $input.item.json.chatId,\n  response: response,\n  parseMode: 'Markdown'\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "6454f0d9-1b24-4dec-820d-073ce268d1a2",
      "name": "Build AI System Prompt",
      "type": "n8n-nodes-base.code",
      "position": [
        1424,
        1664
      ],
      "parameters": {
        "jsCode": "// Build comprehensive AI system prompt with company knowledge\nconst userMessage = $input.first().json.originalText;\nconst userName = $input.first().json.userName;\nconst intent = $input.first().json.intent;\n\n// ========================================\n// CUSTOMIZE THIS SECTION FOR YOUR BUSINESS\n// ========================================\n\nconst systemPrompt = `You are a helpful AI customer service assistant for [YOUR COMPANY NAME].\n\n📋 COMPANY INFORMATION:\n- Business Name: [Your Business Name]\n- Industry: [e.g., Fashion, Electronics, Home Decor, Food & Beverage, etc.]\n- Store Address: [Your Physical Address]\n- Phone: [Your Phone Number(s)]\n- Email: [Your Email Address]\n- Website: [Your Website URL]\n\n🛍️ WHAT WE SELL:\n[Describe your products/services in 2-3 sentences]\nExamples:\n- \"We sell premium handcrafted leather bags, wallets, and accessories\"\n- \"We offer organic skincare products made from natural ingredients\"\n- \"We provide home furniture including sofas, beds, dining sets, and decor\"\n\n📦 PRODUCT CATEGORIES:\n[List your main categories, e.g.:\n- Category 1: [Name]\n- Category 2: [Name]\n- Category 3: [Name]]\n\n💰 PRICING & PAYMENT:\n- Price Range: [e.g., ₹500 - ₹50,000]\n- Accepted Payments: [e.g., Cash on Delivery, Credit/Debit Cards, UPI, Net Banking]\n- Current Offers: [Any ongoing sales/discounts]\n\n🚚 DELIVERY & SHIPPING:\n- Delivery Areas: [e.g., Pan India, Local City Only, International]\n- Delivery Time: [e.g., 3-5 business days]\n- Shipping Cost: [e.g., Free above ₹999, ₹50 flat rate]\n\n🔄 POLICIES:\n- Return Policy: [e.g., 7-day return, 30-day exchange]\n- Warranty: [If applicable]\n- Refund Policy: [Your refund terms]\n\n🎯 YOUR ROLE:\nYou help customers with:\n1. Product recommendations based on their needs\n2. Answering questions about prices, availability, and features\n3. Explaining policies (returns, shipping, payments)\n4. Providing order tracking information\n5. Resolving common issues and concerns\n6. Guiding them to make purchases\n\n💬 RESPONSE STYLE:\n1. Be warm, friendly, and professional\n2. Always use the customer's name: ${userName}\n3. Provide specific, helpful answers\n4. Mention prices in your local currency\n5. Highlight ongoing offers when relevant\n6. Use emojis appropriately for engagement (but don't overdo it)\n7. Keep responses concise and easy to read on mobile\n8. If you don't know something specific, direct them to call or email\n9. Always end complex responses with a clear call-to-action\n\n📍 IMPORTANT NOTES:\n- Current customer query type: ${intent}\n- If customer asks about specific products not in your knowledge, provide general category info and suggest they visit the website or call\n- For order-specific questions (tracking, returns), direct them to email or phone with order number\n- Be honest about delivery times and stock availability\n`;\n\nreturn [{\n  ...($input.first().json),\n  systemPrompt: systemPrompt,\n  userPrompt: userMessage\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "b13be1ed-6b8a-44a8-8dda-30ea5634eb00",
      "name": "Agent IA - Handle Complex Queries",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1632,
        1664
      ],
      "parameters": {
        "text": "={{ $json.userPrompt }}",
        "options": {
          "systemMessage": "={{ $json.systemPrompt }}"
        },
        "promptType": "define"
      },
      "typeVersion": 1.7
    },
    {
      "id": "ea4fbfc4-99fd-4fa0-9c86-a4093d1c5dbd",
      "name": "Modèle de chat Google Gemini",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        1632,
        1520
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "googlePalmApi": {
          "id": "KtAMOYdbcKc3zjad",
          "name": "Google Gemini(PaLM) Api account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "38a18571-b06e-450b-85fe-34b33e312569",
      "name": "Conversation Mémoire",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        1728,
        1808
      ],
      "parameters": {
        "sessionKey": "={{ $json.userId }}",
        "sessionIdType": "customKey"
      },
      "typeVersion": 1.2
    },
    {
      "id": "50a654e2-7c70-4b0c-99be-ca2ba890961e",
      "name": "Google Docs - Product Catalog (Optional)",
      "type": "n8n-nodes-base.googleDocsTool",
      "position": [
        1776,
        1504
      ],
      "parameters": {
        "operation": "get",
        "documentURL": "https://docs.google.com/document/d/YOUR_DOCUMENT_ID/edit"
      },
      "credentials": {
        "googleDocsOAuth2Api": {
          "id": "HHtSmyiZeuvQ7w3f",
          "name": "Google Docs account"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "78c748ca-531b-4aaa-8d75-471bfe96d8d7",
      "name": "Format AI Response",
      "type": "n8n-nodes-base.code",
      "position": [
        1952,
        1664
      ],
      "parameters": {
        "jsCode": "// Format AI response for WhatsApp\nconst aiResponse = $input.first().json.output;\nconst chatId = $input.first().json.chatId;\n\nreturn [{\n  chatId: chatId,\n  response: aiResponse,\n  parseMode: 'Markdown'\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "30eca11b-6aae-4db7-ad0a-1c58d6311d5a",
      "name": "Generate Default Response",
      "type": "n8n-nodes-base.code",
      "position": [
        1136,
        1872
      ],
      "parameters": {
        "jsCode": "// Generate default/fallback response\nconst userName = $input.item.json.userName;\n\n// ========================================\n// CUSTOMIZE THIS MENU FOR YOUR BUSINESS\n// ========================================\n\nconst response = `Hi ${userName}! 👋 Welcome to [Your Store Name]!\\n\\nI can help you with:\\n\\n🛍️ *Browse Products:*\\n• [Your Category 1]\\n• [Your Category 2]\\n• [Your Category 3]\\n• [Your Category 4]\\n• And more...\\n\\n📦 *Order Information:*\\n• Track your order\\n• Check delivery status\\n• Return or exchange items\\n\\n💰 *Pricing & Offers:*\\n• Current promotions\\n• Bulk discounts\\n• Payment options\\n\\n📍 *Store Information:*\\n• Location & hours\\n• Contact details\\n• Shipping areas\\n\\n💬 *Try asking me:*\\n• \"Show me [product type]\"\\n• \"What's available under ₹[amount]?\"\\n• \"Do you deliver to [location]?\"\\n• \"What's your return policy?\"\\n• \"Where is your store?\"\\n\\n📞 *Need Personal Assistance?*\\nCall: +91 XXXXXXXXXX\\nEmail: info@yourstore.com\\n\\nWhat would you like to know? 😊`;\n\nreturn [{\n  chatId: $input.item.json.chatId,\n  response: response,\n  parseMode: 'Markdown'\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "ec2b6512-76a0-4f25-a0eb-0f14615b070f",
      "name": "Send WhatsApp Response",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        2192,
        1664
      ],
      "webhookId": "9fab27ba-160c-49be-8e15-a2dbe798a318",
      "parameters": {},
      "credentials": {
        "whatsAppApi": {
          "id": "k1o5E0dQ9sRIo9pB",
          "name": "WhatsApp account"
        }
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "4cfcb3d6-cf04-4278-ba04-65106b76e543",
  "connections": {
    "7445df59-15a2-4734-a871-2d1559546523": {
      "main": [
        [
          {
            "node": "81f8deee-e06b-496d-9c3b-b7edde36a79a",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "8edafb90-588a-40ca-93b5-366fa5cbcf71",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "30eca11b-6aae-4db7-ad0a-1c58d6311d5a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "78c748ca-531b-4aaa-8d75-471bfe96d8d7": {
      "main": [
        [
          {
            "node": "ec2b6512-76a0-4f25-a0eb-0f14615b070f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Conversation Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent - Handle Complex Queries",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "d5e00bfe-a374-46f6-a058-e5c6d9bab965": {
      "main": [
        [
          {
            "node": "7445df59-15a2-4734-a871-2d1559546523",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "6454f0d9-1b24-4dec-820d-073ce268d1a2": {
      "main": [
        [
          {
            "node": "AI Agent - Handle Complex Queries",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent - Handle Complex Queries",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "30eca11b-6aae-4db7-ad0a-1c58d6311d5a": {
      "main": [
        [
          {
            "node": "6454f0d9-1b24-4dec-820d-073ce268d1a2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "81f8deee-e06b-496d-9c3b-b7edde36a79a": {
      "main": [
        [
          {
            "node": "6454f0d9-1b24-4dec-820d-073ce268d1a2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "06578f8a-5296-4b4e-a8d8-5757a5a346ca": {
      "main": [
        [
          {
            "node": "d5e00bfe-a374-46f6-a058-e5c6d9bab965",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "8edafb90-588a-40ca-93b5-366fa5cbcf71": {
      "main": [
        [
          {
            "node": "6454f0d9-1b24-4dec-820d-073ce268d1a2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent - Handle Complex Queries": {
      "main": [
        [
          {
            "node": "78c748ca-531b-4aaa-8d75-471bfe96d8d7",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "7fb04cfb-53c6-4424-96a4-0a28d0e2c551": {
      "main": [
        [
          {
            "node": "06578f8a-5296-4b4e-a8d8-5757a5a346ca",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "50a654e2-7c70-4b0c-99be-ca2ba890961e": {
      "ai_tool": [
        [
          {
            "node": "AI Agent - Handle Complex Queries",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}
Foire aux questions

Comment utiliser ce workflow ?

Copiez le code de configuration JSON ci-dessus, créez un nouveau workflow dans votre instance n8n et sélectionnez "Importer depuis le JSON", collez la configuration et modifiez les paramètres d'authentification selon vos besoins.

Dans quelles scénarios ce workflow est-il adapté ?

Avancé - Chatbot de support, Chatbot IA

Est-ce payant ?

Ce workflow est entièrement gratuit et peut être utilisé directement. Veuillez noter que les services tiers utilisés dans le workflow (comme l'API OpenAI) peuvent nécessiter un paiement de votre part.

Workflows recommandés

Plugin de réponses automatiques IA pour les médias sociaux (Instagram, Facebook et WhatsApp)
Système de réponse automatique aux messages des médias sociaux par IA basé sur Llama 3.2 (Instagram, Facebook, WhatsApp)
Code
Switch
Webhook
+
Code
Switch
Webhook
12 NœudsOneclick AI Squad
Chatbot de support
Système de réception WhatsApp pour l'accueil d'hôtel
Système de réception d'hôtel intégrant WhatsApp, commutation de modèle Gemini, Redis et Google Sheets
Code
Redis
Whats App
+
Code
Redis
Whats App
18 NœudsAkshay
Chatbot de support
Assistant personnel AI multi-agents avancé (250+ capacités de tâches, WhatsApp + GPT)
Assistant personnel multi-agent avancé IA (250+ tâches, WhatsApp + GPT)
Set
Switch
Whats App
+
Set
Switch
Whats App
213 NœudsElectrabot
Productivité personnelle
Construire un assistant WhatsApp avec mémoire, Google Workspace et imagerie de recherche multi-IA
Construire un assistant WhatsApp avec mémoire, Google Workspace et multiples outils de recherche par imagerie d'IA
If
Set
Code
+
If
Set
Code
71 NœudsIniyavan JC
Chatbot IA
Créer un assistant IA WhatsApp avec Llama-4 et les informations de Google Search
Utiliser LLaMA 4 et les informations Google Search pour créer un assistant IA WhatsApp
Set
Switch
Whats App
+
Set
Switch
Whats App
12 NœudsManav Desai
Chatbot de support
Automatisation du support client WhatsApp avec transcription vocale, FAQ et planification de rendez-vous
Support client WhatsApp automatisé, avec transcription vocale, FAQ et planification de rendez-vous
If
Set
Switch
+
If
Set
Switch
23 NœudsAureusR
Divers
Informations sur le workflow
Niveau de difficulté
Avancé
Nombre de nœuds20
Catégorie2
Types de nœuds9
Description de la difficulté

Adapté aux utilisateurs avancés, avec des workflows complexes contenant 16+ nœuds

Liens externes
Voir sur n8n.io

Partager ce workflow

Catégories

Catégories: 34