Describe the problem/error/question
i AM UNABLE TO RECEIVE MESSAGE A PROPER FORMATTED TEXT or you can call it that the text is not being rendered in a proper format and it remains as a json string maybe as per my understanding. No line breaks bold and other are occuring making it look not good.
What is the error message (if any)?
Please share your workflow
</
{
“nodes”: [
{
“parameters”: {
“modelId”: {
“__rl”: true,
“value”: “gpt-4o”,
“mode”: “list”
},
“messages”: {
“values”: [
{
“content”: “You are a Master Orchestrator Agent for ACADEMY Fahrschule Drive In.\n\nYour job is to analyze incoming queries and determine the routing strategy:\n\nQuery Analysis:\n1. SINGLE TOPIC - Query is ONLY about pricing OR ONLY about general information\n2. HYBRID - Query contains BOTH pricing AND general questions\n3. FOLLOW-UP - Vague continuation of previous context\n\nOutput JSON Format:\n{\n “routingStrategy”: “SINGLE_PRICING” | “SINGLE_GENERAL” | “HYBRID” | “FOLLOW_UP”,\n “confidence”: 0.0-1.0,\n “pricingSubQuery”: “extracted pricing question or null”,\n “generalSubQuery”: “extracted general question or null”,\n “reasoning”: “brief explanation”\n}\n\nClassification Rules:\n\nSINGLE_PRICING:\n- Query ONLY asks for prices/costs/fees/amounts\n- Keywords: “how much”, “price”, “cost”, “€”, “EUR”, “fees”, “rate”\n- Example: “How much is the B197 course?”\n- Output: {routingStrategy: “SINGLE_PRICING”, pricingSubQuery: “B197 course price”, generalSubQuery: null}\n\nSINGLE_GENERAL:\n- Query ONLY asks non-pricing questions (documents, schedule, requirements, process)\n- Keywords: “what documents”, “when”, “how to register”, “requirements”, “schedule”\n- Example: “What documents do I need for Class B?”\n- Output: {routingStrategy: “SINGLE_GENERAL”, pricingSubQuery: null, generalSubQuery: “Class B required documents”}\n\nHYBRID:\n- Query contains BOTH pricing AND general questions\n- Example: “How much is B197 and what documents do I need?”\n- Output: {\n routingStrategy: “HYBRID”,\n pricingSubQuery: “B197 course price”,\n generalSubQuery: “B197 required documents”\n }\n\nFOLLOW_UP:\n- Vague queries using pronouns: “it”, “that”, “this”\n- Continuation phrases: “tell me more”, “explain further”, “break it down”\n- Example: “Can you explain it more?”\n- Output: {routingStrategy: “FOLLOW_UP”, pricingSubQuery: null, generalSubQuery: null}\n\nSub-Query Extraction:\n- Keep sub-queries concise and focused\n- Remove redundant words\n- Preserve class names/codes exactly (B197, A2, CE, etc.)\n- Example: “How much does the B197 cost and what are the requirements?” \n → pricingSubQuery: “B197 price”\n → generalSubQuery: “B197 requirements”\n\nImportant:\n- Always return valid JSON\n- Set confidence based on clarity (0.9+ for clear queries, 0.5-0.8 for ambiguous)\n- For FOLLOW_UP, both sub-queries should be null”,
“role”: “system”
},
{
“content”: “=User Query: {{ $json.OrignalChatInput }}\n\nAnalyze this query and provide routing instructions.”
}
]
},
“jsonOutput”: true,
“options”: {}
},
“type”: “@n8n/n8n-nodes-langchain.openAi”,
“typeVersion”: 1.8,
“position”: [
-672,
496
],
“id”: “da7666c9-a607-48ae-a1b4-232449820b9a”,
“name”: “Master Orchestrator”,
“credentials”: {
“openAiApi”: {
“id”: “7L9oWkrz2VCUu0ZV”,
“name”: “OpenAi account”
}
}
},
{
“parameters”: {
“rules”: {
“values”: [
{
“conditions”: {
“options”: {
“caseSensitive”: true,
“leftValue”: “”,
“typeValidation”: “loose”,
“version”: 2
},
“conditions”: [
{
“leftValue”: “={{ $json.message.content.routingStrategy }}”,
“rightValue”: “SINGLE_PRICING”,
“operator”: {
“type”: “string”,
“operation”: “equals”
},
“id”: “9d1831a9-54ae-47d4-b1f5-e781baf373bc”
}
],
“combinator”: “and”
},
“renameOutput”: true,
“outputKey”: “Single Pricing”
},
{
“conditions”: {
“options”: {
“caseSensitive”: true,
“leftValue”: “”,
“typeValidation”: “loose”,
“version”: 2
},
“conditions”: [
{
“leftValue”: “={{ $json.message.content.routingStrategy }}”,
“rightValue”: “SINGLE_GENERAL”,
“operator”: {
“type”: “string”,
“operation”: “equals”
}
}
],
“combinator”: “and”
},
“renameOutput”: true,
“outputKey”: “Single General”
},
{
“conditions”: {
“options”: {
“caseSensitive”: true,
“leftValue”: “”,
“typeValidation”: “loose”,
“version”: 2
},
“conditions”: [
{
“leftValue”: “={{ $json.message.content.routingStrategy }}”,
“rightValue”: “HYBRID”,
“operator”: {
“type”: “string”,
“operation”: “equals”
}
}
],
“combinator”: “and”
},
“renameOutput”: true,
“outputKey”: “Hybrid Query”
},
{
“conditions”: {
“options”: {
“caseSensitive”: true,
“leftValue”: “”,
“typeValidation”: “loose”,
“version”: 2
},
“conditions”: [
{
“leftValue”: “={{ $json.message.content.routingStrategy }}”,
“rightValue”: “FOLLOW_UP”,
“operator”: {
“type”: “string”,
“operation”: “equals”
}
}
],
“combinator”: “and”
},
“renameOutput”: true,
“outputKey”: “Follow Up”
}
]
},
“looseTypeValidation”: true,
“options”: {}
},
“type”: “n8n-nodes-base.switch”,
“typeVersion”: 3.2,
“position”: [
-240,
464
],
“id”: “8f7dbd58-fc4a-4f48-aa76-1a43b0b085fd”,
“name”: “Routing Switch”
},
{
“parameters”: {
“promptType”: “define”,
“text”: “={{ $(‘Master Orchestrator’).item.json.message.content.pricingSubQuery }} || {{ $(‘Edit Fields’).item.json.OrignalChatInput }}”,
“options”: {
“systemMessage”: “You are ACADEMY Pricing Agent. ”
}
},
“type”: “@n8n/n8n-nodes-langchain.agent”,
“typeVersion”: 2.2,
“position”: [
464,
-272
],
“id”: “c02aaa6c-7800-412b-9724-a89cbdc35b2b”,
“name”: “Pricing Agent”
},
{
“parameters”: {
“promptType”: “define”,
“text”: “={{ $(‘Master Orchestrator’).item.json.message.content.generalSubQuery || $(‘Edit Fields’).item.json.OrignalChatInput }}”,
“options”: {
“systemMessage”: “You are a Fahrschule Drive In Assistant, a bilingual (German and English) chatbot for ACADEMY Fahrschule Drive In, Germany. Search thoroughly through the “Pinecone Vector Store” for answers before returning any response. Whenever you write in German; ALWAYS write in “du” form\n\nLanguage Rule: Match the user’s language exactly - if they write in English, respond in English; if German, respond in German.\n\nCore Rule: You ONLY provide information from RAG AGENT outputs. Never generate answers independently. Make sure the response is well formatted.\n\nSearch Rule: ALWAYS query RAG Agent thoroughly and search in detail before returning any answer. Ensure you retrieve comprehensive information from the tool like “Database”.\n”
}
},
“type”: “@n8n/n8n-nodes-langchain.agent”,
“typeVersion”: 2.2,
“position”: [
368,
512
],
“id”: “e0659983-ff1c-48d4-a1d2-1335286db596”,
“name”: “General Agent”,
“alwaysOutputData”: true
},
{
“parameters”: {
“modelId”: {
“__rl”: true,
“value”: “gpt-4o”,
“mode”: “list”
},
“messages”: {
“values”: [
{
“content”: “=You are a Response Synthesizer for ACADEMY Fahrschule Drive In chatbot.\n\nYour job is to combine responses from specialized agents into ONE coherent, well-formatted answer.\n\nInputs:\n- Original User Query\n- Pricing Agent Response (if available)\n- General Agent Response (if available)\n- Routing Strategy used\n\nTasks:\n1. Merge responses intelligently - remove redundancy\n2. Maintain formatting - preserve tables, bullets, structure\n3. Ensure flow - make it read as ONE response, not two pasted together\n4. Keep language consistent - match user’s language (English/German)\n5. Preserve all key information - don’t drop important details\n\nFormatting Rules:\n- If both responses exist, use clear section breaks\n- Keep pricing tables intact\n- Use markdown formatting (bold headings, bullets)\n- No duplicate information\n- Maximum 150 words total unless tables require more space\n- End with ONE relevant follow-up question\n\nExample Input:\nUser Query: “How much is B197 and what documents do I need?”\nPricing Response: [Table with B197 pricing]\nGeneral Response: “You need: passport photo, ID, proof of residency”\n\nExample Output:\nB197 Course Pricing\n[Pricing List]\n\nRequired Documents:\n• Biometric passport photo\n• Valid ID or passport \n• Proof of residency\n\nWould you like to know about payment options or schedule a registration appointment?\n\nCritical:\n- Never invent information not in the agent responses\n- If one agent returned “no information found”, acknowledge it gracefully\n- Preserve exact pricing amounts and document names\n\nFormatting Rules:\n- Use actual line breaks, not \n escape sequences\n- Use proper Markdown with ** for bold, • for bullets\n- Format output as clean HTML if the client expects HTML\n- Never output escaped characters like \n or \t”,
“role”: “system”
},
{
“content”: “=Original Query: {{ $(‘Edit Fields’).item.json.OrignalChatInput }}\n\nRouting Strategy: {{ $(‘Master Orchestrator’).item.json.message.content.routingStrategy }}\n\nPricing Agent Response:\n{{ $input.all().find(item => item.json.PricingAgentOutput)?.json.PricingAgentOutput || ‘Not called’ }}\n\nGeneral Agent Response:\n{{ $input.all().find(item => item.json.GeneralAgentOutput)?.json.GeneralAgentOutput || ‘Not called’ }}\n\nSynthesize these into ONE coherent response.”
}
]
},
“options”: {}
},
“type”: “@n8n/n8n-nodes-langchain.openAi”,
“typeVersion”: 1.8,
“position”: [
1808,
496
],
“id”: “52afbb49-5431-4713-9461-47f12e3cb8a2”,
“name”: “Response Synthesizer”,
“credentials”: {
“openAiApi”: {
“id”: “7L9oWkrz2VCUu0ZV”,
“name”: “OpenAi account”
}
}
},
{
“parameters”: {
“model”: {
“__rl”: true,
“value”: “gpt-4.1-2025-04-14”,
“mode”: “list”,
“cachedResultName”: “gpt-4.1-2025-04-14”
},
“options”: {}
},
“type”: “@n8n/n8n-nodes-langchain.lmChatOpenAi”,
“typeVersion”: 1.2,
“position”: [
288,
-32
],
“id”: “b53d81c7-3a4a-4ca9-9ded-d10bcfa417ca”,
“name”: “Pricing LLM”,
“credentials”: {
“openAiApi”: {
“id”: “7L9oWkrz2VCUu0ZV”,
“name”: “OpenAi account”
}
}
},
{
“parameters”: {
“model”: {
“__rl”: true,
“value”: “gpt-4.1-2025-04-14”,
“mode”: “list”,
“cachedResultName”: “gpt-4.1-2025-04-14”
},
“options”: {}
},
“type”: “@n8n/n8n-nodes-langchain.lmChatOpenAi”,
“typeVersion”: 1.2,
“position”: [
160,
1040
],
“id”: “775c0e2c-3278-490a-8693-2b40214034cb”,
“name”: “General LLM”,
“credentials”: {
“openAiApi”: {
“id”: “7L9oWkrz2VCUu0ZV”,
“name”: “OpenAi account”
}
}
},
{
“parameters”: {
“sessionIdType”: “customKey”,
“sessionKey”: “={{ $(‘When chat message received’).item.json.sessionId }}”
},
“type”: “@n8n/n8n-nodes-langchain.memoryBufferWindow”,
“typeVersion”: 1.3,
“position”: [
336,
176
],
“id”: “6cc55e6d-892e-4d6e-a2ea-72dffef07f21”,
“name”: “Pricing Memory”
},
{
“parameters”: {
“sessionIdType”: “customKey”,
“sessionKey”: “={{ $(‘When chat message received’).item.json.sessionId }}”
},
“type”: “@n8n/n8n-nodes-langchain.memoryBufferWindow”,
“typeVersion”: 1.3,
“position”: [
288,
1040
],
“id”: “5b5215be-033a-4d0f-a23e-977f8b1c29f1”,
“name”: “General Memory”
},
{
“parameters”: {
“mode”: “retrieve-as-tool”,
“toolDescription”: “Retrieve pricing information from vector store”,
“pineconeIndex”: {
“__rl”: true,
“value”: “pricelistpdfdrivein”,
“mode”: “list”
},
“topK”: 20,
“options”: {
“pineconeNamespace”: “Brandilyst”
}
},
“type”: “@n8n/n8n-nodes-langchain.vectorStorePinecone”,
“typeVersion”: 1.3,
“position”: [
512,
64
],
“id”: “b4ad20ce-fd7e-427d-92d0-8332bc0f6952”,
“name”: “Pricing Vector Store”,
“credentials”: {
“pineconeApi”: {
“id”: “ivhMrbkuOfJQZcoc”,
“name”: “PineconeApi account”
}
}
},
{
“parameters”: {
“mode”: “retrieve-as-tool”,
“toolDescription”: “Retrieve general information from vector store”,
“pineconeIndex”: {
“__rl”: true,
“value”: “generalinquiriesdrivein”,
“mode”: “list”
},
“topK”: 30,
“options”: {
“pineconeNamespace”: “Brandilyst”
}
},
“type”: “@n8n/n8n-nodes-langchain.vectorStorePinecone”,
“typeVersion”: 1.3,
“position”: [
416,
1040
],
“id”: “4350d83d-7ab0-4ce5-a7ad-5f12eb4b8c26”,
“name”: “General Vector Store”,
“credentials”: {
“pineconeApi”: {
“id”: “ivhMrbkuOfJQZcoc”,
“name”: “PineconeApi account”
}
}
},
{
“parameters”: {
“model”: “text-embedding-3-large”,
“options”: {}
},
“type”: “@n8n/n8n-nodes-langchain.embeddingsOpenAi”,
“typeVersion”: 1.2,
“position”: [
512,
304
],
“id”: “6bd9eac9-e30a-4286-b3c2-49f9fd15f9e4”,
“name”: “Pricing Embeddings”,
“credentials”: {
“openAiApi”: {
“id”: “7L9oWkrz2VCUu0ZV”,
“name”: “OpenAi account”
}
}
},
{
“parameters”: {
“model”: “text-embedding-3-large”,
“options”: {}
},
“type”: “@n8n/n8n-nodes-langchain.embeddingsOpenAi”,
“typeVersion”: 1.2,
“position”: [
496,
1248
],
“id”: “6c4271b8-77a0-4e64-b30a-a85ac6a4e8b1”,
“name”: “General Embeddings”,
“credentials”: {
“openAiApi”: {
“id”: “7L9oWkrz2VCUu0ZV”,
“name”: “OpenAi account”
}
}
},
{
“parameters”: {
“options”: {}
},
“type”: “n8n-nodes-base.dateTimeTool”,
“typeVersion”: 2,
“position”: [
800,
144
],
“id”: “58836f9a-62cf-484a-9625-d147e084cbdc”,
“name”: “Pricing Date & Time”
},
{
“parameters”: {
“options”: {}
},
“type”: “n8n-nodes-base.dateTimeTool”,
“typeVersion”: 2,
“position”: [
704,
1040
],
“id”: “b512ce0b-a1ce-4547-b0cd-8418595ff559”,
“name”: “General Date & Time”
},
{
“parameters”: {},
“type”: “n8n-nodes-base.merge”,
“typeVersion”: 3.2,
“position”: [
1552,
496
],
“id”: “aee3bed4-16f9-4b5c-a135-0a106d0362fd”,
“name”: “Merge”
},
{
“parameters”: {
“assignments”: {
“assignments”: [
{
“id”: “d5082d43-2014-4611-83d7-5df03b8dc7a4”,
“name”: “OrignalSessionID”,
“value”: “={{ $json.sessionId }}”,
“type”: “string”
},
{
“id”: “4c957cfd-7b79-4617-b69b-83cf5ac7edfc”,
“name”: “OrignalChatInput”,
“value”: “={{ $json.chatInput }}”,
“type”: “string”
}
]
},
“options”: {}
},
“type”: “n8n-nodes-base.set”,
“typeVersion”: 3.4,
“position”: [
-992,
496
],
“id”: “e0e37e72-237c-472c-80f6-2d9b15489a12”,
“name”: “Edit Fields”
},
{
“parameters”: {
“assignments”: {
“assignments”: [
{
“id”: “257b9d7b-cf3f-4a75-b370-cfb5e5bb0049”,
“name”: “PricingAgentOutput”,
“value”: “={{ $json.output }}”,
“type”: “string”
}
]
},
“options”: {}
},
“type”: “n8n-nodes-base.set”,
“typeVersion”: 3.4,
“position”: [
960,
16
],
“id”: “03172ba6-4601-4d56-b94f-700ed8efc652”,
“name”: “Edit Fields1”
},
{
“parameters”: {
“assignments”: {
“assignments”: [
{
“id”: “927e4243-6e36-4057-946d-49a7bc85a056”,
“name”: “GeneralAgentOutput”,
“value”: “={{ $json.output }}”,
“type”: “string”
}
]
},
“options”: {}
},
“type”: “n8n-nodes-base.set”,
“typeVersion”: 3.4,
“position”: [
960,
512
],
“id”: “4e8e7819-4657-4042-bec8-860211a2c243”,
“name”: “Edit Fields2”
},
{
“parameters”: {
“public”: true,
“mode”: “webhook”,
“options”: {
“responseMode”: “responseNode”
}
},
“type”: “@n8n/n8n-nodes-langchain.chatTrigger”,
“typeVersion”: 1.3,
“position”: [
-1264,
496
],
“id”: “a4395b73-1437-460c-9cae-b8e0f96e4499”,
“name”: “When chat message received”,
“webhookId”: “8e2c21a3-bb82-4efb-869e-f089b9924930”
},
{
“parameters”: {
“respondWith”: “json”,
“responseBody”: “={\n “content”: “{{ $json.message.content.replace(/\\/g, ‘\\\\’).replace(/\”/g, ‘\\“’).replace(/\n/g, ‘\\n’) }}”\n}”,
“options”: {}
},
“type”: “n8n-nodes-base.respondToWebhook”,
“typeVersion”: 1.4,
“position”: [
2480,
496
],
“id”: “27185aa5-f523-470c-a5e6-622850695354”,
“name”: “Respond to Webhook”
},
{
“parameters”: {
“assignments”: {
“assignments”: [
{
“id”: “9fa2d9af-9654-4346-8d14-34d8827f75d6”,
“name”: “message.content”,
“value”: “={{ $json.message.content }}”,
“type”: “string”
}
]
},
“options”: {}
},
“type”: “n8n-nodes-base.set”,
“typeVersion”: 3.4,
“position”: [
2160,
496
],
“id”: “79c5bfbf-9182-4866-81b8-aa6b75171a9c”,
“name”: “Edit Fields3”
}
],
“connections”: {
“Master Orchestrator”: {
“main”: [
[
{
“node”: “Routing Switch”,
“type”: “main”,
“index”: 0
}
]
]
},
“Routing Switch”: {
“main”: [
[
{
“node”: “Pricing Agent”,
“type”: “main”,
“index”: 0
}
],
[
{
“node”: “General Agent”,
“type”: “main”,
“index”: 0
}
],
[
{
“node”: “Pricing Agent”,
“type”: “main”,
“index”: 0
},
{
“node”: “General Agent”,
“type”: “main”,
“index”: 0
}
],
[
{
“node”: “General Agent”,
“type”: “main”,
“index”: 0
}
]
]
},
“Pricing Agent”: {
“main”: [
[
{
“node”: “Edit Fields1”,
“type”: “main”,
“index”: 0
}
]
]
},
“General Agent”: {
“main”: [
[
{
“node”: “Edit Fields2”,
“type”: “main”,
“index”: 0
}
]
]
},
“Response Synthesizer”: {
“main”: [
[
{
“node”: “Edit Fields3”,
“type”: “main”,
“index”: 0
}
]
]
},
“Pricing LLM”: {
“ai_languageModel”: [
[
{
“node”: “Pricing Agent”,
“type”: “ai_languageModel”,
“index”: 0
}
]
]
},
“General LLM”: {
“ai_languageModel”: [
[
{
“node”: “General Agent”,
“type”: “ai_languageModel”,
“index”: 0
}
]
]
},
“Pricing Memory”: {
“ai_memory”: [
[
{
“node”: “Pricing Agent”,
“type”: “ai_memory”,
“index”: 0
}
]
]
},
“General Memory”: {
“ai_memory”: [
[
{
“node”: “General Agent”,
“type”: “ai_memory”,
“index”: 0
}
]
]
},
“Pricing Vector Store”: {
“ai_tool”: [
[
{
“node”: “Pricing Agent”,
“type”: “ai_tool”,
“index”: 0
}
]
]
},
“General Vector Store”: {
“ai_tool”: [
[
{
“node”: “General Agent”,
“type”: “ai_tool”,
“index”: 0
}
]
]
},
“Pricing Embeddings”: {
“ai_embedding”: [
[
{
“node”: “Pricing Vector Store”,
“type”: “ai_embedding”,
“index”: 0
}
]
]
},
“General Embeddings”: {
“ai_embedding”: [
[
{
“node”: “General Vector Store”,
“type”: “ai_embedding”,
“index”: 0
}
]
]
},
“Pricing Date & Time”: {
“ai_tool”: [
[
{
“node”: “Pricing Agent”,
“type”: “ai_tool”,
“index”: 0
}
]
]
},
“General Date & Time”: {
“ai_tool”: [
[
{
“node”: “General Agent”,
“type”: “ai_tool”,
“index”: 0
}
]
]
},
“Merge”: {
“main”: [
[
{
“node”: “Response Synthesizer”,
“type”: “main”,
“index”: 0
}
]
]
},
“Edit Fields”: {
“main”: [
[
{
“node”: “Master Orchestrator”,
“type”: “main”,
“index”: 0
}
]
]
},
“Edit Fields1”: {
“main”: [
[
{
“node”: “Merge”,
“type”: “main”,
“index”: 0
}
]
]
},
“Edit Fields2”: {
“main”: [
[
{
“node”: “Merge”,
“type”: “main”,
“index”: 1
}
]
]
},
“When chat message received”: {
“main”: [
[
{
“node”: “Edit Fields”,
“type”: “main”,
“index”: 0
}
]
]
},
“Edit Fields3”: {
“main”: [
[
{
“node”: “Respond to Webhook”,
“type”: “main”,
“index”: 0
}
]
]
}
},
“pinData”: {
“When chat message received”: [
{
“action”: “sendMessage”,
“sessionId”: “c858b1a7-6656-4663-856a-a9a50bef7c63”,
“chatInput”: “How to register for theory course”,
“metadata”: {}
}
]
},
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “994e3e2485257d919a0226764afcc58d13b8dc13805291ba41c5e469b0d99ced”
}
}>
Share the output returned by the last node
{
“message”: {
“content”: “To register for the theory course, you can do so easily online:\n\n
Book Theory Classes / Register\n\nWould you like details on required documents or session schedules?”
}
}
Information on your n8n setup
- n8n version:
- Database (default: SQLite):
- n8n EXECUTIONS_PROCESS setting (default: own, main):
- Running n8n via (Docker, npm, n8n cloud, desktop app):
- Operating system: