AutomationFlowsAI & RAG › Conversational GPT-4.1 Chatbot Collects Leads to Google Sheets

Conversational GPT-4.1 Chatbot Collects Leads to Google Sheets

Original n8n title: Collect Leads with a Conversational Gpt-4.1 Chatbot and Google Sheets

ByIncrementors @incrementors on n8n.io

A natural conversational AI chatbot that collects lead information (Name, Phone, Email, Message) one question at a time without feeling like a form. Uses session-based memory to track conversations, intelligently asks only for missing details, and saves complete leads to Google…

Webhook trigger★★★☆☆ complexityAI-powered10 nodesAgentOpenAI ChatMemory Buffer WindowGoogle Sheets
AI & RAG Trigger: Webhook Nodes: 10 Complexity: ★★★☆☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #13250 — we link there as the canonical source.

This workflow follows the Agent → Google Sheets recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "nodes": [
    {
      "id": "42d8a3f9-abdf-405c-83f0-d0e8d9751e5e",
      "name": "Receive User Message via Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        64,
        -16
      ],
      "parameters": {
        "path": "ff8b6142-d902-41ca-a666-a9e734e8ef14",
        "options": {}
      },
      "typeVersion": 2.1
    },
    {
      "id": "f097a9a1-0232-453c-95e8-43ee1e71d018",
      "name": "Conversational Lead Collection Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        384,
        -16
      ],
      "parameters": {
        "text": "=## User Message\n{{ $json.query.message }}",
        "options": {
          "systemMessage": "=You are a conversational booking assistant for Spark Writers' Retreat.\n\nYour responsibility is to chat naturally with the user and collect these four details:\n1. Name\n2. Phone number\n3. Email address\n4. User message / requirement\n\nConversation rules:\n- Ask only ONE question at a time.\n- Never ask for information that is already collected.\n- If the user gives unclear or invalid input, politely ask again.\n- Keep replies short and friendly.\n- Do not sound like a form or bot.\n\nFlow logic:\n- If Name is missing \u2192 ask for name.\n- If Phone number is missing \u2192 ask for phone number.\n- If Email is missing \u2192 ask for email address.\n- If Message is missing \u2192 ask how you can help.\n\nTool usage (VERY IMPORTANT):\n- Only use the Google Sheets tool AFTER all four details are confidently collected.\n- Do NOT write to the sheet if any field is missing.\n- Write exactly ONE row per user conversation.\n\nData mapping:\n- Name \u2192 Name\n- Phone number \u2192 Phone_No_\n- Email \u2192 Email\n- User message \u2192 Message\n\nAfter successfully writing to the Google Sheet:\n- Thank the user politely.\n- Confirm that the team will contact them shortly.\n\nDo NOT:\n- Mention Google Sheets, tools, backend, webhook, or automation.\n- Save partial or guessed data.\n- Repeat questions unnecessarily.\n\nFinal user message:\n\"Thank you! \ud83d\ude4f We\u2019ve received your details and our team will get back to you shortly.\""
        },
        "promptType": "define"
      },
      "typeVersion": 3.1
    },
    {
      "id": "92930286-b494-45fe-bddf-7a44891423a1",
      "name": "OpenAI GPT-4.1 Mini Language Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        304,
        208
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {},
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "7513a489-35e7-4423-bae9-f0c668ec7c29",
      "name": "Session Memory with Timestamp",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        480,
        208
      ],
      "parameters": {
        "sessionKey": "={{ $('Receive User Message via Webhook').item.json.query.timestamp }}",
        "sessionIdType": "customKey"
      },
      "typeVersion": 1.3
    },
    {
      "id": "79705264-3171-4180-8a3c-a29e95cb93e2",
      "name": "Save Lead to Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        784,
        -16
      ],
      "parameters": {
        "columns": {
          "value": {
            "Name": "={{ $('Receive User Message via Webhook').item.json.query.name }}",
            "Email": "={{ $('Receive User Message via Webhook').item.json.query.email }}",
            "Message": "={{ $('Receive User Message via Webhook').item.json.query.message }}",
            "Phone No.": "={{ $('Receive User Message via Webhook').item.json.query.phone }}",
            "Timestamp": "={{ $('Receive User Message via Webhook').item.json.query.timestamp }}"
          },
          "schema": [
            {
              "id": "Timestamp",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Timestamp",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Phone No.",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Phone No.",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Message",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Message",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Timestamp"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 768094711,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1L709LroC9hYWF1EI4snFgTEzlSVT7aFwTb5mdGNO8NQ/edit#gid=768094711",
          "cachedResultName": "Session Leads"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1L709LroC9hYWF1EI4snFgTEzlSVT7aFwTb5mdGNO8NQ",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1L709LroC9hYWF1EI4snFgTEzlSVT7aFwTb5mdGNO8NQ/edit?usp=drivesdk",
          "cachedResultName": "Sparkwritersretreat.com - Leads Tracking"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "5d7a2403-d11b-4b85-bcc9-fa631795efe5",
      "name": "Send AI Reply to User",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1088,
        -16
      ],
      "parameters": {
        "options": {},
        "respondWith": "allIncomingItems"
      },
      "typeVersion": 1.5
    },
    {
      "id": "01b09ab4-a6ea-4e29-a9c1-cdf5ed7162ae",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -480,
        -256
      ],
      "parameters": {
        "width": 432,
        "height": 752,
        "content": "## AI Booking Chatbot with Lead Collection\n\nThis workflow creates a conversational AI chatbot that naturally\ncollects lead information (Name, Phone, Email, Message) one\nquestion at a time\u2014without feeling like a form. The AI remembers\nthe conversation context using session-based memory, asks only\nfor missing details, and saves complete leads to Google Sheets.\nPerfect for booking systems, contact forms, or any lead capture\nthat needs a human-like conversation experience.\n\n## How it works\n1. User sends a message through webhook integration.\n2. AI checks which details are already collected vs. missing.\n3. Asks ONE question at a time in natural, friendly language.\n4. Session memory tracks the conversation using timestamp ID.\n5. Once all 4 fields collected, AI saves lead to Google Sheets.\n6. Sends confirmation message and AI reply back to user.\n\n## Setup steps\n1. Connect Google Sheets OAuth credentials.\n2. Add OpenAI API key for GPT-4.1-mini model.\n3. Update Google Sheet URL and sheet name in save node.\n4. Copy webhook URL and integrate with your website/app.\n5. Test by sending messages with query parameters."
      },
      "typeVersion": 1
    },
    {
      "id": "c565861e-a63a-4ece-8665-2b5f1810b7a7",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        64,
        -176
      ],
      "parameters": {
        "color": 7,
        "width": 544,
        "height": 208,
        "content": "## Message Receive & AI Processing\n\nReceives user messages via webhook, processes\nthem through the conversational AI agent that\nintelligently asks for missing lead information."
      },
      "typeVersion": 1
    },
    {
      "id": "678385ae-f5da-4e9f-9abc-43664dff705a",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        640,
        -176
      ],
      "parameters": {
        "color": 7,
        "width": 320,
        "height": 208,
        "content": "##  Lead Storage\n\nOnce all 4 details are collected (Name, Phone,\nEmail, Message), the AI saves the complete\nlead data to Google Sheets using timestamp."
      },
      "typeVersion": 1
    },
    {
      "id": "9942d548-022d-4132-ab6e-2b90e33b4299",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        976,
        -176
      ],
      "parameters": {
        "color": 7,
        "width": 288,
        "height": 208,
        "content": "## Response Delivery\n\nSends the AI's conversational reply back\nto the user via webhook, continuing the\nnatural conversation flow."
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Save Lead to Google Sheets": {
      "main": [
        [
          {
            "node": "Send AI Reply to User",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Session Memory with Timestamp": {
      "ai_memory": [
        [
          {
            "node": "Conversational Lead Collection Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Receive User Message via Webhook": {
      "main": [
        [
          {
            "node": "Conversational Lead Collection Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI GPT-4.1 Mini Language Model": {
      "ai_languageModel": [
        [
          {
            "node": "Conversational Lead Collection Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Conversational Lead Collection Agent": {
      "main": [
        [
          {
            "node": "Save Lead to Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

A natural conversational AI chatbot that collects lead information (Name, Phone, Email, Message) one question at a time without feeling like a form. Uses session-based memory to track conversations, intelligently asks only for missing details, and saves complete leads to Google…

Source: https://n8n.io/workflows/13250/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

12-Automate_WhatsApp_Booking_System_with_GPT_4_Assistant__Cal_com_and_SMS_Reminders. Uses agent, lmChatOpenAi, memoryBufferWindow, googleSheetsTool. Webhook trigger; 26 nodes.

Agent, OpenAI Chat, Memory Buffer Window +5
AI & RAG

12-Automate_WhatsApp_Booking_System_with_GPT_4_Assistant__Cal_com_and_SMS_Reminders. Uses agent, lmChatOpenAi, memoryBufferWindow, googleSheetsTool. Webhook trigger; 26 nodes.

Agent, OpenAI Chat, Memory Buffer Window +5
AI & RAG

Automate_WhatsApp_Booking_System_with_GPT_4_Assistant__Cal_com_and_SMS_Reminders. Uses agent, lmChatOpenAi, memoryBufferWindow, googleSheetsTool. Webhook trigger; 26 nodes.

Agent, OpenAI Chat, Memory Buffer Window +5
AI & RAG

This workflow is designed for solo entrepreneurs, consultants, coaches, clinics, or any business that handles client appointments and wants to automate the entire scheduling experience via WhatsApp —

Agent, OpenAI Chat, Memory Buffer Window +5
AI & RAG

Automate WhatsApp bookings with an AI assistant and smart SMS reminders (24/7). Uses agent, lmChatOpenAi, memoryBufferWindow, googleSheetsTool. Webhook trigger; 25 nodes.

Agent, OpenAI Chat, Memory Buffer Window +5