1. Open Telegram
2. Search @botfather
3. Type /newbot .
4. It will show “Alright, a new bot. How are we going to call it? Please choose a name for your bot.”
5. Type the name of your bot.
6. After, it’ll show “Good. Now let’s choose a username for your bot. It must end in `bot`. Like this, for example: TetrisBot or tetris_bot.”
7. You’ve to give a unique username and it should be ending with bot.
8. After giving the name it’ll show :-
“Done! Congratulations on your new bot. You will find it at t.me/ShibinTest3bot. You can now add a description, about section and profile picture for your bot, see /help for a list of commands. By the way, when you’ve finished creating your cool bot, ping our Bot Support if you want a better username for it. Just make sure the bot is fully operational before you do this.
Use this token to access the HTTP API: “TOKEN”
9.Copy the Api Token for further
How to get the Group or Channel id
1. Add the Telegram BOT to the group.
2. Message your bot in the group. E.g. if your bot is called ExampleBot, send a message from your personal account @ExampleBot /start to the group. Prior to this your bot does not have access to the messages in the chat.
3. Get the list of updates for your BOT:
https://api.telegram.org/bot<YourBOTToken>/getUpdates
Ex:
https://api.telegram.org/bot123456789:jbd78sadvbdy63d37gda37bd8/getUpdates
4. Look for the “chat” object:
{
"update_id": 8393,
"message": {
"message_id": 3,
"from": {
"id": 7474,
"first_name": "AAA"
},
"chat": {
"id": <group_ID>,
"title": "<Group name>"
},
"date": 25497,
"new_chat_participant": {
"id": 71,
"first_name": "NAME",
"username": "YOUR_BOT_NAME"
}
}
This is a sample of the response when you add your BOT into a group.
5. Use the “id” of the “chat” object to send your messages (always negative?).