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": "Main Router",
"id": "SvKKVIGPCc68OOyL",
"active": true,
"nodes": [
{
"parameters": {
"updates": [
"message"
]
},
"id": "37fdbd79-a755-4c63-aaa7-a2bf08fe97eb",
"name": "Telegram Trigger",
"type": "n8n-nodes-base.telegramTrigger",
"typeVersion": 1,
"position": [
0,
0
],
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"jsCode": "// Main Router \u2014 command and keyword routing\n\nconst ALLOWED_CHAT_ID = parseInt($env.TELEGRAM_CHAT_ID, 10);\nconst message = $input.first().json.message || {};\nconst chatId = message.chat && message.chat.id;\n\nif (!Number.isFinite(ALLOWED_CHAT_ID) || chatId !== ALLOWED_CHAT_ID) {\n return [];\n}\n\nconst rawText = String(message.text || '').trim();\nconst text = rawText.toLowerCase();\n\nconst WORKFLOW_IDS = {\n 'daily-briefing': 'KZPDjrKOkeo5VEgr',\n 'calendar-sync': 'calendarSync2468',\n 'aulas-sync': 'aulasSync24680',\n 'moodle-sync': 'moodleSync123456',\n 'classroom-sync': 'classroomSync789',\n 'general-qa': 'qaPatch429'\n};\n\nfunction hasAny(words) {\n return words.some(word => text.includes(word));\n}\n\nlet route = 'general-qa';\n\nif (/^\\/briefing\\b/.test(text)) {\n route = 'daily-briefing';\n} else if (/^\\/(calendar|calendario)\\b/.test(text)) {\n route = 'calendar-sync';\n} else if (/^\\/(aulas|horario)\\b/.test(text)) {\n route = 'aulas-sync';\n} else if (/^\\/moodle\\b/.test(text)) {\n route = 'moodle-sync';\n} else if (/^\\/classroom\\b/.test(text)) {\n route = 'classroom-sync';\n} else if (hasAny(['briefing', 'hoje', 'semana'])) {\n route = 'daily-briefing';\n} else if (hasAny(['aulas', 'horario de aula', 'horario das aulas', 'faltas', 'frequencia'])) {\n route = 'aulas-sync';\n} else if (hasAny(['moodle', 'ava', 'utfpr'])) {\n route = 'moodle-sync';\n} else if (hasAny(['classroom', 'tarefa', 'atividade da turma'])) {\n route = 'classroom-sync';\n} else if (hasAny(['calendario', 'agenda', 'compromisso', 'evento'])) {\n route = 'calendar-sync';\n}\n\nconst workflowId = WORKFLOW_IDS[route] || WORKFLOW_IDS['general-qa'];\n\nreturn [\n {\n json: {\n route,\n workflowId,\n original_message: message\n }\n }\n];"
},
"id": "5de7e200-d401-4e1d-b3e7-dd9be16d83b7",
"name": "Router Logic",
"type": "n8n-nodes-base.code",
"typeVersion": 1,
"position": [
200,
0
]
},
{
"parameters": {
"workflowId": "={{ $json.workflowId }}",
"options": {}
},
"id": "e3c14a18-10dc-4bd9-a21e-6175c9bd83be",
"name": "Execute Sub-Workflow",
"type": "n8n-nodes-base.executeWorkflow",
"typeVersion": 1,
"position": [
400,
0
]
}
],
"connections": {
"Telegram Trigger": {
"main": [
[
{
"node": "Router Logic",
"type": "main",
"index": 0
}
]
]
},
"Router Logic": {
"main": [
[
{
"node": "Execute Sub-Workflow",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1"
}
}
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.
telegramApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Main Router. Uses telegramTrigger. Event-driven trigger; 3 nodes.
Source: https://github.com/webtraveler-br/servidor-assistente-com-n8n/blob/212c03ae8f676129a5fc3354b7c64e4876716fb1/workflows/main-router.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.
N8N Complete Final. Uses telegramTrigger, dataTable, telegram, mqtt. Event-driven trigger; 58 nodes.
TextMain. Uses telegramTrigger, stopAndError, telegram, httpRequest. Event-driven trigger; 56 nodes.
Pede Ai. Uses httpRequest, telegram, postgres, telegramTrigger. Event-driven trigger; 53 nodes.
📄 Documentation: Notion Guide
News Digest Bot - Multi-User (Postgres). Uses telegramTrigger, postgres, telegram, rssFeedRead. Event-driven trigger; 45 nodes.