Answer the question
In order to leave comments, you need to log in
Telegram Bot: requires a user ID, where can I get it?
I'm a bit confused trying to use the Telegram Bot API. I'm trying to send a message to the user using the method:
$telegram = new telegramBot("121681**:AAHOjf*****ROYb03utzRf91ECBd8");
$telegram->sendMessage('@febox', 'Hello World!');
{"ok":false,"error_code":400,"description":"Error: Bad Request: wrong chat id"}
Answer the question
In order to leave comments, you need to log in
Write to the bot, he will receive json in which, in addition to the message, there will be a chat_id of the one who wrote.
Example:
{
"update_id":600028960,
"message":{
"message_id":1,
"from":{
"id":57350918,
"first_name":"Евгений",
"last_name":"Колотилин",
"username":"iswitch"
},
"chat":{
"id":57350918,
"first_name":"Евгений",
"last_name":"Колотилин",
"username":"iswitch"
},
"date":1437049435,
"text":"test message"
}
}
I will add Evgeny Kolotilin - even if you substitute id from an external source - the user will not see messages from the bot until he writes to him for the first time.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question