Create Telegram Bot and get Bot's token and the Group's chat id

edited April 2019 in Knowledgebase

Create a Telegram group where Bot and you are members, and all other people that you want to send alarms to.
(You will create and make the Bot join the group in the next steps)

Talk to BotFather, goto @BotFather in Telegram or goto:
https://telegram.me/botfather

Create a new Bot
/newbot

Enter name of your Bot
FirstWarningBot

Enter username for Bot
FirstWarningBot

Then you will see a token, something like this:
110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw
Copy token

In Telegram write
/setjoingroups

Select the Bot that should join the Alarm group
Click the Bot
Click Enable

Add the Bot to the group, the same procedure as when adding a normal person to a group.

You and the Bot should now be members of the Alarm group.

Now you need to get the ChatID for the group

If you forgot your bot token, go to Botfather in Telegram and write:
/mybots
Click the correct bot and then click API Token

Then go to url: https://api.telegram.org/botYOUR_BOT_TOKEN_THAT_YOU_COPIED_ABOVE/getUpdates

Replace YOUR_BOT_TOKEN_THAT_YOU COPIED_ABOVE with your bot token.
Remember to write bot just before your token in the url

Look for "chat":{"id":-yyyyyyyyy,
-yyyyyyyyy is the groups chatid(it should have a negative sign)

If chatid is not shown when going to above url, remove bot from group and then add bot again.
Goto https://api.telegram.org/botYOUR_BOT_TOKEN_THAT_YOU_COPIED_ABOVE/getUpdates

Now you have both the Bot's token and Group's chatid, input them on the "Add/Edit display page"
Write "bot" before your token in the "Telegram token" box, example: bot110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw

Sign In or Register to comment.