Closed andrebruton closed 6 years ago
@andrebruton You didn't specify an chat ID
The $chat_id comes from this line of code: $chat_id = $telegram->ChatID();
What should the example code be then? Where do I specify the $chat_id
Did you tested the bot? Send any message to it and see if it responds If not, set $chat_id as your own id and test again
Ok, I've figured it out. You have to save the $chat_id's of the people subscribing to your chat via the callback / getdata routine. There is no other way of finding peoples ID unless they send it to you after visiting bot @userinfobot. You then have to use this saved ID to send your messages to.
@andrebruton u can get the ID by going to this link: https://api.telegram.org/bot(Token)/getUpdates
I'm trying to get a basic example running. I've registered an app and got the app ID. I installed your library using Composer. My code is:
The log files give the following reply:
============[Date]============ [ 2018-02-05 13:54:31 Europe/Berlin ] ==========[Response]========== ok: False error_code: 400 description: Bad Request: chat_id is empty =========[Sent Data]========== [ref] ref.chat_id= ref.text= Test 02
============[Trace]===========
0 C:\xampp\htdocs\vdw_telegram\vendor\eleirbag89\telegrambotphp\Telegram.php(3057): TelegramErrorLogger::log(Array, Array)
1 C:\xampp\htdocs\vdw_telegram\vendor\eleirbag89\telegrambotphp\Telegram.php(93): Telegram->sendAPIRequest('https://api.tel...', Array)
2 C:\xampp\htdocs\vdw_telegram\vendor\eleirbag89\telegrambotphp\Telegram.php(178): Telegram->endpoint('sendMessage', Array)
3 C:\xampp\htdocs\vdw_telegram\test02.php(19): Telegram->sendMessage(Array)
4 {main}
Any idea why I can't get a chat ID?