AutomationFlowsAI & RAG › Telegram Bot Command Handler with HTTP Requests

Telegram Bot Command Handler with HTTP Requests

Original n8n title: Phase 0 — Telegram Foundation

Phase 0 — Telegram Foundation. Uses telegramTrigger, telegram, httpRequest. Event-driven trigger; 9 nodes.

Event trigger★★★★☆ complexity9 nodesTelegram TriggerTelegramHTTP Request
AI & RAG Trigger: Event Nodes: 9 Complexity: ★★★★☆ Added:

This workflow follows the HTTP Request → Telegram 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 →

Download .json
{
  "name": "Phase 0 \u2014 Telegram Foundation",
  "nodes": [
    {
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "id": "a1b2c3d4-0000-0000-0000-000000000001",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "typeVersion": 1.1,
      "position": [
        160,
        300
      ],
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "const msg      = $input.item.json.message || {};\nconst text     = (msg.text || '').trim();\nconst chatId   = msg.chat?.id;\nconst username = msg.from?.first_name || msg.from?.username || 'User';\n\nlet command = 'unknown';\nif      (text.startsWith('/ping'))   command = 'ping';\nelse if (text.startsWith('/status')) command = 'status';\nelse if (text.startsWith('/help'))   command = 'help';\nelse if (text.startsWith('/'))       command = 'unknown_cmd';\n\nreturn { json: { command, chatId, username, originalText: text } };"
      },
      "id": "a1b2c3d4-0000-0000-0000-000000000002",
      "name": "Parse Command",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        380,
        300
      ]
    },
    {
      "parameters": {
        "mode": "rules",
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "typeValidation": "loose"
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.command }}",
                    "rightValue": "ping",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "ping"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "typeValidation": "loose"
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.command }}",
                    "rightValue": "status",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "status"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "typeValidation": "loose"
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.command }}",
                    "rightValue": "help",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "help"
            }
          ]
        },
        "options": {
          "fallbackOutput": "extra"
        }
      },
      "id": "a1b2c3d4-0000-0000-0000-000000000003",
      "name": "Route Command",
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3,
      "position": [
        600,
        300
      ]
    },
    {
      "parameters": {
        "chatId": "={{ $('Parse Command').item.json.chatId }}",
        "text": "\ud83c\udfd3 Pong! Bot is alive.",
        "additionalFields": {}
      },
      "id": "a1b2c3d4-0000-0000-0000-000000000004",
      "name": "Send Pong",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        840,
        120
      ],
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "url": "=http://localhost:{{ $env.PORT || '3000' }}/health",
        "options": {
          "timeout": 6000
        }
      },
      "id": "a1b2c3d4-0000-0000-0000-000000000005",
      "name": "Get Health",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        840,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "const h    = $input.item.json;\nconst s    = h.stats             || {};\nconst sess = h.linkedin_session  || {};\nconst up   = h.uptime_seconds    || 0;\nconst emoji = { healthy:'\u2705', degraded:'\u26a0\ufe0f', logged_out:'\ud83d\udd12', error:'\u274c', unknown:'\u2753' };\nconst sesE  = emoji[sess.status] || '\u2753';\n\nconst text = [\n  `<b>Job Application Agent \u2014 Status</b>`,\n  ``,\n  `Status: ${h.status === 'ok' ? '\u2705 Healthy' : '\u274c Degraded'}`,\n  `Uptime: ${Math.floor(up/60)}m ${up%60}s   Phase: ${h.phase||0}`,\n  ``,\n  `<b>\ud83d\udcca Pipeline:</b>`,\n  `\u2022 Total jobs: <b>${s.total_jobs||0}</b>`,\n  `\u2022 New (unscored): ${s.new_jobs||0}`,\n  `\u2022 Scored: ${s.scored_jobs||0}`,\n  `\u2022 Applied: ${s.applied_jobs||0}`,\n  `\u2022 Pending approval: ${s.pending_approval||0}`,\n  ``,\n  `<b>\ud83d\udd17 LinkedIn Session:</b>`,\n  `${sesE} ${sess.status||'unknown'}`,\n  `Last check: ${sess.last_check||'Never'}`,\n  `Failures: ${sess.consecutive_failures||0}`,\n].join('\\n');\n\nreturn { json: { text, chatId: $('Parse Command').item.json.chatId } };"
      },
      "id": "a1b2c3d4-0000-0000-0000-000000000006",
      "name": "Format Status",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1060,
        300
      ]
    },
    {
      "parameters": {
        "chatId": "={{ $json.chatId }}",
        "text": "={{ $json.text }}",
        "additionalFields": {
          "parse_mode": "HTML"
        }
      },
      "id": "a1b2c3d4-0000-0000-0000-000000000007",
      "name": "Send Status",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        1280,
        300
      ],
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "chatId": "={{ $('Parse Command').item.json.chatId }}",
        "text": "<b>Job Application Agent \u2014 Commands</b>\n\n<b>Phase 0 (Active):</b>\n/ping \u2014 Check bot is alive\n/status \u2014 System health and pipeline stats\n/help \u2014 This message\n\n<b>Phase 1 \u2014 Discovery:</b>\n/scan \u2014 Trigger LinkedIn job scan\n/topjobs \u2014 List top scored jobs\n\n<b>Phase 2 \u2014 Scoring:</b>\n/review &lt;job_id&gt; \u2014 Review job details and score\n\n<b>Phase 3 \u2014 Packages:</b>\n/approve &lt;app_id&gt; \u2014 Approve application\n/reject &lt;app_id&gt; \u2014 Reject application\n\n<b>Phase 4 \u2014 Apply:</b>\n/apply &lt;job_id&gt; \u2014 Playwright-assisted apply\n/relogin \u2014 Re-authenticate LinkedIn",
        "additionalFields": {
          "parse_mode": "HTML"
        }
      },
      "id": "a1b2c3d4-0000-0000-0000-000000000008",
      "name": "Send Help",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        840,
        460
      ],
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "chatId": "={{ $('Parse Command').item.json.chatId }}",
        "text": "Unknown command. Send /help for the full list.",
        "additionalFields": {}
      },
      "id": "a1b2c3d4-0000-0000-0000-000000000009",
      "name": "Send Unknown",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        840,
        620
      ],
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Parse Command",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Command": {
      "main": [
        [
          {
            "node": "Route Command",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route Command": {
      "main": [
        [
          {
            "node": "Send Pong",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Health",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Help",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Unknown",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Health": {
      "main": [
        [
          {
            "node": "Format Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Status": {
      "main": [
        [
          {
            "node": "Send Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "phase0-v1.0.0",
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "id": "workflow-phase0-foundation",
  "tags": [
    {
      "name": "phase-0"
    },
    {
      "name": "telegram"
    }
  ]
}

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.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Phase 0 — Telegram Foundation. Uses telegramTrigger, telegram, httpRequest. Event-driven trigger; 9 nodes.

Source: https://github.com/manni17/jobapplicationagent/blob/781a5b57d95a4bf38cbae98558817146c8e386fd/n8n-workflows/phase0-foundation.json — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

Lead Interaction (Supabase) - AutoDeployed. Uses telegramTrigger, httpRequest, telegram. Event-driven trigger; 7 nodes.

Telegram Trigger, HTTP Request, Telegram
AI & RAG

Model Onboarding (Supabase) - AutoDeployed. Uses telegramTrigger, httpRequest, telegram. Event-driven trigger; 6 nodes.

Telegram Trigger, HTTP Request, Telegram
AI & RAG

This workflow creates a multi-talented AI assistant named Simran that interacts with users via Telegram. It can handle text and voice messages, understand the user's intent, and perform various tasks.

MongoDB, Chain Llm, Google Gemini Chat +11
AI & RAG

Generate AI viral videos with NanoBanana & VEO3, shared on socials via Blotato 2. Uses @blotato/n8n-nodes-blotato, googleSheets, lmChatOpenAi, toolThink. Event-driven trigger; 94 nodes.

@Blotato/N8N Nodes Blotato, Google Sheets, OpenAI Chat +9
AI & RAG

This project is a template for building a complete academic virtual assistant using n8n. It connects to Telegram, answers frequently asked questions by querying MongoDB, keeps the community informed a

Telegram, MongoDB, Telegram Trigger +6