Skip to main content

How to create a Telegram Bot and use it to post in Telegram channels

Here's a quick guide on how to create a Telegram bot that you can use for chats within NetHunt or API calls in Workflows.

Create a Telegram bot

  1. Search for the “@Botfather” in Telegram

  2. Start a conversation and type “/newbot”

  3. Enter the new bot’s name (this will be a display name)

  4. Enter bot’s username (must end with “_bot”)

  5. Get bot’s API Token

    NOTE: Bots can’t message people first, but can message channels.

How to use a bot to post on Telegram channel

  1. Create a new channel in Telegram (you can do so by starting a new message)

  2. Invite your bot to the Channel (search by bot’s username) and add it as an Admin

  3. Go to https://api.telegram.org/bot{{TOKEN}}/getUpdates
    Replace {{TOKEN}} with your bot’s Token in the URL (you can always get your token under chat with @Botfather), You should get the following message:

    {"ok":true,"result":[]}
  4. Post something to the channel with the bot (so the bot “sees” that it’s added to the channel)

  5. Refresh the link above and it should have a list of all channels and conversations the bot participates in. You should get a similar message:

    "channel_post":{"message_id":2,"sender_chat":{"id":-1001631771642,"title":"ThisIsThechannel","type":"channel"},"chat":{"id":-1001631771642,"title":"ThisIsThechannel","type":"channel"},"date":1660333732,"text":"hey","has_protected_content":true}}]}

  6. For API Call only: copy the channel’s ID to which you want to send messages via the bot. NOTE: Channel’s IDs always start with a minus symbol (-). In our case, it is: -"1001631771642",

    {"id":-1001631771642,"title":"ThisIsThechannel","type":"channel"},"date":1660333732,"text":"hey","has_protected_content":true}}]}

    If you wish to use a bot to post on Telegram channels via API, please check out this guide.


Haven’t found the answers you’re looking for? Ask our Users Community.

Did this answer your question?