{ "id": "ax8PJlp1UDb6EGFt", "meta": { "instanceId": "fb924c73af8f703905bc09c9ee8076f48c17b596ed05b18c0ff86915ef8a7c4a" }, "name": "Telegram AI Langchain bot", "tags": [], "nodes": [ { "id": "e275f31f-6a5f-4444-8bf7-6c003a8e53df", "name": "OpenAI Chat Model", "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi", "position": [ 1100, 600 ], "parameters": { "model": "gpt-4-1106-preview", "options": { "temperature": 0.7, "frequencyPenalty": 0.2 } }, "credentials": { "openAiApi": { "id": "63", "name": "OpenAi account" } }, "typeVersion": 1 }, { "id": "f25a6666-ff23-4372-afd0-4920a99aab6a", "name": "Window Buffer Memory", "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow", "position": [ 1220, 600 ], "parameters": { "sessionKey": "=chat_with_{{ $('Listen for incoming events').first().json.message.chat.id }}", "contextWindowLength": 10 }, "typeVersion": 1 }, { "id": "96faef5d-0349-47fe-a7cf-150953490e90", "name": "Telegram", "type": "n8n-nodes-base.telegram", "onError": "continueErrorOutput", "position": [ 1500, 380 ], "parameters": { "text": "={{ $json.output }}", "chatId": "={{ $('Listen for incoming events').first().json.message.from.id }}", "additionalFields": { "parse_mode": "HTML", "appendAttribution": false } }, "credentials": { "telegramApi": { "id": "70", "name": "Telegram sdfsdfsdfsdfsfd_bot" } }, "typeVersion": 1.1 }, { "id": "5ad43039-aaa6-43cd-9b0f-1d02f4d9c4ff", "name": "Correct errors", "type": "n8n-nodes-base.telegram", "position": [ 1700, 380 ], "parameters": { "text": "={{ $('AI Agent').item.json.output.replace(/&/g, \"&\").replace(/>/g, \">\").replace(/bold, bold\nitalic, italic\nunderline, underline\nstrikethrough, strikethrough, strikethrough\nspoiler, spoiler\nbold italic bold italic bold strikethrough italic bold strikethrough spoiler underline italic bold bold\ninline URL\ninline fixed-width code\n
pre-formatted fixed-width code block
\n2. Any code that you send should be wrapped in these tags:
pre-formatted fixed-width code block written in the Python programming language
\nOther programming languages are supported as well.\n3. All <, > and & symbols that are not a part of a tag or an HTML entity must be replaced with the corresponding HTML entities (< with <, > with > and & with &)\n4. If the user sends you a message starting with / sign, it means this is a Telegram bot command. For example, all users send /start command as their first message. Try to figure out what these commands mean and reply accodringly\n" } }, "typeVersion": 1.1 } ], "active": true, "pinData": {}, "settings": { "callerPolicy": "workflowsFromSameOwner", "executionOrder": "v1", "saveManualExecutions": true, "saveDataSuccessExecution": "all" }, "versionId": "3e9c27eb-1d2f-40bf-b284-4f6a1bece30c", "connections": { "AI Agent": { "main": [ [ { "node": "Telegram", "type": "main", "index": 0 } ] ] }, "Telegram": { "main": [ [], [ { "node": "Correct errors", "type": "main", "index": 0 } ] ] }, "Dall-E 3 Tool": { "ai_tool": [ [ { "node": "AI Agent", "type": "ai_tool", "index": 0 } ] ] }, "OpenAI Chat Model": { "ai_languageModel": [ [ { "node": "AI Agent", "type": "ai_languageModel", "index": 0 } ] ] }, "Send back an image": { "main": [ [ { "node": "add response field", "type": "main", "index": 0 } ] ] }, "Window Buffer Memory": { "ai_memory": [ [ { "node": "AI Agent", "type": "ai_memory", "index": 0 } ] ] }, "Execute Workflow Trigger": { "main": [ [ { "node": "Generate image in Dall-E 3", "type": "main", "index": 0 } ] ] }, "Generate image in Dall-E 3": { "main": [ [ { "node": "Send back an image", "type": "main", "index": 0 } ] ] }, "Listen for incoming events": { "main": [ [ { "node": "AI Agent", "type": "main", "index": 0 } ] ] } } }