Creating a telegram bot
To create a telegram bot, follow these steps:
- In Telegram, find the bot user “BotFather”.
- In a chat with the bot, write the command “/start”.
- In a chat with a bot, write the command “/newbot” and follow the instructions:
- enter bot name;
- Enter “username” bot. Note: it must necessarily end with “bot”, for example “fds_demo_bot” (we will search for the bot by this name later).
- The bot has been created and we have received its “token”. We will put this token on the site, so keep it handy.
Adding a bot to a channel (group)
- Create a telegram group and add a bot with administrator rights to it (if the group already exists, just add the bot to it). In the search we drive “username” bot that we entered when creating the bot. In our case it is “fds_demo_bot”.
- Now we need to get the id of this group. To do this, you must send any message to the group. Then follow this link https://api.telegram.org/bot{token}/getUpdates , where “{token}” this is the bot token we got when we created the bot. In our example, the link will look like https://api.telegram.org/bot1082167235:AAE0LivyczCeBKY53VtLjitTdBqs6INc9Eo/getUpdates. On this page, we need to find the chat id value. In our example, this is “-221363777”. All the necessary data is there. Go to the site admin area.