This workflow follows the Agent → OpenAI Embeddings 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": "tr3dbs",
"nodes": [
{
"parameters": {
"updates": [
"message"
],
"additionalFields": {}
},
"type": "n8n-nodes-base.telegramTrigger",
"typeVersion": 1.2,
"position": [
0,
-112
],
"id": "8819d863-0c93-4b7f-95ce-d4ed6e4bd0ef",
"name": "Telegram Trigger",
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"functionCode": "const text = $json.message.text.toLowerCase();\nlet namespace;\nlet mode;\n\nif (text.startsWith('/studenthandbook')) {\n namespace = 'studenthandbook';\n mode = 'set';\n} else if (text.startsWith('/recipes')) {\n namespace = 'recipes';\n mode = 'set';\n} else if (text.startsWith('/onboarding')) {\n namespace = 'onboarding';\n mode = 'set';\n} else {\n const data = this.getWorkflowStaticData('global');\n namespace = data[$json.message.chat.id] || 'studenthandbook';\n mode = 'query';\n}\n\n// Save namespace per user\nconst data = this.getWorkflowStaticData('global');\ndata[$json.message.chat.id] = namespace;\n\nreturn {\n ...$json,\n namespace,\n mode\n};"
},
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
240,
0
],
"id": "d09668a2-7a8a-48be-a41c-480bb643bb3f",
"name": "Namespace Selector"
},
{
"parameters": {
"options": {
"dimensions": 512
}
},
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
"typeVersion": 1.2,
"position": [
1152,
432
],
"id": "499c7973-7fab-4318-b1e0-ec6ce020476b",
"name": "Embeddings OpenAI",
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"model": {
"__rl": true,
"value": "gpt-4o",
"mode": "list",
"cachedResultName": "gpt-4o"
},
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"typeVersion": 1.2,
"position": [
672,
272
],
"id": "ab9d63a6-7952-41b1-9e15-857dbf7e0d6f",
"name": "OpenAI Chat Model",
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"chatId": "={{ $('Namespace Selector').item.json.message.chat.id }}",
"text": "={{ $json.output }}",
"additionalFields": {}
},
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.2,
"position": [
1168,
0
],
"id": "28e739f6-30cb-4144-9e31-66e8a2bc7026",
"name": "Telegram Reply",
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"promptType": "define",
"text": "={{ $json.message.text }}",
"options": {
"systemMessage": "=You are answering from the {{ $json.namespace }} database. Avoid speculations and anything out of context or whose context is irrelevant to the question. You should say, \"Sorry!!\", as I cannot find the relevant information in the knowledge base. Do not provide any additional information. You should not generate or interpret any response from your knowledge. "
}
},
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 2.2,
"position": [
672,
-16
],
"id": "75e2059c-ba6c-4f02-8900-33029a70df67",
"name": "AI Agent"
},
{
"parameters": {
"mode": "retrieve-as-tool",
"toolDescription": "get data from the message",
"pineconeIndex": {
"__rl": true,
"value": "icn8n",
"mode": "list",
"cachedResultName": "icn8n"
},
"options": {
"pineconeNamespace": "={{ $json.namespace }}"
}
},
"type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
"typeVersion": 1.3,
"position": [
1152,
192
],
"id": "c598154d-ba9c-4c3b-acb6-82bea08832a8",
"name": "Pinecone Vector Store1",
"credentials": {
"pineconeApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"sessionIdType": "customKey",
"sessionKey": "={{ $json.message.chat.id }}"
},
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"typeVersion": 1.3,
"position": [
880,
384
],
"id": "0e59844b-a7a8-45e7-aead-456391726d15",
"name": "Simple Memory"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "595fdd37-feac-4ce1-a4c9-867beaca2f81",
"leftValue": "={{ $json.mode }}",
"rightValue": "=set",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
448,
0
],
"id": "97a63c57-55d1-4dbd-a29a-b48d8346b199",
"name": "If"
},
{
"parameters": {
"chatId": "={{ $('Namespace Selector').item.json.message.chat.id }}",
"text": "={{ $('Namespace Selector').item.json.mode }} {{ \" to \" }}{{ $('Namespace Selector').item.json.namespace }}",
"additionalFields": {}
},
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.2,
"position": [
432,
176
],
"id": "847bf665-6ff0-45c9-a52b-56c131b4cfa2",
"name": "Telegram Reply1",
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
}
}
],
"connections": {
"Telegram Trigger": {
"main": [
[
{
"node": "Namespace Selector",
"type": "main",
"index": 0
}
]
]
},
"Namespace Selector": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"Pinecone Vector Store1": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Simple Memory": {
"ai_memory": [
[
{
"node": "AI Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"Embeddings OpenAI": {
"ai_embedding": [
[
{
"node": "Pinecone Vector Store1",
"type": "ai_embedding",
"index": 0
}
]
]
},
"AI Agent": {
"main": [
[
{
"node": "Telegram Reply",
"type": "main",
"index": 0
}
]
]
},
"If": {
"main": [
[
{
"node": "Telegram Reply1",
"type": "main",
"index": 0
}
],
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
}
},
"active": true,
"settings": {
"executionOrder": "v1",
"callerPolicy": "workflowsFromSameOwner",
"errorWorkflow": "ws69zNH3tNxAznlz"
},
"versionId": "de213ddf-9fad-4caa-bd45-ed49c0a5cefc",
"meta": {
"templateCredsSetupCompleted": true
},
"id": "0HG9CJQO58kwkaDb",
"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.
openAiApipineconeApitelegramApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
tr3dbs. Uses telegramTrigger, embeddingsOpenAi, lmChatOpenAi, telegram. Event-driven trigger; 10 nodes.
Source: https://github.com/viswapani/Blackelephant/blob/f6c06dee5510bea6203c407e704128024adb8802/n8n/tr3dbs_final_v2.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.
Alfred (funcional). Uses gmailTool, googleCalendarTool, gmail, embeddingsOpenAi. Event-driven trigger; 83 nodes.
OIL Rag. Uses lmChatOpenAi, embeddingsOpenAi, agent, telegramTrigger. Event-driven trigger; 53 nodes.
This is an ultimate AI assistant: Handle emails, schedule meetings, search the web, take notes, post to social media, and retrieve information from your knowledge base, all through simple Telegram com
Turn your docs into an AI-powered internal or public-facing assistant. This chatbot workflow uses RAG (Retrieval-Augmented Generation) with Supabase vector search to answer employee or customer questi
Telegram dummy_client. Uses telegramTrigger, agent, lmChatOpenAi, telegram. Event-driven trigger; 48 nodes.