InlineQueryResultArticle
Represents a link to an article or web page.
Fields
typeString = articleRequiredidStringRequiredtitleStringRequiredurlStringOptionaldescriptionStringOptionalthumbnail_urlStringOptionalthumbnail_widthIntegerOptionalthumbnail_heightIntegerOptionalGramIO Usage
Build article results with InlineQueryResult.article():
import {
format,
bold,
InlineKeyboard,
InlineQueryResult,
InputMessageContent,
} from "gramio";
bot.inlineQuery(/wiki (.*)/i, async (ctx) => {
const entry = await lookup(ctx.args![1]);
await ctx.answer(
[
InlineQueryResult.article(
entry.id,
entry.title,
InputMessageContent.text(
format`${bold(entry.title)}\n${entry.summary}`
),
{
description: entry.shortDescription,
url: entry.url,
thumbnail_url: entry.thumbJpegUrl, // see warning below
thumbnail_width: 200,
thumbnail_height: 200,
reply_markup: new InlineKeyboard().url(
"Open source",
entry.url
),
}
),
],
{ cache_time: 0 }
);
});Thumbnail constraints
thumbnail_url must be a JPEG URL — PNG/WebP silently fail in some Telegram clients and the preview disappears instead of falling back to a default. Keep the image ≤320×320 px and ≤200 KB; oversized JPEGs fail the same way. If previews don't render and the URL is reachable, start by checking the format and dimensions.
input_message_content.message_text on InputTextMessageContent accepts a FormattableString (the result of format`…` ) directly — GramIO preserves entities. Do not call .toString() or set parse_mode.
For the full set of context.answer() options — including button for auth redirects, next_offset for pagination, and is_personal — see the inlineQuery trigger guide.
See Also
- InlineQueryResult — the union this variant belongs to
answerInlineQuery— the method that accepts these resultsinlineQuerytrigger — GramIO handler API- InputTextMessageContent — content type for
input_message_content - InlineKeyboardMarkup — attach buttons to the sent message