S
S
sniff12018-12-01 15:22:52
PHP
sniff1, 2018-12-01 15:22:52

Telegram API bot not sending php messages?

$telegram->sendMessage([ 'chat_id' => $chat_id, 'text' => "test"]); - if I just send it, it is delivered without problems, but it is not sent in the check with the team, the check passes, since the letter arrives successfully in the mail.

$result = $telegram -> getWebhookUpdates(); //Передаем в переменную $result полную информацию о сообщении пользователя

    $text = mysqli_real_escape_string($connect, $result["message"]["text"]); 
    $chat_id = $result["message"]["chat"]["id"]; 
    $data = $result['callback_query'];
    $command = $data['data'];
    $name = $result["message"]["from"]["username"];
    
    
if($command == '/plz'){
   
    $cid = $result['callback_query']['id'];
    $telegram->sendMessage([ 'chat_id' => $chat_id, 'text' =>  $cid]);   
    $telegram->answerCallbackQuery(['callback_query_id' => $cid]);
    mail("[email protected]","test","$cid"); // чисто проверка
   // break;
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sniff1, 2018-12-01
@sniff1

Solved a problem. The chat_id variable was empty.
For the command, we get it like this:

$datachat = $result['callback_query']['from']['id'];

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question