This workflow corresponds to n8n.io template #2025 — we link there as the canonical source.
This workflow follows the Chat Trigger → Execute Workflow 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 →
{
"meta": {
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "79573e58-f33f-445a-ad9a-0a92fde845c2",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-280,
480
],
"parameters": {
"width": 1174.6162657502882,
"height": 578.9520146851776,
"content": "## Sub-workflow: Return the capitals of fictional countries\nIt can either list the countries it knows about or return the capital of a specific country"
},
"typeVersion": 1
},
{
"id": "5eddcce9-7ee5-4ec7-a0a1-525a9b806994",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-280,
-80
],
"parameters": {
"width": 1168,
"height": 528,
"content": "## Main workflow: Chat with OpenAI Assistant\nClick the 'Chat' button at the bottom of the screen to try"
},
"typeVersion": 1
},
{
"id": "a6c38394-1be1-4002-a9b7-c4672823aaa5",
"name": "When chat message received",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
-180,
40
],
"parameters": {
"options": {}
},
"typeVersion": 1.1
},
{
"id": "de0398ea-c2ad-49b9-860b-695149b94590",
"name": "OpenAI",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
100,
40
],
"parameters": {
"options": {},
"resource": "assistant",
"assistantId": {
"__rl": true,
"mode": "id",
"value": "asst_BWy0154vMGMdrX7MjCYaYv6a"
}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.8
},
{
"id": "050042f4-f5ff-433a-9651-43cbec8eafb6",
"name": "Simple Memory",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
360,
260
],
"parameters": {},
"typeVersion": 1.3
},
{
"id": "e4ed4cfe-78fb-44a5-8bef-67168dac95ec",
"name": "When Executed by Another Workflow",
"type": "n8n-nodes-base.executeWorkflowTrigger",
"position": [
-180,
740
],
"parameters": {
"workflowInputs": {
"values": [
{
"name": "query"
}
]
}
},
"typeVersion": 1.1
},
{
"id": "a3a1059c-5c36-4d90-90e2-98e37f62bdd2",
"name": "Tool to call the workflow below",
"type": "@n8n/n8n-nodes-langchain.toolWorkflow",
"position": [
40,
260
],
"parameters": {
"name": "country_capitals_tool",
"workflowId": {
"__rl": true,
"mode": "id",
"value": "={{ $workflow.id }}"
},
"description": "This tool has two modes:\n1. Pass 'list' to the tool to get a list of countries that the tool has the capitals for (one per line). This is useful if you can't find a match, to see if the country being asked about might have been misspelled.\n2. Pass one of the country names in the list to the tool to get the capital of that country. Note that the country must be spelled exactly as it is in the list of countries returned in mode 1",
"workflowInputs": {
"value": {
"query": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('query', ``, 'string') }}"
},
"schema": [
{
"id": "query",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "query",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
}
},
"typeVersion": 2
},
{
"id": "80924ec9-5e82-4e90-8b72-42fc805d83c0",
"name": "Tool: Get current date and time",
"type": "@n8n/n8n-nodes-langchain.toolCode",
"position": [
200,
260
],
"parameters": {
"name": "date_tool",
"jsCode": "let now = DateTime.now()\nreturn now.toISO()",
"description": "Call this tool to get the current timestamp (in ISO format). No parameters necessary"
},
"typeVersion": 1.1
},
{
"id": "8f6a83bd-71eb-4f2d-b906-a18476f18f40",
"name": "List countries?",
"type": "n8n-nodes-base.if",
"position": [
40,
740
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "ca43a9bd-5db3-4240-ae46-0402c8411818",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.query }}",
"rightValue": "list"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "40d93a59-4c91-43e4-a4a3-3732475617d6",
"name": "Mapping data",
"type": "n8n-nodes-base.code",
"position": [
260,
600
],
"parameters": {
"jsCode": "return [\n {\n \"country\": \"Wakanda\",\n \"capital\": \"Birnin Zana\"\n },\n {\n \"country\": \"Narnia\",\n \"capital\": \"Cair Paravel\"\n },\n {\n \"country\": \"Gondor\",\n \"capital\": \"Minas Tirith\"\n },\n {\n \"country\": \"Oz\",\n \"capital\": \"The Emerald City\"\n },\n {\n \"country\": \"Westeros\",\n \"capital\": \"King's Landing\"\n },\n {\n \"country\": \"Panem\",\n \"capital\": \"The Capitol\"\n },\n {\n \"country\": \"Ruritania\",\n \"capital\": \"Strelsau\"\n },\n {\n \"country\": \"Mordor\",\n \"capital\": \"Barad-d\u00fbr\"\n },\n {\n \"country\": \"Latveria\",\n \"capital\": \"Doomstadt\"\n },\n {\n \"country\": \"Atlantis\",\n \"capital\": \"Poseidonis\"\n }\n]\n"
},
"typeVersion": 2
},
{
"id": "8765b405-8991-421c-bdc5-3eb6d3757fcb",
"name": "Concatenate country names",
"type": "n8n-nodes-base.summarize",
"position": [
460,
600
],
"parameters": {
"options": {},
"fieldsToSummarize": {
"values": [
{
"field": "country",
"separateBy": "\n",
"aggregation": "concatenate"
}
]
}
},
"typeVersion": 1.1
},
{
"id": "c0b21934-8518-49b4-bbab-f13ad0a74343",
"name": "Return country list",
"type": "n8n-nodes-base.set",
"position": [
660,
600
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "c97c3abc-40b2-4238-912d-030eb9ca3440",
"name": "response",
"type": "string",
"value": "={{ $json.concatenated_country }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "5d4f05cc-f4e3-4ce6-9ea8-a324257fa7c3",
"name": "Mapping data1",
"type": "n8n-nodes-base.code",
"position": [
260,
880
],
"parameters": {
"jsCode": "return [\n {\n \"country\": \"Wakanda\",\n \"capital\": \"Birnin Zana\"\n },\n {\n \"country\": \"Narnia\",\n \"capital\": \"Cair Paravel\"\n },\n {\n \"country\": \"Gondor\",\n \"capital\": \"Minas Tirith\"\n },\n {\n \"country\": \"Oz\",\n \"capital\": \"The Emerald City\"\n },\n {\n \"country\": \"Westeros\",\n \"capital\": \"King's Landing\"\n },\n {\n \"country\": \"Panem\",\n \"capital\": \"The Capitol\"\n },\n {\n \"country\": \"Ruritania\",\n \"capital\": \"Strelsau\"\n },\n {\n \"country\": \"Mordor\",\n \"capital\": \"Barad-d\u00fbr\"\n },\n {\n \"country\": \"Latveria\",\n \"capital\": \"Doomstadt\"\n },\n {\n \"country\": \"Atlantis\",\n \"capital\": \"Poseidonis\"\n }\n]\n"
},
"typeVersion": 2
},
{
"id": "5ed65e2c-b56d-49d9-a205-1e4cc8914fa9",
"name": "Get the matching country's details",
"type": "n8n-nodes-base.merge",
"position": [
460,
820
],
"parameters": {
"mode": "combine",
"options": {},
"advanced": true,
"joinMode": "enrichInput1",
"mergeByFields": {
"values": [
{
"field1": "query",
"field2": "country"
}
]
}
},
"typeVersion": 3
},
{
"id": "313775a0-a4ce-488e-a7db-b1ddd49dc3cd",
"name": "Return specific capital",
"type": "n8n-nodes-base.set",
"position": [
660,
820
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "03ac1883-126f-4419-93e4-c5062b2d766d",
"name": "response",
"type": "string",
"value": "={{ $ifEmpty($json.capital, 'Capital not found') }}"
}
]
}
},
"typeVersion": 3.4
}
],
"connections": {
"Mapping data": {
"main": [
[
{
"node": "Concatenate country names",
"type": "main",
"index": 0
}
]
]
},
"Mapping data1": {
"main": [
[
{
"node": "Get the matching country's details",
"type": "main",
"index": 1
}
]
]
},
"Simple Memory": {
"ai_memory": [
[
{
"node": "OpenAI",
"type": "ai_memory",
"index": 0
}
]
]
},
"List countries?": {
"main": [
[
{
"node": "Mapping data",
"type": "main",
"index": 0
}
],
[
{
"node": "Get the matching country's details",
"type": "main",
"index": 0
},
{
"node": "Mapping data1",
"type": "main",
"index": 0
}
]
]
},
"Concatenate country names": {
"main": [
[
{
"node": "Return country list",
"type": "main",
"index": 0
}
]
]
},
"When chat message received": {
"main": [
[
{
"node": "OpenAI",
"type": "main",
"index": 0
}
]
]
},
"Tool to call the workflow below": {
"ai_tool": [
[
{
"node": "OpenAI",
"type": "ai_tool",
"index": 0
}
]
]
},
"Tool: Get current date and time": {
"ai_tool": [
[
{
"node": "OpenAI",
"type": "ai_tool",
"index": 0
}
]
]
},
"When Executed by Another Workflow": {
"main": [
[
{
"node": "List countries?",
"type": "main",
"index": 0
}
]
]
},
"Get the matching country's details": {
"main": [
[
{
"node": "Return specific capital",
"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
This workflow shows how you can get your OpenAI assistant to call an n8n workflow as a tool. Since you can put almost any functionality in an n8n workflow, this means you can give your assistant access to almost any data source.
Source: https://n8n.io/workflows/2025/ — 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.
2025. Uses chatTrigger, openAi, memoryBufferWindow, executeWorkflowTrigger. Chat trigger; 15 nodes.
Airtable AI Agent. Uses lmChatOpenAi, agent, toolWorkflow, toolCode. Chat trigger; 42 nodes.
Ai Agent To Chat With Airtable And Analyze Data. Uses lmChatOpenAi, agent, stickyNote, memoryBufferWindow. Chat trigger; 41 nodes.
I prepared a detailed guide that shows the entire process of building an AI agent that integrates with Airtable data in n8n. This template covers everything from data preparation to advanced configura
Categories: AI Agents, Design Automation, Business Tools