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 →
{
"name": "Purchasing Agent",
"nodes": [
{
"parameters": {
"public": true,
"mode": "webhook",
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"typeVersion": 1.4,
"position": [
0,
0
],
"id": "ad731937-338b-4c61-a71b-888b097cdd21",
"name": "When chat message received"
},
{
"parameters": {
"options": {
"systemMessage": "You are \u201cAsistente Plus\u201d, an expert in purchase and sales management. Your primary objective is to facilitate product inquiries and the creation of purchase orders, always maintaining a friendly, professional, and concise tone, while using persuasive marketing tactics.\n\nKNOWLEDGE RESTRICTION (CRITICAL)\n\nSINGLE SOURCE OF TRUTH: Your only source of knowledge about products, prices, and availability comes from the \u201cget products\u201d tool.\n\nPROHIBITION: You must NEVER, under any circumstances, invent product names, prices, descriptions, or the existence of products that were not returned by the tool. You may only use the data provided by this tool.\n\nSALES AND COMMUNICATION RULES:\n\nTone: Always be friendly, proactive, and use excellent sales-oriented language. Be brief and concise to optimize the customer experience.\n\nProduct Inquiry: When the customer asks about products:\n\nMANDATORY: ALWAYS use the \u201cget products\u201d tool to retrieve the most up-to-date list from the backend.\n\nPresentation: Display the list of available products without mentioning price or stock quantity. Only indicate if a product is out of stock.\n\nPrice Handling: Only provide the unit price if the customer explicitly requests it.\n\nStock Handling: Stock quantity is internal information. Only disclose to the customer if a product is out of stock.\n\nPURCHASE ORDER PROTOCOL:\n\nActivation: When the customer expresses their intent to create an order (\u201cI want to place a purchase order\u201d), you must initiate the data collection protocol.\n\nMandatory Data (Sales Protocol): Before executing the order, request the following information consecutively: identification (ID), email address, and full name.\n\nContinuation: Once you have these three pieces of information, invite the customer to proceed by indicating the products and quantities they wish to order in order to execute the purchase order.\n\nPURCHASE ORDER PROTOCOL (CRITICAL DATA EXTRACTION)\n\nFor the order creation process, the \u201cCreate Order\u201d tool expects a JSON object with the following example structure:\n\n{\n \"contact_email\": \"customer@example.com\",\n \"contact_name\": \"John Doe\",\n \"shipping_address\": \"123 Main St, City, Country\",\n \"customer_identifier\": 12345678,\n \"items\": [\n {\n \"product_id\": \"3e0a8228-8e70-45c8-bf03-5a72cf7945bf\",\n \"quantity\": 2\n }\n ]\n}\n\n\nActivation: When the customer says they want to create an order, your first objective is to obtain the 5 key data points.\n\nMandatory Key Data: The data you must extract for the order are:\n\ncontact_email (String, e.g., juan@example.com\n)\n\ncontact_name (String, Full name)\n\ncustomer_identifier (Number, ID or National Identification)\n\nshipping_address (String, Shipping address)\n\nitems (Array, List of products)"
}
},
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 3,
"position": [
208,
0
],
"id": "cd2c6213-6022-4e72-9354-f879148b35bd",
"name": "AI Agent"
},
{
"parameters": {
"options": {
"maxOutputTokens": 600
}
},
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"typeVersion": 1,
"position": [
-80,
256
],
"id": "cd0651af-b634-4a29-a585-1c66ebb0fbf4",
"name": "Google Gemini Chat Model"
},
{
"parameters": {
"contextWindowLength": 20
},
"type": "@n8n/n8n-nodes-langchain.memoryPostgresChat",
"typeVersion": 1.3,
"position": [
144,
320
],
"id": "76206c48-5e69-4684-9123-be6e14531f47",
"name": "Postgres Chat Memory"
},
{
"parameters": {
"toolDescription": "This endpoint is used to create an order. When the customer wants to place an order, the Gemini model must send to this endpoint the data it has extracted.",
"method": "POST",
"url": "http://yourhost:3000/api/orders",
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "contact_email",
"value": "={{ $json.contact_email }}"
},
{
"name": "contact_name",
"value": "={{ $json.contact_name }}"
},
{
"name": "shipping_address",
"value": "={{ $json.shipping_address }}"
},
{
"name": "customer_identifier",
"value": "={{ $json.customer_identifier }}"
},
{
"name": "items",
"value": "={{ $json.items }}"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.httpRequestTool",
"typeVersion": 4.3,
"position": [
352,
304
],
"id": "1f4deb21-7c5d-42b5-80c2-7aad69dcb15f",
"name": "Create Order"
},
{
"parameters": {
"toolDescription": "Use this tool at all times to obtain the current list of products, their availability, stock levels, or any offer-related details. This tool performs a GET request to your backend. THE MODEL MUST RELY EXCLUSIVELY ON THE INFORMATION RETURNED BY THIS TOOL when responding to customers about products.",
"url": "http://yourhost:3000/api/products",
"options": {}
},
"type": "n8n-nodes-base.httpRequestTool",
"typeVersion": 4.3,
"position": [
544,
208
],
"id": "a78293a2-bf9b-42e1-accf-b5b21b504b38",
"name": "Get Products"
},
{
"parameters": {
"toolDescription": "Use this tool at all times to obtain the current list of orders, including customer details such as identification, location, full name, and email address, as well as order information such as products, quantities, prices, and stock. This tool queries the backend directly, and THE MODEL MUST RELY EXCLUSIVELY ON THE INFORMATION RETURNED BY THIS TOOL when responding about orders.",
"url": "http://yourhost:3000/api/orders",
"options": {}
},
"type": "n8n-nodes-base.httpRequestTool",
"typeVersion": 4.3,
"position": [
688,
144
],
"id": "fa9c1a3f-be38-4ecc-acb7-c1197d3e18dc",
"name": "Get Orders"
}
],
"connections": {
"When chat message received": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"Google Gemini Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Postgres Chat Memory": {
"ai_memory": [
[
{
"node": "AI Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"Create Order": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Get Products": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Get Orders": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1",
"availableInMCP": false
},
"versionId": "b95ce18f-46fd-43ed-ba2b-4e5653097662",
"id": "EuYLus7DIDRBIo2Y",
"tags": []
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Purchasing Agent. Uses chatTrigger, agent, lmChatGoogleGemini, memoryPostgresChat. Chat trigger; 7 nodes.
Source: https://github.com/SrPlugin/Ecommerce-API/blob/2cc447f6f2faf3f6c3ab9e90f759dfa9f60fb556/N8N/n8nbot.json — 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.
This workflow contains community nodes that are only compatible with the self-hosted version of n8n.
Kangaroo_PS. Uses chatTrigger, postgres, agent, lmChatGoogleGemini. Chat trigger; 20 nodes.
Power BI Data Analyst Agent. Uses stickyNote, chatTrigger, agent, lmChatOpenRouter. Chat trigger; 12 nodes.
This workflow is designed for anyone who wants to automate AI-driven chat responses integrated with Google Docs and Google Sheets, using the Google Gemini (PaLM) language model via n8n. It’s perfect f
A streamlined AI-powered tool that extracts actionable technical insights from HackerOne security reports for advanced bug bounty hunters.