I’m building a webchat bot in n8n for a simple restaurant booking flow. i need button on my chat bot

Describe the problem/error/question

What is the error message (if any)?

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.){
  "nodes": [
    {
      "parameters": {
        "public": true,
        "initialMessages": "Hi there! šŸ‘‹ Do you want to book a table?",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.3,
      "position": [
        1504,
        1008
      ],
      "id": "3a6fc22a-5359-4a91-8062-288df58297f5",
      "name": "When chat message received",
      "webhookId": "your-webhook-id"
    },
    {
      "parameters": {
        "jsCode": "const payload = $json.payload || \"\";\n\nif (payload === \"YES_BOOK\") {\n\t// If 'Yes' is clicked, prepare intent to check availability\n\treturn [{ json: { intent: \"check_availability\" } }];\n} else if (payload === \"NO_BOOK\") {\n\t// If 'No' is clicked, send a closing message\n\treturn [{ json: { text: \"Okay! Let me know if you need anything else.\" } }];\n} else {\n\t// FALLBACK: This runs for any other input (like 'hi') and outputs the buttons.\n\treturn [\n\t\t{\n\t\t\tjson: {\n\t\t\t\ttext: \"Hi there! šŸ‘‹ Do you want to book a table?\",\n\t\t\t\tbuttons: [\n\t\t\t\t\t{ type: \"reply\", title: \"Yes\", payload: \"YES_BOOK\" },\n\t\t\t\t\t{ type: \"reply\", title: \"No\", payload: \"NO_BOOK\" }\n\t\t\t\t]\n\t\t\t}\n\t\t}\n\t];\n}\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1744,
        1008
      ],
      "id": "cc213f36-e9d8-45ed-a9ba-86bfaaa62a7b",
      "name": "Handle Yes/No5"
    },
    {
      "parameters": {
        "jsCode": "const ignoreColumns = [\"Table No.\", \"Capacity\", \"Notes\"];\nlet availableTables = [];\n\nfor (let i = 0; i < $input.all().length; i++) {\n\tconst row = $input.all()[i].json;\n\tif (!row) continue;\n\n\tconst tableNo = row[\"Table No.\"]?.toString().trim();\n\tif (!tableNo) continue;\n\n\tconst timeSlots = Object.keys(row).filter(key => !ignoreColumns.includes(key));\n\tfor (const time of timeSlots) {\n\t\tconst status = row[time] != null ? row[time].toString().trim() : \"\";\n\t\tif (status.toLowerCase() === \"available\") {\n\t\t\tavailableTables.push(`Table ${tableNo} at ${time}`);\n\t\t}\n\t}\n}\n\nreturn [\n\t{\n\t\tjson: {\n\t\t\ttext: availableTables.length > 0\n\t\t\t\t? \"Here are the available tables:\\n\" + availableTables.join(\"\\n\")\n\t\t\t\t: \"Sorry, no tables are available at the moment.\"\n\t\t}\n\t}\n];\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        2144,
        1008
      ],
      "id": "f5859dda-7dfe-47c6-a3bd-21a5ea106fa7",
      "name": "Show Available Tables6"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "You are a restaurant reservation assistant bot.\n\nRules:\n1. If the user wants to book a table (e.g., 'I want to reserve', 'Book a table', 'Show tables'), respond with { \"intent\": \"check_availability\" }.\n2. If the user clicks Yes/No or table buttons, your workflow handles it, do nothing here.\n3. If the user says something unrelated (greetings, menu, hours), respond naturally in plain text.\nAlways keep responses polite and concise.",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2.2,
      "position": [
        2336,
        1008
      ],
      "id": "31a34125-4470-4376-b0c9-c902e1956633",
      "name": "AI Agent6"
    },
    {
      "parameters": {
        "documentId": {
          "__rl": true,
          "value": "1ypsWuP8PbbppnhvNtC6Db4wOIfu_o9linqF9pkGXZ5E",
          "mode": "list",
          "cachedResultName": "sample",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ypsWuP8PbbppnhvNtC6Db4wOIfu_o9linqF9pkGXZ5E/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Sheet1",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ypsWuP8PbbppnhvNtC6Db4wOIfu_o9linqF9pkGXZ5E/edit#gid=0"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        1952,
        1008
      ],
      "id": "c7ba5a9f-ae18-4d64-a66b-695a3e714055",
      "name": "Get row(s) in sheet6"
    },
    {
      "parameters": {
        "contextWindowLength": 15
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        2352,
        1216
      ],
      "id": "12d1f052-2e62-4d78-8307-33e1a9073adb",
      "name": "Simple Memory6",
      "disabled": true
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        2208,
        1216
      ],
      "id": "5dbf228b-2fb6-4a34-afe4-050fbc4945be",
      "name": "OpenAI Chat Model1"
    }
  ],
  "connections": {
    "When chat message received": {
      "main": [
        [
          {
            "node": "Handle Yes/No5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Handle Yes/No5": {
      "main": [
        [
          {
            "node": "Get row(s) in sheet6",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Show Available Tables6": {
      "main": [
        [
          {
            "node": "AI Agent6",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) in sheet6": {
      "main": [
        [
          {
            "node": "Show Available Tables6",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory6": {
      "ai_memory": [
        [
          {
            "node": "AI Agent6",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent6",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "42d7c7b5b50aca77104aa1d3fc4424f10846c3761dd2e5253827266277c282c5"
  }
}

Share the output returned by the last node

Information on your n8n setup

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system: