How to obtain user chat_id
in Telegram bot API?
The documentation says:
Integer | Unique identifier for the message recipient — User or G
First, post a message in a chat where your bot is included (channel, group mentioning the bot, or one-to-one chat). Then, just run:
curl https://api.telegram.org/bot/getUpdates | jq
Feel free to remove the | jq
part if your dont have jq installed, it's only useful for pretty printing. You should get something like this:
You can see the chat ID in the returned json object, together with the chat name and associated message.