telegram-crawler/data/web/blogfork.telegram.org/api/bots/inline.html

218 lines
25 KiB
HTML
Raw Normal View History

2022-05-14 00:37:40 +02:00
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Inline</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
2022-11-15 00:55:37 +01:00
<meta property="description" content="Users can interact with your bot via inline queries, straight from the text input field in any chat.">
2022-05-14 00:37:40 +02:00
<meta property="og:title" content="Inline">
<meta property="og:image" content="">
2022-11-15 00:55:37 +01:00
<meta property="og:description" content="Users can interact with your bot via inline queries, straight from the text input field in any chat.">
2022-05-14 00:37:40 +02:00
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
2023-03-20 12:08:32 +01:00
<link href="/css/telegram.css?236" rel="stylesheet" media="screen">
2022-05-14 00:37:40 +02:00
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
2022-11-15 00:55:37 +01:00
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/bots%2Finline" >Inline</a></li></ul></div>
2022-05-14 00:37:40 +02:00
<h1 id="dev_page_title">Inline</h1>
<div id="dev_page_content"><!-- scroll_nav -->
2022-11-15 00:55:37 +01:00
<p>Users can interact with your bot via <a href="/bots/features#inline-requests"><strong>inline queries</strong></a>, straight from the <strong>text input field</strong> in <strong>any</strong> chat.<br>
2022-05-14 00:37:40 +02:00
This article describes the full inline bot flow, using the MTProto API. </p>
2022-11-15 00:55:37 +01:00
<p>For a simplified description using the HTTP bot API, see <a href="/bots/features#inline-requests">here »</a>. </p>
2023-05-22 14:54:47 +02:00
<h3><a class="anchor" href="#1-making-an-inline-query" id="1-making-an-inline-query" name="1-making-an-inline-query"><i class="anchor-icon"></i></a>1. Making an inline query</h3>
<pre><code><a href='/constructor/messages.botResults'>messages.botResults</a>#e021f2f6 flags:<a href='/type/%23'>#</a> gallery:flags.0?<a href='/constructor/true'>true</a> query_id:<a href='/type/long'>long</a> next_offset:flags.1?<a href='/type/string'>string</a> switch_pm:flags.2?<a href='/type/InlineBotSwitchPM'>InlineBotSwitchPM</a> switch_webview:flags.3?<a href='/type/InlineBotWebView'>InlineBotWebView</a> results:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/BotInlineResult'>BotInlineResult</a>&gt; cache_time:<a href='/type/int'>int</a> users:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/User'>User</a>&gt; = <a href='/type/messages.BotResults'>messages.BotResults</a>;
2022-05-14 00:37:40 +02:00
---functions---
<a href='/method/messages.getInlineBotResults'>messages.getInlineBotResults</a>#514e999d flags:<a href='/type/%23'>#</a> bot:<a href='/type/InputUser'>InputUser</a> peer:<a href='/type/InputPeer'>InputPeer</a> geo_point:flags.0?<a href='/type/InputGeoPoint'>InputGeoPoint</a> query:<a href='/type/string'>string</a> offset:<a href='/type/string'>string</a> = <a href='/type/messages.BotResults'>messages.BotResults</a>;</code></pre>
<p>When, in a graphical client, the user starts a message with an <code>@</code>, clients should:</p>
<ul>
<li>Use the cached <a href="/api/top-rating">top peer rating for inline bots</a> to show a list of frequently used inline bots.</li>
<li>If the user chooses a bot from the recent bot list or:</li>
<li>Finishes typing a full username followed by a whitespace, and if the username <a href="/method/contacts.resolveUsername">resolves</a> to a valid bot</li>
<li><a href="/method/messages.getInlineBotResults">messages.getInlineBotResults</a> is called, with the following parameters:<ul>
<li><code>bot</code> - The bot peer</li>
<li><code>peer</code> - The chat where the user made the query</li>
<li><code>geo_point</code> - The user's current geolocation, if the bot requires <a href="/bots/inline#location-based-results">location-based inline results</a> (the <code>bot_inline_geo</code> flag of the bot's <a href="/constructor/user">user constructor</a> will be set)</li>
<li><code>query</code> - What the user typed after the bot's username</li>
<li><code>offset</code> - If the user scrolls past the first <code>len(results)</code> results, and <code>next_offset</code> field is set, the inline query should be repeated with this offset.</li>
</ul>
</li>
</ul>
2023-05-22 14:54:47 +02:00
<h3><a class="anchor" href="#2-answering-to-an-inline-query" id="2-answering-to-an-inline-query" name="2-answering-to-an-inline-query"><i class="anchor-icon"></i></a>2. Answering to an inline query</h3>
2024-02-10 15:29:33 +01:00
<pre><code><a href='/constructor/inputBotInlineMessageMediaAuto'>inputBotInlineMessageMediaAuto</a>#3380c786 flags:<a href='/type/%23'>#</a> invert_media:flags.3?<a href='/constructor/true'>true</a> message:<a href='/type/string'>string</a> entities:flags.1?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageEntity'>MessageEntity</a>&gt; reply_markup:flags.2?<a href='/type/ReplyMarkup'>ReplyMarkup</a> = <a href='/type/InputBotInlineMessage'>InputBotInlineMessage</a>;
<a href='/constructor/inputBotInlineMessageText'>inputBotInlineMessageText</a>#3dcd7a87 flags:<a href='/type/%23'>#</a> no_webpage:flags.0?<a href='/constructor/true'>true</a> invert_media:flags.3?<a href='/constructor/true'>true</a> message:<a href='/type/string'>string</a> entities:flags.1?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageEntity'>MessageEntity</a>&gt; reply_markup:flags.2?<a href='/type/ReplyMarkup'>ReplyMarkup</a> = <a href='/type/InputBotInlineMessage'>InputBotInlineMessage</a>;
2022-05-14 00:37:40 +02:00
<a href='/constructor/inputBotInlineMessageMediaGeo'>inputBotInlineMessageMediaGeo</a>#96929a85 flags:<a href='/type/%23'>#</a> geo_point:<a href='/type/InputGeoPoint'>InputGeoPoint</a> heading:flags.0?<a href='/type/int'>int</a> period:flags.1?<a href='/type/int'>int</a> proximity_notification_radius:flags.3?<a href='/type/int'>int</a> reply_markup:flags.2?<a href='/type/ReplyMarkup'>ReplyMarkup</a> = <a href='/type/InputBotInlineMessage'>InputBotInlineMessage</a>;
<a href='/constructor/inputBotInlineMessageMediaVenue'>inputBotInlineMessageMediaVenue</a>#417bbf11 flags:<a href='/type/%23'>#</a> geo_point:<a href='/type/InputGeoPoint'>InputGeoPoint</a> title:<a href='/type/string'>string</a> address:<a href='/type/string'>string</a> provider:<a href='/type/string'>string</a> venue_id:<a href='/type/string'>string</a> venue_type:<a href='/type/string'>string</a> reply_markup:flags.2?<a href='/type/ReplyMarkup'>ReplyMarkup</a> = <a href='/type/InputBotInlineMessage'>InputBotInlineMessage</a>;
<a href='/constructor/inputBotInlineMessageMediaContact'>inputBotInlineMessageMediaContact</a>#a6edbffd flags:<a href='/type/%23'>#</a> phone_number:<a href='/type/string'>string</a> first_name:<a href='/type/string'>string</a> last_name:<a href='/type/string'>string</a> vcard:<a href='/type/string'>string</a> reply_markup:flags.2?<a href='/type/ReplyMarkup'>ReplyMarkup</a> = <a href='/type/InputBotInlineMessage'>InputBotInlineMessage</a>;
<a href='/constructor/inputBotInlineMessageGame'>inputBotInlineMessageGame</a>#4b425864 flags:<a href='/type/%23'>#</a> reply_markup:flags.2?<a href='/type/ReplyMarkup'>ReplyMarkup</a> = <a href='/type/InputBotInlineMessage'>InputBotInlineMessage</a>;
<a href='/constructor/inputBotInlineResult'>inputBotInlineResult</a>#88bf9319 flags:<a href='/type/%23'>#</a> id:<a href='/type/string'>string</a> type:<a href='/type/string'>string</a> title:flags.1?<a href='/type/string'>string</a> description:flags.2?<a href='/type/string'>string</a> url:flags.3?<a href='/type/string'>string</a> thumb:flags.4?<a href='/type/InputWebDocument'>InputWebDocument</a> content:flags.5?<a href='/type/InputWebDocument'>InputWebDocument</a> send_message:<a href='/type/InputBotInlineMessage'>InputBotInlineMessage</a> = <a href='/type/InputBotInlineResult'>InputBotInlineResult</a>;
<a href='/constructor/inputBotInlineResultPhoto'>inputBotInlineResultPhoto</a>#a8d864a7 id:<a href='/type/string'>string</a> type:<a href='/type/string'>string</a> photo:<a href='/type/InputPhoto'>InputPhoto</a> send_message:<a href='/type/InputBotInlineMessage'>InputBotInlineMessage</a> = <a href='/type/InputBotInlineResult'>InputBotInlineResult</a>;
<a href='/constructor/inputBotInlineResultDocument'>inputBotInlineResultDocument</a>#fff8fdc4 flags:<a href='/type/%23'>#</a> id:<a href='/type/string'>string</a> type:<a href='/type/string'>string</a> title:flags.1?<a href='/type/string'>string</a> description:flags.2?<a href='/type/string'>string</a> document:<a href='/type/InputDocument'>InputDocument</a> send_message:<a href='/type/InputBotInlineMessage'>InputBotInlineMessage</a> = <a href='/type/InputBotInlineResult'>InputBotInlineResult</a>;
<a href='/constructor/inputBotInlineResultGame'>inputBotInlineResultGame</a>#4fa417f2 id:<a href='/type/string'>string</a> short_name:<a href='/type/string'>string</a> send_message:<a href='/type/InputBotInlineMessage'>InputBotInlineMessage</a> = <a href='/type/InputBotInlineResult'>InputBotInlineResult</a>;
<a href='/constructor/updateBotInlineQuery'>updateBotInlineQuery</a>#496f379c flags:<a href='/type/%23'>#</a> query_id:<a href='/type/long'>long</a> user_id:<a href='/type/long'>long</a> query:<a href='/type/string'>string</a> geo:flags.0?<a href='/type/GeoPoint'>GeoPoint</a> peer_type:flags.1?<a href='/type/InlineQueryPeerType'>InlineQueryPeerType</a> offset:<a href='/type/string'>string</a> = <a href='/type/Update'>Update</a>;
---functions---
2023-05-22 14:54:47 +02:00
<a href='/method/messages.setInlineBotResults'>messages.setInlineBotResults</a>#bb12a419 flags:<a href='/type/%23'>#</a> gallery:flags.0?<a href='/constructor/true'>true</a> private:flags.1?<a href='/constructor/true'>true</a> query_id:<a href='/type/long'>long</a> results:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/InputBotInlineResult'>InputBotInlineResult</a>&gt; cache_time:<a href='/type/int'>int</a> next_offset:flags.2?<a href='/type/string'>string</a> switch_pm:flags.3?<a href='/type/InlineBotSwitchPM'>InlineBotSwitchPM</a> switch_webview:flags.4?<a href='/type/InlineBotWebView'>InlineBotWebView</a> = <a href='/type/Bool'>Bool</a>;</code></pre>
2022-05-14 00:37:40 +02:00
<p>Bots can answer to incoming <a href="/constructor/updateBotInlineQuery">updateBotInlineQuery</a> updates using <a href="/method/messages.setInlineBotResults">messages.setInlineBotResults</a>.<br>
Just like its <a href="/bots/api#answerinlinequery">bot API counterpart</a>, the method can be used to send a set of inline results to the user; see the <a href="/method/messages.setInlineBotResults">constructor page for more info on the MTProto method parameters »</a>.</p>
2023-05-22 14:54:47 +02:00
<p>In general, the method accepts a vector of <a href="/type/InputBotInlineResult">InputBotInlineResult</a> constructors, that when <a href="#3-sending-the-inline-query-result">chosen</a>, generates a message with optionally attached media, and even inline buttons.</p>
<h3><a class="anchor" href="#3-sending-the-inline-query-result" id="3-sending-the-inline-query-result" name="3-sending-the-inline-query-result"><i class="anchor-icon"></i></a>3. Sending the inline query result</h3>
2024-02-10 15:29:33 +01:00
<pre><code><a href='/constructor/botInlineMessageMediaAuto'>botInlineMessageMediaAuto</a>#764cf810 flags:<a href='/type/%23'>#</a> invert_media:flags.3?<a href='/constructor/true'>true</a> message:<a href='/type/string'>string</a> entities:flags.1?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageEntity'>MessageEntity</a>&gt; reply_markup:flags.2?<a href='/type/ReplyMarkup'>ReplyMarkup</a> = <a href='/type/BotInlineMessage'>BotInlineMessage</a>;
<a href='/constructor/botInlineMessageText'>botInlineMessageText</a>#8c7f65e2 flags:<a href='/type/%23'>#</a> no_webpage:flags.0?<a href='/constructor/true'>true</a> invert_media:flags.3?<a href='/constructor/true'>true</a> message:<a href='/type/string'>string</a> entities:flags.1?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageEntity'>MessageEntity</a>&gt; reply_markup:flags.2?<a href='/type/ReplyMarkup'>ReplyMarkup</a> = <a href='/type/BotInlineMessage'>BotInlineMessage</a>;
2022-05-14 00:37:40 +02:00
<a href='/constructor/botInlineMessageMediaGeo'>botInlineMessageMediaGeo</a>#51846fd flags:<a href='/type/%23'>#</a> geo:<a href='/type/GeoPoint'>GeoPoint</a> heading:flags.0?<a href='/type/int'>int</a> period:flags.1?<a href='/type/int'>int</a> proximity_notification_radius:flags.3?<a href='/type/int'>int</a> reply_markup:flags.2?<a href='/type/ReplyMarkup'>ReplyMarkup</a> = <a href='/type/BotInlineMessage'>BotInlineMessage</a>;
<a href='/constructor/botInlineMessageMediaVenue'>botInlineMessageMediaVenue</a>#8a86659c flags:<a href='/type/%23'>#</a> geo:<a href='/type/GeoPoint'>GeoPoint</a> title:<a href='/type/string'>string</a> address:<a href='/type/string'>string</a> provider:<a href='/type/string'>string</a> venue_id:<a href='/type/string'>string</a> venue_type:<a href='/type/string'>string</a> reply_markup:flags.2?<a href='/type/ReplyMarkup'>ReplyMarkup</a> = <a href='/type/BotInlineMessage'>BotInlineMessage</a>;
<a href='/constructor/botInlineMessageMediaContact'>botInlineMessageMediaContact</a>#18d1cdc2 flags:<a href='/type/%23'>#</a> phone_number:<a href='/type/string'>string</a> first_name:<a href='/type/string'>string</a> last_name:<a href='/type/string'>string</a> vcard:<a href='/type/string'>string</a> reply_markup:flags.2?<a href='/type/ReplyMarkup'>ReplyMarkup</a> = <a href='/type/BotInlineMessage'>BotInlineMessage</a>;
<a href='/constructor/botInlineResult'>botInlineResult</a>#11965f3a flags:<a href='/type/%23'>#</a> id:<a href='/type/string'>string</a> type:<a href='/type/string'>string</a> title:flags.1?<a href='/type/string'>string</a> description:flags.2?<a href='/type/string'>string</a> url:flags.3?<a href='/type/string'>string</a> thumb:flags.4?<a href='/type/WebDocument'>WebDocument</a> content:flags.5?<a href='/type/WebDocument'>WebDocument</a> send_message:<a href='/type/BotInlineMessage'>BotInlineMessage</a> = <a href='/type/BotInlineResult'>BotInlineResult</a>;
<a href='/constructor/botInlineMediaResult'>botInlineMediaResult</a>#17db940b flags:<a href='/type/%23'>#</a> id:<a href='/type/string'>string</a> type:<a href='/type/string'>string</a> photo:flags.0?<a href='/type/Photo'>Photo</a> document:flags.1?<a href='/type/Document'>Document</a> title:flags.2?<a href='/type/string'>string</a> description:flags.3?<a href='/type/string'>string</a> send_message:<a href='/type/BotInlineMessage'>BotInlineMessage</a> = <a href='/type/BotInlineResult'>BotInlineResult</a>;
2023-05-22 14:54:47 +02:00
<a href='/constructor/messages.botResults'>messages.botResults</a>#e021f2f6 flags:<a href='/type/%23'>#</a> gallery:flags.0?<a href='/constructor/true'>true</a> query_id:<a href='/type/long'>long</a> next_offset:flags.1?<a href='/type/string'>string</a> switch_pm:flags.2?<a href='/type/InlineBotSwitchPM'>InlineBotSwitchPM</a> switch_webview:flags.3?<a href='/type/InlineBotWebView'>InlineBotWebView</a> results:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/BotInlineResult'>BotInlineResult</a>&gt; cache_time:<a href='/type/int'>int</a> users:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/User'>User</a>&gt; = <a href='/type/messages.BotResults'>messages.BotResults</a>;
2022-05-14 00:37:40 +02:00
---functions---
2024-02-10 15:29:33 +01:00
<a href='/method/messages.sendInlineBotResult'>messages.sendInlineBotResult</a>#f7bc68ba flags:<a href='/type/%23'>#</a> silent:flags.5?<a href='/constructor/true'>true</a> background:flags.6?<a href='/constructor/true'>true</a> clear_draft:flags.7?<a href='/constructor/true'>true</a> hide_via:flags.11?<a href='/constructor/true'>true</a> peer:<a href='/type/InputPeer'>InputPeer</a> reply_to:flags.0?<a href='/type/InputReplyTo'>InputReplyTo</a> random_id:<a href='/type/long'>long</a> query_id:<a href='/type/long'>long</a> id:<a href='/type/string'>string</a> schedule_date:flags.10?<a href='/type/int'>int</a> send_as:flags.13?<a href='/type/InputPeer'>InputPeer</a> = <a href='/type/Updates'>Updates</a>;</code></pre>
2023-05-22 14:54:47 +02:00
<p>The user client should display the <a href="/constructor/messages.botResults">messages.botResults</a>.<code>results</code> obtained <a href="#1-making-an-inline-query">during querying</a> in a list, making sure to handle eventual bot timeouts in the form of a <code>BOT_RESPONSE_TIMEOUT</code> RPC error, by simply not displaying anything. </p>
2024-02-10 15:29:33 +01:00
<p>If either the <a href="/constructor/messages.botResults">messages.botResults</a>.<code>switch_pm</code> or <a href="/constructor/messages.botResults">messages.botResults</a>.<code>switch_webview</code> flags are populated, a button should be displayed on top of the result list, that when clicked, instead of sending an inline result to the chat, switches the user to a private chat with the bot (<code>switch_pm</code>) or to a <a href="/api/bots/webapps#inline-mode-mini-apps">inline mode mini app</a> (<code>switch_webview</code>). </p>
2023-05-22 14:54:47 +02:00
<p>If the user instead chooses a specific <code>BotInlineResult</code> from the normal <code>results</code> list, the <a href="/method/messages.sendInlineBotResult">messages.sendInlineBotResult</a> method should be invoked, passing:</p>
2022-05-14 00:37:40 +02:00
<ul>
<li>The <code>query_id</code> from <code>messages.botResults</code></li>
<li>The <code>id</code> of the chosen result</li>
<li>The <code>peer</code> where to send the chosen result</li>
</ul>
<p>The resulting <a href="/constructor/message">message</a> will have the <code>via_bot_id</code> field set, to indicate that the result was generated by the bot that generated the inline result.<br>
Graphical clients should display the bot <code>@username</code> in the header of the message, allowing the user to click on it, automatically starting an inline query by inserting <code>@username</code> in the text bar.</p>
2023-05-22 14:54:47 +02:00
<h3><a class="anchor" href="#4-inline-feedback" id="4-inline-feedback" name="4-inline-feedback"><i class="anchor-icon"></i></a>4. Inline feedback</h3>
2022-05-14 00:37:40 +02:00
<pre><code><a href='/constructor/inputBotInlineMessageID'>inputBotInlineMessageID</a>#890c3d89 dc_id:<a href='/type/int'>int</a> id:<a href='/type/long'>long</a> access_hash:<a href='/type/long'>long</a> = <a href='/type/InputBotInlineMessageID'>InputBotInlineMessageID</a>;
<a href='/constructor/updateBotInlineSend'>updateBotInlineSend</a>#12f12a07 flags:<a href='/type/%23'>#</a> user_id:<a href='/type/long'>long</a> query:<a href='/type/string'>string</a> geo:flags.0?<a href='/type/GeoPoint'>GeoPoint</a> id:<a href='/type/string'>string</a> msg_id:flags.1?<a href='/type/InputBotInlineMessageID'>InputBotInlineMessageID</a> = <a href='/type/Update'>Update</a>;</code></pre>
2023-05-22 14:54:47 +02:00
<p>If <a href="/bots/inline#collecting-feedback">feedback collection</a> is enabled, the bot may receive an <a href="/constructor/updateBotInlineSend">updateBotInlineSend</a> when the user <a href="#3-sending-the-inline-query-result">chooses and sends</a> an inline result. </p>
2022-05-14 00:37:40 +02:00
<p>Even if the <a href="/bots/inline#collecting-feedback">probability setting is set to 100%</a>, not all inline results may be reported due to caching (see the <code>cache_time</code> parameter in <a href="/api/bots/buttons#answering-a-callback-query">Answering a callback query</a>).<br>
<a href="/bots/inline#collecting-feedback">Feedback collection</a> can also create load issues for popular bots, so adjust the probability setting to a lower value in such cases.</p>
<p>Either way, feedback collection should only be used for statistical purposes rather than functional. </p>
<p>The <a href="/constructor/updateBotInlineSend">updateBotInlineSend</a> will contain: </p>
<ul>
<li><code>id</code> - The ID of the chosen result</li>
<li><code>msg_id</code> - The ID of the sent inline message</li>
<li><code>user_id</code> - The ID of the user that chose the result</li>
<li><code>query</code> - The query string that was used to obtain the result</li>
<li><code>geo</code> - For bots requiring <a href="/bots/inline#location-based-results">location-based inline results</a>, the user's location</li>
</ul>
2023-05-22 14:54:47 +02:00
<h3><a class="anchor" href="#5-editing-sent-inline-messages" id="5-editing-sent-inline-messages" name="5-editing-sent-inline-messages"><i class="anchor-icon"></i></a>5. Editing sent inline messages</h3>
2022-05-14 00:37:40 +02:00
<pre><code><a href='/constructor/updateInlineBotCallbackQuery'>updateInlineBotCallbackQuery</a>#691e9052 flags:<a href='/type/%23'>#</a> query_id:<a href='/type/long'>long</a> user_id:<a href='/type/long'>long</a> msg_id:<a href='/type/InputBotInlineMessageID'>InputBotInlineMessageID</a> chat_instance:<a href='/type/long'>long</a> data:flags.0?<a href='/type/bytes'>bytes</a> game_short_name:flags.1?<a href='/type/string'>string</a> = <a href='/type/Update'>Update</a>;
<a href='/constructor/inputBotInlineMessageID'>inputBotInlineMessageID</a>#890c3d89 dc_id:<a href='/type/int'>int</a> id:<a href='/type/long'>long</a> access_hash:<a href='/type/long'>long</a> = <a href='/type/InputBotInlineMessageID'>InputBotInlineMessageID</a>;
---functions---
2024-02-10 15:29:33 +01:00
<a href='/method/messages.editInlineBotMessage'>messages.editInlineBotMessage</a>#83557dba flags:<a href='/type/%23'>#</a> no_webpage:flags.1?<a href='/constructor/true'>true</a> invert_media:flags.16?<a href='/constructor/true'>true</a> id:<a href='/type/InputBotInlineMessageID'>InputBotInlineMessageID</a> message:flags.11?<a href='/type/string'>string</a> media:flags.14?<a href='/type/InputMedia'>InputMedia</a> reply_markup:flags.2?<a href='/type/ReplyMarkup'>ReplyMarkup</a> entities:flags.3?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageEntity'>MessageEntity</a>&gt; = <a href='/type/Bool'>Bool</a>;</code></pre>
2022-05-14 00:37:40 +02:00
<p>Sent inline messages can be edited by the bot, for example in response to a <a href="/api/bots/buttons#callback-queries">button press callback query</a>. </p>
<p>Simply pass the <a href="/constructor/inputBotInlineMessageID">inputBotInlineMessageID</a> specified in the <a href="/constructor/updateInlineBotCallbackQuery">updateInlineBotCallbackQuery</a> to <a href="/method/messages.editInlineBotMessage">messages.editInlineBotMessage</a> along with the new message, making sure to send the query to the <a href="/api/datacenter">datacenter</a> specified in <code>inputBotInlineMessageID.dc_id</code>.</p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
2022-09-09 12:10:24 +02:00
<li><a href="//telegram.org/privacy">Privacy</a></li>
2022-09-09 23:58:59 +02:00
<li><a href="//telegram.org/press">Press</a></li>
2022-05-14 00:37:40 +02:00
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
2022-09-09 23:58:59 +02:00
<li><a href="//telegram.org/android">Android</a></li>
<li><a href="//telegram.org/dl/web">Mobile Web</a></li>
2022-05-14 00:37:40 +02:00
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
2024-02-15 09:53:05 +01:00
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
2022-05-14 00:37:40 +02:00
</div>
</div>
</div>
</div>
2022-12-10 23:50:15 +01:00
<script src="/js/main.js?47"></script>
2022-05-14 00:37:40 +02:00
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>