telegram-crawler/data/web/core.telegram.org/bots/inline.html
2024-04-22 11:05:10 +00:00

191 lines
12 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Inline Bots</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Inline bots: A new way to interact with bots and send bot-generated content to any chat, group or channel.">
<meta property="og:title" content="Inline Bots">
<meta property="og:image" content="https://core.telegram.org/file/811140530/1/h-eMmPp2vp4/cd4a109f75e6561305">
<meta property="og:description" content="Inline bots: A new way to interact with bots and send bot-generated content to any chat, group or channel.">
<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">
<link href="/css/telegram.css?237" rel="stylesheet" media="screen">
<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=""><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=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/bots" >Telegram Bots</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/bots/inline" >Inline Bots</a></li></ul></div>
<h1 id="dev_page_title">Inline Bots</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<div class="dev_side_image">
<a href="/file/811140221/1/fW9vnLya4Fg/e2b5c530c7b0e019c4" target="_blank"><img src="/file/811140530/1/h-eMmPp2vp4/cd4a109f75e6561305" title="Inline bots. Click for hi-res picture">
</a></div>
<p>Beyond sending commands in private messages or groups, users can interact with your bot via <a href="/bots/api#inline-mode"><strong>inline queries</strong></a>. If inline queries are enabled, users can call your bot by typing its username and a query in the <strong>text input field</strong> in <strong>any</strong> chat. The query is sent to your bot in an update. This way, people can request content from your bot in <strong>any</strong> of their chats, groups, or channels without sending any messages at all.</p>
<div><center>
<a href="/file/811140995/1/I-wubuXAnzk/2e39739d0ac6bd5458" target="_blank"><img src="/file/811140995/1/I-wubuXAnzk/2e39739d0ac6bd5458" title="Users can type the bots username in any chat, then type a query without sending any messages" style="width:300px; padding:10px 0px 10px"/></a></center>
<br/>
</div>
<p>To enable this option, send the <code>/setinline</code> command to <a href="https://telegram.me/botfather">@BotFather</a> and provide the placeholder text that the user will see in the input field after typing your bots name.</p>
<blockquote>
<p>See the <a href="/bots/api#inline-mode">Bot API Manual</a> for the relevant methods and objects.</p>
</blockquote>
<h3><a class="anchor" name="inline-results" href="#inline-results"><i class="anchor-icon"></i></a>Inline results</h3>
<p>Inline bots support <strong>all types of content</strong> available in Telegram (20 in all). They are capable of sending stickers, videos, music, locations, documents and more. </p>
<div><center>
<a href="/file/811140994/2/fvw-q_CRaBQ/c618325e119b0a8229" target="_blank"><img src="/file/811140994/2/fvw-q_CRaBQ/c618325e119b0a8229" title="All kinds of inline content" style="width: 295px; padding: 10px 20px;" /></a></center>
<br/>
</div>
<p>Clients can display the results with vertical or horizontal scrolling, depending on the type of content:</p>
<div><center>
<a href="/file/811140049/2/M2mzqjZoiUw/2d872f0df2aed182d6" target="_blank"><img src="/file/811140049/2/M2mzqjZoiUw/2d872f0df2aed182d6" title="Vertical scrolling" style="width: 295px; padding: 0px 20px;" /></a>
<a href="/file/811140592/2/P4-tFhmBsCg/57418af08f1a252d45" target="_blank"><img src="/file/811140592/2/P4-tFhmBsCg/57418af08f1a252d45" title="Horizontal scrolling" style="width: 295px; padding: 0px 20px;" /></a>
</center>
<br/>
</div>
<p>As soon as the user taps on an item, it&#39;s immediately sent to the recipient, and the input field is cleared.</p>
<h3><a class="anchor" name="switching-inline-pm-modes" href="#switching-inline-pm-modes"><i class="anchor-icon"></i></a>Switching inline/PM modes</h3>
<p>Some inline bots can benefit from an initial setup process, like connecting them to an account on an external service (e.g., YouTube). We&#39;ve added an easy way of switching between the private chat with a bot and whatever chat the user wants to share inline results in.</p>
<div><center>
<a href="/file/811140951/1/FD93gAgDVDI/8d8bdd16e6a7b40c12" target="_blank"><img src="/file/811140951/1/FD93gAgDVDI/8d8bdd16e6a7b40c12" title="Switch to PM button" style="width: 295px; padding: 10px 20px;" /></a></center><br/>
</div>
<p>You can display a special &#39;Switch to PM&#39; button above the inline results (or instead of them). This button will open a private chat with the bot and pass a parameter of your choosing, so that you can prompt the user for the relevant setup actions. Once done, you can use an inline keyboard with a <a href="/bots/api#inlinekeyboardmarkup"><em>switch_inline_query</em></a> button to send the user back to the original chat. </p>
<p><strong>Sample bots</strong><br><a href="https://telegram.me/youtube">@youtube</a> Shows a &#39;Sign in to YouTube&#39; button, then suggests personalized results.</p>
<blockquote>
<p><a href="/bots/api#answerinlinequery">Manual: Switch to PM</a></p>
</blockquote>
<h3><a class="anchor" name="location-based-results" href="#location-based-results"><i class="anchor-icon"></i></a>Location-based results</h3>
<p>Inline bots can request location data from their users. Use the <code>/setinlinegeo</code> command with <a href="https://telegram.me/botfather">@BotFather</a> to enable this. Your bot will ask the user for permission to access their location whenever they send an inline request.</p>
<p><strong>Sample bot</strong><br><a href="https://telegram.me/foursquare">@foursquare</a> This bot will ask for permission to access the user&#39;s location, then provide geo-targeted results.</p>
<h3><a class="anchor" name="spreading-virally" href="#spreading-virally"><i class="anchor-icon"></i></a>Spreading virally</h3>
<p>Messages sent with the help of your bot will show its username next to the sender&#39;s name.</p>
<div><center>
<a href="/file/811140680/2/P3E5RVFzGZ8/5ae6f9c9610b0cbace" target="_blank"><img src="/file/811140680/2/P3E5RVFzGZ8/5ae6f9c9610b0cbace" title="Gif shared via a bot" style="width: 295px; padding: 0px 20px;" /></a>
<a href="/file/811140016/2/2b_B7nq9OQA/161b06d38843930fe5" target="_blank"><img src="/file/811140016/2/2b_B7nq9OQA/161b06d38843930fe5" title="Inline bot suggestions" style="width: 295px; padding: 0px 20px;" /></a>
<br/><br/>
</center></div>
<p>When a user taps on the bot username in the message header, the mention is automatically inserted into the input field. Entering the <code>@</code> symbol in the input field brings up a list of suggestions, featuring recently used inline bots.</p>
<h4><a class="anchor" name="collecting-feedback" href="#collecting-feedback"><i class="anchor-icon"></i></a>Collecting feedback</h4>
<p>To know which of the provided results your users are sending to their chat partners, send <a href="https://telegram.me/botfather">@Botfather</a> the <code>/setinlinefeedback</code> command. With this enabled, you will receive updates on the results chosen by your users.</p>
<p>Please note that this can create load issues for popular bots you may receive more results than actual requests due to caching (see the <em>cache_time</em> parameter in <a href="/bots/api#answerinlinequery">answerInlineQuery</a>). For these cases, we recommend adjusting the probability setting to receive 1/10, 1/100 or 1/1000 of the results.</p>
<h3><a class="anchor" name="inline-bot-samples" href="#inline-bot-samples"><i class="anchor-icon"></i></a>Inline bot samples</h3>
<p>Here are some sample inline bots, in case youre curious to see one in action. Try any of these:<br><a href="https://telegram.me/gif">@gif</a> GIF search<br><a href="https://telegram.me/vid">@vid</a> Video search<br><a href="https://telegram.me/pic">@pic</a> Yandex image search<br><a href="https://telegram.me/bing">@bing</a> Bing image search<br><a href="https://telegram.me/wiki">@wiki</a> Wikipedia search<br><a href="https://telegram.me/imdb">@imdb</a> IMDB search<br><a href="https://telegram.me/bold">@bold</a> Make bold, italic or fixed sys text</p>
<p><strong>NEW</strong><br><a href="https://telegram.me/youtube">@youtube</a> - Connect your account for personalized results<br><a href="https://telegram.me/music">@music</a> - Search and send classical music<br><a href="https://telegram.me/foursquare">@foursquare</a> Find and send venue addresses<br><a href="https://telegram.me/sticker">@sticker</a> Find and send stickers based on emoji</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>
<li><a href="//telegram.org/privacy">Privacy</a></li>
<li><a href="//telegram.org/press">Press</a></li>
</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>
<li><a href="//telegram.org/android">Android</a></li>
<li><a href="//telegram.org/dl/web">Mobile Web</a></li>
</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">
<h5><a href="//telegram.org/press">Press</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?47"></script>
<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>