Find out my own user ID for sending a message with Telegram API

row248 picture row248 · Sep 20, 2015 · Viewed 57.6k times · Source

For Telegram, how can I find out my own user id (chat_id) for use with the Telegram API?

I want to send myself a message via the Telegram API, like this:

https://api.telegram.org/bot<BOTID>/sendMessage

Answer

user3396065 picture user3396065 · Sep 25, 2015

Send a message to your bot then retrieve the update with:

https://api.telegram.org/bot<BOTID>/getUpdates

In the json string returned you will find you chat_id/user_id.
In single chat with the bot chat_id is equal to user_id.
Now you can send your message with:

https://api.telegram.org/bot<BOTID>/sendMessage?chat_id="yourchatid"&text="Hello!"