Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Method transfer answerCallbackQuery does not work #47

Open
asasem opened this issue Nov 18, 2021 · 1 comment
Open

Method transfer answerCallbackQuery does not work #47

asasem opened this issue Nov 18, 2021 · 1 comment

Comments

@asasem
Copy link

asasem commented Nov 18, 2021

Tell me why the method does not work in your library at the moment

class TelegramController extends Controller
{

public $enableCsrfValidation = false;

public function actionWebhook(){
$telegram = Yii::$app->telegram;

if (!empty($telegram->input->callback_query->data)){

        $callback_query_id = $telegram->input->callback_query->id;

         $telegram->answerCallbackQuery([
            'callback_query_id' =>  $callback_query_id, //require
            'text' => 'text', //Optional
            'show_alert' => true,  //Optional
            // 'url' => 'http://sample.com', //Optional
           // 'cache_time' => 1,  //Optional
        ]);
}

}
It just freezes and the entire response is not transmitted to the server

@asasem
Copy link
Author

asasem commented Nov 18, 2021

But this is work
$content = array(
'callback_query_id' => $callback_query_id,
'show_alert'=>false,
'text' => '❗️',
);

        $token = $telegram->botToken;
        $url_ = "https://api.telegram.org/bot$token/answerCallbackQuery?";
        file_get_contents($url_.http_build_query($content));
        exit;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant