{
  "name": "WhatsApp AI agent: answer FAQs and capture bookings (official WhatsApp Cloud API)",
  "nodes": [
    {
      "parameters": {
        "content": "## WhatsApp AI agent\nUses the official WhatsApp Business Cloud API.\nThe agent answers from your FAQ sheet and logs booking requests.\n1. Connect WhatsApp (Meta), OpenAI and Google Sheets\n2. Edit the system message with your business details\n3. Replies outside the 24-hour window need approved templates\n\nBuilt by SixSol Technologies · sixsol.co.uk",
        "height": 340,
        "width": 460
      },
      "id": "34cf967f-8b29-5892-aa45-c04233e38313",
      "name": "Read me",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -100,
        -320
      ]
    },
    {
      "parameters": {
        "updates": [
          "messages"
        ]
      },
      "id": "57ba5f2f-b670-5c06-bb91-2b6559f25d37",
      "name": "WhatsApp message",
      "type": "n8n-nodes-base.whatsAppTrigger",
      "typeVersion": 1,
      "position": [
        0,
        80
      ],
      "webhookId": "91c4f4fe-08e7-50de-ab20-82d2cb3d2f66"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose"
          },
          "conditions": [
            {
              "id": "c1",
              "leftValue": "={{ $json.messages?.[0]?.type }}",
              "rightValue": "text",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "035ba86b-c13f-530e-8ad0-f7bf743074b0",
      "name": "Text only",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        200,
        80
      ]
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.messages[0].text.body }}",
        "options": {
          "systemMessage": "You are the WhatsApp assistant for YOUR BUSINESS. Answer only from the FAQ tool. Be brief and friendly. If the customer wants to book, collect name, preferred date and time, then call the booking tool. If you are unsure, say a team member will reply soon."
        }
      },
      "id": "b68756f6-1285-571a-9d14-63abc783b9ff",
      "name": "AI agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.7,
      "position": [
        440,
        80
      ]
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "id": "45fe5259-9764-5ca7-9bad-723c200d47d2",
      "name": "OpenAI model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        340,
        300
      ]
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $('WhatsApp message').item.json.contacts[0].wa_id }}",
        "contextWindowLength": 8
      },
      "id": "9c292155-4623-5feb-81dd-1f8a26b8e5ec",
      "name": "Chat memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        480,
        300
      ]
    },
    {
      "parameters": {
        "descriptionType": "manual",
        "toolDescription": "Read the business FAQ: questions, answers, prices and opening hours.",
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": "https://docs.google.com/spreadsheets/d/YOUR_SHEET_ID/edit"
        },
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "FAQ"
        },
        "options": {}
      },
      "id": "5fc4e932-ca3c-52a6-a17d-6648d980a95d",
      "name": "FAQ sheet",
      "type": "n8n-nodes-base.googleSheetsTool",
      "typeVersion": 4.5,
      "position": [
        620,
        300
      ]
    },
    {
      "parameters": {
        "operation": "append",
        "descriptionType": "manual",
        "toolDescription": "Save a booking request with name, date, time and phone.",
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": "https://docs.google.com/spreadsheets/d/YOUR_SHEET_ID/edit"
        },
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Bookings"
        },
        "columns": {
          "mappingMode": "autoMapInputData",
          "value": {}
        },
        "options": {}
      },
      "id": "32ccdcf3-2d8c-5ef4-9056-66b2948346d5",
      "name": "Log booking",
      "type": "n8n-nodes-base.googleSheetsTool",
      "typeVersion": 4.5,
      "position": [
        760,
        300
      ]
    },
    {
      "parameters": {
        "operation": "send",
        "phoneNumberId": "YOUR_PHONE_NUMBER_ID",
        "recipientPhoneNumber": "={{ $('WhatsApp message').item.json.contacts[0].wa_id }}",
        "textBody": "={{ $json.output }}",
        "additionalFields": {}
      },
      "id": "56ad0022-0271-5fd0-bbac-6f9d0de21a85",
      "name": "Send reply",
      "type": "n8n-nodes-base.whatsApp",
      "typeVersion": 1,
      "position": [
        820,
        80
      ]
    }
  ],
  "connections": {
    "WhatsApp message": {
      "main": [
        [
          {
            "node": "Text only",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Text only": {
      "main": [
        [
          {
            "node": "AI agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI agent": {
      "main": [
        [
          {
            "node": "Send reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI model": {
      "ai_languageModel": [
        [
          {
            "node": "AI agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Chat memory": {
      "ai_memory": [
        [
          {
            "node": "AI agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "FAQ sheet": {
      "ai_tool": [
        [
          {
            "node": "AI agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Log booking": {
      "ai_tool": [
        [
          {
            "node": "AI agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": false,
    "templateBy": "SixSol Technologies · https://www.sixsol.co.uk/n8n-templates/"
  },
  "tags": []
}