This workflow corresponds to n8n.io template #6656 — we link there as the canonical source.
This workflow follows the Agent → Chat Trigger 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 →
{
"nodes": [
{
"id": "9b686668-2c0e-4c1d-908f-c2954e67b0da",
"name": "When chat message received",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
20,
580
],
"parameters": {
"public": true,
"options": {}
},
"typeVersion": 1.1
},
{
"id": "851344f4-1862-4bc6-9ea6-1f17831a706f",
"name": "When clicking \u2018Test workflow\u2019",
"type": "n8n-nodes-base.manualTrigger",
"position": [
0,
0
],
"parameters": {},
"typeVersion": 1
},
{
"id": "a6e3505c-3e7d-43d1-bfb4-b3c2b0a44e46",
"name": "OpenAI Chat Model1",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
400,
300
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "243b3744-ada2-4eaa-bcaf-3ae91e3a4441",
"name": "Structured Output Parser",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
600,
300
],
"parameters": {
"jsonSchemaExample": "{\n \"Name\": \"Alex Chen\",\n \"Is Good Lead\": \"No\",\n \"Reasoning\": \"The customer is interested in buying a single item for personal use.\"\n}\n"
},
"typeVersion": 1.2
},
{
"id": "5177741d-236d-47a6-9ac8-9cb46ba1a3f1",
"name": "Edit Fields1",
"type": "n8n-nodes-base.set",
"position": [
780,
40
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "948759d1-4c0c-4751-a83d-9daa1ec3bb1c",
"name": "Name",
"type": "string",
"value": "={{$json[\"output\"][\"Name\"]}}"
},
{
"id": "91dbdf7b-8f0d-4ae2-ab36-701b01b581e2",
"name": "Good Lead",
"type": "string",
"value": "={{$json[\"output\"][\"Is Good Lead\"]}}"
},
{
"id": "5d38cd05-eb1a-4734-83d2-cdd5ee973ea7",
"name": "Reasoning",
"type": "string",
"value": "={{ $json.output.Reasoning }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "7261e97b-e056-44f5-a98e-b62641ed137e",
"name": "OpenAI Chat Model2",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
240,
800
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "a9207b97-4599-44d4-9cfe-a38d6a5976c0",
"name": "Simple Memory",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
420,
820
],
"parameters": {
"contextWindowLength": 10
},
"typeVersion": 1.3
},
{
"id": "162bcc59-f8ac-4468-900a-a65f52320ec8",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-180,
-60
],
"parameters": {
"width": 1300,
"height": 500,
"content": "## Lead Qualifier Agent\n"
},
"typeVersion": 1
},
{
"id": "45e03054-92b4-4fbb-a9f0-a65bd024f972",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-180,
460
],
"parameters": {
"color": 5,
"width": 1300,
"height": 540,
"content": "## Ecommerce Chatbot\n"
},
"typeVersion": 1
},
{
"id": "19c265f1-ac38-472f-a975-4674a42f89ef",
"name": "Create Sample Data",
"type": "n8n-nodes-base.code",
"position": [
200,
40
],
"parameters": {
"jsCode": "return [\n {\n json: {\n name: \"Jordan Lee\",\n transcript: \"Hi, I'm looking to place a large order of custom mugs for an upcoming corporate event. Probably around 300 units.\"\n }\n },\n {\n json: {\n name: \"Alex Chen\",\n transcript: \"Do you sell just one of these backpacks? I\u2019m shopping for my daughter.\"\n }\n },\n {\n json: {\n name: \"Samira Patel\",\n transcript: \"We\u2019re exploring gifts for our team and might want to add a logo. What's your bulk pricing on notebooks?\"\n }\n },\n {\n json: {\n name: \"Marcus Grant\",\n transcript: \"Just checking shipping times for a single product before I order. Thanks.\"\n }\n }\n];\n"
},
"typeVersion": 2
},
{
"id": "dbf6ef88-e1c3-4cd7-95e9-9fa47b2d81b4",
"name": "Lead Qualifier Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
400,
40
],
"parameters": {
"text": "=Name: {{$json[\"name\"]}}\nTranscript: {{$json[\"transcript\"]}}\n",
"options": {
"systemMessage": "You are a lead qualification assistant for an ecommerce store. Your job is to determine if a customer from a phone call is a good lead for a **bulk order**.\n\nIf they mention:\n- large quantities\n- logos\n- team gifts\n- events\n- wholesale\n- or any indication of buying in bulk\n\nThen classify them as a **good lead**. Otherwise, mark them as not a good lead.\n\nRespond only in valid JSON with:\n- \"Name\": customer\u2019s name\n- \"Is Good Lead\": Yes or No\n- \"Reasoning\": short one-sentence reason"
},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 1.8
},
{
"id": "ef1d7730-6945-4dc6-b8d1-0d8b48c29b10",
"name": "Ecommerce Chatbot",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
300,
580
],
"parameters": {
"options": {
"systemMessage": "\ud83d\udc4b Hi there! I'm your personal assistant here to help you with anything related to our ecommerce store.\n\nI can assist you with:\n- Product information\n- Bulk orders\n- Pricing questions\n- Customization options (like adding a logo)\n- Shipping times and return policies\n\nHere\u2019s how I work:\n- I know the details of our products, pricing, and bulk order discounts.\n- I respond politely, professionally, and clearly.\n- If you're placing a bulk order, I\u2019ll ask for the quantity you need, when you need it, and whether you have your artwork or logo ready.\n\n## Product Pricing (Standard Retail):\n- **Custom Notebook**: $12.00 each \n- **Eco Water Bottle**: $15.00 each \n- **Enamel Mug**: $10.00 each \n- **Canvas Tote Bag**: $14.00 each\n\n## Bulk Discount Tiers:\n- 50+ units: 10% off \n- 100+ units: 15% off \n- 250+ units: 20% off \n- 500+ units: 25% off \n*Discounts apply per product type and are automatically calculated.*\n\n## Shipping & Returns:\n- Standard shipping: 3\u20135 business days \n- Bulk orders may take 7\u201314 business days depending on customization\n- Returns accepted within 30 days for non-customized items\n\n## Rules:\n- Be honest and helpful\n- Never make up data or offer discounts outside the tiers above\n- If unsure about something, say a team member will follow up\n- If the customer mentions a bulk order, ask how many units they need and if they have artwork ready\n\n\n- if the customer has confirmed they want to place an order output ***** along with the response. \n\nJust ask your question, and I\u2019ll take it from there!\n"
}
},
"typeVersion": 1.8
},
{
"id": "052a2f31-f0fa-41ff-be09-121b7ac2f9f1",
"name": "Test if conversation is complete",
"type": "n8n-nodes-base.if",
"position": [
640,
600
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "a3eb2967-e920-4342-ad2b-a2ae3b972955",
"operator": {
"type": "string",
"operation": "contains"
},
"leftValue": "={{ $json.output }}",
"rightValue": "*****"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "973fc612-a2ff-4105-8b58-ab1c22f171ba",
"name": "Respond to User",
"type": "n8n-nodes-base.noOp",
"position": [
860,
720
],
"parameters": {},
"typeVersion": 1
},
{
"id": "e7401017-be65-4e75-8cd3-1af132116108",
"name": "End the Conversation",
"type": "n8n-nodes-base.code",
"position": [
880,
500
],
"parameters": {
"jsCode": "let text = \"Your order has been placed\"\n\nreturn {text}\n \n "
},
"typeVersion": 2
},
{
"id": "d2055f0c-81ce-4b83-9541-12634e4fc75c",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-900,
-60
],
"parameters": {
"color": 4,
"width": 680,
"height": 1060,
"content": "### Need help? \nEmail **rbreen@ynteractive.com**\n\n---\n\n### How to Install & Run\n\n1. **Import the workflow** \n - n8n \u2192 **Workflows \u2192 Import from File** (or **Paste JSON**) \u2192 **Save**\n\n2. **Add your OpenAI API key** \n - n8n \u2192 **Credentials \u2192 New \u2192 OpenAI API** \n - Paste the key from <https://platform.openai.com> \n - Select this credential in both **OpenAI Chat Model** nodes\n\n3. **(Optional) Choose another model** \n - Default model: **gpt\u20114o\u2011mini** \n - Open each **OpenAI Chat Model** node \u2192 choose **GPT\u20114o**, **GPT\u20113.5\u2011turbo**, etc.\n\n4. **Test the Lead\u2011Qualifier Task Automator** \n - Click **Activate** \n - Press **Test workflow** \n - Sample transcripts run; each item returns JSON with **Name**, **Is\u202fGood\u202fLead**, **Reasoning**\n\n5. **Test the Ecommerce Chatbot** \n - Copy the **Webhook URL** from **When chat message received** \n - POST example payload: \n ```json\n { \"message\": \"Hi, do you offer discounts if I buy 120 notebooks?\" }\n ``` \n - Chatbot replies with pricing details \n - If the response contains `*****`, the **If** node sends: **\u201cYour order has been placed\u201d**\n\n---\n\n### Customization Ideas\n\n- Edit prompts to change lead\u2011qualification rules or chatbot dialogue \n- Add Google Sheets, Airtable, or database nodes to store qualified leads \n- Integrate inventory, shipping, or payment APIs \n- Adjust the **Simple Memory** node\u2019s window size to remember more conversation context\n"
},
"typeVersion": 1
}
],
"connections": {
"Simple Memory": {
"ai_memory": [
[
{
"node": "Ecommerce Chatbot",
"type": "ai_memory",
"index": 0
}
]
]
},
"Ecommerce Chatbot": {
"main": [
[
{
"node": "Test if conversation is complete",
"type": "main",
"index": 0
}
]
]
},
"Create Sample Data": {
"main": [
[
{
"node": "Lead Qualifier Agent",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model1": {
"ai_languageModel": [
[
{
"node": "Lead Qualifier Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"OpenAI Chat Model2": {
"ai_languageModel": [
[
{
"node": "Ecommerce Chatbot",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Lead Qualifier Agent": {
"main": [
[
{
"node": "Edit Fields1",
"type": "main",
"index": 0
}
]
]
},
"Structured Output Parser": {
"ai_outputParser": [
[
{
"node": "Lead Qualifier Agent",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"When chat message received": {
"main": [
[
{
"node": "Ecommerce Chatbot",
"type": "main",
"index": 0
}
]
]
},
"Test if conversation is complete": {
"main": [
[
{
"node": "End the Conversation",
"type": "main",
"index": 0
}
],
[
{
"node": "Respond to User",
"type": "main",
"index": 0
}
]
]
},
"When clicking \u2018Test workflow\u2019": {
"main": [
[
{
"node": "Create Sample Data",
"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.
openAiApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Status: Ready for Use ✅ Note: This template is built entirely with official n8n nodes—no community‑node installation required.
Source: https://n8n.io/workflows/6656/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
HDW Lead Geländewagen. Uses chatTrigger, lmChatOpenAi, memoryBufferWindow, outputParserStructured. Chat trigger; 92 nodes.
by Varritech Technologies
Who is this workflow for? This workflow is designed for SEO analysts, content creators, marketing agencies, and developers who need to index a website and then interact with its content as if it were
This workflow enables users to interact with a PostgreSQL database using natural language. It translates text inputs into SQL queries, retrieves the corresponding data, and generates visualizations us
This Chatbot automates the process of discovering job openings and generating tailored job application emails.