how to promote users to supergroup using telegram bot api(PHP)?

1.3k views Asked by At


I'm using this code to add some of my users to a supergroup but it doesn't work
is there something wrong with it?

function makereq($method,$datas=[])
{
    $url = "https://api.telegram.org/bot".API_KEY."/".$method;
    $ch = curl_init();
    curl_setopt($ch,CURLOPT_URL,$url);
    curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
    curl_setopt($ch,CURLOPT_POSTFIELDS,http_build_query($datas));
    $res = curl_exec($ch);
    if(curl_error($ch)){
        var_dump(curl_error($ch));
    }else{
        return json_decode($res);
    }
}
makereq('promoteChatMember',[
    'chat_id'=>$chat_id,
    'user_id'=>$user_id
  ]);
1

There are 1 answers

0
Sean Wei On BEST ANSWER

Bots can't add user to group/channel, promoteChatMember is used to make existing members have admin permission.

You can only send invite link of group, and they need to join themselves. :(