QUERY_ID_INVALID - Telegram inline bot

0

Hello

I'm creating an inline bot for Telegram, but I always get the error QUERY_ID_INVALID. I do not know where I'm going wrong ...

$json = file_get_contents("php://input");
$dados = json_decode($json,true);
$id_query = $dados['inline_query']['id'];

 $resultados_inline[] = [
                        'type'  => 'article',
                        'id'    => "1",
                        'title' => "Test",
                        'message_text' => "test",
                    ];

  $post[] = [
    'inline_query_id' => $id_query,
    'results'   => serialize($resultados_inline),           
];

  $context_options = array(
'http' => array(
    'method' => 'POST',
    'header'=> "Content-type: application/x-www-form-urlencoded\r\n"
        . "Content-Length: " . strlen($post) . "\r\n",
    'content' => $post
    )
);

file_get_contents("https://api.telegram.org/bot" . $api_telegram . "/answerInlineQuery",NULL,$context);

The code runs fine, but Telegram always returns that error. Could you help me?

Thankful

    
asked by anonymous 16.05.2016 / 18:45

1 answer

0

I searched for this problem and got the following response from Bot Support:

  

"Inline queries require a fast answer, if the answer is delayed, you may get that error and the answer will not be valid. I suggest you answer them faster in order to make them work." >

In short, my problem is that I was using debug mode and it took time to respond and the API returned this error. I also had to change my design, because this response requires being extremely fast.

    
27.07.2016 / 04:12