Automatische Bearbeitung des Kundensupports mit einem WhatsApp-KI-Assistenten und Google Docs sowie Gemini

Fortgeschritten

Dies ist ein Support Chatbot, AI Chatbot-Bereich Automatisierungsworkflow mit 14 Nodes. Hauptsächlich werden If, Code, Webhook, DateTime, GoogleDocs und andere Nodes verwendet. Automatisierte Bearbeitung von Kunden-Support über WhatsApp mit KI-Assistent, Google Docs und Gemini

Voraussetzungen
  • HTTP Webhook-Endpunkt (wird von n8n automatisch generiert)
  • Google Sheets API-Anmeldedaten
  • Google Gemini API Key
Workflow-Vorschau
Visualisierung der Node-Verbindungen, mit Zoom und Pan
Workflow exportieren
Kopieren Sie die folgende JSON-Konfiguration und importieren Sie sie in n8n
{
  "meta": {
    "instanceId": "e42ff03bc515cd7f9edc081a89072ca1985132e0d4a1cdabe6c26855a252768f",
    "templateId": "4966"
  },
  "nodes": [
    {
      "id": "02f761e2-83c4-488b-91f4-f4ae11b15c00",
      "name": "KI-Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "maxTries": 5,
      "position": [
        1420,
        680
      ],
      "parameters": {
        "text": "={{ $json.finalPrompt }}\n\n\n",
        "options": {
          "systemMessage": "You are [Company]’s support assistant for Black Ball Sporting Club.\n• Do NOT include any preamble such as “Based on the document you provided” or “Okay, [Name].” Just jump straight to the answer.\n* don't ever start your response with\"based on the document you provided\" , or \"According to the document\", don't mention any documents at all , also don't mention today's date unless you asked\n"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "retryOnFail": false,
      "typeVersion": 1.7,
      "alwaysOutputData": true,
      "waitBetweenTries": null
    },
    {
      "id": "57ecb397-5772-4db3-8a5a-ce28a4e01e63",
      "name": "Antwort bereinigen",
      "type": "n8n-nodes-base.code",
      "position": [
        2680,
        580
      ],
      "parameters": {
        "jsCode": "// cleanAnswer – run once per item\nlet txt = $('AI Agent').first().json.output || '';\n\n// 1. Remove bold / italic / strike markers\ntxt = txt.replace(/[*_~]+/g, '');\n\n// 2. Convert [Texto](https://url) → Texto https://url\ntxt = txt.replace(/\\[([^\\]]+)\\]\\((https?:\\/\\/[^\\s)]+)\\)/g, '$1 $2');\n\n// 3. Collapse 3+ blank lines\ntxt = txt.replace(/\\n{3,}/g, '\\n\\n').trim();\n\n// 4. Remove the unwanted source-reference preamble\ntxt = txt.replace(/^.*?based on the document you provided[,:]?\\s*/i, '');\n\nreturn [{ json: { answer: txt } }];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "d70cf8b1-8c24-44f2-9b37-5205b130cff2",
      "name": "24-Stunden-Fenster prüfen",
      "type": "n8n-nodes-base.code",
      "position": [
        2240,
        680
      ],
      "parameters": {
        "jsCode": "// within24h?  – run once per item\n// Meta (WhatsApp) timestamp arrives as seconds since epoch\nconst lastTs = Number($('when message received').first().json.messages[0].timestamp) * 1000;   // → ms\nconst withinWindow = Date.now() - lastTs < 24 * 60 * 60 * 1000;\n\nreturn [{ json: { withinWindow, answer: $json.answer, userId: $json.userId } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "66c83de5-413a-440f-804e-15b137beb873",
      "name": "Wenn",
      "type": "n8n-nodes-base.if",
      "position": [
        2460,
        680
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "d33e218e-a49a-49ed-9c6b-55b9ea0b0dbb",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.withinWindow }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "c9d931c3-d88c-4d15-b8fe-787327c0200a",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        1380,
        900
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.5-flash-preview-04-17-thinking"
      },
      "typeVersion": 1
    },
    {
      "id": "df46b528-cbbd-49c2-9b83-4402ef0c8ac7",
      "name": "Prompt vorbereiten",
      "type": "n8n-nodes-base.aiTransform",
      "position": [
        1200,
        680
      ],
      "parameters": {
        "jsCode": "const googleDocs = $input.all().map((item) => item.json);\nconst whatsappMessages = $(\"when message received\")\n  .all()\n  .map((item) => item.json);\n\nconst date = new Date();\nconst formattedDate = `${date.getMonth() + 1} ${date.getDate()}, ${date.getFullYear()}`;\n\nconst docText = googleDocs[0].content.split(\"\\n\").join(\" \");\n\nconst body = whatsappMessages[0].messages[0].text.body;\n\nconst finalPrompt = `Today's date is: ${formattedDate}\\n\\n${docText}\\n\\nUser's question:\\n${body}`;\n\nreturn { finalPrompt };\n",
        "instructions": "Write code to:\n• Get today’s date formatted “Month Day, Year”\n• Extract the Google Doc’s plain text by joining its body.content textRuns\n• Extract the WhatsApp message from messages[0].text.body\n• Build a field finalPrompt exactly as:\n\nvbnet\nCopy\nEdit\nToday's date is: [date]\n\n[doc text]\n\nUser's question:\n[body]\n• Return finalPrompt only.",
        "codeGeneratedForPrompt": "Write code to:\n• Get today’s date formatted “Month Day, Year”\n• Extract the Google Doc’s plain text by joining its body.content textRuns\n• Extract the WhatsApp message from messages[0].text.body\n• Build a field finalPrompt exactly as:\n\nvbnet\nCopy\nEdit\nToday's date is: [date]\n\n[doc text]\n\nUser's question:\n[body]\n• Return finalPrompt only."
      },
      "typeVersion": 1
    },
    {
      "id": "19de46dc-add8-4cad-81a9-6e5b341f1f33",
      "name": "Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2020,
        680
      ],
      "parameters": {},
      "credentials": {},
      "typeVersion": 4.6
    },
    {
      "id": "b622392e-65dc-4d27-a5f9-d27ea57aae61",
      "name": "Datum & Uhrzeit",
      "type": "n8n-nodes-base.dateTime",
      "position": [
        1800,
        680
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 2
    },
    {
      "id": "a6ae2118-9d68-4fb0-b975-b9c6d4170e00",
      "name": "Haftnotiz",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        380,
        240
      ],
      "parameters": {
        "height": 1520,
        "content": "# WhatsApp AI Assistant \n\n**No Business Verification Required\nInstant activation with full WhatsApp Group support.**\n\n**Instantly answer WhatsApp questions using your internal documents. No AI training required.**\n\n*Skip the complex WhatsApp Business Cloud API setup - WhapAround solve that problem for you.*\n\n## How It Works\nYour assistant reads a live Google Doc, processes incoming WhatsApp messages, generates AI responses using OpenAI/Gemini, and sends replies automatically.\n\n## Requirements\n- **WhapAround Account**: https://whaparound.pro/ (eliminates need for WhatsApp Business Cloud API configuration)\n- **Google Doc** with your business content\n- **API Key**: OpenAI or Gemini\n- **Database** (optional): PostgreSQL memory setup - https://www.youtube.com/watch?v=JjBofKJnYIU\n\n## Quick Setup\n1. Add your Google Doc ID to the Docs node\n2. Connect WhatsApp webhook (follow provided guidance)\n3. Map the message field\n4. Connect your AI provider (OpenAI/Gemini)\n5. Test with a live message\n\n## Professional Setup Services\nNeed help with implementation? We provide:\n- **Easy WhatsApp connection** (bypass WhatsApp Business Cloud API complexity entirely)\n- Google OAuth & document structure\n- AI model configuration\n- Custom branding & tone\n- Logging & escalation systems\n\n**Contact**: andrea@jamot.pro | WhatsApp: +16508665016"
      },
      "typeVersion": 1
    },
    {
      "id": "8f4a786b-fc6d-4e2f-b8df-c605475afc81",
      "name": "Unternehmenswissen",
      "type": "n8n-nodes-base.googleDocs",
      "position": [
        980,
        680
      ],
      "parameters": {
        "operation": "get",
        "documentURL": "=1Uv1WYCcXNlp-jaeJ7-3MNxWYfPj-wcYnJv4_colXSvk"
      },
      "typeVersion": 2
    },
    {
      "id": "a6de89dd-ada0-432c-9f8e-ece38264ad81",
      "name": "Einfacher Speicher",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        1500,
        900
      ],
      "parameters": {
        "sessionKey": "={{ $('when message received').item.json.contacts[0].wa_id }}",
        "sessionIdType": "customKey"
      },
      "typeVersion": 1.3
    },
    {
      "id": "bc950073-fd3c-45e6-bb14-d2d361418725",
      "name": "WhapAround - Zuhören",
      "type": "n8n-nodes-base.webhook",
      "position": [
        720,
        680
      ],
      "webhookId": "30720c7c-18f4-4815-be3b-03343d53ee45",
      "parameters": {
        "path": "30720c7c-18f4-4815-be3b-03343d53ee45",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 2
    },
    {
      "id": "ce59dedc-9e76-4d68-a3d7-721a58593c92",
      "name": "WhapAround - Nachricht beantworten",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        2920,
        580
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "b88bce3f-8aa1-4cc1-9d0f-31f229cc19de",
      "name": "WhapAround - Vorlage beantworten",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        2700,
        800
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.2
    }
  ],
  "pinData": {},
  "connections": {
    "66c83de5-413a-440f-804e-15b137beb873": {
      "main": [
        [
          {
            "node": "57ecb397-5772-4db3-8a5a-ce28a4e01e63",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "b88bce3f-8aa1-4cc1-9d0f-31f229cc19de",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "02f761e2-83c4-488b-91f4-f4ae11b15c00": {
      "main": [
        [
          {
            "node": "b622392e-65dc-4d27-a5f9-d27ea57aae61",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "b622392e-65dc-4d27-a5f9-d27ea57aae61": {
      "main": [
        [
          {
            "node": "19de46dc-add8-4cad-81a9-6e5b341f1f33",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "57ecb397-5772-4db3-8a5a-ce28a4e01e63": {
      "main": [
        [
          {
            "node": "ce59dedc-9e76-4d68-a3d7-721a58593c92",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "19de46dc-add8-4cad-81a9-6e5b341f1f33": {
      "main": [
        [
          {
            "node": "d70cf8b1-8c24-44f2-9b37-5205b130cff2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a6de89dd-ada0-432c-9f8e-ece38264ad81": {
      "ai_memory": [
        [
          {
            "node": "02f761e2-83c4-488b-91f4-f4ae11b15c00",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "df46b528-cbbd-49c2-9b83-4402ef0c8ac7": {
      "main": [
        [
          {
            "node": "02f761e2-83c4-488b-91f4-f4ae11b15c00",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "8f4a786b-fc6d-4e2f-b8df-c605475afc81": {
      "main": [
        [
          {
            "node": "df46b528-cbbd-49c2-9b83-4402ef0c8ac7",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d70cf8b1-8c24-44f2-9b37-5205b130cff2": {
      "main": [
        [
          {
            "node": "66c83de5-413a-440f-804e-15b137beb873",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "bc950073-fd3c-45e6-bb14-d2d361418725": {
      "main": [
        [
          {
            "node": "8f4a786b-fc6d-4e2f-b8df-c605475afc81",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "c9d931c3-d88c-4d15-b8fe-787327c0200a": {
      "ai_languageModel": [
        [
          {
            "node": "02f761e2-83c4-488b-91f4-f4ae11b15c00",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  }
}
Häufig gestellte Fragen

Wie verwende ich diesen Workflow?

Kopieren Sie den obigen JSON-Code, erstellen Sie einen neuen Workflow in Ihrer n8n-Instanz und wählen Sie "Aus JSON importieren". Fügen Sie die Konfiguration ein und passen Sie die Anmeldedaten nach Bedarf an.

Für welche Szenarien ist dieser Workflow geeignet?

Fortgeschritten - Support-Chatbot, KI-Chatbot

Ist es kostenpflichtig?

Dieser Workflow ist völlig kostenlos. Beachten Sie jedoch, dass Drittanbieterdienste (wie OpenAI API), die im Workflow verwendet werden, möglicherweise kostenpflichtig sind.

Workflow-Informationen
Schwierigkeitsgrad
Fortgeschritten
Anzahl der Nodes14
Kategorie2
Node-Typen12
Schwierigkeitsbeschreibung

Für erfahrene Benutzer, mittelkomplexe Workflows mit 6-15 Nodes

Autor
Jamot

Jamot

@jamot

Elevating Human Well-being Through Accessible AI Technologies.

Externe Links
Auf n8n.io ansehen

Diesen Workflow teilen

Kategorien

Kategorien: 34