This workflow follows the Agent → OpenAI Chat 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": "Country",
"nodes": [
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "44a69fcd-4886-4f25-843c-9ab37bf2166c",
"name": "given_country",
"value": "={{ $json.query.given_country }}",
"type": "string"
},
{
"id": "db037e62-c4b8-4445-9ee0-508e2e665007",
"name": "correct_country",
"value": "={{ $json.query.correct_country }}",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
224,
0
],
"id": "bb66b03e-8f11-47ce-b7f9-30631398bd44",
"name": "Edit Fields"
},
{
"parameters": {
"promptType": "define",
"text": "=Compare these country names:\n\ngiven_country: \"{{ $json.given_country }}\"\ncorrect_country: \"{{$json.correct_country}}\"\n\nReturn ONLY the JSON object in the format { \"isMatch\": true | false }.",
"hasOutputParser": true,
"options": {
"systemMessage": "You are an expert for validating country names.\n\nRules for matching given_country to correct_country:\n1. Only respond in the following JSON format: { \"isMatch\": true | false }.\n2. Accept minor typos:\n - For long country names (>7 letters), up to 3 character edits.\n - For short country names (\u22647 letters), up to 2 character edits.\n - Minor swaps or missing letters are allowed.\n3. Accept official names, ISO codes, translations, and common abbreviations.\n4. Reject:\n - Fantasies, invented names, or unrelated words.\n - Words that are clearly wrong even with minor typos.\n5. Always return false if uncertain.\n6. Do not add explanations or text outside the JSON object.\n\nYour output MUST be valid JSON matching the schema."
}
},
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 3,
"position": [
448,
0
],
"id": "1ce1ea21-9ed0-4ec8-9bc4-1a202b046f76",
"name": "AI Agent"
},
{
"parameters": {
"schemaType": "manual",
"inputSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"isMatch\": {\n \"type\": \"boolean\",\n \"description\": \"True if given_country refers to the same country as correct_country.\"\n }\n },\n \"required\": [\"isMatch\"]\n}"
},
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"typeVersion": 1.3,
"position": [
592,
240
],
"id": "1a599357-2fa9-4730-ae82-1097b3255134",
"name": "Structured Output Parser"
},
{
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini"
},
"builtInTools": {},
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"typeVersion": 1.3,
"position": [
448,
240
],
"id": "25192621-5ea2-4d65-9a9a-1db308563209",
"name": "OpenAI Chat Model",
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"path": "/country-validation",
"responseMode": "responseNode",
"options": {}
},
"type": "n8n-nodes-base.webhook",
"typeVersion": 2.1,
"position": [
-48,
-32
],
"id": "3d430ce4-c1a6-4062-a79c-e71646dfb227",
"name": "Webhook"
},
{
"parameters": {},
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
-16,
144
],
"id": "c9fb42b6-24b9-41f4-adda-f95e83afd3d0",
"name": "When clicking \u2018Execute workflow\u2019"
},
{
"parameters": {
"options": {}
},
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.4,
"position": [
832,
0
],
"id": "d0de0869-0c54-4f92-8f41-4622f9925b4f",
"name": "Respond to Webhook"
}
],
"connections": {
"Edit Fields": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"Structured Output Parser": {
"ai_outputParser": [
[
{
"node": "AI Agent",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Webhook": {
"main": [
[
{
"node": "Edit Fields",
"type": "main",
"index": 0
}
]
]
},
"When clicking \u2018Execute workflow\u2019": {
"main": [
[
{
"node": "Edit Fields",
"type": "main",
"index": 0
}
]
]
},
"AI Agent": {
"main": [
[
{
"node": "Respond to Webhook",
"type": "main",
"index": 0
}
]
]
}
},
"active": true,
"settings": {
"executionOrder": "v1"
},
"versionId": "e4e7aa4f-0b64-4fb8-a7c0-06ec01470831",
"meta": {
"templateCredsSetupCompleted": true
},
"id": "jIuYvqrvjSA0L27P",
"tags": []
}
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
Country. Uses agent, outputParserStructured, lmChatOpenAi. Webhook trigger; 7 nodes.
Source: https://github.com/paulaaronfrank/container-journey/blob/4b2d5be4062c5dc01292bb66a38958efe60f77a6/n8n/Country.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.
jarvis. Uses agent, lmChatOpenAi, outputParserStructured, toolWorkflow. Webhook trigger; 13 nodes.
⏺ 🚀 How it works
Enhance your support, onboarding, and internal knowledge workflows with an intelligent RAG-powered chatbot that responds using live data stored in Google Sheets. 🤖📚 Built for teams that rely on struct
leads. Uses supabase, gmail, formTrigger, httpRequest. Webhook trigger; 62 nodes.
🧠 Gwen – The AI Voice Marketing Agent Gwen is your intelligent voice-powered marketing assistant built in n8n. She combines the power of OpenAI, ElevenLabs, and automation workflows to handle content