TechBuzzPro

Connect n8n to Telegram: Step-by-Step Guide

· 6 min read · Apps & Browsers

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

You connect n8n to Telegram by creating a bot with Telegram's official @BotFather, copying the bot token into an n8n Telegram credential, and then adding a Telegram trigger or action node to a workflow. That gives you a working two-way link: Telegram messages can start automations, and n8n can send messages, photos, documents and inline keyboards back to chats, groups or channels.

What You'll Need

  • An n8n instance you can open in a browser. n8n Cloud works, and so does a self-hosted instance. For triggers to fire reliably, a self-hosted instance needs a public HTTPS URL, because Telegram delivers updates by webhook.
  • A Telegram account and the Telegram app on your phone or desktop.
  • Admin rights in the Telegram chat, group or channel where the bot will post. For a channel, the bot must be added as an administrator before it can send anything.
  • About ten minutes. No coding is required, though knowing what a webhook is helps when troubleshooting.

Step-by-Step

  1. Create the bot in Telegram. Open Telegram and search for @BotFather. Check for the verified badge and the exact handle before you message it, because impostor accounts exist. Start a chat and send /newbot. BotFather asks for a display name (anything you like) and then a username, which must be unique and must end in bot, for example my_n8n_helper_bot. When it succeeds, BotFather replies with a message containing the HTTP API token. Treat that token like a password.
  2. Copy the token somewhere safe. The token looks like a long number, a colon, and a string of letters and digits. Anyone who has it can control the bot. If you ever leak it, return to BotFather, send /revoke, pick the bot, and generate a new token.
  3. Open n8n and create a credential. In your n8n editor, open the credentials menu and create a new credential of type Telegram. Paste the token into the Access Token field and save. n8n tests the connection; a green success message means the token is valid. Menu labels in n8n can differ slightly between versions, so if you cannot see the credentials option, look under the settings or the left sidebar.
  4. Add a Telegram Trigger node. Create a new workflow and add the Telegram Trigger node. Select the credential you just made. In the trigger's update options, choose which events should start the workflow. Message is the usual choice, and you can add others such as callback query if you plan to use inline buttons. Save the workflow.
  5. Activate the workflow and register the webhook. Toggle the workflow to Active. On a self-hosted instance, the trigger registers a webhook with Telegram pointing at your n8n URL. On n8n Cloud this is handled for you. If the trigger shows a webhook URL, open it in a browser once to confirm it responds.
  6. Send a test message. In Telegram, open a chat with your bot and send /start or any short message. In n8n, open the trigger node and check the output panel. You should see the message text, the sender's ID and the chat ID. If nothing appears, see Troubleshooting below.
  7. Add an action node. Add a Telegram action node after the trigger and choose an operation such as Send Message. Select the same credential. For the chat ID, the simplest reliable method is to reference the chat ID from the trigger output rather than typing it by hand. Write your message text, then execute the workflow to test.
  8. Handle groups and channels correctly. Add the bot to the group as a member, or to the channel as an administrator. In groups, bots only receive messages that mention them or reply to them unless you change the bot's privacy settings through BotFather with /setprivacy. In channels, the bot can post only after being made an admin.
  9. Build out the workflow. From here you can branch on message text, call other n8n nodes (HTTP requests, databases, email), and reply with formatted text, photos, documents or inline keyboards. Keep the credential shared across every Telegram node in the workflow so you only manage the token in one place.

Common Mistakes

  • Pasting the bot's username instead of the token, or pasting the token with a trailing space. Both fail the credential test.
  • Using a self-hosted n8n instance that is not reachable from the internet. Telegram cannot deliver webhook updates to a localhost address, so the trigger never fires.
  • Forgetting to activate the workflow. An inactive workflow does not register its webhook, so messages arrive in Telegram but nothing happens in n8n.
  • Typing a chat ID by hand and getting the sign or digits wrong. Group and channel IDs are negative numbers. Always copy the ID from the trigger output or from a getUpdates call.
  • Adding the bot to a channel without admin rights and expecting it to post. It will silently fail or return a permissions error.
  • Leaving the bot's group privacy mode on and then wondering why the bot ignores ordinary group messages.

Tips

  • Store the token only in the n8n credential, never in a Set node or a text field inside the workflow, so it does not appear in execution logs.
  • Use the chat ID from the trigger output to reply to the same person who messaged the bot, which avoids hardcoding IDs.
  • Give the bot a clear display name and description in BotFather so users know what it does before they message it.
  • If you change the workflow's webhook path or move n8n to a new domain, deactivate and reactivate the workflow so the webhook is registered again.
  • Keep one Telegram credential per bot. If you run several bots, separate credentials make revocation and rotation much easier.

Troubleshooting

Work through these in order, simplest first.

  1. Credential test fails. Re-copy the token from BotFather, check for spaces, and confirm the bot still exists. If in doubt, revoke and generate a new token, then update the credential.
  2. Trigger never fires. Confirm the workflow is active. On self-hosted n8n, confirm the instance has a public HTTPS address and that your reverse proxy forwards the webhook path. Check the trigger node for any webhook error message.
  3. Messages arrive but the workflow does not run. Deactivate and reactivate the workflow to re-register the webhook, then send a fresh message. Old messages sent while the workflow was inactive are not replayed.
  4. Send Message returns a chat not found or permissions error. Verify the chat ID, confirm the bot is a member of the group or an admin of the channel, and confirm the bot has not been removed or blocked.
  5. Bot ignores group messages. Mention the bot directly or reply to one of its messages, or change privacy mode through BotFather and re-add the bot to the group.
  6. Everything worked and then stopped. Check whether the token was revoked, whether n8n's URL changed, or whether the workflow was edited and left inactive. Reactivating usually restores delivery.

Frequently Asked Questions

Do I need a paid Telegram account or API key?

No. Bots are free to create through BotFather, and the bot token is the only credential n8n needs.

Can I connect more than one bot to n8n?

Yes. Create each bot in BotFather and add a separate Telegram credential in n8n for each token, then pick the right credential in each node.

Why does my self-hosted trigger not receive updates?

Telegram needs a public HTTPS URL to deliver webhook updates. A localhost or private network address cannot receive them, so expose n8n through a proper domain and reverse proxy.

Can the bot post to a channel?

Yes, but only after you add it to the channel as an administrator. A bot that is merely a member cannot post.

What happens if I revoke the token?

The old token stops working immediately. Generate a new one in BotFather and update the n8n credential; workflows using that credential resume once it is saved.

Does the bot see every message in a group?

Not by default. With privacy mode on, it only receives messages that mention it or reply to it. You can change this through BotFather, then re-add the bot to the group.