skip to Main Content

have a problem with telegram bot. Bot is in 5 groups. Sending works fine to 4 groups. Bot can’t send any message to 1 group and don’t understand why.

Any help / idea please?
Bot is in all groups of course.

$apiToken = "XXXXXXXXXXXXXXXXXXXXXXXXXXX";
$data = [
'chat_id' => '-11223344556677889900',
'text' => "TEST"
];
$response = file_get_contents("https://api.telegram.org/bot$apiToken/sendMessage?" . http_build_query($data) ); 

2

Answers


  1. The document does not mention but i have been using 1 bot to send messages to 10 groups. it works normally.
    There is no limit to the number of groups the bot can send messages . lease double check the group id.

    Login or Signup to reply.
  2. I had same problems, solve it:

    1. test send http-request direct from browser:
    https://api.telegram.org/bot<tocken>/sendMessage?text=%27test%27&chat_id=@channel_name
    
    1. prepare args and request ‘manually’:
    function build_args($arr){
       $str = '';
       foreach ($arr as $key => $val) {
          $str .= "$key=$val&";
       }
       return rtrim($str,'&');
    }
    
    $data = array('chat_id' => $channel, 'text' => $msg, 'parse_mode'=>'Markdown');
    $easy_query = build_args($data);
            $req = $url_bot."/sendMessage?".$easy_query;
    return json_decode( file_get_contents($req), true);
    
    1. Anywhere if you will have a working step 1 then try to create same request in php
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search