AI website chatbot with CRM lead collection using GPT and Google Sheets
This n8n training workflow demonstrates how to connect a sub-workflow as a tool to an AI Agent. In this example, the main workflow is a Website Chatbot that engages visitors, collects contact information, and sends th...
Template notes
This n8n training workflow demonstrates how to connect a sub-workflow as a tool to an AI Agent. In this example, the main workflow is a Website Chatbot that engages visitors, collects contact information, and sends that data to a CRM process. The CRM process itself is a separate sub-workflow, connected to the agent as a tool via the Tool Workflow node.
---
Step-by-Step Setup Instructions
1. Create the Sub-Workflow (CRM Tool) This sub-workflow will be triggered by the AI agent to process collected information. It will: 1. Receive inputs (email, description) from the main chatbot workflow. 2. Format the data into a structured JSON format. 3. Append the data to a Google Sheet (acting as the CRM database). 4. Send a confirmation message back to the main workflow.
Steps inside the sub-workflow: - When Executed by Another Workflow – Triggered by the main workflow’s tool node. - Convert Conversation (Agent) – Uses OpenAI to extract and format the input into a JSON structure: json { "email": "jane.doe@example.com", "description": "Wants help automating lead intake and sending Slack notifications." }
Structured Output Parser – Ensures the extracted data matches the expected JSON schema.
Append row in sheet (Google Sheets) – Adds the new lead data to your CRM sheet.
Code Node – Returns a simple text confirmation like "Thanks for the info, we will be in touch soon".