telegram inline bot - InlineQueryResultCachedPhoto does not show title and description
Asked Answered
J

1

9

I'm using telegram bot api for implementing an inline bot. For sending query result to the user, I'm using answerInlineQuery method in this way. This is just an example for showing a photo that exist on telegram server to user:

$results = array(
    array(
        "type" => "photo",
        "id" => "1",
        "photo_file_id" => the file id,
        "title" => "test title",
        "description" => "test description",
        "caption" => "test caption",
        "parse_mode" => "HTML"
    ),
);

$postFields["results"] = json_encode($results);
$postFields["cache_time"] = 0;

//send $postFields to telegram bot api server with curl

This works and after user sending inline query, one image shows as the result list. But the problem is two fields title and description does not show in the result list, even these are exist in telegram api documentation here.

What's is the problem and whay these two fields does not present in the result list?

Jaeger answered 19/7, 2018 at 17:11 Comment(0)
C
0

Title and description for photos would be shown only in situations when preview of the image can't be generated.

https://t.me/BotTalk/713870

But if you use InlineQueryResultPhoto instead InlineQueryResultCachedPhoto and pass thumb_url, telegram will be display title and description, BUT only in the list result.

To display queries as list, you need to add InlineQueryResultArticle in your response.

enter image description here

Comprehension answered 28/8, 2023 at 17:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.