- Create telegram bot https://core.telegram.org/bots/api#authorizing-your-bot. Make sure the bot works as expected:
$ export TELEGRAM_TOKEN=your_token
$ curl -s https://api.telegram.org/bot$TELEGRAM_TOKEN/getMe
{
"ok": true,
"result": {
"id": xxx,
"is_bot": true,
"first_name": "drone",
"username": "cuongnv23_telegram_bot"
}
}
- Create a group, add your bot to that group with admin right. Send any message to the group
- Get the chat_id:
$ curl https://api.telegram.org/bot$TELEGRAM_TOKEN/getUpdates -s | jq '.result[0].message.chat.id'
-xxx