This workflow corresponds to n8n.io template #5792 — we link there as the canonical source.
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 →
{
"id": "6tW6bM6XI6pqrQgn",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "My dictionary_complext",
"tags": [],
"nodes": [
{
"id": "87575fd4-3eda-4e20-8d6b-82a1ec37f1d5",
"name": "AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
-600,
-360
],
"parameters": {
"text": "={{ $json.body.word }}",
"options": {
"systemMessage": "Purpose:\nYou are a bilingual dictionary assistant that helps users understand English and German words in the context of literature. It provides Chinese definitions and three literary-style sentence examples for each word, helping users deepen their vocabulary and reading comprehension.\n\nBehavior Guidelines:\n\nInput Handling:\n\nAccept single words in either English or German.\n\nDetect the language automatically.\n\nIf ambiguous, ask the user to clarify.\n\nResponse Format:\n\nLanguage: State the input language.\n\nWord: Bold the input word.\n\nPart of Speech: Indicate (e.g., noun, verb, adjective, etc.).\n\nChinese Meaning: Provide a concise and literary-relevant translation in Simplified Chinese.\n\nExamples:\n\nProvide three example sentences.\n\nThe sentences should be literary in tone or style (poetic, novelistic, expressive).\n\nProvide translations of the examples in Simplified Chinese beneath each.\n\nFocus on Literary Use:\n\nPrioritize literary, archaic, or metaphorical meanings when available.\n\nIf a word has multiple meanings, emphasize the one most relevant to literature.\n\nTone:\n\nKeep responses clear, elegant, and not overly academic.\n\nIf a word has rich etymology or symbolism, briefly mention it.\n\n\ud83e\uddea Example Interaction\nUser Input: serenity\n\nYour Response:\n\nLanguage: English\nWord: serenity\nPart of Speech: Noun\nChinese Meaning: \u5b81\u9759\uff1b\u5b89\u8be6\uff1b\u5fc3\u7075\u7684\u5e73\u548c\uff08\u5e38\u7528\u4e8e\u63cf\u5199\u81ea\u7136\u6216\u4eba\u7269\u7684\u5185\u5fc3\u72b6\u6001\uff09\n\nExamples:\n\nThe serenity of the moonlit lake whispered secrets to the wind.\n\u6708\u5149\u6e56\u9762\u7684\u5b81\u9759\u5411\u5fae\u98ce\u4f4e\u8bed\u7740\u79d8\u5bc6\u3002\n\nShe wore her serenity like a veil, untouched by the chaos around her.\n\u5979\u5e26\u7740\u4e00\u79cd\u5b81\u9759\u7684\u6c14\u8d28\uff0c\u5982\u9762\u7eb1\u822c\u5c06\u7eb7\u4e71\u9694\u7edd\u5728\u5916\u3002\n\nIn the quiet of dawn, serenity settled over the forest like a benediction.\n\u9ece\u660e\u7684\u9759\u8c27\u4e2d\uff0c\u5b81\u9759\u5982\u795d\u798f\u822c\u6d12\u843d\u5728\u68ee\u6797\u4e4b\u4e0a\u3002"
},
"promptType": "define"
},
"typeVersion": 1.9
},
{
"id": "4547dfac-fb63-4950-8413-c93d4560f05e",
"name": "Supabase",
"type": "n8n-nodes-base.supabase",
"position": [
-360,
420
],
"parameters": {
"tableId": "Dict",
"fieldsUi": {
"fieldValues": [
{
"fieldId": "Words",
"fieldValue": "={{ $json.body.word }}"
},
{
"fieldId": "chineseMeaning",
"fieldValue": "={{ $json.body.chineseMeaning }}"
},
{
"fieldId": "Examples",
"fieldValue": "={{ $json.body.examples }}"
}
]
}
},
"credentials": {
"supabaseApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "e21676fe-0d24-4b15-8121-f6b0285cc5f4",
"name": "If",
"type": "n8n-nodes-base.if",
"position": [
-140,
-360
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "or",
"conditions": [
{
"id": "71dec079-93c3-44c1-a798-a2c9df48cff5",
"operator": {
"type": "string",
"operation": "contains"
},
"leftValue": "={{ $('AI Agent').first().json.output }}",
"rightValue": "It seems "
},
{
"id": "52f131e5-69c7-4862-864f-76f336cf46a4",
"operator": {
"type": "string",
"operation": "contains"
},
"leftValue": "={{ $('AI Agent').first().json.output }}",
"rightValue": "unclear"
},
{
"id": "bc103838-6de4-4f72-bd67-03ea710c607f",
"operator": {
"type": "string",
"operation": "contains"
},
"leftValue": "={{ $('AI Agent').first().json.output }}",
"rightValue": "please provide"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "eb58c75b-d4f3-4597-8b93-cd769a7e880d",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2240,
-660
],
"parameters": {
"width": 540,
"height": 1120,
"content": "# Literary Dictionary Assistant \n\nThis n8n template creates a sophisticated bilingual dictionary that provides literary-style definitions and examples for English and German words with Chinese translations.\n\nUse cases are many: Language learning apps, reading comprehension tools, literary analysis, translation assistance, and vocabulary building for creative writing!\n\n## How it works\n\n* Input word is received via webhook and processed by the AI Agent with a specialized literary dictionary prompt.\n* OpenAI GPT-4o-mini generates comprehensive definitions with part of speech, Chinese meanings, and three literary-style example sentences.\n* Response formatting extracts structured data (word, meaning, examples with translations) from the AI output.\n* Quality control checks for unclear responses and returns appropriate error messages for invalid inputs.\n* Valid responses are simultaneously returned to the user and saved to Supabase database.\n* The workflow provides clean JSON API responses perfect for integration with apps or websites.\n\n## Good to know\n\n* The workflow automatically detects input language (English/German) and handles error cases gracefully.\n* All lookups are saved to Supabase database for building a personal vocabulary collection over time.\n\n## Requirements\n\n* OpenAI account with API access for GPT-4o-mini\n* Supabase account for database storage\n* Basic understanding of webhook APIs for integration\n\n## Customizing this workflow\n\n* Modify the system prompt to support additional languages or change the literary style (academic, casual, business-focused).\n* Add user authentication to create personalized vocabulary collections.\n* Integrate with reading apps, language learning platforms, or writing tools."
},
"typeVersion": 1
},
{
"id": "7300514a-b5ea-40d0-8a29-02a1586cd124",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1140,
-600
],
"parameters": {
"color": 4,
"width": 440,
"height": 220,
"content": "\n\n## 1. Webhook Receiver\n\nReceives word requests via HTTP POST. It captures the input word to be processed and triggers the entire workflow chain.\n\n**I use this Webhook to receive word input by user from a HTML web app**"
},
"typeVersion": 1
},
{
"id": "a8b8f6f8-9dd3-465c-8a30-66132144e2e3",
"name": "Openai translate & give examples",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
-580,
-180
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "3b794b96-5195-4771-bb5f-ea0ea99762a2",
"name": "Respond to user",
"type": "n8n-nodes-base.respondToWebhook",
"position": [
820,
-500
],
"parameters": {
"options": {}
},
"typeVersion": 1.2
},
{
"id": "6c4ce691-a8c5-4ff4-8cd5-1103af2d34ad",
"name": "Respond to user1",
"type": "n8n-nodes-base.respondToWebhook",
"position": [
820,
-300
],
"parameters": {
"options": {},
"respondWith": "text",
"responseBody": "={{ JSON.stringify($('Format response').first().json) }}"
},
"typeVersion": 1.2
},
{
"id": "2e551b35-2292-4f47-ab5d-d1e658d18adc",
"name": "Format error message",
"type": "n8n-nodes-base.set",
"position": [
400,
-500
],
"parameters": {
"mode": "raw",
"options": {},
"jsonOutput": "{\n \"error\": true,\n \"message\": \"Please provide a specific word in English or German. The input was not recognized as a valid word.\",\n \"word\": \"{{ $('Webhook').first().json.body.word }}\"\n}"
},
"typeVersion": 3.4
},
{
"id": "69ca7f02-6991-4ef9-bc1e-f900507838ab",
"name": "Format response",
"type": "n8n-nodes-base.code",
"position": [
400,
-300
],
"parameters": {
"jsCode": "// Get the AI response from the previous node\nconst aiResponse = $('AI Agent').first().json.output;\n\n// Split the response into lines for parsing\nconst lines = aiResponse.split('\\n').filter(line => line.trim() !== '');\n\nlet word = '';\nlet chineseMeaning = '';\nlet examples = [];\n\n// Parse each line to extract the needed information\nlet inExamples = false;\nlet currentExample = '';\nlet currentTranslation = '';\n\nfor (let i = 0; i < lines.length; i++) {\n const trimmedLine = lines[i].trim();\n \n // Extract the word (looking for \"Word: **word**\" format)\n if (trimmedLine.startsWith('Word:')) {\n // Remove \"Word:\" and extract text between ** markers\n word = trimmedLine.replace('Word:', '').trim();\n // Remove bold markdown formatting if present\n word = word.replace(/\\*\\*/g, '').trim();\n }\n \n // Extract Chinese meaning\n if (trimmedLine.startsWith('Chinese Meaning:')) {\n chineseMeaning = trimmedLine.replace('Chinese Meaning:', '').trim();\n }\n \n // Check if we've reached the Examples section\n if (trimmedLine === 'Examples:' || trimmedLine.startsWith('Examples:')) {\n inExamples = true;\n continue;\n }\n \n // Parse examples when we're in the examples section\n if (inExamples && trimmedLine) {\n // Check if this line is an English sentence (not a Chinese translation)\n // Chinese translations typically start with Chinese characters\n const isChineseTranslation = /^[\\u4e00-\\u9fff]/.test(trimmedLine);\n \n if (!isChineseTranslation && trimmedLine.length > 10) {\n // This is likely an English example sentence\n // Save the previous example if we have both parts\n if (currentExample && currentTranslation) {\n examples.push({\n sentence: currentExample,\n translation: currentTranslation\n });\n }\n \n // Start a new example\n currentExample = trimmedLine;\n currentTranslation = '';\n } else if (isChineseTranslation && currentExample) {\n // This is the Chinese translation for the current example\n currentTranslation = trimmedLine;\n }\n }\n}\n\n// Don't forget to add the last example if it exists\nif (currentExample && currentTranslation) {\n examples.push({\n sentence: currentExample,\n translation: currentTranslation\n });\n}\n\n// Return the structured data\nreturn {\n word: word,\n chineseMeaning: chineseMeaning,\n examples: examples\n};"
},
"typeVersion": 2
},
{
"id": "6c366b3a-fb16-468a-8615-a86c58398378",
"name": "Webhook to fetch user word input",
"type": "n8n-nodes-base.webhook",
"position": [
-940,
-360
],
"parameters": {
"path": "e50639d5-af5b-4523-864a-cb123250887f",
"options": {},
"httpMethod": "POST",
"responseMode": "responseNode"
},
"typeVersion": 2
},
{
"id": "47059065-9d8c-40a0-8728-84e7030bab73",
"name": "Webhook to save words in Supabase",
"type": "n8n-nodes-base.webhook",
"position": [
-940,
420
],
"parameters": {
"path": "e50639d5-af5b-4523-864a-cb123250887f",
"options": {},
"httpMethod": "POST",
"responseMode": "responseNode"
},
"typeVersion": 2
},
{
"id": "6c098436-bbee-416d-9838-b57bb6bf71b7",
"name": "Respond message",
"type": "n8n-nodes-base.respondToWebhook",
"position": [
120,
420
],
"parameters": {
"options": {},
"respondWith": "text",
"responseBody": "={\n \"success\": true,\n \"message\": \"Word saved successfully\"\n}"
},
"typeVersion": 1.2
},
{
"id": "92eff8ea-f97e-44dc-b902-f384d89ebe92",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-680,
-20
],
"parameters": {
"color": 4,
"width": 440,
"height": 220,
"content": "\n\n## 2. AI Agent\n\nI use specialized literary dictionary prompt. It will auto-detect language (English/German) and then generate comprehensive definitions. It will also create 3 literary-style example sentences."
},
"typeVersion": 1
},
{
"id": "62945248-fb2d-4a4c-8479-6f7f3d6b1d75",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
300,
-140
],
"parameters": {
"color": 4,
"width": 440,
"height": 220,
"content": "\n\n## 4. Data Structure Parser\n\nIt extracts structured data from AI output and organizes: word, part of speech, meanings\nFormats examples with translations\n"
},
"typeVersion": 1
},
{
"id": "9b3eb8d6-9210-466e-885f-3015c1c97854",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-300,
-640
],
"parameters": {
"color": 4,
"width": 440,
"height": 220,
"content": "\n\n## 3. Error Handler \n\nThis if node checks for unclear or invalid responses and returns appropriate error messages\n"
},
"typeVersion": 1
},
{
"id": "8a7c23e1-d537-491d-b4c8-e7b933e3709d",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1620,
420
],
"parameters": {
"color": 3,
"width": 440,
"height": 100,
"content": "\n\n## Workflow for data storage"
},
"typeVersion": 1
},
{
"id": "55d3c004-cb9a-41cc-884e-829785a8ffe4",
"name": "Sticky Note6",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1620,
-360
],
"parameters": {
"color": 3,
"width": 440,
"height": 100,
"content": "\n\n## Workflow for looking up words\n"
},
"typeVersion": 1
},
{
"id": "07bc4443-1d63-4c29-8cbd-386522c73ed2",
"name": "Sticky Note7",
"type": "n8n-nodes-base.stickyNote",
"position": [
-520,
620
],
"parameters": {
"color": 4,
"width": 440,
"height": 220,
"content": "\n\n## 2. Supabase Integration\n\nIt saves all valid lookups to database and builds personal structured dictionary data.\n"
},
"typeVersion": 1
},
{
"id": "75a5c8ec-f15c-48dd-b140-2eaee66cd85b",
"name": "Sticky Note8",
"type": "n8n-nodes-base.stickyNote",
"position": [
380,
400
],
"parameters": {
"color": 4,
"width": 440,
"height": 220,
"content": "\n\n## 3. Webhook Response Node\n\nIt completes the workflow by sending the final response back to the requesting user: \"Word saved successfully\".\n"
},
"typeVersion": 1
},
{
"id": "a05d401b-792f-437d-bdd1-f08285e5ee9f",
"name": "Sticky Note9",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1120,
620
],
"parameters": {
"color": 4,
"width": 440,
"height": 220,
"content": "\n\n## 1. Save Words Trigger\n\nWhen the user clicks the \" Save to vocabulary list\" button, it will trigger this workflow and the word will be saved to Supabase.\n"
},
"typeVersion": 1
},
{
"id": "27e60f98-b4ea-4b29-a2d2-c53b6b786d96",
"name": "Sticky Note10",
"type": "n8n-nodes-base.stickyNote",
"position": [
1060,
-500
],
"parameters": {
"color": 4,
"width": 440,
"height": 320,
"content": "\n\n## 5. Webhook Response Node\n\nIt completes this workflow by sending the final response back to the requesting user. It is either\n\n* includes the complete dictionary data (word, definitions, examples, translations).\n\nor\n\n* \"Please provide a specific word in English or German. The input was not recognized as a valid word.\"\n\n"
},
"typeVersion": 1
}
],
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "03878a15-0672-4cd3-baf8-40b47c357052",
"connections": {
"If": {
"main": [
[
{
"node": "Format error message",
"type": "main",
"index": 0
}
],
[
{
"node": "Format response",
"type": "main",
"index": 0
}
]
]
},
"AI Agent": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"Supabase": {
"main": [
[
{
"node": "Respond message",
"type": "main",
"index": 0
}
]
]
},
"Format response": {
"main": [
[
{
"node": "Respond to user1",
"type": "main",
"index": 0
}
]
]
},
"Respond to user1": {
"main": [
[]
]
},
"Format error message": {
"main": [
[
{
"node": "Respond to user",
"type": "main",
"index": 0
}
]
]
},
"Openai translate & give examples": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Webhook to fetch user word input": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"Webhook to save words in Supabase": {
"main": [
[
{
"node": "Supabase",
"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.
openAiApisupabaseApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This workflow creates a sophisticated bilingual dictionary that provides literary-style definitions and examples for English and German words. The system automatically detects the input language, generates comprehensive definitions in Chinese, creates three literary-style…
Source: https://n8n.io/workflows/5792/ — 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.
⏺ 🚀 How it works
L&D_AgentsAI_ATIVO. Uses httpRequest, agent, googleCalendarTool, toolSerpApi. Webhook trigger; 93 nodes.
Flux. Uses lmChatOpenAi, agent, googleGemini, httpRequest. Webhook trigger; 67 nodes.
leads. Uses supabase, gmail, formTrigger, httpRequest. Webhook trigger; 62 nodes.
Agent: IPTV (instance_e2165d22_1762376395079). Uses openAi, redis, supabase, httpRequest. Webhook trigger; 56 nodes.