Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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
like image 579
row248 Avatar asked Sep 20 '15 20:09

row248


People also ask

How can I get Telegram API User ID?

When you've located @userinfobot, click or tap it. Then, select Start at the bottom of the chat. By clicking Start, you've automatically entered “/start.” It will prompt the bot to display your user ID, as well as your selected first name, last name, and the language of choice.

How can I find my Telegram chat ID?

Click on the “Start” button in the auto-reply message. The Telegram bot will send a message with your account info. Scroll down and find “Chat.” Your chat ID number is listed below, next to “id.

Does Telegram have user ID?

From now on, you can choose a public username in the Settings section of Telegram. If you do, anyone will be able to find you by your username and contact you – without having to know your phone number. To find people by username, just start typing any name in the search field of the Contacts section.

How to send a message through the telegram API?

CHAT_ID: To send a message through the Telegram API, the bot needs to provide the ID of the chat it wishes to speak in. The chat ID will be generated once you start the first conversation with your bot. Start a conversation with your bot:

How to find a user’s ID on Telegram?

Steps to finding a user’s ID on the Telegram app 1 You will first, of course, need to open the Telegram app on your device. ... 2 When the Home page opens, in the search bar search for the @userinfobot and click on that username. 3 You should now start a chat with this bot, click on the big Start button at the end of your screen. More items...

How to use Telegram bot on iPhone?

You can also use your Face ID or just press the “Home” button. Find the Telegram icon and tap to launch the app. Use the search function to access the “Telegram Bot Raw.” Find your chat ID in the auto-reply message. You can also use a chat command to ask the Telegram bot for your account information.

How to use Telegram Messenger on Linux?

Download and install the telegram messenger for your platform. Start the telegram client and follow the registration process. Cool Tip: Install the Telegram app on Ubuntu and Linux Mint! Read more → BotFather: The BotFather is the one bot to rule them all.


Video Answer


1 Answers

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!"
like image 75
user3396065 Avatar answered Oct 22 '22 03:10

user3396065