telegram-crawler/data/web/blogfork.telegram.org/bots.html
2024-09-23 18:02:35 +00:00

250 lines
18 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>Bots: An introduction for developers</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Bots are small applications that run entirely within the Telegram app. Users interact with bots through flexible interfaces…">
<meta property="og:title" content="Bots: An introduction for developers">
<meta property="og:image" content="75f7c457f2561cbf84">
<meta property="og:description" content="Bots are small applications that run entirely within the Telegram app. Users interact with bots through flexible interfaces…">
<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?241" 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"></div>
<h1 id="dev_page_title">Bots: An introduction for developers</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<p>Bots are <strong>small applications</strong> that run entirely within the Telegram app. Users interact with bots through <strong>flexible interfaces</strong> that can support <strong>any kind of task or service</strong>. For more information, see:</p>
<ul>
<li><a href="/bots/features">Detailed Guide to Bot Features</a></li>
<li><a href="/bots/api">Full API Reference for Developers</a></li>
<li><a href="/bots/tutorial">Basic Tutorial: From @BotFather to &#39;Hello World&#39;</a></li>
</ul>
<p>The <strong>Telegram Bot Platform</strong> hosts more than <strong>10 million</strong> bots and is <strong>free</strong> for both users and developers.</p>
<h3><a class="anchor" name="what-can-you-do-with-bots" href="#what-can-you-do-with-bots"><i class="anchor-icon"></i></a>What Can You Do with Bots?</h3>
<ul>
<li><a href="#replace-entire-websites">Replace Entire Websites</a></li>
<li><a href="#manage-your-business">Manage Your Business</a></li>
<li><a href="#receive-payments">Receive Payments</a></li>
<li><a href="#create-custom-tools">Create Custom Tools</a></li>
<li><a href="#integrate-with-other-services">Integrate with Other Services</a></li>
<li><a href="#host-games">Host Games</a></li>
<li><a href="#build-social-networks">Build Social Networks</a></li>
<li><a href="#anything-else">Anything Else!</a></li>
</ul>
<h4><a class="anchor" name="replace-entire-websites" href="#replace-entire-websites"><i class="anchor-icon"></i></a>Replace Entire Websites</h4>
<p>Telegram bots can host <a href="/bots/webapps">Mini Apps</a> built with <em>JavaScript</em>. This allows for <strong>infinitely flexible</strong> interfaces that can power everything from online stores to arcade games. Unlike websites, bots support <a href="/api/url-authorization">seamless authorization</a> and notifications through Telegram out of the box.</p>
<div class="blog_video_player_wrap" style="max-width: 600px; margin: 20px auto 20px;">
<video class="blog_video_player tl_blog_vid_autoplay" onclick="videoTogglePlay(this)" autoplay loop controls muted poster="/file/464001434/100bf/eWprjdgzEbE.100386/644bbea83084f44c8f" style="max-width: 600px;" title="console.log('Vive la révolution')" alt="Bot Revolution">
<source src="/file/464001679/11aa9/KQx_BlPVXRo.4922145.mp4/c65433c8ac11a347a8" type="video/mp4">
</video>
</div>
<blockquote>
<p>Try <a href="https://t.me/durgerkingbot">@DurgerKingBot</a> or check out the <a href="/bots/webapps">dedicated guide to Web Apps</a> to build your own.</p>
</blockquote>
<h4><a class="anchor" name="manage-your-business" href="#manage-your-business"><i class="anchor-icon"></i></a>Manage Your Business</h4>
<p><a href="https://telegram.org/blog/telegram-business">Telegram Business</a> users can connect Telegram bots to process and answer messages <strong>on their behalf</strong>, via their personal account. This allows businesses to <strong>seamlessly integrate</strong> any existing tools and workflows, or add new AI assistants to <strong>increase productivity</strong>.</p>
<p>As we continue to expand the set of <strong>free tools</strong> <a href="https://core.telegram.org/bots">available to bots</a> through this integration, we encourage all developers to <strong>innovate</strong> and <strong>develop</strong> useful applications and services for <strong>businesses</strong> on Telegram.</p>
<div class="blog_video_player_wrap" style="max-width: 600px; margin: 20px auto 20px;">
<video class="blog_video_player tl_blog_vid_autoplay" onclick="videoTogglePlay(this)" autoplay loop controls muted poster="/file/400780400238/1/x875tPT245w.58064/1b426d3eda0a923c03" style="max-width: 600px;" title="" alt="Chatbots for Business">
<source src="/file/400780400382/1/BVN6m4W5a6w.4289566.mp4/9dc47caab261eaade4" type="video/mp4">
</video>
</div>
<blockquote>
<p>Developers can turn on <a href="https://core.telegram.org/bots/features#bots-for-business">Business Mode</a> in <a href="https://t.me/BotFather">@BotFather</a> if their bot supports <a href="https://core.telegram.org/bots/api#businessconnection">integration</a> with Telegram Business accounts.</p>
</blockquote>
<h5><a class="anchor" name="receive-payments" href="#receive-payments"><i class="anchor-icon"></i></a>Receive Payments</h5>
<p>Bots can sell all kinds of goods and services on Telegram to anyone in the world. <a href="https://telegram.org/blog/telegram-stars">Telegram Stars</a> allow users to securely and effortlessly buy <strong>digital products</strong> via in-app purchases. In addition, <strong>physical products</strong> can be purchased through more than 20 <a href="https://core.telegram.org/bots/payments#supported-payment-providers">integrated payment providers</a>.</p>
<div class="blog_video_player_wrap" style="max-width: 600px; margin: 20px auto 20px;">
<video class="blog_video_player tl_blog_vid_autoplay" onclick="videoTogglePlay(this)" autoplay loop controls muted poster="/file/464001866/10889/GZJM7zyZ6UE.105798/32d6a4d1d4f0b13355" style="max-width: 600px;" title="If your pizza place can't deliver a clone army, you're buying pizza from the wrong shop." alt="Video: Ordering a pizza through a Telegram channel">
<source src="/file/464001417/10bf1/nIRBV1iB0NY.3878528.mp4/c95b8092ce1ece10ef" type="video/mp4">
</video>
</div>
<blockquote>
<p>Try <a href="https://t.me/shopbot">@ShopBot</a> or check out our dedicated guides for <a href="https://core.telegram.org/bots/payments-stars">digital</a> and <a href="https://core.telegram.org/bots/payments">physical</a> products to build your own.</p>
</blockquote>
<h4><a class="anchor" name="create-custom-tools" href="#create-custom-tools"><i class="anchor-icon"></i></a>Create Custom Tools</h4>
<p>Increase your productivity by creating bots for <strong>specific tasks</strong> like converting files, managing chats or fetching todays forecast. Users can chat directly with bots, or add them to groups and channels to introduce extra features.</p>
<div class="blog_video_player_wrap" style="max-width: 600px; margin: 20px auto 20px;">
<video class="blog_video_player tl_blog_vid_autoplay" onclick="videoTogglePlay(this)" autoplay loop controls muted poster="/file/464001084/12c1d/eNLdXm8moqA.134736/e28dd8ea6d49eee57d" style="max-width: 600px;" title="" alt="Custom tools">
<source src="/file/464001127/10a99/GC0dSHYQTb0.3621529.mp4/75439f14147e13b6fb" type="video/mp4">
</video>
</div>
<blockquote>
<p>Try <a href="https://t.me/quizbot">@QuizBot</a> to combine several quiz-style polls into a <a href="https://telegram.org/tour/quizbot">proper quiz</a>.</p>
</blockquote>
<h4><a class="anchor" name="integrate-with-other-services" href="#integrate-with-other-services"><i class="anchor-icon"></i></a>Integrate with Other Services</h4>
<p>Many popular platforms already have official Telegram bots, which allow users to comfortably access content in one app or perform quick searches using <a href="/bots/inline">inline mode</a>.</p>
<div style="max-width: 600px; margin: 20px auto 20px;">
<a href="/file/464001186/11e04/7XO37b9iccE.133932/a29f8bf593af567fcc" target="_blank"><img src="/file/464001186/11e04/7XO37b9iccE.133932/a29f8bf593af567fcc" title="Gmail bot" class="dev_page_image" style="max-width: 600px;" /></a>
</div>
<blockquote>
<p>Try <a href="https://t.me/gmailbot">@GMailBot</a>, <a href="https://t.me/githubbot">@GitHubBot</a>, <a href="https://t.me/bing">@Bing</a>, <a href="https://t.me/youtube">@YouTube</a>, <a href="https://t.me/wiki">@wiki</a> and more.</p>
</blockquote>
<h4><a class="anchor" name="host-games" href="#host-games"><i class="anchor-icon"></i></a>Host Games</h4>
<p>Using <a href="/bots/games">HTML5</a>, developers can create immersive single or multi-player games that allow users to <strong>team up</strong> or <strong>compete</strong> for the highest score.</p>
<div class="blog_video_player_wrap" style="max-width: 600px; margin: 20px auto 20px;">
<video class="blog_video_player tl_blog_vid_autoplay" onclick="videoTogglePlay(this)" autoplay loop controls muted poster="/file/464001988/109f0/_Bu1DzRXl1o.145338/e58b7165e08ecbb936" style="max-width: 600px;" title="" alt="">
<source src="/file/464001693/1044a/rZXmc2EPIqY.3678215.mp4/94b37cec71e8e6287e" type="video/mp4">
</video>
</div>
<blockquote>
<p>Try <a href="https://t.me/gamee">@Gamee</a> and <a href="https://t.me/gamebot">@GameBot</a> or check out the <a href="/bots/games">HTML5 Games Manual</a> to build your own. </p>
</blockquote>
<h4><a class="anchor" name="build-social-networks" href="#build-social-networks"><i class="anchor-icon"></i></a>Build Social Networks</h4>
<p>Bots can serve as an intermediary to connect users based on shared interests, location, and more. Coordinate meetups, show local services, or help people sell second-hand items.</p>
<div class="blog_video_player_wrap" style="max-width: 600px; margin: 20px auto 20px;">
<video class="blog_video_player tl_blog_vid_autoplay" onclick="videoTogglePlay(this)" autoplay loop controls muted poster="/file/464001041/10ebf/BPN6BLcuS8I.137509/fd81647baa51b928a2" style="max-width: 600px;" title="" alt="">
<source src="/file/464001262/106bf/TVxoe4U0kIY.2116862.mp4/db7dfd397afbe2a61c" type="video/mp4">
</video>
</div>
<h4><a class="anchor" name="anything-else" href="#anything-else"><i class="anchor-icon"></i></a>Anything Else</h4>
<p>The possibilities for bots are endless from simple scripts to complex mini apps. Whether youre a beginner or professional programmer, you can create personalized tools with the help of the <a href="/bots/api">Bot Platform</a>.</p>
<hr>
<h3><a class="anchor" name="how-do-bots-work" href="#how-do-bots-work"><i class="anchor-icon"></i></a>How Do Bots Work?</h3>
<blockquote>
<p>For a detailed explanation of Bot Features, see <a href="/bots/features">this guide</a> </p>
</blockquote>
<p>Telegram bots are special accounts that do not need a phone number to set up. Bots are connected to their owners server, which processes inputs and requests from users.</p>
<p>Telegrams intermediary server handles all encryption and communication with the Telegram API. Developers communicate with this server via an easy HTTPS-interface with a simplified version of the <a href="/api">Telegram API</a> known as the <a href="/bots/api">Bot API</a>.</p>
<h4><a class="anchor" name="how-are-bots-different-from-users" href="#how-are-bots-different-from-users"><i class="anchor-icon"></i></a>How Are Bots Different from Users?</h4>
<p>Bots are able to process inputs and requests in ways that user accounts cant, but there are several differences between a bot and a normal user.</p>
<ul>
<li>Bots dont have last seen or online statuses instead they show a bot label in the chat.</li>
<li>Bots have limited cloud storage older messages may be removed by the server shortly after they have been processed.</li>
<li>Bots can&#39;t start conversations with users. A user must either add them to a group or send them a message first. People can search for your bots username or start a chat via its unique t.me/bot_username link.</li>
<li>By default, bots added to groups <strong>only see relevant messages</strong> in the chat (see <a href="/bots/features#privacy-mode">Privacy Mode</a>).</li>
<li>Bots never eat, sleep or complain (unless expressly programmed otherwise).</li>
</ul>
<h4><a class="anchor" name="bot-links" href="#bot-links"><i class="anchor-icon"></i></a>Bot Links</h4>
<p>Bot usernames normally require a bot suffix, but some bots dont have them such as <a href="https://t.me/stickers">@stickers</a>, <a href="https://t.me/gif">@gif</a>, <a href="https://t.me/wiki">@wiki</a> or <a href="https://t.me/bing">@bing</a>. </p>
<p>Anyone can <a href="https://telegram.org/blog/shareable-folders-custom-wallpapers#bot-links-and-telegram-premium-on-fragment">assign collectible usernames</a> to bots, including those without the &#39;bot&#39; suffix.</p>
<h3><a class="anchor" name="how-do-i-create-a-bot" href="#how-do-i-create-a-bot"><i class="anchor-icon"></i></a>How Do I Create a Bot?</h3>
<p>Creating Telegram bots is super-easy, but you will need at least some skills in <strong>computer programming</strong>. </p>
<p>Creating a bot is streamlined by Telegrams Bot API, which gives the tools and framework required to integrate your code. To get started, message <a href="https://t.me/botfather">@BotFather</a> on Telegram to register your bot and receive its authentication token.</p>
<blockquote>
<p>Your <strong>bot token</strong> is its unique identifier store it in a <strong>secure place</strong>, and only share it with people who need direct access to the bot. Everyone who has your token will have <strong>full control</strong> over your bot.</p>
</blockquote>
<h4><a class="anchor" name="what-next" href="#what-next"><i class="anchor-icon"></i></a>What Next?</h4>
<p>We recommend that you check out our guide to <a href="/bots/features">Bot Features</a> to see what you can teach your bot to do:</p>
<ul>
<li><a href="/bots/features">Detailed Guide to Bot Features</a></li>
<li><a href="/bots/api">Full API Reference for Developers</a></li>
<li><a href="/bots/tutorial">Basic Tutorial: From @BotFather to &#39;Hello World&#39;</a></li>
<li><a href="/bots/samples">Code Examples</a></li>
</ul>
</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();
initScrollVideos(true);
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>