如何检测在线查询结果电报机器人中选择了哪个选项 api

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

我正在开发由 irazasyed/telegram-bot-sdk 编写的购物电报机器人。

我已经通过 @botFather 中的 /setinline 命令为我的机器人启用了内联查询功能。

我处理了如何向用户显示一些像这张照片这样的结果:

假设这是我的代码:

$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);

但我不知道如何检测用户点击了哪些选项。

例如,我希望当用户点击某个选项时获得 product_id uniti 然后可以从数据库中获取该选项的详细信息。

您可以启用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.