Ahmad Badpey
Ahmad Badpey

Reputation: 6612

how to detect which option is selected in inline query results telegram bot api

I'm working on a shopping telegram bot that is written by irazasyed/telegram-bot-sdk.

I already enabled inline Query features via /setinline command in @botFather for my Bot.

I handled that how can I show some reault to user like this picture : enter image description here

And suppose this is my Codes :

$inlineQuery = $update->getInlineQuery();

$query = $inlineQuery->getQuery();

$results = array();
$results[] = array(
    'type' => 'article',
    'id' => '0',
    'title' => 'Query: ' . $query,
    //'input_message_content' => array(
        'message_text' => 'Text',
    //),
    'description' => 'description',
);

$params = array(
    'inline_query_id' => $inlineQuery->getId(),
    'results' => $results,
);

$result = $telegram->answerInlineQuery($params);

But I do not know how can I detect which options is tapped by user.

For example I want when user rapped on an option get the product_id uniti then can fetch details of that from database.

Upvotes: 0

Views: 1830

Answers (1)

Sean Wei
Sean Wei

Reputation: 7975

You can enable callback feedback.

To know which of the provided results your users are sending to their chat partners, send @Botfather the /setinlinefeedback command.
With this enabled, you will receive updates on the results chosen by your users.

Upvotes: 1

Related Questions