mirror of
https://github.com/MarshalX/telegram-crawler.git
synced 2025-03-15 13:22:43 +01:00
Update content of files
This commit is contained in:
parent
549136f34e
commit
033c96283b
8 changed files with 3850 additions and 1767 deletions
|
@ -48,10 +48,10 @@
|
|||
<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 'Hello World'</a></li>
|
||||
<li><a href="/bots/tutorial">Basic Tutorial: From @BotFather to 'Hello World'</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" href="#what-can-you-do-with-bots" id="what-can-you-do-with-bots" name="what-can-you-do-with-bots"><i class="anchor-icon"></i></a>What Can You Do with Bots?</h3>
|
||||
<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>
|
||||
|
@ -62,107 +62,115 @@
|
|||
<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" href="#replace-entire-websites" id="replace-entire-websites" name="replace-entire-websites"><i class="anchor-icon"></i></a>Replace Entire Websites</h4>
|
||||
<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">
|
||||
</source></video>
|
||||
</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>
|
||||
<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" href="#manage-your-business" id="manage-your-business" name="manage-your-business"><i class="anchor-icon"></i></a>Manage Your Business</h4>
|
||||
<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">
|
||||
</source></video>
|
||||
</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" href="#receive-payments" id="receive-payments" name="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>
|
||||
<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">
|
||||
</source></video>
|
||||
</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" href="#create-custom-tools" id="create-custom-tools" name="create-custom-tools"><i class="anchor-icon"></i></a>Create Custom Tools</h4>
|
||||
<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 today’s 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">
|
||||
</source></video>
|
||||
</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" href="#integrate-with-other-services" id="integrate-with-other-services" name="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>
|
||||
<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>
|
||||
<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" href="#host-games" id="host-games" name="host-games"><i class="anchor-icon"></i></a>Host Games</h4>
|
||||
<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">
|
||||
</source></video>
|
||||
</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>
|
||||
<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" href="#build-social-networks" id="build-social-networks" name="build-social-networks"><i class="anchor-icon"></i></a>Build Social Networks</h4>
|
||||
<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">
|
||||
</source></video>
|
||||
</video>
|
||||
</div>
|
||||
<h4><a class="anchor" href="#anything-else" id="anything-else" name="anything-else"><i class="anchor-icon"></i></a>Anything Else</h4>
|
||||
|
||||
<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 you’re 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" href="#how-do-bots-work" id="how-do-bots-work" name="how-do-bots-work"><i class="anchor-icon"></i></a>How Do Bots Work?</h3>
|
||||
<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 owner’s server, which processes inputs and requests from users.</p>
|
||||
<p>Telegram’s 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" href="#how-are-bots-different-from-users" id="how-are-bots-different-from-users" name="how-are-bots-different-from-users"><i class="anchor-icon"></i></a>How Are Bots Different from Users?</h4>
|
||||
<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 can’t, but there are several differences between a bot and a normal user.</p>
|
||||
<ul>
|
||||
<li>Bots don’t 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'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 bot’s username or start a chat via its unique t.me/bot_username link.</li>
|
||||
<li>Bots can'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 bot’s 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" href="#bot-links" id="bot-links" name="bot-links"><i class="anchor-icon"></i></a>Bot Links</h4>
|
||||
<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 don’t 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 'bot' suffix.</p>
|
||||
<h3><a class="anchor" href="#how-do-i-create-a-bot" id="how-do-i-create-a-bot" name="how-do-i-create-a-bot"><i class="anchor-icon"></i></a>How Do I Create a Bot?</h3>
|
||||
<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 'bot' 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 Telegram’s 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" href="#what-next" id="what-next" name="what-next"><i class="anchor-icon"></i></a>What Next?</h4>
|
||||
<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 'Hello World'</a></li>
|
||||
<li><a href="/bots/tutorial">Basic Tutorial: From @BotFather to 'Hello World'</a></li>
|
||||
<li><a href="/bots/samples">Code Examples</a></li>
|
||||
</ul></div>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
@ -47,16 +47,171 @@ To learn how to create…">
|
|||
<div id="dev_page_content"><!-- scroll_nav -->
|
||||
|
||||
<blockquote>
|
||||
<p>The Bot API is an HTTP-based interface created for developers keen on building bots for Telegram.
|
||||
To learn how to create and set up a bot, please consult our <a href="https://core.telegram.org/bots"><strong>Introduction to Bots »</strong></a></p>
|
||||
<p>The Bot API is an HTTP-based interface created for developers keen on building bots for Telegram.<br>To learn how to create and set up a bot, please consult our <a href="https://core.telegram.org/bots"><strong>Introduction to Bots »</strong></a></p>
|
||||
</blockquote>
|
||||
<p>You will find all changes to our <a href="/bots/api"><strong>Bot API</strong></a> on this page.</p>
|
||||
<h3><a class="anchor" href="#recent-changes" id="recent-changes" name="recent-changes"><i class="anchor-icon"></i></a>Recent changes</h3>
|
||||
<h3><a class="anchor" name="recent-changes" href="#recent-changes"><i class="anchor-icon"></i></a>Recent changes</h3>
|
||||
<blockquote>
|
||||
<p>Subscribe to <a href="https://t.me/botnews">@BotNews</a> to be the first to know about the latest updates and join the discussion in <a href="https://t.me/bottalk">@BotTalk</a></p>
|
||||
</blockquote>
|
||||
<h3><a class="anchor" href="#2023" id="2023" name="2023"><i class="anchor-icon"></i></a>2023</h3>
|
||||
<h4><a class="anchor" href="#december-29-2023" id="december-29-2023" name="december-29-2023"><i class="anchor-icon"></i></a>December 29, 2023</h4>
|
||||
<h3><a class="anchor" name="2024" href="#2024"><i class="anchor-icon"></i></a>2024</h3>
|
||||
<h4><a class="anchor" name="september-6-2024" href="#september-6-2024"><i class="anchor-icon"></i></a>September 6, 2024</h4>
|
||||
<p><strong>Bot API 7.10</strong></p>
|
||||
<ul>
|
||||
<li>Added updates about purchased paid media, represented by the class <a href="/bots/api#paidmediapurchased">PaidMediaPurchased</a> and the field <em>purchased_paid_media</em> in the class <a href="/bots/api#update">Update</a>.</li>
|
||||
<li>Added the ability to specify a payload in <a href="/bots/api#sendpaidmedia">sendPaidMedia</a> that is received back by the bot in <a href="/bots/api#transactionpartneruser">TransactionPartnerUser</a> and <em>purchased_paid_media</em> updates.</li>
|
||||
<li>Added the field <em>prize_star_count</em> to the classes <a href="/bots/api#giveawaycreated">GiveawayCreated</a>, <a href="/bots/api#giveaway">Giveaway</a>, <a href="/bots/api#giveawaywinners">GiveawayWinners</a> and <a href="/bots/api#chatboostsourcegiveaway">ChatBoostSourceGiveaway</a>.</li>
|
||||
<li>Added the field <em>is_star_giveaway</em> to the class <a href="/bots/api#giveawaycompleted">GiveawayCompleted</a>.</li>
|
||||
<li>Added the field <em>SecondaryButton</em> to the class <a href="/bots/webapps#initializing-mini-apps">WebApp</a>.</li>
|
||||
<li>Added the event <em>secondaryButtonClicked</em> for Mini Apps.</li>
|
||||
<li>Added the field <em>bottomBarColor</em> and the method <em>setBottomBarColor</em> to the class <a href="/bots/webapps#initializing-mini-apps">WebApp</a>.</li>
|
||||
<li>Added the field <em>bottom_bar_bg_color</em> to the class <a href="/bots/webapps#themeparams">ThemeParams</a>.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" name="august-14-2024" href="#august-14-2024"><i class="anchor-icon"></i></a>August 14, 2024</h4>
|
||||
<p><strong>Bot API 7.9</strong></p>
|
||||
<ul>
|
||||
<li>Added support for <a href="https://telegram.org/blog/superchannels-star-reactions-subscriptions#super-channels">Super Channels</a>, allowing received channel messages to have users or other channels as their senders.</li>
|
||||
<li>Added the ability to send paid media to any chat.</li>
|
||||
<li>Added the parameter <em>business_connection_id</em> to the method <a href="/bots/api#sendpaidmedia">sendPaidMedia</a>, allowing bots to send paid media on behalf of a business account.</li>
|
||||
<li>Added the field <em>paid_media</em> to the class <a href="/bots/api#transactionpartneruser">TransactionPartnerUser</a> for transactions involving paid media.</li>
|
||||
<li>Added the fields <em>subscription_period</em> and <em>subscription_price</em> to the class <a href="/bots/api#chatinvitelink">ChatInviteLink</a>.</li>
|
||||
<li>Added the method <a href="/bots/api#createchatsubscriptioninvitelink">createChatSubscriptionInviteLink</a>, allowing bots to create subscription invite links.</li>
|
||||
<li>Added the method <a href="/bots/api#editchatsubscriptioninvitelink">editChatSubscriptionInviteLink</a>, allowing bots to edit the <em>name</em> of subscription invite links.</li>
|
||||
<li>Added the field <em>until_date</em> to the class <a href="/bots/api#chatmembermember">ChatMemberMember</a> for members with an active subscription.</li>
|
||||
<li>Added support for paid reactions and the class <a href="/bots/api#reactiontypepaid">ReactionTypePaid</a>.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" name="july-31-2024" href="#july-31-2024"><i class="anchor-icon"></i></a>July 31, 2024</h4>
|
||||
<p><strong>Bot API 7.8</strong></p>
|
||||
<ul>
|
||||
<li>Added the option for bots to set a <a href="/bots/webapps#launching-the-main-mini-app">Main Mini App</a>, which can be previewed and launched directly from a button in the bot's profile or a link.</li>
|
||||
<li>Added the method <em>shareToStory</em> to the class <a href="/bots/webapps#initializing-mini-apps">WebApp</a>.</li>
|
||||
<li>Added the field <em>has_main_web_app</em> to the class <a href="/bots/api#user">User</a>, which is returned in the response to <a href="/bots/api#getme">getMe</a>.</li>
|
||||
<li>Added the parameter <em>business_connection_id</em> to the methods <a href="/bots/api#pinchatmessage">pinChatMessage</a> and <a href="/bots/api#unpinchatmessage">unpinChatMessage</a>, allowing bots to manage pinned messages on behalf of a business account.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" name="july-7-2024" href="#july-7-2024"><i class="anchor-icon"></i></a>July 7, 2024</h4>
|
||||
<p><strong>Bot API 7.7</strong></p>
|
||||
<ul>
|
||||
<li>Added the class <a href="/bots/api#refundedpayment">RefundedPayment</a>, containing information about a refunded payment.</li>
|
||||
<li>Added the field <em>refunded_payment</em> to the class <a href="/bots/api#message">Message</a>, describing a service message about a refunded payment.</li>
|
||||
<li>Added the field <em>isVerticalSwipesEnabled</em> and the methods <em>enableVerticalSwipes</em>, <em>disableVerticalSwipes</em> to the class <a href="/bots/webapps#initializing-mini-apps">WebApp</a>.</li>
|
||||
<li>Added the <a href="/bots/webapps#events-available-for-mini-apps">event</a> <em>scanQrPopupClosed</em> for Mini Apps.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" name="july-1-2024" href="#july-1-2024"><i class="anchor-icon"></i></a>July 1, 2024</h4>
|
||||
<p><strong>Bot API 7.6</strong></p>
|
||||
<ul>
|
||||
<li>Added the classes <a href="/bots/api#paidmedia">PaidMedia</a>, <a href="/bots/api#paidmediainfo">PaidMediaInfo</a>, <a href="/bots/api#paidmediapreview">PaidMediaPreview</a>, <a href="/bots/api#paidmediaphoto">PaidMediaPhoto</a> and <a href="/bots/api#paidmediavideo">PaidMediaVideo</a>, containing information about paid media.</li>
|
||||
<li>Added the method <a href="/bots/api#sendpaidmedia">sendPaidMedia</a> and the classes <a href="/bots/api#inputpaidmedia">InputPaidMedia</a>, <a href="/bots/api#inputpaidmediaphoto">InputPaidMediaPhoto</a> and <a href="/bots/api#inputpaidmediavideo">InputPaidMediaVideo</a>, to support sending paid media.</li>
|
||||
<li>Documented that the methods <a href="/bots/api#copymessage">copyMessage</a> and <a href="/bots/api#copymessages">copyMessages</a> cannot be used to copy paid media.</li>
|
||||
<li>Added the field <em>can_send_paid_media</em> to the class <a href="/bots/api#chatfullinfo">ChatFullInfo</a>.</li>
|
||||
<li>Added the field <em>paid_media</em> to the classes <a href="/bots/api#message">Message</a> and <a href="/bots/api#externalreplyinfo">ExternalReplyInfo</a>.</li>
|
||||
<li>Added the class <a href="/bots/api#transactionpartnertelegramads">TransactionPartnerTelegramAds</a>, containing information about Telegram Star transactions involving the Telegram Ads Platform.</li>
|
||||
<li>Added the field <em>invoice_payload</em> to the class <a href="/bots/api#transactionpartneruser">TransactionPartnerUser</a>, containing the bot-specified invoice payload.</li>
|
||||
<li>Changed the default opening mode for <a href="/bots/webapps#direct-link-mini-apps">Direct Link Mini Apps</a>.</li>
|
||||
<li>Added support for launching Web Apps via <code>t.me</code> link in the class <a href="/bots/api#menubuttonwebapp">MenuButtonWebApp</a>.</li>
|
||||
<li>Added the field <em>section_separator_color</em> to the class <a href="/bots/webapps#themeparams">ThemeParams</a>.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" name="june-18-2024" href="#june-18-2024"><i class="anchor-icon"></i></a>June 18, 2024</h4>
|
||||
<p><strong>Bot API 7.5</strong></p>
|
||||
<ul>
|
||||
<li>Added the classes <a href="/bots/api#startransactions">StarTransactions</a>, <a href="/bots/api#startransaction">StarTransaction</a>, <a href="/bots/api#transactionpartner">TransactionPartner</a> and <a href="/bots/api#revenuewithdrawalstate">RevenueWithdrawalState</a>, containing information about Telegram Star transactions involving the bot.</li>
|
||||
<li>Added the method <a href="/bots/api#getstartransactions">getStarTransactions</a> that can be used to get the list of all Telegram Star transactions for the bot.</li>
|
||||
<li>Added support for <em>callback</em> buttons in <a href="/bots/api#inlinekeyboardmarkup">InlineKeyboardMarkup</a> for messages sent on behalf of a business account.</li>
|
||||
<li>Added support for callback queries originating from a message sent on behalf of a business account.</li>
|
||||
<li>Added the parameter <em>business_connection_id</em> to the methods <a href="/bots/api#editmessagetext">editMessageText</a>, <a href="/bots/api#editmessagemedia">editMessageMedia</a>, <a href="/bots/api#editmessagecaption">editMessageCaption</a>, <a href="/bots/api#editmessagelivelocation">editMessageLiveLocation</a>, <a href="/bots/api#stopmessagelivelocation">stopMessageLiveLocation</a> and <a href="/bots/api#editmessagereplymarkup">editMessageReplyMarkup</a>, allowing the bot to edit business messages.</li>
|
||||
<li>Added the parameter <em>business_connection_id</em> to the method <a href="/bots/api#stoppoll">stopPoll</a>, allowing the bot to stop polls it sent on behalf of a business account.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" name="may-28-2024" href="#may-28-2024"><i class="anchor-icon"></i></a>May 28, 2024</h4>
|
||||
<p><strong>Bot API 7.4</strong></p>
|
||||
<ul>
|
||||
<li>Added support for payments in <a href="https://t.me/BotNews/90">Telegram Stars</a> by introducing the new currency “XTR”.</li>
|
||||
<li>The parameter <em>provider_token</em> of the methods <a href="/bots/api#sendinvoice">sendInvoice</a> and <a href="/bots/api#createinvoicelink">createInvoiceLink</a> must be omitted for payments in <a href="https://t.me/BotNews/90">Telegram Stars</a>.</li>
|
||||
<li>The field <em>provider_token</em> in the class <a href="/bots/api#inputinvoicemessagecontent">InputInvoiceMessageContent</a> must be omitted for payments in <a href="https://t.me/BotNews/90">Telegram Stars</a>.</li>
|
||||
<li>Added the method <a href="/bots/api#refundstarpayment">refundStarPayment</a>.</li>
|
||||
<li>Added the field <em>effect_id</em> to the class <a href="/bots/api#message">Message</a>.</li>
|
||||
<li>Added the parameter <em>message_effect_id</em> to the methods <a href="/bots/api#sendmessage">sendMessage</a>, <a href="/bots/api#sendphoto">sendPhoto</a>, <a href="/bots/api#sendvideo">sendVideo</a>, <a href="/bots/api#sendanimation">sendAnimation</a>, <a href="/bots/api#sendaudio">sendAudio</a>, <a href="/bots/api#senddocument">sendDocument</a>, <a href="/bots/api#sendsticker">sendSticker</a>, <a href="/bots/api#sendvideonote">sendVideoNote</a>, <a href="/bots/api#sendvoice">sendVoice</a>, <a href="/bots/api#sendlocation">sendLocation</a>, <a href="/bots/api#sendvenue">sendVenue</a>, <a href="/bots/api#sendcontact">sendContact</a>, <a href="/bots/api#sendpoll">sendPoll</a>, <a href="/bots/api#senddice">sendDice</a>, <a href="/bots/api#sendinvoice">sendInvoice</a>, <a href="/bots/api#sendgame">sendGame</a>, and <a href="/bots/api#sendmediagroup">sendMediaGroup</a>.</li>
|
||||
<li>Added the field <em>show_caption_above_media</em> to the classes <a href="/bots/api#message">Message</a>, <a href="/bots/api#inputmediaanimation">InputMediaAnimation</a>, <a href="/bots/api#inputmediaphoto">InputMediaPhoto</a>, <a href="/bots/api#inputmediavideo">InputMediaVideo</a>, <a href="/bots/api#inlinequeryresultgif">InlineQueryResultGif</a>, <a href="/bots/api#inlinequeryresultmpeg4gif">InlineQueryResultMpeg4Gif</a>, <a href="/bots/api#inlinequeryresultphoto">InlineQueryResultPhoto</a>, <a href="/bots/api#inlinequeryresultvideo">InlineQueryResultVideo</a>, <a href="/bots/api#inlinequeryresultcachedgif">InlineQueryResultCachedGif</a>, <a href="/bots/api#inlinequeryresultcachedmpeg4gif">InlineQueryResultCachedMpeg4Gif</a>, <a href="/bots/api#inlinequeryresultcachedphoto">InlineQueryResultCachedPhoto</a>, and <a href="/bots/api#inlinequeryresultcachedvideo">InlineQueryResultCachedVideo</a>.</li>
|
||||
<li>Added the parameter <em>show_caption_above_media</em> to the methods <a href="/bots/api#sendanimation">sendAnimation</a>, <a href="/bots/api#sendphoto">sendPhoto</a>, <a href="/bots/api#sendvideo">sendVideo</a>, <a href="/bots/api#copymessage">copyMessage</a>, and <a href="/bots/api#editmessagecaption">editMessageCaption</a>.</li>
|
||||
<li>Added support for “expandable_blockquote” entities in received messages.</li>
|
||||
<li>Added support for “expandable_blockquote” entity parsing in “MarkdownV2” and “HTML” parse modes.</li>
|
||||
<li>Allowed to explicitly specify “expandable_blockquote” entities in formatted texts.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" name="may-6-2024" href="#may-6-2024"><i class="anchor-icon"></i></a>May 6, 2024</h4>
|
||||
<p><strong>Bot API 7.3</strong></p>
|
||||
<ul>
|
||||
<li>Added support for <a href="/bots/api#inlinekeyboardmarkup">InlineKeyboardMarkup</a> with <em>url</em>, <em>login_url</em>, and <em>callback_game</em> buttons for messages sent on behalf of a business account.</li>
|
||||
<li>Added the field <em>via_join_request</em> to the class <a href="/bots/api#chatmemberupdated">ChatMemberUpdated</a>.</li>
|
||||
<li>Added support for live locations that can be edited indefinitely, allowing 0x7FFFFFFF to be used as <em>live_period</em>.</li>
|
||||
<li>Added the parameter <em>live_period</em> to the method <a href="/bots/api#editmessagelivelocation">editMessageLiveLocation</a>.</li>
|
||||
<li>Added the field <em>question_entities</em> to the class <a href="/bots/api#poll">Poll</a>.</li>
|
||||
<li>Added the field <em>text_entities</em> to the class <a href="/bots/api#polloption">PollOption</a>.</li>
|
||||
<li>Added the parameters <em>question_parse_mode</em> and <em>question_entities</em> to the method <a href="/bots/api#sendpoll">sendPoll</a>.</li>
|
||||
<li>Added the class <a href="/bots/api#inputpolloption">InputPollOption</a> and changed the type of the parameter <em>options</em> in the method <a href="/bots/api#sendpoll">sendPoll</a> to Array of <a href="/bots/api#inputpolloption">InputPollOption</a>.</li>
|
||||
<li>Added the classes <a href="/bots/api#chatbackground">ChatBackground</a>, <a href="/bots/api#backgroundtype">BackgroundType</a>, <a href="/bots/api#backgroundfill">BackgroundFill</a> and the field <em>chat_background_set</em> of type <a href="/bots/api#chatbackground">ChatBackground</a> to the class <a href="/bots/api#message">Message</a>, describing service messages about background changes.</li>
|
||||
<li>Split out the class <a href="/bots/api#chatfullinfo">ChatFullInfo</a> from the class <a href="/bots/api#chat">Chat</a> and changed the return type of the method <a href="/bots/api#getchat">getChat</a> to <a href="/bots/api#chatfullinfo">ChatFullInfo</a>.</li>
|
||||
<li>Added the field <em>max_reaction_count</em> to the class <a href="/bots/api#chatfullinfo">ChatFullInfo</a>.</li>
|
||||
<li>Documented that .MP3 and .M4A files can be used as voice messages.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" name="march-31-2024" href="#march-31-2024"><i class="anchor-icon"></i></a>March 31, 2024</h4>
|
||||
<p><strong>Bot API 7.2</strong></p>
|
||||
<p><strong>Integration with Business Accounts</strong></p>
|
||||
<ul>
|
||||
<li>Added the class <a href="/bots/api#businessconnection">BusinessConnection</a> and updates about the connection or disconnection of the bot to a business account, represented by the field <em>business_connection</em> in the class <a href="/bots/api#update">Update</a>.</li>
|
||||
<li>Added updates about new messages in a business account connected to the bot, represented by the field <em>business_message</em> in the class <a href="/bots/api#update">Update</a>.</li>
|
||||
<li>Added updates about message edits in a business account connected to the bot, represented by the field <em>edited_business_message</em> in the class <a href="/bots/api#update">Update</a>.</li>
|
||||
<li>Added updates about message deletion in a business account connected to the bot, represented by the class <a href="/bots/api#businessmessagesdeleted">BusinessMessagesDeleted</a> and the field <em>deleted_business_messages</em> in the class <a href="/bots/api#update">Update</a>.</li>
|
||||
<li>Added the method <a href="/bots/api#getbusinessconnection">getBusinessConnection</a>.</li>
|
||||
</ul>
|
||||
<p><strong>Working on Behalf of Business Accounts</strong></p>
|
||||
<ul>
|
||||
<li>Added the parameter <em>business_connection_id</em> to the methods <a href="/bots/api#sendmessage">sendMessage</a>, <a href="/bots/api#sendphoto">sendPhoto</a>, <a href="/bots/api#sendvideo">sendVideo</a>, <a href="/bots/api#sendanimation">sendAnimation</a>, <a href="/bots/api#sendaudio">sendAudio</a>, <a href="/bots/api#senddocument">sendDocument</a>, <a href="/bots/api#sendsticker">sendSticker</a>, <a href="/bots/api#sendvideonote">sendVideoNote</a>, <a href="/bots/api#sendvoice">sendVoice</a>, <a href="/bots/api#sendlocation">sendLocation</a>, <a href="/bots/api#sendvenue">sendVenue</a>, <a href="/bots/api#sendcontact">sendContact</a>, <a href="/bots/api#sendpoll">sendPoll</a>, <a href="/bots/api#senddice">sendDice</a>, <a href="/bots/api#sendgame">sendGame</a>, and <a href="/bots/api#sendmediagroup">sendMediaGroup</a>.</li>
|
||||
<li>Added the parameter <em>business_connection_id</em> to the method <a href="/bots/api#sendchataction">sendChatAction</a>.</li>
|
||||
<li>Added the field <em>business_connection_id</em> to the class <a href="/bots/api#message">Message</a>.</li>
|
||||
<li>Added the field <em>sender_business_bot</em> to the class <a href="/bots/api#message">Message</a>.</li>
|
||||
</ul>
|
||||
<p><strong>Information about Business Accounts</strong></p>
|
||||
<ul>
|
||||
<li>Added the class <a href="/bots/api#businessintro">BusinessIntro</a> and the field <em>business_intro</em> to the class <a href="/bots/api#chat">Chat</a>.</li>
|
||||
<li>Added the class <a href="/bots/api#businesslocation">BusinessLocation</a> and the field <em>business_location</em> to the class <a href="/bots/api#chat">Chat</a>.</li>
|
||||
<li>Added the classes <a href="/bots/api#businessopeninghours">BusinessOpeningHours</a> and <a href="/bots/api#businessopeninghoursinterval">BusinessOpeningHoursInterval</a> and the field <em>business_opening_hours</em> to the class <a href="/bots/api#chat">Chat</a>.</li>
|
||||
</ul>
|
||||
<p><strong>Mixed-Format Sticker Packs</strong></p>
|
||||
<ul>
|
||||
<li>Removed the fields <em>is_animated</em> and <em>is_video</em> from the class <a href="/bots/api#stickerset">StickerSet</a>.</li>
|
||||
<li>Added the field <em>format</em> to the class <a href="/bots/api#inputsticker">InputSticker</a>.</li>
|
||||
<li>Removed the parameter <em>sticker_format</em> from the method <a href="/bots/api#createnewstickerset">createNewStickerSet</a>.</li>
|
||||
<li>Added the parameter <em>format</em> to the method <a href="/bots/api#setstickersetthumbnail">setStickerSetThumbnail</a>.</li>
|
||||
<li>Increased the maximum number of stickers in any regular and mask sticker set to 120.</li>
|
||||
<li>Allowed to upload WEBM stickers using <a href="/bots/api#sendsticker">SendSticker</a>.</li>
|
||||
</ul>
|
||||
<p><strong>Request Chat Improvements</strong></p>
|
||||
<ul>
|
||||
<li>Added the fields <em>request_name</em>, <em>request_username</em>, and <em>request_photo</em> to the class <a href="/bots/api#keyboardbuttonrequestusers">KeyboardButtonRequestUsers</a>.</li>
|
||||
<li>Added the fields <em>request_title</em>, <em>request_username</em>, and <em>request_photo</em> to the class <a href="/bots/api#keyboardbuttonrequestchat">KeyboardButtonRequestChat</a>.</li>
|
||||
<li>Added the class <em>SharedUser</em> and replaced the field <em>user_ids</em> in the class <a href="/bots/api#usersshared">UsersShared</a> with the field <em>users</em>.</li>
|
||||
<li>Added the fields <em>title</em>, <em>username</em>, and <em>photo</em> to the class <a href="/bots/api#chatshared">ChatShared</a>.</li>
|
||||
</ul>
|
||||
<p><strong>Other Changes</strong></p>
|
||||
<ul>
|
||||
<li>Added the field <em>is_from_offline</em> to the class <a href="/bots/api#message">Message</a>.</li>
|
||||
<li>Added the field <em>can_connect_to_business</em> to the class <a href="/bots/api#user">User</a>.</li>
|
||||
<li>Added the field <em>personal_chat</em> to the class <a href="/bots/api#chat">Chat</a>.</li>
|
||||
<li>Added the method <a href="/bots/api#replacestickerinset">replaceStickerInSet</a>,</li>
|
||||
<li>Added the class <a href="/bots/api#birthdate">Birthdate</a> and the field <em>birthdate</em> to the class <a href="/bots/api#chat">Chat</a>.</li>
|
||||
<li>Added the field <em>BiometricManager</em> to the class <a href="/bots/webapps#initializing-mini-apps">WebApp</a>.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" name="february-16-2024" href="#february-16-2024"><i class="anchor-icon"></i></a>February 16, 2024</h4>
|
||||
<p><strong>Bot API 7.1</strong></p>
|
||||
<ul>
|
||||
<li>Added support for the administrator rights <em>can_post_stories</em>, <em>can_edit_stories</em>, <em>can_delete_stories</em> in supergroups.</li>
|
||||
<li>Added the class <a href="/bots/api#chatboostadded">ChatBoostAdded</a> and the field <em>boost_added</em> to the class <a href="/bots/api#message">Message</a> for service messages about a user boosting a chat.</li>
|
||||
<li>Added the field <em>sender_boost_count</em> to the class <a href="/bots/api#message">Message</a>.</li>
|
||||
<li>Added the field <em>reply_to_story</em> to the class <a href="/bots/api#message">Message</a>.</li>
|
||||
<li>Added the fields <em>chat</em> and <em>id</em> to the class <a href="/bots/api#story">Story</a>.</li>
|
||||
<li>Added the field <em>unrestrict_boost_count</em> to the class <a href="/bots/api#chat">Chat</a>.</li>
|
||||
<li>Added the field <em>custom_emoji_sticker_set_name</em> to the class <a href="/bots/api#chat">Chat</a>.</li>
|
||||
</ul>
|
||||
<h3><a class="anchor" name="2023" href="#2023"><i class="anchor-icon"></i></a>2023</h3>
|
||||
<h4><a class="anchor" name="december-29-2023" href="#december-29-2023"><i class="anchor-icon"></i></a>December 29, 2023</h4>
|
||||
<p><strong>Bot API 7.0</strong></p>
|
||||
<p><strong>Reactions</strong></p>
|
||||
<ul>
|
||||
|
@ -85,9 +240,9 @@ To learn how to create and set up a bot, please consult our <a href="https://cor
|
|||
</ul>
|
||||
<p><strong>Block Quotation</strong></p>
|
||||
<ul>
|
||||
<li>Added support for "blockquote" entities in received messages.</li>
|
||||
<li>Added support for "blockquote" entity parsing in "MarkdownV2" and "HTML" parse modes.</li>
|
||||
<li>Allowed to explicitly specify "blockquote" entities in formatted texts.</li>
|
||||
<li>Added support for “blockquote” entities in received messages.</li>
|
||||
<li>Added support for “blockquote” entity parsing in “MarkdownV2” and “HTML” parse modes.</li>
|
||||
<li>Allowed to explicitly specify “blockquote” entities in formatted texts.</li>
|
||||
</ul>
|
||||
<p><strong>Multiple Message Actions</strong></p>
|
||||
<ul>
|
||||
|
@ -129,7 +284,7 @@ To learn how to create and set up a bot, please consult our <a href="https://cor
|
|||
<li>Added the class <a href="/bots/api#messageorigin">MessageOrigin</a> and replaced the fields <em>forward_from</em>, <em>forward_from_chat</em>, <em>forward_from_message_id</em>, <em>forward_signature</em>, <em>forward_sender_name</em>, and <em>forward_date</em> with the field <em>forward_origin</em> of type <a href="/bots/api#messageorigin">MessageOrigin</a> in the class <a href="/bots/api#message">Message</a>.</li>
|
||||
<li>Improved documentation for the field <em>message</em> of the class <a href="/bots/api#callbackquery">callbackQuery</a> and the field <em>pinned_message</em> of the class <a href="/bots/api#message">Message</a> by adding the classes <a href="/bots/api#maybeinaccessiblemessage">MaybeInaccessibleMessage</a> and <a href="/bots/api#inaccessiblemessage">InaccessibleMessage</a>.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#september-22-2023" id="september-22-2023" name="september-22-2023"><i class="anchor-icon"></i></a>September 22, 2023</h4>
|
||||
<h4><a class="anchor" name="september-22-2023" href="#september-22-2023"><i class="anchor-icon"></i></a>September 22, 2023</h4>
|
||||
<p><strong>Bot API 6.9</strong></p>
|
||||
<ul>
|
||||
<li>Added the new administrator privileges <em>can_post_stories</em>, <em>can_edit_stories</em> and <em>can_delete_stories</em> to the classes <a href="/bots/api#chatmemberadministrator">ChatMemberAdministrator</a> and <a href="/bots/api#chatadministratorrights">ChatAdministratorRights</a>.</li>
|
||||
|
@ -141,7 +296,7 @@ To learn how to create and set up a bot, please consult our <a href="https://cor
|
|||
<li>Added the fields <em>from_request</em> and <em>from_attachment_menu</em> to the class <a href="/bots/api#writeaccessallowed">WriteAccessAllowed</a>.</li>
|
||||
<li>Added the fields <em>added_to_attachment_menu</em> and <em>allows_write_to_pm</em> to the class <a href="/bots/webapps#webappuser">WebAppUser</a>.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#august-18-2023" id="august-18-2023" name="august-18-2023"><i class="anchor-icon"></i></a>August 18, 2023</h4>
|
||||
<h4><a class="anchor" name="august-18-2023" href="#august-18-2023"><i class="anchor-icon"></i></a>August 18, 2023</h4>
|
||||
<p><strong>Bot API 6.8</strong></p>
|
||||
<ul>
|
||||
<li>Added the field <em>story</em> to the class <a href="/bots/api#message">Message</a> for messages with forwarded stories. Currently, it holds no information.</li>
|
||||
|
@ -150,7 +305,7 @@ To learn how to create and set up a bot, please consult our <a href="https://cor
|
|||
<li>Added the method <a href="/bots/api#unpinallgeneralforumtopicmessages">unpinAllGeneralForumTopicMessages</a>.</li>
|
||||
<li>Increased to 512 characters the maximum length of the <em>startapp</em> parameter in direct Web App links.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#april-21-2023" id="april-21-2023" name="april-21-2023"><i class="anchor-icon"></i></a>April 21, 2023</h4>
|
||||
<h4><a class="anchor" name="april-21-2023" href="#april-21-2023"><i class="anchor-icon"></i></a>April 21, 2023</h4>
|
||||
<p><strong>Bot API 6.7</strong></p>
|
||||
<ul>
|
||||
<li>Added support for launching <a href="/bots/webapps">Web Apps</a> from inline query results by replacing the parameters <em>switch_pm_text</em> and <em>switch_pm_parameter</em> of the method <a href="/bots/api#answerinlinequery">answerInlineQuery</a> with the parameter <em>button</em> of type <a href="/bots/api#inlinequeryresultsbutton">InlineQueryResultsButton</a>.</li>
|
||||
|
@ -159,10 +314,10 @@ To learn how to create and set up a bot, please consult our <a href="https://cor
|
|||
<li>Added the field <em>via_chat_folder_invite_link</em> to the class <a href="/bots/api#chatmemberupdated">ChatMemberUpdated</a>.</li>
|
||||
<li>Added the ability to set different bot names for different user languages using the method <a href="/bots/api#setmyname">setMyName</a>.</li>
|
||||
<li>Added the ability to get the current bot name in the given language as the class <a href="/bots/api#botname">BotName</a> using the method <a href="/bots/api#getmyname">getMyName</a>.</li>
|
||||
<li>Added the ability to change bot settings from the bot's profile in official Telegram apps, including the ability to set animated profile photos.</li>
|
||||
<li>Added the ability to change bot settings from the bot's profile in official Telegram apps, including the ability to set animated profile photos.</li>
|
||||
<li>Added the ability to specify custom emoji entities using <a href="/bots/api#html-style">HTML</a> and <a href="/bots/api#markdownv2-style">MarkdownV2</a> formatting options for bots that purchased additional usernames on <a href="https://fragment.com">Fragment</a>.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#march-9-2023" id="march-9-2023" name="march-9-2023"><i class="anchor-icon"></i></a>March 9, 2023</h4>
|
||||
<h4><a class="anchor" name="march-9-2023" href="#march-9-2023"><i class="anchor-icon"></i></a>March 9, 2023</h4>
|
||||
<p><strong>Bot API 6.6</strong></p>
|
||||
<ul>
|
||||
<li>Added the ability to set different bot descriptions for different user languages using the method <a href="/bots/api#setmydescription">setMyDescription</a>.</li>
|
||||
|
@ -191,7 +346,7 @@ To learn how to create and set up a bot, please consult our <a href="https://cor
|
|||
<li>Renamed the field <em>thumb_url</em> in the classes <a href="/bots/api#inlinequeryresultphoto">InlineQueryResultPhoto</a> and <a href="/bots/api#inlinequeryresultvideo">InlineQueryResultVideo</a> to <em>thumbnail_url</em>.</li>
|
||||
<li>Renamed the fields <em>thumb_url</em> and <em>thumb_mime_type</em> in the classes <a href="/bots/api#inlinequeryresultgif">InlineQueryResultGif</a>, and <a href="/bots/api#inlinequeryresultmpeg4gif">InlineQueryResultMpeg4Gif</a> to <em>thumbnail_url</em> and <em>thumbnail_mime_type</em> respectively.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#february-3-2023" id="february-3-2023" name="february-3-2023"><i class="anchor-icon"></i></a>February 3, 2023</h4>
|
||||
<h4><a class="anchor" name="february-3-2023" href="#february-3-2023"><i class="anchor-icon"></i></a>February 3, 2023</h4>
|
||||
<p><strong>Bot API 6.5</strong></p>
|
||||
<ul>
|
||||
<li>Added <a href="https://telegram.org/blog/profile-pics-emoji-translations#chat-selection-for-bots">requests for users and chats</a> and support for <a href="https://telegram.org/blog/profile-pics-emoji-translations#granular-media-permissions">granular media permissions</a>.</li>
|
||||
|
@ -202,8 +357,8 @@ To learn how to create and set up a bot, please consult our <a href="https://cor
|
|||
<li>Added the parameter <em>use_independent_chat_permissions</em> to the methods <a href="/bots/api#restrictchatmember">restrictChatMember</a> and <a href="/bots/api#setchatpermissions">setChatPermissions</a>.</li>
|
||||
<li>Added the field <em>user_chat_id</em> to the class <a href="/bots/api#chatjoinrequest">ChatJoinRequest</a>.</li>
|
||||
</ul>
|
||||
<h3><a class="anchor" href="#2022" id="2022" name="2022"><i class="anchor-icon"></i></a>2022</h3>
|
||||
<h4><a class="anchor" href="#december-30-2022" id="december-30-2022" name="december-30-2022"><i class="anchor-icon"></i></a>December 30, 2022</h4>
|
||||
<h3><a class="anchor" name="2022" href="#2022"><i class="anchor-icon"></i></a>2022</h3>
|
||||
<h4><a class="anchor" name="december-30-2022" href="#december-30-2022"><i class="anchor-icon"></i></a>December 30, 2022</h4>
|
||||
<p><strong>Bot API 6.4</strong></p>
|
||||
<ul>
|
||||
<li>Added the field <em>is_persistent</em> to the class <a href="/bots/api#replykeyboardmarkup">ReplyKeyboardMarkup</a>, allowing to control when the keyboard is shown.</li>
|
||||
|
@ -221,13 +376,13 @@ To learn how to create and set up a bot, please consult our <a href="https://cor
|
|||
<li>Added the methods <em>showScanQrPopup</em>, <em>closeScanQrPopup</em>, and <em>readTextFromClipboard</em> to the class <a href="/bots/webapps#initializing-web-apps">WebApp</a>.</li>
|
||||
<li>Added the parameter <em>options</em> to the method <em>openLink</em> of the class <a href="/bots/webapps#initializing-web-apps">WebApp</a>.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#november-5-2022" id="november-5-2022" name="november-5-2022"><i class="anchor-icon"></i></a>November 5, 2022</h4>
|
||||
<h4><a class="anchor" name="november-5-2022" href="#november-5-2022"><i class="anchor-icon"></i></a>November 5, 2022</h4>
|
||||
<p><strong>Bot API 6.3</strong></p>
|
||||
<ul>
|
||||
<li>Added support for <a href="https://telegram.org/blog/topics-in-groups-collectible-usernames#topics-in-groups">Topics in Groups</a>.</li>
|
||||
<li>Added the field <em>is_forum</em> to the class <a href="/bots/api#chat">Chat</a>.</li>
|
||||
<li>Added the fields <em>is_topic_message</em> and <em>message_thread_id</em> to the class <a href="/bots/api#message">Message</a> to allow detection of messages belonging to a forum topic and their message thread identifier.</li>
|
||||
<li>Added the classes <a href="/bots/api#forumtopiccreated">ForumTopicCreated</a>, <a href="/bots/api#forumtopicclosed">ForumTopicClosed</a>, and <a href="/bots/api#forumtopicreopened">ForumTopicReopened</a> and the fields <em>forum_topic_created</em>, <em>forum_topic_closed</em>, and <em>forum_topic_reopened</em> to the class <a href="/bots/api#message">Message</a>. Note that service messages about forum topic creation can't be deleted with the <a href="/bots/api#deletemessage">deleteMessage</a> method.</li>
|
||||
<li>Added the classes <a href="/bots/api#forumtopiccreated">ForumTopicCreated</a>, <a href="/bots/api#forumtopicclosed">ForumTopicClosed</a>, and <a href="/bots/api#forumtopicreopened">ForumTopicReopened</a> and the fields <em>forum_topic_created</em>, <em>forum_topic_closed</em>, and <em>forum_topic_reopened</em> to the class <a href="/bots/api#message">Message</a>. Note that service messages about forum topic creation can't be deleted with the <a href="/bots/api#deletemessage">deleteMessage</a> method.</li>
|
||||
<li>Added the field <em>can_manage_topics</em> to the classes <a href="/bots/api#chatadministratorrights">ChatAdministratorRights</a>, <a href="/bots/api#chatpermissions">ChatPermissions</a>, <a href="/bots/api#chatmemberadministrator">ChatMemberAdministrator</a>, and <a href="/bots/api#chatmemberrestricted">ChatMemberRestricted</a>.</li>
|
||||
<li>Added the parameter <em>can_manage_topics</em> to the method <a href="/bots/api#promotechatmember">promoteChatMember</a>.</li>
|
||||
<li>Added the methods <a href="/bots/api#createforumtopic">createForumTopic</a>, <a href="/bots/api#editforumtopic">editForumTopic</a>, <a href="/bots/api#closeforumtopic">closeForumTopic</a>, <a href="/bots/api#reopenforumtopic">reopenForumTopic</a>, <a href="/bots/api#deleteforumtopic">deleteForumTopic</a>, <a href="/bots/api#unpinallforumtopicmessages">unpinAllForumTopicMessages</a>, and <a href="/bots/api#getforumtopiciconstickers">getForumTopicIconStickers</a> for forum topic management.</li>
|
||||
|
@ -235,12 +390,12 @@ To learn how to create and set up a bot, please consult our <a href="https://cor
|
|||
<li>Added support for <a href="https://telegram.org/blog/topics-in-groups-collectible-usernames#collectible-usernames">Multiple Usernames</a> via the field <em>active_usernames</em> in the class <a href="/bots/api#chat">Chat</a>.</li>
|
||||
<li>Added the field <em>emoji_status_custom_emoji_id</em> to the class <a href="/bots/api#chat">Chat</a>.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#august-12-2022" id="august-12-2022" name="august-12-2022"><i class="anchor-icon"></i></a>August 12, 2022</h4>
|
||||
<h4><a class="anchor" name="august-12-2022" href="#august-12-2022"><i class="anchor-icon"></i></a>August 12, 2022</h4>
|
||||
<p><strong>Bot API 6.2</strong></p>
|
||||
<p><strong>Custom Emoji Support</strong></p>
|
||||
<ul>
|
||||
<li>Added the <a href="/bots/api#messageentity">MessageEntity</a> type "custom_emoji".</li>
|
||||
<li>Added the field <em>custom_emoji_id</em> to the class <a href="/bots/api#messageentity">MessageEntity</a> for "custom_emoji" entities.</li>
|
||||
<li>Added the <a href="/bots/api#messageentity">MessageEntity</a> type “custom_emoji”.</li>
|
||||
<li>Added the field <em>custom_emoji_id</em> to the class <a href="/bots/api#messageentity">MessageEntity</a> for “custom_emoji” entities.</li>
|
||||
<li>Added the method <a href="/bots/api#getcustomemojistickers">getCustomEmojiStickers</a>.</li>
|
||||
<li>Added the fields <em>type</em> and <em>custom_emoji_id</em> to the class <a href="/bots/api#sticker">Sticker</a>.</li>
|
||||
<li>Added the field <em>sticker_type</em> to the class <a href="/bots/api#stickerset">StickerSet</a>, describing the type of stickers in the set.</li>
|
||||
|
@ -258,11 +413,11 @@ To learn how to create and set up a bot, please consult our <a href="https://cor
|
|||
<ul>
|
||||
<li>Added the field <em>has_restricted_voice_and_video_messages</em> to the class <a href="/bots/api#chat">Chat</a> to support the <a href="https://telegram.org/blog/custom-emoji#privacy-settings-for-voice-messages">new setting</a>.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#june-20-2022" id="june-20-2022" name="june-20-2022"><i class="anchor-icon"></i></a>June 20, 2022</h4>
|
||||
<h4><a class="anchor" name="june-20-2022" href="#june-20-2022"><i class="anchor-icon"></i></a>June 20, 2022</h4>
|
||||
<p><strong>Bot API 6.1</strong></p>
|
||||
<p><strong>Media in Descriptions</strong></p>
|
||||
<ul>
|
||||
<li>Added support for photos and videos in the 'What can this bot do?' section (shown on the bot's start screen). Use <a href="https://t.me/BotFather">BotFather</a> to set up media.</li>
|
||||
<li>Added support for photos and videos in the 'What can this bot do?' section (shown on the bot's start screen). Use <a href="https://t.me/BotFather">BotFather</a> to set up media.</li>
|
||||
</ul>
|
||||
<p><strong>Web App Improvements</strong></p>
|
||||
<ul>
|
||||
|
@ -275,7 +430,7 @@ To learn how to create and set up a bot, please consult our <a href="https://cor
|
|||
<p><strong>Join Requests & Payments</strong></p>
|
||||
<ul>
|
||||
<li>Added the fields <em>join_to_send_messages</em> and <em>join_by_request</em> to the class <a href="/bots/api#chat">Chat</a>.</li>
|
||||
<li>Added the ability to process join requests which were created <a href="https://telegram.org/blog/700-million-and-premium#join-requests-for-public-groups">without an invite link</a>. Bots will receive a "chat_join_request" update as usual.</li>
|
||||
<li>Added the ability to process join requests which were created <a href="https://telegram.org/blog/700-million-and-premium#join-requests-for-public-groups">without an invite link</a>. Bots will receive a “chat_join_request” update as usual.</li>
|
||||
<li>Added the method <a href="/bots/api#createinvoicelink">createInvoiceLink</a> to generate an HTTP link for an invoice.</li>
|
||||
</ul>
|
||||
<p><strong>Telegram Premium Support</strong> (<a href="https://telegram.org/blog/700-million-and-premium#telegram-premium">more info</a>)</p>
|
||||
|
@ -295,15 +450,15 @@ To learn how to create and set up a bot, please consult our <a href="https://cor
|
|||
<li>Added the parameter <em>secret_token</em> to the method <a href="/bots/api#setwebhook">setWebhook</a>.</li>
|
||||
<li>As previously announced, only HTTPS links are now allowed in <em>login_url</em> inline keyboard buttons.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#april-16-2022" id="april-16-2022" name="april-16-2022"><i class="anchor-icon"></i></a>April 16, 2022</h4>
|
||||
<h4><a class="anchor" name="april-16-2022" href="#april-16-2022"><i class="anchor-icon"></i></a>April 16, 2022</h4>
|
||||
<p><strong>Bot API 6.0</strong></p>
|
||||
<ul>
|
||||
<li>Added support for <strong>Web Apps</strong>, see the <a href="/bots/webapps">detailed manual here</a>. (<a href="https://telegram.org/blog/notifications-bots">blog announcement</a>)</li>
|
||||
<li>Added the class <a href="/bots/api#webappinfo">WebAppInfo</a> and the fields <em>web_app</em> to the classes <a href="/bots/api#keyboardbutton">KeyboardButton</a> and <a href="/bots/api#inlinekeyboardbutton">InlineKeyboardButton</a>.</li>
|
||||
<li>Added the class <a href="/bots/api#sentwebappmessage">SentWebAppMessage</a> and the method <a href="/bots/api#answerwebappquery">answerWebAppQuery</a> for sending an answer to a Web App query, which originated from an inline button of the 'web_app' type.</li>
|
||||
<li>Added the class <a href="/bots/api#sentwebappmessage">SentWebAppMessage</a> and the method <a href="/bots/api#answerwebappquery">answerWebAppQuery</a> for sending an answer to a Web App query, which originated from an inline button of the 'web_app' type.</li>
|
||||
<li>Added the class <a href="/bots/api#webappdata">WebAppData</a> and the field <em>web_app_data</em> to the class <a href="/bots/api#message">Message</a>.</li>
|
||||
<li>Added the class <a href="/bots/api#menubutton">MenuButton</a> and the methods <a href="/bots/api#setchatmenubutton">setChatMenuButton</a> and <a href="/bots/api#getchatmenubutton">getChatMenuButton</a> for managing the behavior of the bot's menu button in private chats.</li>
|
||||
<li>Added the class <a href="/bots/api#chatadministratorrights">ChatAdministratorRights</a> and the methods <a href="/bots/api#setmydefaultadministratorrights">setMyDefaultAdministratorRights</a> and <a href="/bots/api#getmydefaultadministratorrights">getMyDefaultAdministratorRights</a> for managing the bot's default administrator rights.</li>
|
||||
<li>Added the class <a href="/bots/api#menubutton">MenuButton</a> and the methods <a href="/bots/api#setchatmenubutton">setChatMenuButton</a> and <a href="/bots/api#getchatmenubutton">getChatMenuButton</a> for managing the behavior of the bot's menu button in private chats.</li>
|
||||
<li>Added the class <a href="/bots/api#chatadministratorrights">ChatAdministratorRights</a> and the methods <a href="/bots/api#setmydefaultadministratorrights">setMyDefaultAdministratorRights</a> and <a href="/bots/api#getmydefaultadministratorrights">getMyDefaultAdministratorRights</a> for managing the bot's default administrator rights.</li>
|
||||
<li>Added support for t.me links that can be used to add the bot to groups and channels as an administrator.</li>
|
||||
<li>Added the field <em>last_synchronization_error_date</em> to the class <a href="/bots/api#webhookinfo">WebhookInfo</a>.</li>
|
||||
<li>Renamed the field <em>can_manage_voice_chats</em> to <em>can_manage_video_chats</em> in the class <a href="/bots/api#chatmemberadministrator">ChatMemberAdministrator</a>. The old field will remain temporarily available.</li>
|
||||
|
@ -312,31 +467,30 @@ To learn how to create and set up a bot, please consult our <a href="https://cor
|
|||
</ul>
|
||||
<hr>
|
||||
<blockquote>
|
||||
<p><strong><img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /> WARNING! <img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /></strong>
|
||||
After the next update, only HTTPS links will be allowed in <em>login_url</em> inline keyboard buttons.</p>
|
||||
<p><strong><img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /> WARNING! <img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /></strong><br>After the next update, only HTTPS links will be allowed in <em>login_url</em> inline keyboard buttons.</p>
|
||||
</blockquote>
|
||||
<hr>
|
||||
<h4><a class="anchor" href="#january-31-2022" id="january-31-2022" name="january-31-2022"><i class="anchor-icon"></i></a>January 31, 2022</h4>
|
||||
<h4><a class="anchor" name="january-31-2022" href="#january-31-2022"><i class="anchor-icon"></i></a>January 31, 2022</h4>
|
||||
<p><strong>Bot API 5.7</strong></p>
|
||||
<ul>
|
||||
<li>Added support for <a href="https://telegram.org/blog/video-stickers-better-reactions">Video Stickers</a>.</li>
|
||||
<li>Added the field <em>is_video</em> to the classes <a href="/bots/api#sticker">Sticker</a> and <a href="/bots/api#stickerset">StickerSet</a>.</li>
|
||||
<li>Added the parameter <em>webm_sticker</em> to the methods <a href="/bots/api#createnewstickerset">createNewStickerSet</a> and <a href="/bots/api#addstickertoset">addStickerToSet</a>.</li>
|
||||
</ul>
|
||||
<h3><a class="anchor" href="#2021" id="2021" name="2021"><i class="anchor-icon"></i></a>2021</h3>
|
||||
<h4><a class="anchor" href="#december-30-2021" id="december-30-2021" name="december-30-2021"><i class="anchor-icon"></i></a>December 30, 2021</h4>
|
||||
<h3><a class="anchor" name="2021" href="#2021"><i class="anchor-icon"></i></a>2021</h3>
|
||||
<h4><a class="anchor" name="december-30-2021" href="#december-30-2021"><i class="anchor-icon"></i></a>December 30, 2021</h4>
|
||||
<p><strong>Bot API 5.6</strong></p>
|
||||
<ul>
|
||||
<li>Improved support for <a href="https://telegram.org/blog/protected-content-delete-by-date-and-more#protected-content-in-groups-and-channels">Protected Content</a>.</li>
|
||||
<li>Added the parameter <em>protect_content</em> to the methods <a href="/bots/api#sendmessage">sendMessage</a>, <a href="/bots/api#sendphoto">sendPhoto</a>, <a href="/bots/api#sendvideo">sendVideo</a>, <a href="/bots/api#sendanimation">sendAnimation</a>, <a href="/bots/api#sendaudio">sendAudio</a>, <a href="/bots/api#senddocument">sendDocument</a>, <a href="/bots/api#sendsticker">sendSticker</a>, <a href="/bots/api#sendvideonote">sendVideoNote</a>, <a href="/bots/api#sendvoice">sendVoice</a>, <a href="/bots/api#sendlocation">sendLocation</a>, <a href="/bots/api#sendvenue">sendVenue</a>, <a href="/bots/api#sendcontact">sendContact</a>, <a href="/bots/api#sendpoll">sendPoll</a>, <a href="/bots/api#senddice">sendDice</a>, <a href="/bots/api#sendinvoice">sendInvoice</a>, <a href="/bots/api#sendgame">sendGame</a>, <a href="/bots/api#sendmediagroup">sendMediaGroup</a>, <a href="/bots/api#copymessage">copyMessage</a>, <a href="/bots/api#forwardmessage">forwardMessage</a> to allow sending messages with protected content to any chat.</li>
|
||||
<li>Added support for <a href="https://telegram.org/blog/reactions-spoilers-translations#spoilers">spoiler entities</a>, which will work in Telegram versions released after December 30, 2021. Older clients will display <em>unsupported message</em>.</li>
|
||||
<li>Added new <a href="/bots/api#messageentity">MessageEntity</a> type "spoiler".</li>
|
||||
<li>Added new <a href="/bots/api#messageentity">MessageEntity</a> type “spoiler”.</li>
|
||||
<li>Added the ability to specify spoiler entities using <a href="/bots/api#html-style">HTML</a> and <a href="/bots/api#markdownv2-style">MarkdownV2</a> formatting options.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#december-7-2021" id="december-7-2021" name="december-7-2021"><i class="anchor-icon"></i></a>December 7, 2021</h4>
|
||||
<h4><a class="anchor" name="december-7-2021" href="#december-7-2021"><i class="anchor-icon"></i></a>December 7, 2021</h4>
|
||||
<p><strong>Bot API 5.5</strong></p>
|
||||
<ul>
|
||||
<li>Bots are now allowed to contact users who sent a join request to a chat where the bot is an administrator with the <em>can_invite_users</em> administrator right – even if the user never interacted with the bot before.</li>
|
||||
<li>Bots are now allowed to contact users who sent a join request to a chat where the bot is an administrator with the <em>can_invite_users</em> administrator right – even if the user never interacted with the bot before.</li>
|
||||
<li>Added support for mentioning users by their ID in inline keyboards. This will only work in Telegram versions released after December 7, 2021. Older clients will display <em>unsupported message</em>.</li>
|
||||
<li>Added the methods <a href="/bots/api#banchatsenderchat">banChatSenderChat</a> and <a href="/bots/api#unbanchatsenderchat">unbanChatSenderChat</a> for banning and unbanning channel chats in supergroups and channels.</li>
|
||||
<li>Added the field <em>has_private_forwards</em> to the class <a href="/bots/api#chat">Chat</a> for private chats, which can be used to check the possibility of mentioning the user by their ID.</li>
|
||||
|
@ -346,7 +500,7 @@ After the next update, only HTTPS links will be allowed in <em>login_url</em> in
|
|||
<p><strong>Note:</strong> After this update it will become impossible to forward messages from some chats. Use the fields <em>has_protected_content</em> in the classes <a href="/bots/api#message">Message</a> and <a href="/bots/api#chat">Chat</a> to check this.</p>
|
||||
<p><strong>Note:</strong> After this update users are able to send messages on behalf of channels they own. Bots are expected to use the field <em>sender_chat</em> in the class <a href="/bots/api#message">Message</a> to correctly support such messages.</p>
|
||||
<p><strong>Note:</strong> As previously announced, user identifiers can now have up to 52 significant bits and require a 64-bit integer or double-precision float type to be stored safely.</p>
|
||||
<h4><a class="anchor" href="#november-5-2021" id="november-5-2021" name="november-5-2021"><i class="anchor-icon"></i></a>November 5, 2021</h4>
|
||||
<h4><a class="anchor" name="november-5-2021" href="#november-5-2021"><i class="anchor-icon"></i></a>November 5, 2021</h4>
|
||||
<p><strong>Bot API 5.4</strong></p>
|
||||
<ul>
|
||||
<li>Added the the parameter <code>creates_join_request</code> to the methods <a href="/bots/api#createchatinvitelink">createChatInviteLink</a> and <a href="/bots/api#editchatinvitelink">editChatInviteLink</a> for managing chat invite links that create join requests (read more about this on our <a href="https://telegram.org/blog/shared-media-scrolling-calendar-join-requests-and-more#join-requests-for-groups-and-channels">blog</a>).</li>
|
||||
|
@ -358,11 +512,10 @@ After the next update, only HTTPS links will be allowed in <em>login_url</em> in
|
|||
</ul>
|
||||
<hr>
|
||||
<blockquote>
|
||||
<p><strong><img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /> WARNING! <img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /></strong>
|
||||
User identifiers will become bigger than <code>2^31 - 1</code> before the end of this year and it will be no longer possible to store them in a signed 32-bit integer type. User identifiers will have up to 52 significant bits, so a 64-bit integer or double-precision float type would still be safe for storing them. Please make sure that your code can correctly handle such user identifiers.</p>
|
||||
<p><strong><img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /> WARNING! <img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /></strong><br>User identifiers will become bigger than <code>2^31 - 1</code> before the end of this year and it will be no longer possible to store them in a signed 32-bit integer type. User identifiers will have up to 52 significant bits, so a 64-bit integer or double-precision float type would still be safe for storing them. Please make sure that your code can correctly handle such user identifiers.</p>
|
||||
</blockquote>
|
||||
<hr>
|
||||
<h4><a class="anchor" href="#june-25-2021" id="june-25-2021" name="june-25-2021"><i class="anchor-icon"></i></a>June 25, 2021</h4>
|
||||
<h4><a class="anchor" name="june-25-2021" href="#june-25-2021"><i class="anchor-icon"></i></a>June 25, 2021</h4>
|
||||
<p><strong>Bot API 5.3</strong></p>
|
||||
<p><strong>Personalized Commands</strong></p>
|
||||
<ul>
|
||||
|
@ -370,8 +523,8 @@ User identifiers will become bigger than <code>2^31 - 1</code> before the end of
|
|||
<li>Added the class <a href="/bots/api#botcommandscope">BotCommandScope</a>, describing the scope to which bot commands apply.</li>
|
||||
<li>Added the parameters <code>scope</code> and <code>language_code</code> to the method <a href="/bots/api#setmycommands">setMyCommands</a> to allow bots specify different commands for different chats and users.</li>
|
||||
<li>Added the parameters <code>scope</code> and <code>language_code</code> to the method <a href="/bots/api#getmycommands">getMyCommands</a>.</li>
|
||||
<li>Added the method <a href="/bots/api#deletemycommands">deleteMyCommands</a> to allow deletion of the bot's commands for the given scope and user language.</li>
|
||||
<li>Improved visibility of bot commands in Telegram apps with the new 'Menu' button in chats with bots, read more on the <a href="https://telegram.org/blog/animated-backgrounds#bot-menu">blog</a>.</li>
|
||||
<li>Added the method <a href="/bots/api#deletemycommands">deleteMyCommands</a> to allow deletion of the bot's commands for the given scope and user language.</li>
|
||||
<li>Improved visibility of bot commands in Telegram apps with the new 'Menu' button in chats with bots, read more on the <a href="https://telegram.org/blog/animated-backgrounds#bot-menu">blog</a>.</li>
|
||||
</ul>
|
||||
<p><strong>Custom Placeholders</strong></p>
|
||||
<ul>
|
||||
|
@ -386,39 +539,35 @@ User identifiers will become bigger than <code>2^31 - 1</code> before the end of
|
|||
</ul>
|
||||
<hr>
|
||||
<blockquote>
|
||||
<p><strong><img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /> WARNING! <img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /></strong>
|
||||
After one of the upcoming Bot API updates, user identifiers will become bigger than <code>2^31 - 1</code> and it will be no longer possible to store them in a signed 32-bit integer type. User identifiers will have up to 52 significant bits, so a 64-bit integer or double-precision float type would still be safe for storing them. Please make sure that your code can correctly handle such user identifiers.</p>
|
||||
<p><strong><img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /> WARNING! <img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /></strong><br>After one of the upcoming Bot API updates, user identifiers will become bigger than <code>2^31 - 1</code> and it will be no longer possible to store them in a signed 32-bit integer type. User identifiers will have up to 52 significant bits, so a 64-bit integer or double-precision float type would still be safe for storing them. Please make sure that your code can correctly handle such user identifiers.</p>
|
||||
</blockquote>
|
||||
<hr>
|
||||
<h4><a class="anchor" href="#april-26-2021" id="april-26-2021" name="april-26-2021"><i class="anchor-icon"></i></a>April 26, 2021</h4>
|
||||
<h4><a class="anchor" name="april-26-2021" href="#april-26-2021"><i class="anchor-icon"></i></a>April 26, 2021</h4>
|
||||
<p><strong>Bot API 5.2</strong></p>
|
||||
<ul>
|
||||
<li>Support for <a href="https://telegram.org/blog/payments-2-0-scheduled-voice-chats">Payments 2.0</a>, see <a href="https://core.telegram.org/bots/payments">this manual</a> for more details about the <strong>Bot Payments API</strong>.</li>
|
||||
<li>Added the type <a href="/bots/api#inputinvoicemessagecontent">InputInvoiceMessageContent</a> to support sending invoices as inline query results.</li>
|
||||
<li>Allowed sending invoices to group, supergroup and channel chats.</li>
|
||||
<li>Added the fields <em>max_tip_amount</em> and <em>suggested_tip_amounts</em> to the method <a href="/bots/api#sendinvoice">sendInvoice</a> to allow adding optional tips to the payment.</li>
|
||||
<li>The parameter <em>start_parameter</em> of the method <a href="/bots/api#sendinvoice">sendInvoice</a> became optional. If the parameter isn't specified, the invoice can be paid directly from forwarded messages.</li>
|
||||
<li>The parameter <em>start_parameter</em> of the method <a href="/bots/api#sendinvoice">sendInvoice</a> became optional. If the parameter isn't specified, the invoice can be paid directly from forwarded messages.</li>
|
||||
<li>Added the field <em>chat_type</em> to the class <a href="/bots/api#inlinequery">InlineQuery</a>, containing the type of the chat, from which the inline request was sent.</li>
|
||||
<li>Added the type <a href="/bots/api#voicechatscheduled">VoiceChatScheduled</a> and the field <em>voice_chat_scheduled</em> to the class <a href="/bots/api#message">Message</a>.</li>
|
||||
<li>Fixed an error in <a href="/bots/api#sendchataction">sendChatAction</a> documentation to correctly mention "record_voice" and "upload_voice" instead of "record_audio" and "upload_audio" for related to voice note actions. Old action names will still work for backward compatibility.</li>
|
||||
<li>Fixed an error in <a href="/bots/api#sendchataction">sendChatAction</a> documentation to correctly mention “record_voice” and “upload_voice” instead of “record_audio” and “upload_audio” for related to voice note actions. Old action names will still work for backward compatibility.</li>
|
||||
</ul>
|
||||
<hr>
|
||||
<blockquote>
|
||||
<p><strong><img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /> WARNING! <img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /></strong>
|
||||
After the next Bot API update (Bot API 5.3) there will be a one-time change of the value of the field <code>file_unique_id</code> in objects of the type <a href="/bots/api#photosize">PhotoSize</a> and of the fields <code>small_file_unique_id</code> and <code>big_file_unique_id</code> in objects of the type <a href="/bots/api#chatphoto">ChatPhoto</a>.</p>
|
||||
<p><strong><img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /> WARNING! <img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /></strong><br>After the next Bot API update (Bot API 5.3) there will be a one-time change of the value of the field <code>file_unique_id</code> in objects of the type <a href="/bots/api#photosize">PhotoSize</a> and of the fields <code>small_file_unique_id</code> and <code>big_file_unique_id</code> in objects of the type <a href="/bots/api#chatphoto">ChatPhoto</a>.</p>
|
||||
</blockquote>
|
||||
<hr>
|
||||
<blockquote>
|
||||
<p><strong><img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /> WARNING! <img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /></strong>
|
||||
Service messages about non-bot users joining the chat will be soon removed from large groups. We recommend using the "chat_member" update as a replacement.</p>
|
||||
<p><strong><img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /> WARNING! <img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /></strong><br>Service messages about non-bot users joining the chat will be soon removed from large groups. We recommend using the “chat_member” update as a replacement.</p>
|
||||
</blockquote>
|
||||
<hr>
|
||||
<blockquote>
|
||||
<p><strong><img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /> WARNING! <img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /></strong>
|
||||
After one of the upcoming Bot API updates, user identifiers will become bigger than <code>2^31 - 1</code> and it will be no longer possible to store them in a signed 32-bit integer type. User identifiers will have up to 52 significant bits, so a 64-bit integer or double-precision float type would still be safe for storing them. Please make sure that your code can correctly handle such user identifiers.</p>
|
||||
<p><strong><img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /> WARNING! <img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /></strong><br>After one of the upcoming Bot API updates, user identifiers will become bigger than <code>2^31 - 1</code> and it will be no longer possible to store them in a signed 32-bit integer type. User identifiers will have up to 52 significant bits, so a 64-bit integer or double-precision float type would still be safe for storing them. Please make sure that your code can correctly handle such user identifiers.</p>
|
||||
</blockquote>
|
||||
<hr>
|
||||
<h4><a class="anchor" href="#march-9-2021" id="march-9-2021" name="march-9-2021"><i class="anchor-icon"></i></a>March 9, 2021</h4>
|
||||
<h4><a class="anchor" name="march-9-2021" href="#march-9-2021"><i class="anchor-icon"></i></a>March 9, 2021</h4>
|
||||
<p><strong>Bot API 5.1</strong></p>
|
||||
<p><strong>Added two new update types</strong></p>
|
||||
<ul>
|
||||
|
@ -447,16 +596,15 @@ After one of the upcoming Bot API updates, user identifiers will become bigger t
|
|||
</ul>
|
||||
<hr>
|
||||
<blockquote>
|
||||
<p><strong><img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /> WARNING! <img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /></strong>
|
||||
After one of the upcoming Bot API updates, some user identifiers will become bigger than <code>2^31 - 1</code> and it will be no longer possible to store them in a signed 32-bit integer type. User identifiers will have up to 52 significant bits, so a 64-bit integer or double-precision float type would still be safe for storing them. Please make sure that your code can correctly handle such user identifiers.</p>
|
||||
<p><strong><img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /> WARNING! <img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /></strong><br>After one of the upcoming Bot API updates, some user identifiers will become bigger than <code>2^31 - 1</code> and it will be no longer possible to store them in a signed 32-bit integer type. User identifiers will have up to 52 significant bits, so a 64-bit integer or double-precision float type would still be safe for storing them. Please make sure that your code can correctly handle such user identifiers.</p>
|
||||
</blockquote>
|
||||
<hr>
|
||||
<h3><a class="anchor" href="#2020" id="2020" name="2020"><i class="anchor-icon"></i></a>2020</h3>
|
||||
<h4><a class="anchor" href="#november-4-2020" id="november-4-2020" name="november-4-2020"><i class="anchor-icon"></i></a>November 4, 2020</h4>
|
||||
<h3><a class="anchor" name="2020" href="#2020"><i class="anchor-icon"></i></a>2020</h3>
|
||||
<h4><a class="anchor" name="november-4-2020" href="#november-4-2020"><i class="anchor-icon"></i></a>November 4, 2020</h4>
|
||||
<p>Introducing <strong>Bot API 5.0</strong></p>
|
||||
<p><strong>Run Your Own Bot API Server</strong></p>
|
||||
<ul>
|
||||
<li>Bot API source code is now available at <a href="https://github.com/tdlib/telegram-bot-api">telegram-bot-api</a>. You can now run your <strong>own Bot API server</strong> locally, boosting your bots' performance.</li>
|
||||
<li>Bot API source code is now available at <a href="https://github.com/tdlib/telegram-bot-api">telegram-bot-api</a>. You can now run your <strong>own Bot API server</strong> locally, boosting your bots' performance.</li>
|
||||
<li>Added the method <a href="/bots/api#logout">logOut</a>, which can be used to log out from the cloud Bot API server before launching your bot locally. You <strong>must</strong> log out the bot before running it locally, otherwise there is no guarantee that the bot will receive all updates.</li>
|
||||
<li>Added the method <a href="/bots/api#close">close</a>, which can be used to close the bot instance before moving it from one local server to another.</li>
|
||||
</ul>
|
||||
|
@ -472,7 +620,7 @@ After one of the upcoming Bot API updates, some user identifiers will become big
|
|||
</ul>
|
||||
<p><strong>Working with Groups</strong></p>
|
||||
<ul>
|
||||
<li>The <a href="/bots/api#getchat">getChat</a> request now returns the user's bio for private chats if available.</li>
|
||||
<li>The <a href="/bots/api#getchat">getChat</a> request now returns the user's bio for private chats if available.</li>
|
||||
<li>The <a href="/bots/api#getchat">getChat</a> request now returns the identifier of the linked chat for supergroups and channels, i.e. the discussion group identifier for a channel and vice versa.</li>
|
||||
<li>The <a href="/bots/api#getchat">getChat</a> request now returns the location to which the supergroup is connected (see <a href="https://telegram.org/blog/contacts-local-groups">Local Groups</a>). Added the class <a href="/bots/api#chatlocation">ChatLocation</a> to represent the location.</li>
|
||||
<li>Added the parameter <em>only_if_banned</em> to the method <a href="/bots/api#unbanchatmember">unbanChatMember</a> to allow safe unban.</li>
|
||||
|
@ -495,7 +643,7 @@ After one of the upcoming Bot API updates, some user identifiers will become big
|
|||
<p><strong>Live Locations</strong></p>
|
||||
<ul>
|
||||
<li>Added the field <em>live_period</em> to the class <a href="/bots/api#location">Location</a>, representing a maximum period for which the live location can be updated.</li>
|
||||
<li>Added support for live location [heading](<a href="https://en.wikipedia.org/wiki/Heading_(navigation&#41">https://en.wikipedia.org/wiki/Heading_(navigation&#41</a>;): added the field <em>heading</em> to the classes <a href="/bots/api#location">Location</a>, <a href="/bots/api#inlinequeryresultlocation">InlineQueryResultLocation</a>, <a href="/bots/api#inputlocationmessagecontent">InputLocationMessageContent</a> and the parameter <em>heading</em> to the methods <a href="/bots/api#sendlocation">sendLocation</a> and <a href="/bots/api#editmessagelivelocation">editMessageLiveLocation</a>.</li>
|
||||
<li>Added support for live location <a href="https://en.wikipedia.org/wiki/Heading_(navigation)">heading</a>: added the field <em>heading</em> to the classes <a href="/bots/api#location">Location</a>, <a href="/bots/api#inlinequeryresultlocation">InlineQueryResultLocation</a>, <a href="/bots/api#inputlocationmessagecontent">InputLocationMessageContent</a> and the parameter <em>heading</em> to the methods <a href="/bots/api#sendlocation">sendLocation</a> and <a href="/bots/api#editmessagelivelocation">editMessageLiveLocation</a>.</li>
|
||||
<li>Added support for proximity alerts in live locations: added the field <em>proximity_alert_radius</em> to the classes <a href="/bots/api#location">Location</a>, <a href="/bots/api#inlinequeryresultlocation">InlineQueryResultLocation</a>, <a href="/bots/api#inputlocationmessagecontent">InputLocationMessageContent</a> and the parameter <em>proximity_alert_radius</em> to the methods <a href="/bots/api#sendlocation">sendLocation</a> and <a href="/bots/api#editmessagelivelocation">editMessageLiveLocation</a>.</li>
|
||||
<li>Added the type <a href="/bots/api#proximityalerttriggered">ProximityAlertTriggered</a> and the field <em>proximity_alert_triggered</em> to the class <a href="/bots/api#message">Message</a>.</li>
|
||||
<li>Added possibility to specify the horizontal accuracy of a location. Added the field <em>horizontal_accuracy</em> to the classes <a href="/bots/api#location">Location</a>, <a href="/bots/api#inlinequeryresultlocation">InlineQueryResultLocation</a>, <a href="/bots/api#inputlocationmessagecontent">InputLocationMessageContent</a> and the parameter <em>horizontal_accuracy</em> to the methods <a href="/bots/api#sendlocation">sendLocation</a> and <a href="/bots/api#editmessagelivelocation">editMessageLiveLocation</a>.</li>
|
||||
|
@ -519,14 +667,14 @@ After one of the upcoming Bot API updates, some user identifiers will become big
|
|||
<ul>
|
||||
<li>Supported the new <strong>football</strong> and <strong>slot machine</strong> animations for the random <a href="/bots/api#dice">dice</a>. Choose between different animations (dice, darts, basketball, football, slot machine) by specifying the <em>emoji</em> parameter in the method <a href="/bots/api#senddice">sendDice</a>.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#june-4-2020" id="june-4-2020" name="june-4-2020"><i class="anchor-icon"></i></a>June 4, 2020</h4>
|
||||
<h4><a class="anchor" name="june-4-2020" href="#june-4-2020"><i class="anchor-icon"></i></a>June 4, 2020</h4>
|
||||
<p><strong>Bot API 4.9</strong></p>
|
||||
<ul>
|
||||
<li>Added the new field <em>via_bot</em> to the <a href="/bots/api#message">Message</a> object. You can now know which bot was used to send a message.</li>
|
||||
<li>Supported video thumbnails for inline <a href="/bots/api#inlinequeryresultgif">GIF</a> and <a href="/bots/api#inlinequeryresultmpeg4gif">MPEG4</a> animations.</li>
|
||||
<li>Supported the new basketball animation for the random <a href="/bots/api#dice">dice</a>. Choose between different animations (dice, darts, basketball) by specifying the <em>emoji</em> parameter in the method <a href="/bots/api#senddice">sendDice</a>.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#april-24-2020" id="april-24-2020" name="april-24-2020"><i class="anchor-icon"></i></a>April 24, 2020</h4>
|
||||
<h4><a class="anchor" name="april-24-2020" href="#april-24-2020"><i class="anchor-icon"></i></a>April 24, 2020</h4>
|
||||
<p><strong>Bot API 4.8</strong></p>
|
||||
<ul>
|
||||
<li>Supported explanations for <a href="https://telegram.org/blog/400-million#better-quizzes">Quizzes 2.0</a>. Add explanations by specifying the parameters <em>explanation</em> and <em>explanation_parse_mode</em> in the method <a href="/bots/api#sendpoll">sendPoll</a>.</li>
|
||||
|
@ -536,19 +684,19 @@ After one of the upcoming Bot API updates, some user identifiers will become big
|
|||
<li>Supported the new <a href="https://telegram.org/blog/400-million#bullseye">darts</a> animation for the dice mini-game. Choose between the default dice animation and darts animation by specifying the parameter <em>emoji</em> in the method <a href="/bots/api#senddice">sendDice</a>.</li>
|
||||
<li>Added the field <em>emoji</em> to the <a href="/bots/api#dice">Dice</a> object.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#march-30-2020" id="march-30-2020" name="march-30-2020"><i class="anchor-icon"></i></a>March 30, 2020</h4>
|
||||
<h4><a class="anchor" name="march-30-2020" href="#march-30-2020"><i class="anchor-icon"></i></a>March 30, 2020</h4>
|
||||
<p><strong>Bot API 4.7</strong></p>
|
||||
<ul>
|
||||
<li>Added the method <a href="/bots/api#senddice">sendDice</a> for sending a dice message, which will have a random value from 1 to 6. (Yes, we're aware of the <em>"proper"</em> singular of <em>die</em>. But it's awkward, and we decided to help it change. One dice at a time!)</li>
|
||||
<li>Added the method <a href="/bots/api#senddice">sendDice</a> for sending a dice message, which will have a random value from 1 to 6. (Yes, we're aware of the <em>“proper”</em> singular of <em>die</em>. But it's awkward, and we decided to help it change. One dice at a time!)</li>
|
||||
<li>Added the field <a href="/bots/api#dice">dice</a> to the <a href="/bots/api#message">Message</a> object.</li>
|
||||
<li>Added the method <a href="/bots/api#getmycommands">getMyCommands</a> for getting the current list of the bot's commands.</li>
|
||||
<li>Added the method <a href="/bots/api#setmycommands">setMyCommands</a> for changing the list of the bot's commands through the Bot API instead of <a href="https://t.me/botfather">@BotFather</a>.</li>
|
||||
<li>Added the method <a href="/bots/api#getmycommands">getMyCommands</a> for getting the current list of the bot's commands.</li>
|
||||
<li>Added the method <a href="/bots/api#setmycommands">setMyCommands</a> for changing the list of the bot's commands through the Bot API instead of <a href="https://t.me/botfather">@BotFather</a>.</li>
|
||||
<li>Added the ability to create animated sticker sets by specifying the parameter <em>tgs_sticker</em> instead of <em>png_sticker</em> in the method <a href="/bots/api#createnewstickerset">createNewStickerSet</a>.</li>
|
||||
<li>Added the ability to add animated stickers to sets created by the bot by specifying the parameter <em>tgs_sticker</em> instead of <em>png_sticker</em> in the method <a href="/bots/api#addstickertoset">addStickerToSet</a>.</li>
|
||||
<li>Added the field <em>thumb</em> to the <a href="/bots/api#stickerset">StickerSet</a> object.</li>
|
||||
<li>Added the ability to change thumbnails of sticker sets created by the bot using the method <a href="/bots/api#setstickersetthumb">setStickerSetThumb</a>.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#january-23-2020" id="january-23-2020" name="january-23-2020"><i class="anchor-icon"></i></a>January 23, 2020</h4>
|
||||
<h4><a class="anchor" name="january-23-2020" href="#january-23-2020"><i class="anchor-icon"></i></a>January 23, 2020</h4>
|
||||
<p><strong>Bot API 4.6</strong></p>
|
||||
<ul>
|
||||
<li>Supported <a href="https://telegram.org/blog/polls-2-0-vmq">Polls 2.0</a>.</li>
|
||||
|
@ -560,20 +708,20 @@ After one of the upcoming Bot API updates, some user identifiers will become big
|
|||
<li>Added more information about the bot in response to the <a href="/bots/api#getme">getMe</a> request: added the fields <em>can_join_groups</em>, <em>can_read_all_group_messages</em> and <em>supports_inline_queries</em> to the <a href="/bots/api#user">User</a> object.</li>
|
||||
<li>Added the optional field <em>language</em> to the <a href="/bots/api#messageentity">MessageEntity</a> object.</li>
|
||||
</ul>
|
||||
<h3><a class="anchor" href="#2019" id="2019" name="2019"><i class="anchor-icon"></i></a>2019</h3>
|
||||
<h4><a class="anchor" href="#december-31-2019" id="december-31-2019" name="december-31-2019"><i class="anchor-icon"></i></a>December 31, 2019</h4>
|
||||
<h3><a class="anchor" name="2019" href="#2019"><i class="anchor-icon"></i></a>2019</h3>
|
||||
<h4><a class="anchor" name="december-31-2019" href="#december-31-2019"><i class="anchor-icon"></i></a>December 31, 2019</h4>
|
||||
<p><strong>Bot API 4.5</strong></p>
|
||||
<ul>
|
||||
<li>Added support for two new <a href="/bots/api#messageentity">MessageEntity</a> types, <em>underline</em> and <em>strikethrough</em>.</li>
|
||||
<li>Added support for nested <a href="/bots/api#messageentity">MessageEntity</a> objects. Entities can now contain other entities. If two entities have common characters then one of them is fully contained inside the other.</li>
|
||||
<li>Added support for nested entities and the new tags <code><u>/<ins></code> (for underlined text) and <code><s>/<strike>/<del></code> (for strikethrough text) in parse mode HTML.</li>
|
||||
<li>Added a new parse mode, <a href="/bots/api#markdownv2-style">MarkdownV2</a>, which supports nested entities and two new entities <code>__</code> (for underlined text) and <code>~</code> (for strikethrough text). Parse mode <a href="/bots/api#markdown-style">Markdown</a> remains unchanged for backward compatibility.</li>
|
||||
<li>Added the field <em>file_unique_id</em> to the objects <a href="/bots/api#animation">Animation</a>, <a href="/bots/api#audio">Audio</a>, <a href="/bots/api#document">Document</a>, <a href="/bots/api#passportfile">PassportFile</a>, <a href="/bots/api#photosize">PhotoSize</a>, <a href="/bots/api#sticker">Sticker</a>, <a href="/bots/api#video">Video</a>, <a href="/bots/api#videonote">VideoNote</a>, <a href="/bots/api#voice">Voice</a>, <a href="/bots/api#file">File</a> and the fields <em>small_file_unique_id</em> and <em>big_file_unique_id</em> to the object <a href="/bots/api#chatphoto">ChatPhoto</a>. The new fields contain a unique file identifier, which is supposed to be the same over time and for different bots, but can't be used to download or reuse the file.</li>
|
||||
<li>Added the field <em>file_unique_id</em> to the objects <a href="/bots/api#animation">Animation</a>, <a href="/bots/api#audio">Audio</a>, <a href="/bots/api#document">Document</a>, <a href="/bots/api#passportfile">PassportFile</a>, <a href="/bots/api#photosize">PhotoSize</a>, <a href="/bots/api#sticker">Sticker</a>, <a href="/bots/api#video">Video</a>, <a href="/bots/api#videonote">VideoNote</a>, <a href="/bots/api#voice">Voice</a>, <a href="/bots/api#file">File</a> and the fields <em>small_file_unique_id</em> and <em>big_file_unique_id</em> to the object <a href="/bots/api#chatphoto">ChatPhoto</a>. The new fields contain a unique file identifier, which is supposed to be the same over time and for different bots, but can't be used to download or reuse the file.</li>
|
||||
<li>Added the field <em>custom_title</em> to the <a href="/bots/api#chatmember">ChatMember</a> object.</li>
|
||||
<li>Added the new method <a href="/bots/api#setchatadministratorcustomtitle">setChatAdministratorCustomTitle</a> to manage the custom titles of administrators promoted by the bot.</li>
|
||||
<li>Added the field <em>slow_mode_delay</em> to the <a href="/bots/api#chat">Chat</a> object.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#july-29-2019" id="july-29-2019" name="july-29-2019"><i class="anchor-icon"></i></a>July 29, 2019</h4>
|
||||
<h4><a class="anchor" name="july-29-2019" href="#july-29-2019"><i class="anchor-icon"></i></a>July 29, 2019</h4>
|
||||
<p><strong>Bot API 4.4</strong></p>
|
||||
<ul>
|
||||
<li>Added support for <a href="https://telegram.org/blog/animated-stickers"><strong>animated stickers</strong></a>. New field <em>is_animated</em> in <a href="/bots/api#sticker">Sticker</a> and <a href="/bots/api#stickerset">StickerSet</a> objects, animated stickers can now be used in <a href="/bots/api#sendsticker">sendSticker</a> and <a href="/bots/api#inlinequeryresultcachedsticker">InlineQueryResultCachedSticker</a>.</li>
|
||||
|
@ -581,49 +729,50 @@ After one of the upcoming Bot API updates, some user identifiers will become big
|
|||
<li>The field <em>all_members_are_administrators</em> has been removed from the documentation for the <a href="/bots/api#chat">Chat</a> object. The field is still returned in the object for backward compatibility, but new bots should use the <em>permissions</em> field instead.</li>
|
||||
<li>Added support for more permissions for group and supergroup members: added the new field <em>can_send_polls</em> to <a href="/bots/api#chatmember">ChatMember</a> object, added <em>can_change_info</em>, <em>can_invite_users</em>, <em>can_pin_messages</em> in <a href="/bots/api#chatmember">ChatMember</a> object for restricted users (previously available only for administrators).</li>
|
||||
<li>The method <a href="/bots/api#restrictchatmember">restrictChatMember</a> now takes the new user permissions in a single argument of the type <a href="/bots/api#chatpermissions">ChatPermissions</a>. The old way of passing parameters will keep working for a while for backward compatibility.</li>
|
||||
<li>Added <em>description</em> support for basic groups (previously available in supergroups and channel chats). You can pass a group's chat_id to <a href="/bots/api#setchatdescription">setChatDescription</a> and receive the group's description in the <a href="/bots/api#chat">Chat</a> object in the response to <a href="/bots/api#getchat">getChat</a> method.</li>
|
||||
<li>Added <em>invite_link</em> support for basic groups (previously available in supergroups and channel chats). You can pass a group's chat_id to <a href="/bots/api#exportchatinvitelink">exportChatInviteLink</a> and receive the group's invite link in the <a href="/bots/api#chat">Chat</a> object in the response to <a href="/bots/api#getchat">getChat</a> method.</li>
|
||||
<li>Added <em>description</em> support for basic groups (previously available in supergroups and channel chats). You can pass a group's chat_id to <a href="/bots/api#setchatdescription">setChatDescription</a> and receive the group's description in the <a href="/bots/api#chat">Chat</a> object in the response to <a href="/bots/api#getchat">getChat</a> method.</li>
|
||||
<li>Added <em>invite_link</em> support for basic groups (previously available in supergroups and channel chats). You can pass a group's chat_id to <a href="/bots/api#exportchatinvitelink">exportChatInviteLink</a> and receive the group's invite link in the <a href="/bots/api#chat">Chat</a> object in the response to <a href="/bots/api#getchat">getChat</a> method.</li>
|
||||
<li>File identifiers from the <a href="/bots/api#chatphoto">ChatPhoto</a> object are now invalidated and can no longer be used whenever the photo is changed.</li>
|
||||
<li>All <strong>webhook requests</strong> from the Bot API are now coming from the subnets <code>149.154.160.0/20</code> and <code>91.108.4.0/22</code>. Most users won't need to do anything to continue receiving webhooks. If you control inbound access with a firewall, you may need to update your configuration. You can always find the list of actual IP addresses of servers used to send webhooks there: <a href="/bots/webhooks">https://core.telegram.org/bots/webhooks</a>.</li>
|
||||
<li>All <strong>webhook requests</strong> from the Bot API are now coming from the subnets <code>149.154.160.0/20</code> and <code>91.108.4.0/22</code>. Most users won't need to do anything to continue receiving webhooks. If you control inbound access with a firewall, you may need to update your configuration. You can always find the list of actual IP addresses of servers used to send webhooks there: <a href="/bots/webhooks"><a href="https://core.telegram.org/bots/webhooks">https://core.telegram.org/bots/webhooks</a></a>.</li>
|
||||
<li>As of the <strong>next Bot API</strong> update (<strong>version 4.5</strong>), nested <a href="/bots/api#messageentity">MessageEntity</a> objects will be allowed in message texts and captions. Please make sure that your code can correctly handle such entities.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#may-31-2019" id="may-31-2019" name="may-31-2019"><i class="anchor-icon"></i></a>May 31, 2019</h4>
|
||||
<h4><a class="anchor" name="may-31-2019" href="#may-31-2019"><i class="anchor-icon"></i></a>May 31, 2019</h4>
|
||||
<p><strong>Bot API 4.3</strong></p>
|
||||
<ul>
|
||||
<li>Added support for <a href="https://telegram.org/blog/privacy-discussions-web-bots#meet-seamless-web-bots"><strong>Seamless Telegram Login</strong></a> on external websites.</li>
|
||||
<li>Added the new object <a href="/bots/api#loginurl">LoginUrl</a> and the new field <em>login_url</em> to the <a href="/bots/api#inlinekeyboardbutton">InlineKeyboardButton</a> object which allows to <strong>automatically authorize</strong> users before they go to a URL specified by the bot. Users will be asked to confirm authorization in their Telegram app (needs version 5.7 or higher) when they press the button:</li>
|
||||
</ul>
|
||||
<div class="blog_image_wrap">
|
||||
<a href="/file/811140015/1734/8VZFkwWXalM.97872/6127fa62d8a0bf2b3c" target="_blank"><img src="/file/811140909/1631/20k1Z53eiyY.23995/c541e89b74253623d9" title="TITLE" alt="TITLE" srcset="/file/811140015/1734/8VZFkwWXalM.97872/6127fa62d8a0bf2b3c , 2x"></a>
|
||||
<a href="/file/811140015/1734/8VZFkwWXalM.97872/6127fa62d8a0bf2b3c" target="_blank"><img src="/file/811140909/1631/20k1Z53eiyY.23995/c541e89b74253623d9" title="TITLE" alt="TITLE" srcset="/file/811140015/1734/8VZFkwWXalM.97872/6127fa62d8a0bf2b3c , 2x" /></a>
|
||||
</div>
|
||||
|
||||
<p><strong>Also in this update:</strong></p>
|
||||
<ul>
|
||||
<li>Added the field <code>reply_markup</code> to the <a href="/bots/api#message">Message</a> object, containing the inline keyboard attached to the message.</li>
|
||||
<li>If a message with an inline keyboard is forwarded, the forwarded message will now have an inline keyboard if the keyboard contained only <em>url</em> and <em>login_url</em> buttons or if the message was sent via a bot and the keyboard contained only <em>url</em>, <em>login_url</em>, <em>switch_inline_query</em> or <em>switch_inline_query_current_chat</em> buttons. In the latter case, <em>switch_inline_query_current_chat</em> buttons are replaced with <em>switch_inline_query</em> buttons.</li>
|
||||
<li>Bots now receive the <em>edited_message</em> <a href="/bots/api#update">Update</a> even if only <em>Message.reply_markup</em> has changed.</li>
|
||||
<li>Bots that have the <em>can_edit_messages</em> right in a channel can now use the method <a href="/bots/api#editmessagereplymarkup">editMessageReplyMarkup</a> for messages written by other administrators forever without the 48 hours limit.</li>
|
||||
<li>Don't forget that starting in <strong>July 2019</strong>, <strong>webhook requests</strong> from Bot API will be coming from the subnets <code>149.154.160.0/20</code> and <code>91.108.4.0/22</code>. Most users won't need to do anything to continue receiving webhooks. If you control inbound access with a firewall, you may need to update your configuration. You can always find the list of actual IP addresses of servers used to send webhooks there: <a href="/bots/webhooks">https://core.telegram.org/bots/webhooks</a>.</li>
|
||||
<li>Don't forget that starting in <strong>July 2019</strong>, <strong>webhook requests</strong> from Bot API will be coming from the subnets <code>149.154.160.0/20</code> and <code>91.108.4.0/22</code>. Most users won't need to do anything to continue receiving webhooks. If you control inbound access with a firewall, you may need to update your configuration. You can always find the list of actual IP addresses of servers used to send webhooks there: <a href="/bots/webhooks"><a href="https://core.telegram.org/bots/webhooks">https://core.telegram.org/bots/webhooks</a></a>.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#april-14-2019" id="april-14-2019" name="april-14-2019"><i class="anchor-icon"></i></a>April 14, 2019</h4>
|
||||
<h4><a class="anchor" name="april-14-2019" href="#april-14-2019"><i class="anchor-icon"></i></a>April 14, 2019</h4>
|
||||
<p><strong>Bot API 4.2</strong></p>
|
||||
<ul>
|
||||
<li>Added support for native polls: added the object <a href="/bots/api#poll">Poll</a>, the methods <a href="/bots/api#sendpoll">sendPoll</a> and <a href="/bots/api#stoppoll">stopPoll</a> and the field <em>poll</em> in the <a href="/bots/api#message">Message</a> and <a href="/bots/api#update">Update</a> objects.</li>
|
||||
<li>The method <a href="/bots/api#deletemessage">deleteMessage</a> can now be used to delete messages sent by a user to the bot in private chats within 48 hours.</li>
|
||||
<li>Added support for pinned messages in basic groups in addition to supergroups and channel chats: you can pass group's chat_id to <a href="/bots/api#pinchatmessage">pinChatMessage</a> and <a href="/bots/api#unpinchatmessage">unpinChatMessage</a>, and receive the pinned group message in <a href="/bots/api#chat">Chat</a> object.</li>
|
||||
<li>Added support for pinned messages in basic groups in addition to supergroups and channel chats: you can pass group's chat_id to <a href="/bots/api#pinchatmessage">pinChatMessage</a> and <a href="/bots/api#unpinchatmessage">unpinChatMessage</a>, and receive the pinned group message in <a href="/bots/api#chat">Chat</a> object.</li>
|
||||
<li>Added the field <em>is_member</em> to the <a href="/bots/api#chatmember">ChatMember</a> object, which can be used to find whether a restricted user is a member of the chat.</li>
|
||||
<li>Added the field <em>forward_sender_name</em> to the <a href="/bots/api#message">Message</a> object, containing name of the sender who has opted to hide their account.</li>
|
||||
<li>Starting in July 2019, webhook requests from Bot API will be coming from the subnets <code>149.154.160.0/20</code> and <code>91.108.4.0/22</code>. Most users won't need to do anything to continue receiving webhooks. If you control inbound access with a firewall, you may need to update your configuration. You can always find the list of actual IP addresses of servers used to send webhooks there: <a href="/bots/webhooks">https://core.telegram.org/bots/webhooks</a>.</li>
|
||||
<li>Starting in July 2019, webhook requests from Bot API will be coming from the subnets <code>149.154.160.0/20</code> and <code>91.108.4.0/22</code>. Most users won't need to do anything to continue receiving webhooks. If you control inbound access with a firewall, you may need to update your configuration. You can always find the list of actual IP addresses of servers used to send webhooks there: <a href="/bots/webhooks"><a href="https://core.telegram.org/bots/webhooks">https://core.telegram.org/bots/webhooks</a></a>.</li>
|
||||
<li>Document thumbnails now should be inscribed in a 320x320 square instead of 90x90.</li>
|
||||
</ul>
|
||||
<h3><a class="anchor" href="#2018" id="2018" name="2018"><i class="anchor-icon"></i></a>2018</h3>
|
||||
<h4><a class="anchor" href="#august-27-2018" id="august-27-2018" name="august-27-2018"><i class="anchor-icon"></i></a>August 27, 2018</h4>
|
||||
<h3><a class="anchor" name="2018" href="#2018"><i class="anchor-icon"></i></a>2018</h3>
|
||||
<h4><a class="anchor" name="august-27-2018" href="#august-27-2018"><i class="anchor-icon"></i></a>August 27, 2018</h4>
|
||||
<p><strong>Bot API 4.1</strong></p>
|
||||
<ul>
|
||||
<li>Added support for translated versions of documents in <a href="/passport">Telegram Passport</a>.</li>
|
||||
<li>New field <em>translation</em> in <a href="/bots/api#encryptedpassportelement">EncryptedPassportElement</a>.</li>
|
||||
<li>New errors: <a href="/bots/api#passportelementerrortranslationfile">PassportElementErrorTranslationFile</a> and <a href="/bots/api#passportelementerrortranslationfile">PassportElementErrorTranslationFiles</a> and <a href="/bots/api#passportelementerrorunspecified">PassportElementErrorUnspecified</a>.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#july-26-2018" id="july-26-2018" name="july-26-2018"><i class="anchor-icon"></i></a>July 26, 2018</h4>
|
||||
<h4><a class="anchor" name="july-26-2018" href="#july-26-2018"><i class="anchor-icon"></i></a>July 26, 2018</h4>
|
||||
<p><strong>Bot API 4.0</strong>.</p>
|
||||
<ul>
|
||||
<li>Added support for <a href="https://telegram.org/blog/passport"><strong>Telegram Passport</strong></a>. See the official announcement on the <a href="https://telegram.org/blog">blog</a> and the <a href="https://core.telegram.org/passport">manual</a> for details.</li>
|
||||
|
@ -635,36 +784,36 @@ After one of the upcoming Bot API updates, some user identifiers will become big
|
|||
<li>Added the field <a href="/bots/api#animation">animation</a> to the <a href="/bots/api#message">Message</a> object. For backward compatibility, when this field is set, the <em>document</em> field will be also set.</li>
|
||||
<li>Added two new <a href="/bots/api#messageentity">MessageEntity</a> types: <em>cashtag</em> and <em>phone_number</em>.</li>
|
||||
<li>Added support for Foursquare venues: added the new field <em>foursquare_type</em> to the objects <a href="/bots/api#venue">Venue</a>, <a href="/bots/api#inlinequeryresultvenue">InlineQueryResultVenue</a> and <a href="/bots/api#inputvenuemessagecontent">InputVenueMessageContent</a>, and the parameter <em>foursquare_type</em> to the <a href="/bots/api#sendvenue">sendVenue</a> method.</li>
|
||||
<li>You can now create inline mentions of users, who have pressed your bot's callback buttons.</li>
|
||||
<li>You can now create inline mentions of users, who have pressed your bot's callback buttons.</li>
|
||||
<li>You can now use the <code>Retry-After</code> response header to configure the delay after which the Bot API will retry the request after an unsuccessful response from a webhook.</li>
|
||||
<li>If a webhook returns the HTTP error <code>410 Gone</code> for all requests for more than 23 hours successively, it can be automatically removed.</li>
|
||||
<li>Added <a href="https://en.wikipedia.org/wiki/VCard">vCard</a> support when sharing contacts: added the field <em>vcard</em> to the objects <a href="/bots/api#contact">Contact</a>, <a href="/bots/api#inlinequeryresultcontact">InlineQueryResultContact</a>, <a href="/bots/api#inputcontactmessagecontent">InputContactMessageContent</a> and the method <a href="/bots/api#sendcontact">sendContact</a>.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#february-13-2018" id="february-13-2018" name="february-13-2018"><i class="anchor-icon"></i></a>February 13, 2018</h4>
|
||||
<h4><a class="anchor" name="february-13-2018" href="#february-13-2018"><i class="anchor-icon"></i></a>February 13, 2018</h4>
|
||||
<p><strong>Bot API 3.6</strong>.</p>
|
||||
<ul>
|
||||
<li>Supported <a href="https://core.telegram.org/bots/api#formatting-options">text formatting</a> in media captions. Specify the desired <em>parse_mode</em> (<a href="https://core.telegram.org/bots/api#markdown-style">Markdown</a> or <a href="https://core.telegram.org/bots/api#html-style">HTML</a>) when you provide a caption.</li>
|
||||
<li>In supergroups, if the bot receives a message that is a reply, it will also receive the message to which that message is replying – even if the original message is inaccessible due to the bot's privacy settings. (In other words, replying to any message in a supergroup with a message that mentions the bot or features a command for it acts as forwarding the original message to the bot). </li>
|
||||
<li>Added the new field <em>connected_website</em> to <a href="/bots/api#message">Message</a>. The bot will receive a message with this field in a private chat when a user logs in on the bot's connected website using the <a href="https://core.telegram.org/widgets/login">Login Widget</a> and allows sending messages from your bot.</li>
|
||||
<li>In supergroups, if the bot receives a message that is a reply, it will also receive the message to which that message is replying – even if the original message is inaccessible due to the bot's privacy settings. (In other words, replying to any message in a supergroup with a message that mentions the bot or features a command for it acts as forwarding the original message to the bot). </li>
|
||||
<li>Added the new field <em>connected_website</em> to <a href="/bots/api#message">Message</a>. The bot will receive a message with this field in a private chat when a user logs in on the bot's connected website using the <a href="https://core.telegram.org/widgets/login">Login Widget</a> and allows sending messages from your bot.</li>
|
||||
<li>Added the new parameter <em>supports_streaming</em> to the <a href="/bots/api#sendvideo">sendVideo</a> method and a field with the same name to the <a href="/bots/api#inputmediavideo">InputMediaVideo</a> object.</li>
|
||||
</ul>
|
||||
<h3><a class="anchor" href="#2017" id="2017" name="2017"><i class="anchor-icon"></i></a>2017</h3>
|
||||
<h4><a class="anchor" href="#november-17-2017" id="november-17-2017" name="november-17-2017"><i class="anchor-icon"></i></a>November 17, 2017</h4>
|
||||
<h3><a class="anchor" name="2017" href="#2017"><i class="anchor-icon"></i></a>2017</h3>
|
||||
<h4><a class="anchor" name="november-17-2017" href="#november-17-2017"><i class="anchor-icon"></i></a>November 17, 2017</h4>
|
||||
<p><strong>Bot API 3.5</strong>.</p>
|
||||
<ul>
|
||||
<li>Added the new method <a href="/bots/api#sendmediagroup">sendMediaGroup</a> and two kinds of <a href="/bots/api#inputmedia">InputMedia</a> objects to support the new <a href="https://telegram.org/blog/albums-saved-messages">albums feature</a>.</li>
|
||||
<li>Added support for pinning messages in channels. <a href="/bots/api#pinchatmessage">pinChatMessage</a> and <a href="/bots/api#unpinchatmessage">unpinChatMessage</a> accept channels.</li>
|
||||
<li>Added the new fields <em>provider_data</em>, <em>send_phone_number_to_provider</em>, <em>send_email_to_provider</em> to <a href="/bots/api#sendinvoice">sendInvoice</a> for sharing information about the invoice with the payment provider.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#october-11-2017" id="october-11-2017" name="october-11-2017"><i class="anchor-icon"></i></a>October 11, 2017</h4>
|
||||
<h4><a class="anchor" name="october-11-2017" href="#october-11-2017"><i class="anchor-icon"></i></a>October 11, 2017</h4>
|
||||
<p><strong>Bot API 3.4</strong>.</p>
|
||||
<ul>
|
||||
<li>Bots can now send and receive <a href="https://telegram.org/blog/live-locations">Live Locations</a>. Added new field <em>live_period</em> to the <a href="/bots/api#sendlocation">sendLocation</a> method and the <a href="/bots/api#editmessagelivelocation">editMessageLiveLocation</a> and <a href="/bots/api#stopmessagelivelocation">stopMessageLiveLocation</a> methods as well as the necessary objects for inline bots.</li>
|
||||
<li>Bots can use the new <a href="/bots/api#setchatstickerset">setChatStickerSet</a> and <a href="/bots/api#deletechatstickerset">deleteChatStickerSet</a> methods to manage <a href="https://telegram.org/blog#stickers-of-the-group">group sticker sets</a>.</li>
|
||||
<li>The <a href="/bots/api#getchat">getChat</a> request now returns the group's sticker set for supergroups if available.</li>
|
||||
<li>The <a href="/bots/api#getchat">getChat</a> request now returns the group's sticker set for supergroups if available.</li>
|
||||
<li>Bots now receive entities from media captions in the new field <em>caption_entities</em> in <a href="/bots/api#message">Message</a>.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#august-23-2017" id="august-23-2017" name="august-23-2017"><i class="anchor-icon"></i></a>August 23, 2017</h4>
|
||||
<h4><a class="anchor" name="august-23-2017" href="#august-23-2017"><i class="anchor-icon"></i></a>August 23, 2017</h4>
|
||||
<p><strong>Bot API 3.3</strong>.</p>
|
||||
<ul>
|
||||
<li>Bots can now mention users via <a href="/bots/api#formatting-options">inline mentions</a>, without using usernames.</li>
|
||||
|
@ -672,13 +821,13 @@ After one of the upcoming Bot API updates, some user identifiers will become big
|
|||
<li>Added the new fields <em>author_signature</em> and <em>forward_signature</em> to the <a href="/bots/api#message">Message</a> object.</li>
|
||||
<li>Added the new field <em>is_bot</em> to the <a href="/bots/api#user">User</a> object.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#july-21-2017" id="july-21-2017" name="july-21-2017"><i class="anchor-icon"></i></a>July 21, 2017</h4>
|
||||
<h4><a class="anchor" name="july-21-2017" href="#july-21-2017"><i class="anchor-icon"></i></a>July 21, 2017</h4>
|
||||
<p><strong>Bot API 3.2</strong>. Teach your bot to handle <a href="/bots/api#stickers">stickers and sticker sets</a>.</p>
|
||||
<ul>
|
||||
<li>Added new methods for working with stickers: <a href="/bots/api#getstickerset">getStickerSet</a>, <a href="/bots/api#uploadstickerfile">uploadStickerFile</a>, <a href="/bots/api#createnewstickerset">createNewStickerSet</a>, <a href="/bots/api#addstickertoset">addStickerToSet</a>, <a href="/bots/api#setstickerpositioninset">setStickerPositionInSet</a>, and <a href="/bots/api#deletestickerfromset">deleteStickerFromSet</a>.</li>
|
||||
<li>Added the fields <em>set_name</em> and <em>mask_position</em> to the <a href="/bots/api#sticker">Sticker</a> object, plus two new objects, <a href="/bots/api#stickerset">StickerSet</a>, and <a href="/bots/api#maskposition">MaskPosition</a>.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#june-30-2017" id="june-30-2017" name="june-30-2017"><i class="anchor-icon"></i></a>June 30, 2017</h4>
|
||||
<h4><a class="anchor" name="june-30-2017" href="#june-30-2017"><i class="anchor-icon"></i></a>June 30, 2017</h4>
|
||||
<p><strong>Bot API 3.1</strong>. Build your own robotic police force for supergoups with these new methods for admin bots:</p>
|
||||
<ul>
|
||||
<li>Added new methods <a href="/bots/api#restrictchatmember">restrictChatMember</a> and <a href="/bots/api#promotechatmember">promoteChatMember</a> to manage users and admins, added new parameter <em>until_date</em> to <a href="/bots/api#kickchatmember">kickChatMember</a> for temporary bans.</li>
|
||||
|
@ -686,10 +835,10 @@ After one of the upcoming Bot API updates, some user identifiers will become big
|
|||
<li>Added the new fields <em>photo</em>, <em>description</em> and <em>invite_link</em> to the <a href="/bots/api#chat">Chat</a> object.</li>
|
||||
<li>Added the new fields <em>until_date</em>, <em>can_be_edited</em>, <em>can_change_info</em>, <em>can_post_messages</em>, <em>can_edit_messages</em>, <em>can_delete_messages</em>, <em>can_invite_users</em>, <em>can_restrict_members</em>, <em>can_pin_messages</em>, <em>can_promote_members</em>, <em>can_send_messages</em>, <em>can_send_media_messages</em>, <em>can_send_other_messages</em> and <em>can_add_web_page_previews</em> to the <a href="/bots/api#chatmember">ChatMember</a> object.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#may-18-2017" id="may-18-2017" name="may-18-2017"><i class="anchor-icon"></i></a>May 18, 2017</h4>
|
||||
<h4><a class="anchor" name="may-18-2017" href="#may-18-2017"><i class="anchor-icon"></i></a>May 18, 2017</h4>
|
||||
<p>Introducing <strong>Bot API 3.0</strong>.</p>
|
||||
<p><strong>NEW Payment Platform</strong></p>
|
||||
<p>See <a href="/bots/payments">Introduction to Bot Payments</a> for a brief overview. If you're not a developer, you may like <a href="https://telegram.org/blog/payments">this user-friendly blog post</a> better.</p>
|
||||
<p>See <a href="/bots/payments">Introduction to Bot Payments</a> for a brief overview. If you're not a developer, you may like <a href="https://telegram.org/blog/payments">this user-friendly blog post</a> better.</p>
|
||||
<ul>
|
||||
<li>Your bot can now accept <a href="/bots/api#payments">payments</a> for goods and services via Telegram. </li>
|
||||
<li>Added new kinds of <a href="/bots/api#update">updates</a>, <em>shipping_query</em> and <em>pre_checkout_query</em>, and new types of <a href="/bots/api#message">message</a> content, <em>invoice</em> and <em>successful_payment</em>.</li>
|
||||
|
@ -703,7 +852,7 @@ After one of the upcoming Bot API updates, some user identifiers will become big
|
|||
</ul>
|
||||
<p><strong>NEW Multilingual Bots</strong></p>
|
||||
<ul>
|
||||
<li>The <a href="/bots/api#user">User</a> object now may have a <em>language_code</em> field that contains the <a href="https://en.wikipedia.org/wiki/IETF_language_tag">IETF language tag</a> of the user's language.</li>
|
||||
<li>The <a href="/bots/api#user">User</a> object now may have a <em>language_code</em> field that contains the <a href="https://en.wikipedia.org/wiki/IETF_language_tag">IETF language tag</a> of the user's language.</li>
|
||||
<li>Thanks to this, your bot can now offer localized responses to users that speak different languages.</li>
|
||||
</ul>
|
||||
<p><strong>More power to admin bots</strong></p>
|
||||
|
@ -717,45 +866,30 @@ After one of the upcoming Bot API updates, some user identifiers will become big
|
|||
<li><a href="https://core.telegram.org/bots/api#inlinekeyboardbutton">Inline keyboards</a> with <em>switch_inline_query</em> and <em>switch_inline_query_current_chat</em> can no longer be sent to channels because they are useless there.</li>
|
||||
<li>New fields <em>gif_duration</em> in <a href="/bots/api#inlinequeryresultgif">InlineQueryResultGif</a> and <em>mpeg4_duration</em> in <a href="/bots/api#inlinequeryresultmpeg4gif">InlineQueryResultMpeg4Gif</a>.</li>
|
||||
</ul>
|
||||
<h3><a class="anchor" href="#2016" id="2016" name="2016"><i class="anchor-icon"></i></a>2016</h3>
|
||||
<h4><a class="anchor" href="#december-4-2016" id="december-4-2016" name="december-4-2016"><i class="anchor-icon"></i></a>December 4, 2016</h4>
|
||||
<h3><a class="anchor" name="2016" href="#2016"><i class="anchor-icon"></i></a>2016</h3>
|
||||
<h4><a class="anchor" name="december-4-2016" href="#december-4-2016"><i class="anchor-icon"></i></a>December 4, 2016</h4>
|
||||
<p>Introducing <strong>Bot API 2.3.1</strong>, a nifty little update that will give you more control over how your bot gets its updates.</p>
|
||||
<ul>
|
||||
<li>Use the new field <em>max_connections</em> in <a href="/bots/api#setwebhook">setWebhook</a> to optimize your bot's server load</li>
|
||||
<li>Use the new field <em>max_connections</em> in <a href="/bots/api#setwebhook">setWebhook</a> to optimize your bot's server load</li>
|
||||
<li>Use <em>allowed_updates</em> in <a href="/bots/api#setwebhook">setWebhook</a> and <a href="/bots/api#getupdates">getUpdates</a> to selectively subscribe to updates of a certain type. Among other things, this allows you to stop getting updates about new posts in channels where your bot is an admin.</li>
|
||||
<li><a href="/bots/api#deletewebhook">deleteWebhook</a> moved out of <a href="/bots/api#setwebhook">setWebhook</a> to get a whole separate method for itself.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#november-21-2016" id="november-21-2016" name="november-21-2016"><i class="anchor-icon"></i></a>November 21, 2016</h4>
|
||||
<h4><a class="anchor" name="november-21-2016" href="#november-21-2016"><i class="anchor-icon"></i></a>November 21, 2016</h4>
|
||||
<p><strong>Bot API 2.3</strong></p>
|
||||
<ul>
|
||||
<li>
|
||||
<p>Modified <a href="/bots/faq#what-messages-will-my-bot-get"><strong>bot privacy mode</strong></a> for the sake of consistency. </p>
|
||||
<li>Modified <a href="/bots/faq#what-messages-will-my-bot-get"><strong>bot privacy mode</strong></a> for the sake of consistency. </li>
|
||||
<li><p>Your bot can now get <strong>updates about posts in channels</strong>. Added new fields <em>channel_post</em> and <em>edited_channel_post</em> to <a href="/bots/#update">Update</a>.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Your bot can now get <strong>updates about posts in channels</strong>. Added new fields <em>channel_post</em> and <em>edited_channel_post</em> to <a href="/bots/#update">Update</a>.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>You can now update high scores to a lower value by using the new <em>force</em> parameter in <a href="/bots/#setgamescore">setGameScore</a>. Handy for punishing <strong>cheaters</strong> or fixing errors in your game's High Score table.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Starting today, messages with high scores will be updated with new high scores by default. Use <em>disable_edit_message</em> in <a href="/bots/#setgamescore">setGameScore</a> if you don't want this.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>The <em>edit_message</em> parameter from <a href="/bots/#setgamescore">setGameScore</a> is no longer in use. For backward compatibility, it will be taken into account for a while, unless <em>disable_edit_message</em> is passed explicitly.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Added the new field <em>forward_from_message_id</em> to <a href="/bots/#message">Message</a>.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Added the new parameter <em>cache_time</em> to <a href="/bots/#answercallbackquery">answerCallbackQuery</a>. Will eventually work in Telegram apps — somewhere after version 3.14, maybe 3.15.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Renamed <em>hide_keyboard</em> to <em>remove_keyboard</em> in <a href="/bots/#replykeyboardremove">ReplyKeyboardRemove</a> for clarity. <em>hide_keyboard</em> will still work for a while for backward compatibility.</p>
|
||||
<li><p>You can now update high scores to a lower value by using the new <em>force</em> parameter in <a href="/bots/#setgamescore">setGameScore</a>. Handy for punishing <strong>cheaters</strong> or fixing errors in your game's High Score table.</p>
|
||||
</li>
|
||||
<li>Starting today, messages with high scores will be updated with new high scores by default. Use <em>disable_edit_message</em> in <a href="/bots/#setgamescore">setGameScore</a> if you don't want this.</li>
|
||||
<li>The <em>edit_message</em> parameter from <a href="/bots/#setgamescore">setGameScore</a> is no longer in use. For backward compatibility, it will be taken into account for a while, unless <em>disable_edit_message</em> is passed explicitly.</li>
|
||||
<li>Added the new field <em>forward_from_message_id</em> to <a href="/bots/#message">Message</a>.</li>
|
||||
<li>Added the new parameter <em>cache_time</em> to <a href="/bots/#answercallbackquery">answerCallbackQuery</a>. Will eventually work in Telegram apps — somewhere after version 3.14, maybe 3.15.</li>
|
||||
<li>Renamed <em>hide_keyboard</em> to <em>remove_keyboard</em> in <a href="/bots/#replykeyboardremove">ReplyKeyboardRemove</a> for clarity. <em>hide_keyboard</em> will still work for a while for backward compatibility.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#october-3-2016" id="october-3-2016" name="october-3-2016"><i class="anchor-icon"></i></a>October 3, 2016</h4>
|
||||
<p><strong>Bot API 2.2.</strong> <a href="/bots/games">Introducing a new Gaming Platform!</a> See <a href="/bots/games">this introduction</a> for a brief overview.
|
||||
If you're not a developer, you may like <a href="https://telegram.org/blog/games"><strong>this user-friendly blog post</strong></a> better.</p>
|
||||
<h4><a class="anchor" name="october-3-2016" href="#october-3-2016"><i class="anchor-icon"></i></a>October 3, 2016</h4>
|
||||
<p><strong>Bot API 2.2.</strong> <a href="/bots/games">Introducing a new Gaming Platform!</a> See <a href="/bots/games">this introduction</a> for a brief overview.<br>If you're not a developer, you may like <a href="https://telegram.org/blog/games"><strong>this user-friendly blog post</strong></a> better.</p>
|
||||
<ul>
|
||||
<li>New tools for building <a href="/bots/api#games"><strong>HTML5 games</strong></a>.</li>
|
||||
<li>New method <a href="/bots/api#sendgame">sendGame</a>, new object <a href="/bots/api#inlinequeryresultgame">InlineQueryResultGame</a>, new field <em>game</em> in <a href="/bots/api#message">Message</a>.</li>
|
||||
|
@ -765,50 +899,40 @@ If you're not a developer, you may like <a href="https://telegram.org/blog/games
|
|||
</ul>
|
||||
<p><strong>Other changes</strong></p>
|
||||
<ul>
|
||||
<li>
|
||||
<p>Making life easier for webhook users. Added a detailed <a href="https://core.telegram.org/bots/webhooks"><strong>Guide to All Things Webhook</strong></a> that describes every pothole you can run into on the webhook road.</p>
|
||||
<li>Making life easier for webhook users. Added a detailed <a href="https://core.telegram.org/bots/webhooks"><strong>Guide to All Things Webhook</strong></a> that describes every pothole you can run into on the webhook road.</li>
|
||||
<li><p>New method <a href="/bots/api#getwebhookinfo">getWebhookInfo</a> to check current webhook status.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>New method <a href="/bots/api#getwebhookinfo">getWebhookInfo</a> to check current webhook status.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Added the option to specify an <strong>HTTP URL</strong> for a file in all methods where <a href="/bots/api#inputfile">InputFile</a> or <em>file_id</em> can be used (except voice messages). Telegram will get the file from the specified URL and send it to the user. Files must be smaller than 5 MB for photos and smaller than 20 MB for all other types of content.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Use the new <em>url</em> parameter in <a href="/bots/api#answercallbackquery">answerCallbackQuery</a> to create buttons that open your bot with user-specific parameters.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Added new field <em>switch_inline_query_current_chat</em> in <a href="/bots/api#inlinekeyboardbutton">InlineKeyboardButton</a>.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Added <em>caption</em> fields to <a href="/bots/api#sendaudio">sendAudio</a>, <a href="/bots/api#sendvoice">sendVoice</a>, <a href="/bots/api#inlinequeryresultaudio">InlineQueryResultAudio</a>, <a href="/bots/api#inlinequeryresultvoice">InlineQueryResultVoice</a>, <a href="/bots/api#inlinequeryresultcachedaudio">InlineQueryResultCachedAudio</a>, and <a href="/bots/api#inlinequeryresultcachedvoice">InlineQueryResultCachedVoice</a>.</p>
|
||||
<li><p>Added the option to specify an <strong>HTTP URL</strong> for a file in all methods where <a href="/bots/api#inputfile">InputFile</a> or <em>file_id</em> can be used (except voice messages). Telegram will get the file from the specified URL and send it to the user. Files must be smaller than 5 MB for photos and smaller than 20 MB for all other types of content.</p>
|
||||
</li>
|
||||
<li>Use the new <em>url</em> parameter in <a href="/bots/api#answercallbackquery">answerCallbackQuery</a> to create buttons that open your bot with user-specific parameters.</li>
|
||||
<li>Added new field <em>switch_inline_query_current_chat</em> in <a href="/bots/api#inlinekeyboardbutton">InlineKeyboardButton</a>.</li>
|
||||
<li>Added <em>caption</em> fields to <a href="/bots/api#sendaudio">sendAudio</a>, <a href="/bots/api#sendvoice">sendVoice</a>, <a href="/bots/api#inlinequeryresultaudio">InlineQueryResultAudio</a>, <a href="/bots/api#inlinequeryresultvoice">InlineQueryResultVoice</a>, <a href="/bots/api#inlinequeryresultcachedaudio">InlineQueryResultCachedAudio</a>, and <a href="/bots/api#inlinequeryresultcachedvoice">InlineQueryResultCachedVoice</a>.</li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li>New field <em>all_members_are_administrators</em> in the <a href="/bots/api#chat">Chat</a> object.</li>
|
||||
<li>Certain server responses may now contain the new <a href="/bots/api#responseparameters"><em>parameters</em></a> field with expanded info on errors that occurred while processing your requests.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#may-25-2016" id="may-25-2016" name="may-25-2016"><i class="anchor-icon"></i></a>May 25, 2016</h4>
|
||||
<h4><a class="anchor" name="may-25-2016" href="#may-25-2016"><i class="anchor-icon"></i></a>May 25, 2016</h4>
|
||||
<ul>
|
||||
<li><a href="/bots/api#inlinekeyboardmarkup">Inline keyboards</a> may now be used in group chats. Channels coming soon.</li>
|
||||
<li>Check out <a href="https://telegram.me/vote">@vote</a> and <a href="https://telegram.me/like">@like</a> for examples.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#may-22-2016" id="may-22-2016" name="may-22-2016"><i class="anchor-icon"></i></a>May 22, 2016</h4>
|
||||
<h4><a class="anchor" name="may-22-2016" href="#may-22-2016"><i class="anchor-icon"></i></a>May 22, 2016</h4>
|
||||
<ul>
|
||||
<li><strong>Bot API 2.1.</strong> Added more tools for group administrator bots. Your bot can now get a list of administrators and members count in a group, check a user's current status (administrator, creator, left the group, kicked from the group), and leave a group.</li>
|
||||
<li><strong>Bot API 2.1.</strong> Added more tools for group administrator bots. Your bot can now get a list of administrators and members count in a group, check a user's current status (administrator, creator, left the group, kicked from the group), and leave a group.</li>
|
||||
<li>Added new methods: <a href="/bots/api#getchat">getChat</a>, <a href="/bots/api#leavechat">leaveChat</a>, <a href="/bots/api#getchatadministrators">getChatAdministrators</a>, <a href="/bots/api#getchatmember">getChatMember</a>, <a href="/bots/api#getchatmemberscount">getChatMembersCount</a>.</li>
|
||||
<li>Added support for <a href="https://telegram.org/blog/edit">edited messages</a> and <a href="https://telegram.org/blog/edit#new-mentions">new mentions</a> from Telegram v.3.9. New fields: <em>edited_message</em> in <a href="/bots/api#update">Update</a>, <em>edit_date</em> in <a href="/bots/api#message">Message</a>, <em>user</em> in <a href="/bots/api#messageentity">MessageEntity</a>. New value <em>text_mention</em> for the <em>type</em> field in <a href="/bots/api#messageentity">MessageEntity</a>.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#may-12-2016" id="may-12-2016" name="may-12-2016"><i class="anchor-icon"></i></a>May 12, 2016</h4>
|
||||
<h4><a class="anchor" name="may-12-2016" href="#may-12-2016"><i class="anchor-icon"></i></a>May 12, 2016</h4>
|
||||
<ul>
|
||||
<li>Added consistency to what messages bots get in groups and supergroups. <a href="/bots/faq#what-messages-will-my-bot-get">See updated FAQ for details »</a></li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#may-6-2016" id="may-6-2016" name="may-6-2016"><i class="anchor-icon"></i></a>May 6, 2016</h4>
|
||||
<h4><a class="anchor" name="may-6-2016" href="#may-6-2016"><i class="anchor-icon"></i></a>May 6, 2016</h4>
|
||||
<ul>
|
||||
<li>Added the field <em>emoji</em> to the <a href="/bots/api#sticker">Sticker</a> object. Your bot can now know the emoji a sticker corresponds to.</li>
|
||||
<li>Added the field <em>forward_from_chat</em> to the <a href="/bots/api#message">Message</a> object for messages forwarded from channels.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#april-9-2016" id="april-9-2016" name="april-9-2016"><i class="anchor-icon"></i></a>April 9, 2016</h4>
|
||||
<h4><a class="anchor" name="april-9-2016" href="#april-9-2016"><i class="anchor-icon"></i></a>April 9, 2016</h4>
|
||||
<p>Introducing <strong>Bot API 2.0</strong>. Check out <a href="/bots/2-0-intro">this page</a> for a review of this major update.</p>
|
||||
<ul>
|
||||
<li>New <a href="/bots/2-0-intro#new-inline-keyboards"><strong>inline keyboards</strong></a> with <strong>callback</strong> and <strong>URL buttons</strong>. Added new objects <a href="/bots/api#inlinekeyboardmarkup">InlineKeyboardMarkup</a>, <a href="/bots/api#inlinekeyboardbutton">InlineKeyboardButton</a> and <a href="/bots/api#callbackquery">CallbackQuery</a>, added <em>reply_markup</em> fields to all <a href="/bots/api#inlinequeryresult">InlineQueryResult</a> objects. Added field <em>callback_query</em> to the <a href="/bots/api#update">Update</a> object, new method <a href="/bots/api#answercallbackquery">answerCallbackQuery</a>.</li>
|
||||
|
@ -828,71 +952,72 @@ If you're not a developer, you may like <a href="https://telegram.org/blog/games
|
|||
<li>Added fields <em>venue</em>, <em>pinned_message</em> and <em>entities</em> to the <a href="/bots/api#message">Message</a> object. Added new objects <a href="/bots/api#messageentity">MessageEntity</a> and <a href="/bots/api#venue">Venue</a>, new methods <a href="/bots/api#sendvenue">sendVenue</a> and <a href="/bots/api#sendcontact">sendContact</a>.</li>
|
||||
<li>Renamed the fields <em>new_chat_participant</em> and <em>left_chat_participant</em> of the <a href="/bots/api#message">Message</a> object to <em>new_chat_member</em> and <em>left_chat_member</em>.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#february-20-2016" id="february-20-2016" name="february-20-2016"><i class="anchor-icon"></i></a>February 20, 2016</h4>
|
||||
<h4><a class="anchor" name="february-20-2016" href="#february-20-2016"><i class="anchor-icon"></i></a>February 20, 2016</h4>
|
||||
<ul>
|
||||
<li>Added the <em>disable_notification</em> parameter to all methods that send messages or any kind.</li>
|
||||
<li>Removed backward compatibility from the method <a href="/bots/api#sendaudio">sendAudio</a>. Voice messages now must be sent using the method <a href="/bots/api#sendvoice">sendVoice</a>. There is no more need to specify a non-empty title or performer while sending the audio by <em>file_id</em>.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#january-20-2016" id="january-20-2016" name="january-20-2016"><i class="anchor-icon"></i></a>January 20, 2016</h4>
|
||||
<h4><a class="anchor" name="january-20-2016" href="#january-20-2016"><i class="anchor-icon"></i></a>January 20, 2016</h4>
|
||||
<ul>
|
||||
<li>By the way, you can use both HTML-style and markdown-style formatting in your bot's messages to send bold, italic or fixed-width text and inline links. All official Telegram clients support this. See <a href="/bots/api#formatting-options">Formatting options</a> for details.</li>
|
||||
<li>By the way, you can use both HTML-style and markdown-style formatting in your bot's messages to send bold, italic or fixed-width text and inline links. All official Telegram clients support this. See <a href="/bots/api#formatting-options">Formatting options</a> for details.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#january-14-2016" id="january-14-2016" name="january-14-2016"><i class="anchor-icon"></i></a>January 14, 2016</h4>
|
||||
<h4><a class="anchor" name="january-14-2016" href="#january-14-2016"><i class="anchor-icon"></i></a>January 14, 2016</h4>
|
||||
<ul>
|
||||
<li>You can now <a href="/bots/inline#collecting-feedback">collect feedback</a> on which results provided by your inline bot get chosen by the users. Added the <code>setinlinefeedback</code> command for Botfather, new type <a href="/bots/api#choseninlineresult">ChosenInlineResult</a>, new field <em>chosen_inline_result</em> to the <a href="/bots/api#update">Update</a> object.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#january-4-2016" id="january-4-2016" name="january-4-2016"><i class="anchor-icon"></i></a>January 4, 2016</h4>
|
||||
<h4><a class="anchor" name="january-4-2016" href="#january-4-2016"><i class="anchor-icon"></i></a>January 4, 2016</h4>
|
||||
<ul>
|
||||
<li>Added support for <a href="/bots/inline">Inline Mode</a>, a new way for people to contact your bot by typing its username and a query in the text input field in any chat. Enable by sending <code>/setinline</code> to <a href="https://telegram.me/botfather">@BotFather</a>.</li>
|
||||
<li>New optional field <em>inline_query</em> added to the <a href="/bots/api#update">Update</a> object.</li>
|
||||
<li>Added new method <a href="/bots/api#answerinlinequery">answerInlineQuery</a> and new objects <a href="/bots/api#inlinequery">InlineQuery</a>, <a href="/bots/api#inlinequeryresultarticle">InlineQueryResultArticle</a>, <a href="/bots/api#inlinequeryresultphoto">InlineQueryResultPhoto</a>, <a href="/bots/api#inlinequeryresultgif">InlineQueryResultGif</a>, <a href="/bots/api#inlinequeryresultmpeg4gif">InlineQueryResultMpeg4Gif</a> and <a href="/bots/api#inlinequeryresultvideo">InlineQueryResultVideo</a>.</li>
|
||||
</ul>
|
||||
<h3><a class="anchor" href="#2015" id="2015" name="2015"><i class="anchor-icon"></i></a>2015</h3>
|
||||
<h4><a class="anchor" href="#november-2015" id="november-2015" name="november-2015"><i class="anchor-icon"></i></a>November, 2015</h4>
|
||||
<h3><a class="anchor" name="2015" href="#2015"><i class="anchor-icon"></i></a>2015</h3>
|
||||
<h4><a class="anchor" name="november-2015" href="#november-2015"><i class="anchor-icon"></i></a>November, 2015</h4>
|
||||
<ul>
|
||||
<li>Added support for <a href="https://telegram.org/blog/supergroups">supergroups</a>. The <em>Type</em> field in the <a href="/bots/api#chat">Chat</a> object can now contain 'supergroup'.</li>
|
||||
<li>Added support for <a href="https://telegram.org/blog/supergroups">supergroups</a>. The <em>Type</em> field in the <a href="/bots/api#chat">Chat</a> object can now contain 'supergroup'.</li>
|
||||
<li>New optional fields added to the <a href="/bots/api#message">Message</a> object: <em>supergroup_chat_created</em>, <em>migrate_to_chat_id</em>, <em>migrate_from_chat_id</em> and <em>channel_chat_created</em>.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#october-8-2015" id="october-8-2015" name="october-8-2015"><i class="anchor-icon"></i></a>October 8, 2015</h4>
|
||||
<h4><a class="anchor" name="october-8-2015" href="#october-8-2015"><i class="anchor-icon"></i></a>October 8, 2015</h4>
|
||||
<ul>
|
||||
<li>Added initial channel support for bots (no Telegram clients support this at the moment, please wait for updates):</li>
|
||||
<li>The <em>Chat</em> field in the <a href="/bots/api#message">Message</a> is now of the new type <a href="/bots/api#chat">Chat</a>.</li>
|
||||
<li>You can now pass a channel username (in the format <code>@channelusername</code>) in the place of <em>chat_id</em> in all methods (and instead of <em>from_chat_id</em> in <a href="/bots/api#forwardmessage">forwardMessage</a>). For this to work, the bot must be an administrator in the channel (and that's exactly what Telegram clients don't support yet — adding bots as administrators coming soon).</li>
|
||||
<li>You can now pass a channel username (in the format <code>@channelusername</code>) in the place of <em>chat_id</em> in all methods (and instead of <em>from_chat_id</em> in <a href="/bots/api#forwardmessage">forwardMessage</a>). For this to work, the bot must be an administrator in the channel (and that's exactly what Telegram clients don't support yet — adding bots as administrators coming soon).</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#september-18-2015" id="september-18-2015" name="september-18-2015"><i class="anchor-icon"></i></a>September 18, 2015</h4>
|
||||
<h4><a class="anchor" name="september-18-2015" href="#september-18-2015"><i class="anchor-icon"></i></a>September 18, 2015</h4>
|
||||
<ul>
|
||||
<li>Bots can now download files and media sent by users.</li>
|
||||
<li>Added <a href="/bots/api#getfile">getFile</a> and <a href="/bots/api#file">File</a>.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#september-7-2015" id="september-7-2015" name="september-7-2015"><i class="anchor-icon"></i></a>September 7, 2015</h4>
|
||||
<h4><a class="anchor" name="september-7-2015" href="#september-7-2015"><i class="anchor-icon"></i></a>September 7, 2015</h4>
|
||||
<ul>
|
||||
<li>You can now <a href="/bots/api#making-requests">pass parameters</a> using <em>application/json</em> (please note that this doesn't work for file uploads: use <em>multipart/form-data</em> to upload files).</li>
|
||||
<li>You can now <a href="/bots/api#making-requests">pass parameters</a> using <em>application/json</em> (please note that this doesn't work for file uploads: use <em>multipart/form-data</em> to upload files).</li>
|
||||
<li>Added very basic <a href="/bots/api#using-markdown">markdown support</a>. New field <em>parse_mode</em> added to <a href="/bots/api#sendmessage">sendMessage</a>. For the moment messages with markdown will be displayed correctly only in Telegram for <strong>Android</strong>. Other official apps will catch up soon.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#august-29-2015" id="august-29-2015" name="august-29-2015"><i class="anchor-icon"></i></a>August 29, 2015</h4>
|
||||
<h4><a class="anchor" name="august-29-2015" href="#august-29-2015"><i class="anchor-icon"></i></a>August 29, 2015</h4>
|
||||
<ul>
|
||||
<li>Added support for self-signed certificates: upload your certificate using the <em>certificate</em> parameter in the <a href="/bots/api#setwebhook">setWebhook</a> method.</li>
|
||||
<li>You can now make <a href="/bots/api#making-requests-when-getting-updates">new requests</a> when responding to webhook updates.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#august-15-2015" id="august-15-2015" name="august-15-2015"><i class="anchor-icon"></i></a>August 15, 2015</h4>
|
||||
<h4><a class="anchor" name="august-15-2015" href="#august-15-2015"><i class="anchor-icon"></i></a>August 15, 2015</h4>
|
||||
<ul>
|
||||
<li>Added new type <strong><a href="/bots/api#voice">Voice</a></strong> and new method <a href="/bots/api#sendvoice"><strong>sendVoice</strong></a> for sending voice messages.</li>
|
||||
<li>Earlier <strong><a href="/bots/api#audio">Audio</a></strong> and <strong><a href="/bots/api#sendaudio">sendAudio</a></strong> should now be used for sending music files. Telegram clients will show such files in the in-app music player. If you were using <a href="/bots/api#sendaudio"><strong>sendAudio</strong></a> for your bot to send voice messages, please use <a href="/bots/api#sendaudio"><strong>sendVoice</strong></a> instead.</li>
|
||||
<li>Added optional fields <em>performer</em>, <em>title</em> to the <a href="/bots/api#audio"><strong>Audio</strong></a> object and <a href="/bots/api#sendaudio"><strong>sendAudio</strong></a> method.</li>
|
||||
<li>Added optional field <em>voice</em> to the <a href="/bots/api#message"><strong>Message</strong></a> object.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#july-2015" id="july-2015" name="july-2015"><i class="anchor-icon"></i></a>July 2015</h4>
|
||||
<h4><a class="anchor" name="july-2015" href="#july-2015"><i class="anchor-icon"></i></a>July 2015</h4>
|
||||
<ul>
|
||||
<li>The <strong>thumb</strong> field is now optional for <a href="/bots/api#video">Video</a>, <a href="/bots/api#sticker">Sticker</a> and <a href="/bots/api#document">Document</a> objects</li>
|
||||
<li>The API now supports both video and photo captions. The <strong>caption</strong> field has been removed from the <a href="/bots/api#video">Video</a> object and added to the <a href="/bots/api#message">Message</a> object instead. </li>
|
||||
<li><strong>caption</strong> and <strong>duration</strong> optional fields have been added to the <a href="/bots/api#sendvideo">sendVideo</a> method.</li>
|
||||
<li>Fixed typo: <strong>user_id</strong> in the Contact object is now correctly labeled as Integer, not String</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#june-24-2015" id="june-24-2015" name="june-24-2015"><i class="anchor-icon"></i></a>June 24, 2015</h4>
|
||||
<h4><a class="anchor" name="june-24-2015" href="#june-24-2015"><i class="anchor-icon"></i></a>June 24, 2015</h4>
|
||||
<p>The bot platform is <a href="https://telegram.org/blog/bot-revolution">officially launched</a>.</p>
|
||||
<blockquote>
|
||||
<p><strong><a href="/bots/api">Back to the Bot API Manual »</a></strong></p>
|
||||
</blockquote></div>
|
||||
</blockquote>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -49,7 +49,7 @@
|
|||
<li><a href="/bots">A General Bot Platform Overview</a></li>
|
||||
<li><a href="/bots/api">Full API Reference for Developers</a></li>
|
||||
</ul>
|
||||
<h3><a class="anchor" href="#what-features-do-bots-have" id="what-features-do-bots-have" name="what-features-do-bots-have"><i class="anchor-icon"></i></a>What features do bots have?</h3>
|
||||
<h3><a class="anchor" name="what-features-do-bots-have" href="#what-features-do-bots-have"><i class="anchor-icon"></i></a>What features do bots have?</h3>
|
||||
<ul>
|
||||
<li><a href="#inputs"><strong>Inputs</strong></a><ul>
|
||||
<li><a href="#inputs">Text</a></li>
|
||||
|
@ -65,7 +65,7 @@
|
|||
</ul>
|
||||
</li>
|
||||
<li><a href="#integration"><strong>Integration</strong></a><ul>
|
||||
<li><a href="#web-apps">Web Apps</a></li>
|
||||
<li><a href="#mini-apps">Mini Apps</a></li>
|
||||
<li><a href="#bots-for-business">Bots for Business</a></li>
|
||||
<li><a href="#payments">Payments</a></li>
|
||||
<li><a href="#web-login">Web Login</a></li>
|
||||
|
@ -84,21 +84,22 @@
|
|||
<li><a href="#botfather"><strong>BotFather, creating and managing bots</strong></a></li>
|
||||
</ul>
|
||||
<hr>
|
||||
<h3><a class="anchor" href="#inputs" id="inputs" name="inputs"><i class="anchor-icon"></i></a>Inputs</h3>
|
||||
<p>Users can send <strong>messages of all types</strong> to bots, including text, files, locations, stickers, voice messages and even <a href="/bots/api#dice">dice</a> if they're feeling lucky. However, Telegram bots offer many other tools for building flexible interfaces tailored to your specific needs:</p>
|
||||
<h3><a class="anchor" name="inputs" href="#inputs"><i class="anchor-icon"></i></a>Inputs</h3>
|
||||
<p>Users can send <strong>messages of all types</strong> to bots, including text, files, locations, stickers, voice messages and even <a href="/bots/api#dice">dice</a> if they're feeling lucky. However, Telegram bots offer many other tools for building flexible interfaces tailored to your specific needs:</p>
|
||||
<ul>
|
||||
<li><a href="#commands">Commands</a> that are highlighted in messages and can be selected from a list after typing <code>/</code>.</li>
|
||||
<li><a href="#keyboards">Keyboards</a> that replace the user's keyboard with predefined answer options.</li>
|
||||
<li><a href="#keyboards">Keyboards</a> that replace the user's keyboard with predefined answer options.</li>
|
||||
<li><a href="#inline-keyboards">Buttons</a> that are shown next to messages from the bot.</li>
|
||||
</ul>
|
||||
<p>For even more flexibility, <a href="#web-apps">Web Apps</a> support 100% custom interfaces with JavaScript. </p>
|
||||
<div>
|
||||
<a href="/file/464001858/11318/ahAJjwERIX8.164875/ce1372cbf73e3ea94e" target="_blank"><img src="/file/464001858/11318/ahAJjwERIX8.164875/ce1372cbf73e3ea94e" title="Inputs" class="dev_page_image" width="70%"></a>
|
||||
<a href="/file/464001858/11318/ahAJjwERIX8.164875/ce1372cbf73e3ea94e" target="_blank"><img src="/file/464001858/11318/ahAJjwERIX8.164875/ce1372cbf73e3ea94e" title="Inputs" class="dev_page_image" width=70% /></a>
|
||||
</div>
|
||||
|
||||
<blockquote>
|
||||
<p><strong>Note:</strong> Telegram bots can support <a href="#language-support">multiple languages</a> that adapt to the users' language settings in the app.</p>
|
||||
<p><strong>Note:</strong> Telegram bots can support <a href="#language-support">multiple languages</a> that adapt to the users' language settings in the app.</p>
|
||||
</blockquote>
|
||||
<h4><a class="anchor" href="#commands" id="commands" name="commands"><i class="anchor-icon"></i></a>Commands</h4>
|
||||
<h4><a class="anchor" name="commands" href="#commands"><i class="anchor-icon"></i></a>Commands</h4>
|
||||
<p>A command is a simple <code>/keyword</code> that tells the bot what to do. Telegram apps will:</p>
|
||||
<ul>
|
||||
<li><strong>Highlight</strong> commands in messages. When the user taps a highlighted command, that command is immediately sent again.</li>
|
||||
|
@ -113,58 +114,61 @@
|
|||
<li>/newlocation </li>
|
||||
<li>/newrule </li>
|
||||
</ul>
|
||||
<p>Commands should be <strong>as specific as possible</strong> – for example <code>/newlocation</code> or <code>/newrule</code> <strong>is better</strong> than a <code>/new</code> command that then requires an additional parameter from the user like "<em>location</em>" or "<em>rule</em>".</p>
|
||||
<p>Commands should be <strong>as specific as possible</strong> – for example <code>/newlocation</code> or <code>/newrule</code> <strong>is better</strong> than a <code>/new</code> command that then requires an additional parameter from the user like "<em>location</em>“ or ”<em>rule</em>".</p>
|
||||
<div>
|
||||
<a href="/file/464001775/10227/HCr0XgSUHrg.119089/c17ff5d34fe528361e" target="_blank"><img src="/file/464001775/10227/HCr0XgSUHrg.119089/c17ff5d34fe528361e" title="Commands" class="dev_page_image" width="44%"></a>
|
||||
<a href="/file/464001775/10227/HCr0XgSUHrg.119089/c17ff5d34fe528361e" target="_blank"><img src="/file/464001775/10227/HCr0XgSUHrg.119089/c17ff5d34fe528361e" title="Commands" class="dev_page_image"
|
||||
width=44% /></a>
|
||||
</div>
|
||||
|
||||
<blockquote>
|
||||
<p>We require <strong>all developers</strong> to support several <a href="#global-commands">Global Commands</a> to make sure Telegram bots offer a consistent and user-friendly experience.</p>
|
||||
</blockquote>
|
||||
<h5><a class="anchor" href="#command-scopes" id="command-scopes" name="command-scopes"><i class="anchor-icon"></i></a>Command Scopes</h5>
|
||||
<p>Your bot is able to <strong>show different commands</strong> to different users and groups – you can control this using <a href="/bots/api#botcommandscope">scopes</a>. For example, your bot could show additional commands to group admins or translate the list based on the user’s <a href="/bots/api#user">language_code</a>.</p>
|
||||
<h5><a class="anchor" name="command-scopes" href="#command-scopes"><i class="anchor-icon"></i></a>Command Scopes</h5>
|
||||
<p>Your bot is able to <strong>show different commands</strong> to different users and groups – you can control this using <a href="/bots/api#botcommandscope">scopes</a>. For example, your bot could show additional commands to group admins or translate the list based on the user’s <a href="/bots/api#user">language_code</a>.</p>
|
||||
<blockquote>
|
||||
<p>Keep in mind that Bot API <a href="/bots/api#update">updates</a> <strong>will not contain any information</strong> about the scope of a command sent by the user – in fact, they may contain commands that don’t exist at all in your bot. Your backend should <strong>always</strong> verify that received commands are valid and that the user was authorized to use them regardless of scope.</p>
|
||||
</blockquote>
|
||||
<blockquote>
|
||||
<p>Bots with privacy mode enabled will only receive commands in groups under special conditions, <a href="#privacy-mode">see here</a>.</p>
|
||||
</blockquote>
|
||||
<h4><a class="anchor" href="#keyboards" id="keyboards" name="keyboards"><i class="anchor-icon"></i></a>Keyboards</h4>
|
||||
<h4><a class="anchor" name="keyboards" href="#keyboards"><i class="anchor-icon"></i></a>Keyboards</h4>
|
||||
<p>Bots are able to interpret free text input from users, but offering <strong>specific suggestions</strong> is often more intuitive – this is where <strong>custom keyboards</strong> can be extremely useful.</p>
|
||||
<p>Whenever your bot sends a message, it can <strong>display a special keyboard</strong> with predefined reply options (see <a href="/bots/api#replykeyboardmarkup">ReplyKeyboardMarkup</a>). Telegram apps that receive the message will display your keyboard to the user. Using any of the buttons will immediately send the respective text. This way you can drastically <strong>simplify</strong> and <strong>streamline</strong> user interaction with your bot.</p>
|
||||
<div>
|
||||
<a href="/file/464001950/1191a/2RwpmgU-swU.123554/b50478c124d5914c23" target="_blank"><img src="/file/464001950/1191a/2RwpmgU-swU.123554/b50478c124d5914c23" title="Keyboards" class="dev_page_image" width="44%"></a>
|
||||
<a href="/file/464001950/1191a/2RwpmgU-swU.123554/b50478c124d5914c23" target="_blank"><img src="/file/464001950/1191a/2RwpmgU-swU.123554/b50478c124d5914c23" title="Keyboards" class="dev_page_image" width=44% /></a>
|
||||
</div>
|
||||
|
||||
<blockquote>
|
||||
<p>Check out the <a href="/bots/api#replykeyboardmarkup">one_time_keyboard</a> parameter to automatically hide your bot's keyboard as soon as it's been used.</p>
|
||||
<p>Check out the <a href="/bots/api#replykeyboardmarkup">one_time_keyboard</a> parameter to automatically hide your bot's keyboard as soon as it's been used.</p>
|
||||
</blockquote>
|
||||
<p>You can also <strong>customize the text placeholder</strong> in the input field by setting the <code>input_field_placeholder</code> parameter.</p>
|
||||
<h4><a class="anchor" href="#inline-keyboards" id="inline-keyboards" name="inline-keyboards"><i class="anchor-icon"></i></a>Inline Keyboards</h4>
|
||||
<p>There are times when you'd prefer to do things <strong>without sending any messages</strong> to the chat – like when a user is changing settings, toggling options or navigating search results. In such cases, you can use <a href="/bots/api#inlinekeyboardmarkup">Inline Keyboards</a> that are shown directly below their relevant messages.</p>
|
||||
<p>Unlike with custom reply keyboards, pressing buttons on inline keyboards <strong>doesn't send messages to the chat</strong>. Instead, inline keyboards support buttons that can work behind the scenes or open different interfaces: <a href="/bots/api#inlinekeyboardbutton">callback buttons</a>, <a href="/bots/api#inlinekeyboardbutton">URL buttons</a>, <a href="/bots/api#inlinekeyboardbutton">switch-to-inline buttons</a>, <a href="/bots/api#inlinekeyboardbutton">game buttons</a> and <a href="/bots/api#inlinekeyboardbutton">payment buttons</a>. </p>
|
||||
<h4><a class="anchor" name="inline-keyboards" href="#inline-keyboards"><i class="anchor-icon"></i></a>Inline Keyboards</h4>
|
||||
<p>There are times when you'd prefer to do things <strong>without sending any messages</strong> to the chat – like when a user is changing settings, toggling options or navigating search results. In such cases, you can use <a href="/bots/api#inlinekeyboardmarkup">Inline Keyboards</a> that are shown directly below their relevant messages.</p>
|
||||
<p>Unlike with custom reply keyboards, pressing buttons on inline keyboards <strong>doesn't send messages to the chat</strong>. Instead, inline keyboards support buttons that can work behind the scenes or open different interfaces: <a href="/bots/api#inlinekeyboardbutton">callback buttons</a>, <a href="/bots/api#inlinekeyboardbutton">URL buttons</a>, <a href="/bots/api#inlinekeyboardbutton">switch-to-inline buttons</a>, <a href="/bots/api#inlinekeyboardbutton">game buttons</a> and <a href="/bots/api#inlinekeyboardbutton">payment buttons</a>. </p>
|
||||
<div>
|
||||
<a href="/file/464001863/110f3/I47qTXAD9Z4.120010/e0ea04f66357b640ec" target="_blank"><img src="/file/464001863/110f3/I47qTXAD9Z4.120010/e0ea04f66357b640ec" title="Inline Keyboard" class="dev_page_image" width="44%"></a>
|
||||
<a href="/file/464001863/110f3/I47qTXAD9Z4.120010/e0ea04f66357b640ec" target="_blank"><img src="/file/464001863/110f3/I47qTXAD9Z4.120010/e0ea04f66357b640ec" title="Inline Keyboard" class="dev_page_image" width=44% /></a>
|
||||
</div>
|
||||
|
||||
<blockquote>
|
||||
<p>To provide a <strong>better user experience</strong>, consider <a href="/bots/api#editmessagereplymarkup">editing your keyboard</a> when the user toggles a setting button or navigates to a new page – this is both <strong>faster</strong> and <strong>smoother</strong> than sending a whole new message and deleting the previous one.</p>
|
||||
</blockquote>
|
||||
<h4><a class="anchor" href="#menu-button" id="menu-button" name="menu-button"><i class="anchor-icon"></i></a>Menu Button</h4>
|
||||
<p>In all bot chats, a menu button appears near the message field. By default, tapping this button <strong>opens a menu</strong> that can hold some or all of a bot's commands, including a short description for each. Users can then <strong>select a command from the menu</strong> without needing to type it out.</p>
|
||||
<h4><a class="anchor" name="menu-button" href="#menu-button"><i class="anchor-icon"></i></a>Menu Button</h4>
|
||||
<p>In all bot chats, a menu button appears near the message field. By default, tapping this button <strong>opens a menu</strong> that can hold some or all of a bot's commands, including a short description for each. Users can then <strong>select a command from the menu</strong> without needing to type it out.</p>
|
||||
<p>You can set different texts of the menu button and its command descriptions for various <strong>individual users</strong> or <strong>groups of users</strong> – for example, showing translated text based on the user’s language, as explained <a href="#commands">here</a>.</p>
|
||||
<div class="blog_video_player_wrap" style="max-width: 400px; margin: 20px auto 20px;">
|
||||
<video class="blog_video_player tl_blog_vid_autoplay" onclick="videoTogglePlay(this)" autoplay="" loop="" controls="" muted="" poster="/file/464001581/11d85/f42u9c5Wncg.133752/b5a95b7f1221032d7d" style="max-width: 400px;" title="Bot Menu Button" alt="Video: Bot Menu Button">
|
||||
<source src="/file/464001555/10fbd/jvTuV2Ke7WQ.1916669.mp4/a056de323645db409d" type="video/mp4">
|
||||
</source></video>
|
||||
</video>
|
||||
</div>
|
||||
|
||||
<p>The <strong>menu button</strong> can alternatively be used to launch a <a href="#web-apps">Web App</a>.</p>
|
||||
<h4><a class="anchor" href="#global-commands" id="global-commands" name="global-commands"><i class="anchor-icon"></i></a>Global Commands</h4>
|
||||
<h4><a class="anchor" name="global-commands" href="#global-commands"><i class="anchor-icon"></i></a>Global Commands</h4>
|
||||
<p>To make basic interactions more uniform, we ask all developers to support a few <strong>basic commands</strong>. Telegram apps will have interface shortcuts for these commands.</p>
|
||||
<ul>
|
||||
<li>/start - begins the interaction with the user, like sending an introductory message. This command can also be used to pass additional parameters to the bot (see <a href="#deep-linking">Deep Linking</a>).</li>
|
||||
<li>/help - returns a help message, like a short text about what your bot can do and a list of commands.</li>
|
||||
<li>/settings - (if applicable) shows the bot's settings for this user and suggests commands to edit them.</li>
|
||||
<li>/settings - (if applicable) shows the bot's settings for this user and suggests commands to edit them.</li>
|
||||
</ul>
|
||||
<p>Users will see a <strong>Start</strong> button the first time they open a chat with your bot. <strong>Help</strong> and <strong>Settings</strong> links will be available in the menu on the bot's profile page if you add them in <a href="https://t.me/botfather">@BotFather</a>.</p>
|
||||
<h3><a class="anchor" href="#chat-and-user-selection" id="chat-and-user-selection" name="chat-and-user-selection"><i class="anchor-icon"></i></a>Chat and User Selection</h3>
|
||||
<p>Users will see a <strong>Start</strong> button the first time they open a chat with your bot. <strong>Help</strong> and <strong>Settings</strong> links will be available in the menu on the bot's profile page if you add them in <a href="https://t.me/botfather">@BotFather</a>.</p>
|
||||
<h3><a class="anchor" name="chat-and-user-selection" href="#chat-and-user-selection"><i class="anchor-icon"></i></a>Chat and User Selection</h3>
|
||||
<p>Bots can present the user with a <strong>friendly</strong> and <strong>intuitive</strong> interface that lists any number of groups, channels or other users according to a custom set of <strong>criteria</strong>. Tapping on a chat will send its identifier to the bot in a service message and seamlessly close the interface.</p>
|
||||
<p>A group management bot is the <strong>perfect example</strong>: an admin could select a chat the bot should manage, and then select a user it should promote – this would happen without ever typing any text.</p>
|
||||
<p>Here is a <strong>quick start guide</strong> to use this feature:</p>
|
||||
|
@ -172,65 +176,66 @@
|
|||
<li>Pick a set of criteria and store them in a <a href="https://core.telegram.org/bots/api#keyboardbuttonrequestchat">KeyboardButtonRequestChat</a> object (or <a href="https://core.telegram.org/bots/api#keyboardbuttonrequestuser">KeyboardButtonRequestUser</a> for users).</li>
|
||||
<li>Create a <a href="https://core.telegram.org/bots/api#keyboardbutton">KeyboardButton</a> and store the criteria under <code>request_chat</code> or <code>request_user</code> respectively.</li>
|
||||
<li>Send a <a href="https://core.telegram.org/bots/api#replykeyboardmarkup">ReplyKeyboardMarkup</a> that contains the button you just created.</li>
|
||||
<li>When the user selects a chat, you'll receive its identifier in a <code>chat_shared</code> or <code>user_shared</code> service message.</li>
|
||||
<li>When the user selects a chat, you'll receive its identifier in a <code>chat_shared</code> or <code>user_shared</code> service message.</li>
|
||||
</ul>
|
||||
<div class="blog_video_player_wrap" style="max-width: 400px; margin: 20px auto 20px;">
|
||||
<video class="blog_video_player tl_blog_vid_autoplay" onclick="videoTogglePlay(this)" loop="" muted="" poster="/file/464001277/1132d/dAINJNWL9jw.34909/08eaf646c24be49a87" style="max-width: 400px;" title="Select Chats For Bots" alt="Select Chats For Bots" vindex="1" preload="auto">
|
||||
<source src="/file/464001095/11121/M6HpBwtivTE.1913043.mp4/0514a29affa78a6dca" type="video/mp4">
|
||||
</source></video>
|
||||
</video>
|
||||
</div>
|
||||
|
||||
<blockquote>
|
||||
<p>Keep in mind that the bot may not be able to use the identifier it receives if the corresponding chat or user is not already known or accessible by some other means.</p>
|
||||
</blockquote>
|
||||
<hr>
|
||||
<h3><a class="anchor" href="#interactions" id="interactions" name="interactions"><i class="anchor-icon"></i></a>Interactions</h3>
|
||||
<h3><a class="anchor" name="interactions" href="#interactions"><i class="anchor-icon"></i></a>Interactions</h3>
|
||||
<p>In addition to sending commands and messages to the chat with the bot, there are several ways of interacting with them without opening any specific chat or group.</p>
|
||||
<ul>
|
||||
<li><a href="#inline-requests"><strong>Inline mode</strong></a> allows sending requests to bots right from the input field – from any chat on Telegram.</li>
|
||||
<li><a href="#deep-linking"><strong>Deep linking</strong></a> allows special links that send certain parameters to the bot when opened.</li>
|
||||
<li><a href="#attachment-menu"><strong>Attachment menu</strong></a> integration makes it possible to use bots from the attachment menu in chats.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#inline-requests" id="inline-requests" name="inline-requests"><i class="anchor-icon"></i></a>Inline Requests</h4>
|
||||
<p>Users can interact with your bot via <strong>inline queries</strong> straight from the message field <strong>in any chat</strong>. All they need to do is start a message with your bot's <em>@username</em> and enter a keyword.</p>
|
||||
<h4><a class="anchor" name="inline-requests" href="#inline-requests"><i class="anchor-icon"></i></a>Inline Requests</h4>
|
||||
<p>Users can interact with your bot via <strong>inline queries</strong> straight from the message field <strong>in any chat</strong>. All they need to do is start a message with your bot's <em>@username</em> and enter a keyword.</p>
|
||||
<p>Having received the query, your bot can return some results. As soon as the user selects one, it is sent to the <strong>relevant chat</strong>. This way, people can request and send content from your bot in any of their chats, groups or channels.</p>
|
||||
<p>Remember that inline functionality has to be enabled via <a href="https://t.me/botfather">@BotFather</a>, or your bot will not receive inline <a href="/bots/api#update">Updates</a>.</p>
|
||||
<div>
|
||||
<a href="/file/464001466/10e4a/r4FKyQ7gw5g.134366/f2606a53d683374703" target="_blank"><img src="/file/464001466/10e4a/r4FKyQ7gw5g.134366/f2606a53d683374703" title="Inline Mode" class="dev_page_image" width="51%/"></a>
|
||||
<a href="/file/464001466/10e4a/r4FKyQ7gw5g.134366/f2606a53d683374703" target="_blank"><img src="/file/464001466/10e4a/r4FKyQ7gw5g.134366/f2606a53d683374703" title="Inline Mode" class="dev_page_image" width=51%/></a>
|
||||
</div>
|
||||
|
||||
<blockquote>
|
||||
<p>Examples of inline bots include <a href="https://gif.t.me">@gif</a>, <a href="https://bing.t.me">@bing</a> and <a href="https://wiki.t.me">@wiki</a>. <a href="#web-apps">Web App</a> bots can also be used inline – try typing <a href="https://durgerkingbot.t.me">@durgerkingbot</a> in any chat.</p>
|
||||
</blockquote>
|
||||
<h4><a class="anchor" href="#deep-linking" id="deep-linking" name="deep-linking"><i class="anchor-icon"></i></a>Deep Linking</h4>
|
||||
<p>Telegram bots have a deep linking mechanism that allows <strong>additional parameters</strong> to be passed to the bot on startup. It could be a command that launches the bot – or an authentication token to connect the user's Telegram account to their account on another platform.</p>
|
||||
<h4><a class="anchor" name="deep-linking" href="#deep-linking"><i class="anchor-icon"></i></a>Deep Linking</h4>
|
||||
<p>Telegram bots have a deep linking mechanism that allows <strong>additional parameters</strong> to be passed to the bot on startup. It could be a command that launches the bot – or an authentication token to connect the user's Telegram account to their account on another platform.</p>
|
||||
<p>Each bot has a link that <strong>opens a conversation</strong> with it in Telegram – <code>https://t.me/<bot_username></code>. Parameters can be added directly to this link to let your bot work with additional information on the fly, without any user input.</p>
|
||||
<blockquote>
|
||||
<p>A-Z, a-z, 0-9, _ and - are allowed. We recommend using base64url to encode parameters with binary and other types of content. The parameter can be up to 64 characters long.</p>
|
||||
</blockquote>
|
||||
<p><strong>Private Chats</strong>
|
||||
In private chats, you can use the <code>start</code> parameter to automatically pass any value to your bot whenever a user presses the link. For example, you could use:</p>
|
||||
<p><strong>Private Chats</strong><br>In private chats, you can use the <code>start</code> parameter to automatically pass any value to your bot whenever a user presses the link. For example, you could use:</p>
|
||||
<pre><code>https://t.me/your_bot?start=airplane</code></pre>
|
||||
<p>When someone opens a chat with your bot via this link, you will receive:</p>
|
||||
<pre><code>/start airplane</code></pre>
|
||||
<p><strong>Groups</strong>
|
||||
In groups, you can add the parameter <code>startgroup</code> to this link. For example:</p>
|
||||
<p><strong>Groups</strong><br>In groups, you can add the parameter <code>startgroup</code> to this link. For example:</p>
|
||||
<pre><code>https://t.me/your_bot?startgroup=spaceship</code></pre>
|
||||
<p>Following a link with this parameter prompts the user to select a group to add the bot to – the resulting update will contain text in the form:</p>
|
||||
<pre><code>/start@your_bot spaceship</code></pre>
|
||||
<blockquote>
|
||||
<p><a href="#web-apps">Web Apps</a> also support deep linking, for more information check out our <a href="/bots/webapps#adding-bots-to-the-attachment-menu">dedicated guide</a>.</p>
|
||||
</blockquote>
|
||||
<h4><a class="anchor" href="#attachment-menu" id="attachment-menu" name="attachment-menu"><i class="anchor-icon"></i></a>Attachment Menu</h4>
|
||||
<h4><a class="anchor" name="attachment-menu" href="#attachment-menu"><i class="anchor-icon"></i></a>Attachment Menu</h4>
|
||||
<p>Certain bots can be added directly to a user’s <strong>attachment menu</strong> – giving them easy access to the bot in any chat. Currently, this option is restricted to certain <a href="/bots/webapps#launching-web-apps-from-the-attachment-menu">approved bots</a>, but may be expanded later.</p>
|
||||
<div class="blog_video_player_wrap" style="max-width: 400px; margin: 20px auto 20px;">
|
||||
<video class="blog_video_player tl_blog_vid_autoplay" onclick="videoTogglePlay(this)" autoplay="" loop="" controls="" muted="" poster="/file/464001491/11651/uwMWNdO29NE.215169/1b37285bbd8fc81244" style="max-width: 400px;" title="Attachment Menu" alt="Video: Bot Attachment Menu">
|
||||
<source src="/file/464001177/11b03/ruSbBLQiLJ8.928268.mp4/d9ad95048d23f3cc3f" type="video/mp4">
|
||||
</source></video>
|
||||
</video>
|
||||
</div>
|
||||
|
||||
<blockquote>
|
||||
<p>Try adding <a href="https://t.me/durgerkingbot?startattach">@DurgerKingBot</a> to your attachment menu.</p>
|
||||
</blockquote>
|
||||
<hr>
|
||||
<h3><a class="anchor" href="#integration" id="integration" name="integration"><i class="anchor-icon"></i></a>Integration</h3>
|
||||
<h3><a class="anchor" name="integration" href="#integration"><i class="anchor-icon"></i></a>Integration</h3>
|
||||
<p>There are various ways of futher integrating bots with Telegram and other services.</p>
|
||||
<ul>
|
||||
<li>Use <a href="#web-apps">Web Apps</a> to replace any website.</li>
|
||||
|
@ -240,18 +245,55 @@ In groups, you can add the parameter <code>startgroup</code> to this link. For e
|
|||
<li>Create gaming bots by integrating <a href="#html5-games">HTML5 Games</a>.</li>
|
||||
<li>Help users create and manage <a href="#stickers-and-custom-emoji">Telegram Stickers</a>.</li>
|
||||
</ul>
|
||||
<h3><a class="anchor" href="#web-apps" id="web-apps" name="web-apps"><i class="anchor-icon"></i></a>Web Apps</h3>
|
||||
<p>Bots can easily process <strong>complex inputs</strong> of any kind and <strong>dynamic interaction flows</strong> via <a href="webapps">Web Apps</a>. With this unique feature, you can develop any number of flexible, streamlined interfaces in <strong>JavaScript</strong>.</p>
|
||||
<h3><a class="anchor" name="mini-apps" href="#mini-apps"><i class="anchor-icon"></i></a>Mini Apps</h3>
|
||||
<p><a href="webapps">Mini Apps</a> allow developers to create infinitely flexible interfaces that can be launched right inside Telegram – integrating seamlessly with the app and replacing <strong>any website</strong>.</p>
|
||||
<p>If your bot is a mini app, you can add a prominent <strong>Launch app</strong> button as well as demo videos and screenshots to the bot’s profile. To do this, go to <a href="https://t.me/botfather">@BotFather</a> and set up your bot's <a href="webapps#launching-the-main-mini-app">Main Mini App</a>.</p>
|
||||
<blockquote>
|
||||
<p>Web Apps are covered in detail in our <a href="webapps">dedicated guide</a> – you should read it carefully to learn the wide variety of features they can offer.</p>
|
||||
<p>Mini apps are covered in detail in our <a href="webapps">dedicated guide</a> – you should read it carefully to learn the wide variety of features they can offer.</p>
|
||||
</blockquote>
|
||||
<div class="blog_video_player_wrap" style="max-width: 400px; 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: 400px;" title="Attachment Menu" alt="Video: Bot Attachment Menu">
|
||||
<source src="/file/464001679/11aa9/KQx_BlPVXRo.4922145.mp4/c65433c8ac11a347a8" type="video/mp4">
|
||||
</source></video>
|
||||
</video>
|
||||
</div>
|
||||
<p>If you develop a <strong>Web App</strong>, be sure to follow our <a href="webapps#design-guidelines">design guidelines</a> – you'll want your custom interface to <strong>seamlessly integrate</strong> into the app to provide users the best possible experience.</p>
|
||||
<h4><a class="anchor" href="#bots-for-business" id="bots-for-business" name="bots-for-business"><i class="anchor-icon"></i></a>Bots for Business</h4>
|
||||
|
||||
<p>If you develop a <strong>mini app</strong>, be sure to follow our <a href="webapps#design-guidelines">design guidelines</a> – you'll want your custom interface to <strong>seamlessly integrate</strong> into the app to provide users the best possible experience.</p>
|
||||
<h4><a class="anchor" name="seamless-integration-with-telegram" href="#seamless-integration-with-telegram"><i class="anchor-icon"></i></a>Seamless Integration With Telegram</h4>
|
||||
<p>Mini apps integrate <strong>seamlessly</strong> with Telegram – from receiving detailed <a href="webapps#themeparams">theme settings</a> to using native dialogs for reading <a href="webapps#initializing-mini-apps">QR codes</a>, controlling <a href="webapps#biometricmanager">biometrics</a>, sharing media <a href="webapps#initializing-mini-apps">directly to stories</a> and more.</p>
|
||||
<p>When opened from a <a href="webapps#direct-link-mini-apps">direct link</a> in a group, mini apps can also use the <code>chat_instance</code> parameter to track of the current context, supporting <strong>shared usage</strong> by multiple chat members – to create live whiteboards, group orders, multiplayer games and much more.</p>
|
||||
<h4><a class="anchor" name="sharing-from-mini-apps-to-stories" href="#sharing-from-mini-apps-to-stories"><i class="anchor-icon"></i></a>Sharing from Mini Apps to Stories</h4>
|
||||
<p>Any media created by the mini app, like whiteboard snapshots, leaderboards and AI-generated videos can be opened with the native story editor via the <a href="webapps#initializing-mini-apps">shareToStory</a> method – for users to share as a <a href="https://telegram.org/tour/stories">Telegram Story</a> right from the mini app. </p>
|
||||
<div class="blog_video_player_wrap" style="max-width: 400px; margin: 20px auto 20px;">
|
||||
<video class="blog_video_player tl_blog_vid_autoplay" onclick="videoTogglePlay(this)" autoplay="" loop="" controls="" muted="" poster="/file/400780400371/4/l5lIymX0jZo.24285/0fe2981522348dce64" style="max-width: 400px;" title="Sharing Stories" alt="Sharing Stories">
|
||||
<source src="/file/400780400676/1/yDZoLCZ9bKQ.3403169.mp4/6e2b8eca9d3a23cc64" type="video/mp4">
|
||||
</video>
|
||||
</div>
|
||||
|
||||
<blockquote>
|
||||
<p>Mini apps also receive a number of <strong>events</strong>, allowing them to <strong>instantly react</strong> to actions by the user. You can learn more about which events are available <a href="webapps#events-available-for-mini-apps">here</a>.</p>
|
||||
</blockquote>
|
||||
<h4><a class="anchor" name="mini-app-previews" href="#mini-app-previews"><i class="anchor-icon"></i></a>Mini App Previews</h4>
|
||||
<p>Developers can <strong>upload screenshots</strong> and <strong>video demos</strong> of their mini app right from the bot's <strong>profile page</strong> – giving users an overview of the app's features and functionality. These media previews will be shown to any user who <strong>views your app</strong> – like in the <a href="#mini-app-store">Mini App Store</a> or via Search.</p>
|
||||
<div>
|
||||
<a href="/file/400780400954/6/9rSb8AM77Ss.158225/1c635ef877be7a6747" target="_blank"><img src="/file/400780400954/6/9rSb8AM77Ss.158225/1c635ef877be7a6747" title="Mini App Previews" width=50% class="dev_page_image" /></a>
|
||||
</div>
|
||||
|
||||
<blockquote>
|
||||
<p>Previews support <strong>multiple languages</strong> – so you can upload <strong>translated versions</strong> of your previews that will be shown to users based on their <strong>app language</strong>.</p>
|
||||
</blockquote>
|
||||
<h4><a class="anchor" name="mini-app-store" href="#mini-app-store"><i class="anchor-icon"></i></a>Mini App Store</h4>
|
||||
<p>More than <strong>500 million</strong> out of Telegram's <a href="https://t.me/durov/337">950</a> million users interact with mini apps every month. Succesful mini apps have the chance to be <strong>highlighted</strong> in the Telegram Mini App Store – appearing for all users in the <em>'Apps'</em> tab of Search.</p>
|
||||
<p>Featured mini apps are chosen based on how they <strong>enrich the Telegram ecosystem</strong>. To increase the chances of being featured, you must <strong>enable</strong> the <a href="https://core.telegram.org/bots/webapps#launching-the-main-mini-app">Main Mini App</a> in <a href="https://t.me/botfather">@BotFather</a>, <strong>upload</strong> high-quality media demos showcasing your app to your bot's profile and <strong>accept payments</strong> in <a href="https://telegram.org/blog/telegram-stars">Telegram Stars</a>.</p>
|
||||
<div class="blog_video_player_wrap" style="max-width: 400px; margin: 20px auto 20px;">
|
||||
<video class="blog_video_player tl_blog_vid_autoplay" onclick="videoTogglePlay(this)" autoplay="" loop="" controls="" muted="" poster="/file/400780400572/1/KDOL4LVn0qU.46714/87e3de3384c284a00d" style="max-width: 400px;" title="Mini App Store" alt="Mini App Store">
|
||||
<source src="/file/400780400928/1/bb7CeIf11Es.6604686.mp4/ea45ba121b84766f1d" type="video/mp4">
|
||||
</video>
|
||||
</div>
|
||||
|
||||
<blockquote>
|
||||
<p>Check out our documentation to learn more about <a href="https://core.telegram.org/bots/webapps#launching-the-main-mini-app">enabling Main Mini Apps</a> and <a href="https://core.telegram.org/bots/payments-stars">accepting payments</a> in Stars.</p>
|
||||
</blockquote>
|
||||
<h3><a class="anchor" name="bots-for-business" href="#bots-for-business"><i class="anchor-icon"></i></a>Bots for Business</h3>
|
||||
<p>Bots can enable <strong>Business Mode</strong>, allowing <a href="https://telegram.org/blog/telegram-business">Telegram Business</a> subscribers to connect them to their account – to streamline and automate private chat management and interactions with their clients.</p>
|
||||
<p>The <strong>account owner</strong> can specify which chats your bot can access – within those chats, the bot will receive all updates normally supported by the <a href="https://core.telegram.org/bots/api">Bot API</a>, except messages sent by itself and other bots. Depending on the business connection settings, your bot may also be able to <strong>send messages</strong> and do other actions on behalf of the account owner in chats that were active in the last 24h.</p>
|
||||
<p>Here is a quick start guide to integrate your bot with Telegram Business:</p>
|
||||
|
@ -262,23 +304,25 @@ In groups, you can add the parameter <code>startgroup</code> to this link. For e
|
|||
<li>Check your bot’s write permissions via <code>can_reply</code> in the latest <a href="https://core.telegram.org/bots#businessconnection">BusinessConnection</a> update.</li>
|
||||
<li>If allowed to, use the <code>business_connection_id</code> field in <a href="https://core.telegram.org/bots/api#sendmessage">sendMessage</a>, <a href="https://core.telegram.org/bots/api#sendchataction">sendChatAction</a> and other send methods to communicate on behalf of the Business user.</li>
|
||||
</ul>
|
||||
<p>Users who <strong>connect your bot</strong> to their account will see a <strong>quick action bar</strong> at the top of each managed chat – tapping on "Manage Bot" will redirect them to your bot, which will receive a deep link message in the format <code>/start bizChat<user_chat_id></code>.</p>
|
||||
<p>Users who <strong>connect your bot</strong> to their account will see a <strong>quick action bar</strong> at the top of each managed chat – tapping on “Manage Bot” will redirect them to your bot, which will receive a deep link message in the format <code>/start bizChat<user_chat_id></code>.</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">
|
||||
</source></video>
|
||||
</video>
|
||||
</div>
|
||||
|
||||
|
||||
<blockquote>
|
||||
<p>Please keep in mind that operating bots on Telegram is subject to the <a href="https://telegram.org/tos/bot-developers">Telegram Bot Developer Terms of Service</a>. Specifically, for Telegram Business, make sure you have read and understood <a href="https://telegram.org/tos/bot-developers#5-4-telegram-business">Section 5.4</a>.</p>
|
||||
</blockquote>
|
||||
<h3><a class="anchor" href="#payments" id="payments" name="payments"><i class="anchor-icon"></i></a>Payments</h3>
|
||||
<h3><a class="anchor" name="payments" href="#payments"><i class="anchor-icon"></i></a>Payments</h3>
|
||||
<blockquote>
|
||||
<p>If your bot or mini app sells <strong>digital goods and services</strong>, be sure to carry out the payment in <a href="https://telegram.org/blog/telegram-stars">Telegram Stars</a> by specifying <code>XTR</code> as currency. In compliance with third-party store policies, Telegram does not support the sale of digital goods and services using other currencies.</p>
|
||||
</blockquote>
|
||||
<p>Telegram bots can accept payments with a sleek, streamlined interface that collects all necessary data from the user. Telegram <strong>doesn't collect</strong> any payment data – like the user's credit card information – and sends it directly to one of the supported <a href="payments#supported-payment-providers">payment providers</a>.</p>
|
||||
<p>Telegram bots can accept payments with a sleek, streamlined interface that collects all necessary data from the user. Telegram <strong>doesn't collect</strong> any payment data – like the user's credit card information – and sends it directly to one of the supported <a href="payments#supported-payment-providers">payment providers</a>.</p>
|
||||
<p>Here is a <strong>quick start guide</strong> to implement payments:</p>
|
||||
<ul>
|
||||
<li>Pick a <a href="payments#supported-payment-providers">provider</a> and obtain the <a href="payments#getting-a-token">proper token</a> as well as a <strong>test token</strong> from the "<strong>Stripe TEST MODE</strong>" provider.</li>
|
||||
<li>Pick a <a href="payments#supported-payment-providers">provider</a> and obtain the <a href="payments#getting-a-token">proper token</a> as well as a <strong>test token</strong> from the "<strong>Stripe TEST MODE</strong>" provider.</li>
|
||||
<li>Implement payments via the <a href="/bots/api#payments">appropriate API methods</a>.</li>
|
||||
<li>Test your implementation by using your <strong>test token</strong> along with a <a href="https://stripe.com/docs/testing#cards">test credit card</a>.</li>
|
||||
</ul>
|
||||
|
@ -295,37 +339,38 @@ In groups, you can add the parameter <code>startgroup</code> to this link. For e
|
|||
<li><a href="/bots/payments">Guide for physical goods and services</a></li>
|
||||
</ul>
|
||||
<div>
|
||||
<a href="/file/464001393/101fc/SB_bFCLR0tg.130549/7ecf91aaa44737e8cb" target="_blank"><img src="/file/464001393/101fc/SB_bFCLR0tg.130549/7ecf91aaa44737e8cb" title="Payments" class="dev_page_image" width="50%"></a>
|
||||
<a href="/file/464001393/101fc/SB_bFCLR0tg.130549/7ecf91aaa44737e8cb" target="_blank"><img src="/file/464001393/101fc/SB_bFCLR0tg.130549/7ecf91aaa44737e8cb" title="Payments" class="dev_page_image" width=50% /></a>
|
||||
</div>
|
||||
|
||||
<blockquote>
|
||||
<p>Telegram does not directly process the payments, does not store data about orders and does not collect any fees. Invoices are forwarded directly to the payment provider.
|
||||
For this reason, disputes must be solved between the user, the bot developer and the payment provider. You can read more about this in the <a href="https://telegram.org/privacy#7-third-party-payment-services">Privacy Policy</a>.</p>
|
||||
<p>Telegram does not directly process the payments, does not store data about orders and does not collect any fees. Invoices are forwarded directly to the payment provider.<br>For this reason, disputes must be solved between the user, the bot developer and the payment provider. You can read more about this in the <a href="https://telegram.org/privacy#7-third-party-payment-services">Privacy Policy</a>.</p>
|
||||
</blockquote>
|
||||
<h3><a class="anchor" href="#web-login" id="web-login" name="web-login"><i class="anchor-icon"></i></a>Web Login</h3>
|
||||
<h3><a class="anchor" name="web-login" href="#web-login"><i class="anchor-icon"></i></a>Web Login</h3>
|
||||
<p>Telegram offers a <strong>flexible</strong>, <strong>lightweight</strong> and <strong>free</strong> framework to authenticate users on any website and app. This can be used to bridge your platform with Telegram, providing a smooth experience to your users. You can also freely rely on this framework to implement a <strong>fast</strong> and <strong>signup-free</strong> login on your site, regardless of its connection to Telegram.</p>
|
||||
<h4><a class="anchor" href="#widgets" id="widgets" name="widgets"><i class="anchor-icon"></i></a>Widgets</h4>
|
||||
<h4><a class="anchor" name="widgets" href="#widgets"><i class="anchor-icon"></i></a>Widgets</h4>
|
||||
<p>The Telegram login widget is a <strong>simple and secure way to authorize users</strong> on your website.</p>
|
||||
<ol>
|
||||
<li>Choose a bot – ideally its name and profile pic <strong>should match</strong> the website title and logo.</li>
|
||||
<li>Use the <code>/setdomain</code> command in <a href="https://t.me/botfather">@BotFather</a> to pair the bot with your website domain. </li>
|
||||
<li>Configure your widget using <a href="/widgets/login#widget-configuration">our dedicated tool</a> and embed it on your website.</li>
|
||||
</ol>
|
||||
<h4><a class="anchor" href="#inline-login" id="inline-login" name="inline-login"><i class="anchor-icon"></i></a>Inline Login</h4>
|
||||
<p>When users open your website via an <strong>inline button</strong>, you can use the <a href="/bots/api#loginurl">login_url</a> parameter as an alternative to login widgets. This way, you'll be able to <a href="https://telegram.org/blog/privacy-discussions-web-bots#meet-seamless-web-bots">seamlessly authorize</a> them on your website or app before the page even loads.</p>
|
||||
<h4><a class="anchor" name="inline-login" href="#inline-login"><i class="anchor-icon"></i></a>Inline Login</h4>
|
||||
<p>When users open your website via an <strong>inline button</strong>, you can use the <a href="/bots/api#loginurl">login_url</a> parameter as an alternative to login widgets. This way, you'll be able to <a href="https://telegram.org/blog/privacy-discussions-web-bots#meet-seamless-web-bots">seamlessly authorize</a> them on your website or app before the page even loads.</p>
|
||||
<div>
|
||||
<a href="/file/464001287/105ea/23bO4ntH4tc.43741/c9624e36c3462b6540" target="_blank"><img src="/file/464001287/105ea/23bO4ntH4tc.43741/c9624e36c3462b6540" width="50%" title="Login Widget" class="dev_page_image"></a>
|
||||
<a href="/file/464001287/105ea/23bO4ntH4tc.43741/c9624e36c3462b6540" target="_blank"><img src="/file/464001287/105ea/23bO4ntH4tc.43741/c9624e36c3462b6540" width=50% title="Login Widget" class="dev_page_image" /></a>
|
||||
</div>
|
||||
|
||||
<blockquote>
|
||||
<p>Make sure to review our <a href="/widgets/login#checking-authorization">guide</a> on authenticating the received data as well as our <a href="https://gist.github.com/anonymous/6516521b1fb3b464534fbc30ea3573c2">sample code</a>.</p>
|
||||
</blockquote>
|
||||
<h3><a class="anchor" href="#html5-games" id="html5-games" name="html5-games"><i class="anchor-icon"></i></a>HTML5 Games</h3>
|
||||
<h3><a class="anchor" name="html5-games" href="#html5-games"><i class="anchor-icon"></i></a>HTML5 Games</h3>
|
||||
<p>Bots can serve as <strong>standalone gaming platforms</strong> – with our <a href="/bots/api#games">HTML5 Gaming API</a> you can develop multiplayer or single-player games and let your users have fun comparing <strong>ranks</strong>, <strong>scores</strong> and much more.</p>
|
||||
<p>To get started, follow these simple steps:</p>
|
||||
<ul>
|
||||
<li>Send the <code>/newgame</code> command to <a href="https://t.me/botfather">@BotFather</a></li>
|
||||
<li>Provide a <strong>description text</strong>, an <strong>image</strong> or an <strong>optional gif</strong> to showcase its gameplay</li>
|
||||
<li>Send the game to users via the <a href="/bots/api#sendgame">sendGame</a> method or via an <a href="/bots/api#inlinequeryresultgame">inline query</a></li>
|
||||
<li>When someone wants to play, you'll receive the appropriate <code>game_short_name</code> in a <a href="/bots/api#callbackquery">CallbackQuery</a></li>
|
||||
<li>When someone wants to play, you'll receive the appropriate <code>game_short_name</code> in a <a href="/bots/api#callbackquery">CallbackQuery</a></li>
|
||||
<li>To launch the game, provide the <strong>HTML5 Game URL</strong> as the <code>url</code> param of <a href="/bots/api#answercallbackquery">answerCallbackQuery</a></li>
|
||||
</ul>
|
||||
<p>Then, to handle <strong>highscores</strong>:</p>
|
||||
|
@ -339,50 +384,49 @@ For this reason, disputes must be solved between the user, the bot developer and
|
|||
<li><a href="/bots/api#games">HTML5 Games Bot API Docs</a></li>
|
||||
</ul>
|
||||
<div>
|
||||
<a href="/file/464001558/11b92/y_Fu9QQWtj0.141959/dc9db48f66800bf271" target="_blank"><img src="/file/464001558/11b92/y_Fu9QQWtj0.141959/dc9db48f66800bf271" title="Games" width="50%" class="dev_page_image"></a>
|
||||
<a href="/file/464001558/11b92/y_Fu9QQWtj0.141959/dc9db48f66800bf271" target="_blank"><img src="/file/464001558/11b92/y_Fu9QQWtj0.141959/dc9db48f66800bf271" title="Games" width=50% class="dev_page_image" /></a>
|
||||
</div>
|
||||
|
||||
<blockquote>
|
||||
<p>Check out <a href="https://t.me/gamebot">@GameBot</a> and <a href="https://t.me/gamee">@gamee</a> for examples of what you can do using our Gaming Platform.</p>
|
||||
</blockquote>
|
||||
<h3><a class="anchor" href="#stickers-and-custom-emoji" id="stickers-and-custom-emoji" name="stickers-and-custom-emoji"><i class="anchor-icon"></i></a>Stickers and Custom Emoji</h3>
|
||||
<h3><a class="anchor" name="stickers-and-custom-emoji" href="#stickers-and-custom-emoji"><i class="anchor-icon"></i></a>Stickers and Custom Emoji</h3>
|
||||
<p><a href="https://core.telegram.org/stickers">Stickers</a> and <a href="https://telegram.org/blog/custom-emoji">Custom Emoji</a> are a distinctive Telegram feature used by millions of users to share artwork every day. Stickers and custom emoji take many forms – ranging from <strong>basic images</strong> to smooth <strong>vector animations</strong> and high-detail <strong>.WEBM videos</strong>.</p>
|
||||
<p>All these formats are supported by our <a href="api#stickers">Bot API</a>, which allows bots to <strong>create</strong>, <strong>edit</strong>, <strong>delete</strong> and <strong>share</strong> new artwork packs on the fly. Telegram's <a href="https://core.telegram.org/import-stickers">Import API</a> lets users <strong>migrate packs</strong> from other platforms and sticker apps.</p>
|
||||
<p><strong>Creating a new pack</strong>
|
||||
To create a <strong>new pack</strong>, simply:</p>
|
||||
<p>All these formats are supported by our <a href="api#stickers">Bot API</a>, which allows bots to <strong>create</strong>, <strong>edit</strong>, <strong>delete</strong> and <strong>share</strong> new artwork packs on the fly. Telegram's <a href="https://core.telegram.org/import-stickers">Import API</a> lets users <strong>migrate packs</strong> from other platforms and sticker apps.</p>
|
||||
<p><strong>Creating a new pack</strong><br>To create a <strong>new pack</strong>, simply:</p>
|
||||
<ul>
|
||||
<li><strong>Prepare</strong> your artwork following our <a href="https://core.telegram.org/stickers">technical requirements</a>.</li>
|
||||
<li><strong>Create</strong> a new sticker pack via <a href="api#createnewstickerset">createStickerSet</a>. Set <code>sticker_type</code> to <em>regular</em> to create a sticker pack or to <em>custom emoji</em> to create a pack of custom emoji. Attach the <a href="api#file">files</a> you wish to include in the pack as an array of <a href="https://core.telegram.org/bots#inputsticker">InputSticker</a></li>
|
||||
<li>You can use <a href="api#addstickertoset">addStickerToSet</a> to add stickers or emoji later on.</li>
|
||||
</ul>
|
||||
<p><strong>Additional features</strong>
|
||||
Regular stickers and custom emoji support <strong>keywords</strong> that users can type to quickly find the respective artwork – this can be useful when a sticker doesn't have obvious ties to a specific emoji. You can use the <code>keywords</code> parameter in <a href="https://core.telegram.org/bots#inputsticker">InputSticker</a> to specify them.</p>
|
||||
<p><strong>Additional features</strong><br>Regular stickers and custom emoji support <strong>keywords</strong> that users can type to quickly find the respective artwork – this can be useful when a sticker doesn't have obvious ties to a specific emoji. You can use the <code>keywords</code> parameter in <a href="https://core.telegram.org/bots#inputsticker">InputSticker</a> to specify them.</p>
|
||||
<p>Custom emoji additionally support <strong>adaptive colors</strong> – they will always match the current context (e.g., white on photos, accent color when used as status, etc.); to enable this feature, use the <code>needs_repainting</code> parameter in <a href="api#createnewstickerset">createStickerSet</a>.</p>
|
||||
<p>Once you're done creating and sharing your artwork, don't forget to check out our <a href="api#stickers">remaining sticker methods</a> to find out how to <a href="api#setstickersetthumb">edit</a>, <a href="api#deletestickerfromset">delete</a> and even <a href="api#setstickerpositioninset">reorder</a> your pack. </p>
|
||||
<p>Once you're done creating and sharing your artwork, don't forget to check out our <a href="api#stickers">remaining sticker methods</a> to find out how to <a href="api#setstickersetthumb">edit</a>, <a href="api#deletestickerfromset">delete</a> and even <a href="api#setstickerpositioninset">reorder</a> your pack. </p>
|
||||
<blockquote>
|
||||
<p>Note that these methods will only work on packs <strong>created by the bot that is calling them</strong>.</p>
|
||||
</blockquote>
|
||||
<h3><a class="anchor" href="#language-support" id="language-support" name="language-support"><i class="anchor-icon"></i></a>Language Support</h3>
|
||||
<h3><a class="anchor" name="language-support" href="#language-support"><i class="anchor-icon"></i></a>Language Support</h3>
|
||||
<p>Bots can tailor their interfaces to <strong>support multiple languages</strong> – updating inputs and information on the fly. A user’s <a href="/bots/api#user">language_code</a> is included in every relevant <a href="/bots/api#update">update</a> as an <a href="https://en.wikipedia.org/wiki/IETF_language_tag">IETF language tag</a>, allowing bots to adapt accordingly. </p>
|
||||
<p>We recommend that you follow our guidelines to provide <strong>the best user experience</strong>.</p>
|
||||
<ul>
|
||||
<li>Your interfaces, texts and <a href="/bots/api#answerinlinequery">inline results</a> should adapt seamlessly to the <em>language_code</em>, without user intervention.</li>
|
||||
<li>Connected <a href="/bots/webapps">WebApps</a> will receive the user's <em>language_code</em> – your HTML page should account for it.</li>
|
||||
<li>Connected <a href="/bots/webapps">WebApps</a> will receive the user's <em>language_code</em> – your HTML page should account for it.</li>
|
||||
<li><a href="/bots/games">HTML5 Games</a> can obtain language information if you specify it as a <a href="/bots/games#using-url-parameters">URL parameter</a>. You can generate this parameter from the <em>language_code</em> field in the <a href="/bots/api#user">User</a> object served with the initial game <a href="/bots/api#callbackquery">CallbackQuery</a>.</li>
|
||||
<li>The bot's <strong>Name</strong>, <strong>Description</strong> and <strong>About text</strong> can be natively localized with the respective <a href="https://core.telegram.org/bots/api#setmydescription">methods</a>.</li>
|
||||
<li>The bot's <strong>Name</strong>, <strong>Description</strong> and <strong>About text</strong> can be natively localized with the respective <a href="https://core.telegram.org/bots/api#setmydescription">methods</a>.</li>
|
||||
<li>Command lists can also be specified for individual languages – more on this <a href="#commands">here</a>.</li>
|
||||
</ul>
|
||||
<div class="blog_video_player_wrap" style="max-width: 400px; margin: 20px auto 20px;">
|
||||
<video class="blog_video_player tl_blog_vid_autoplay" onclick="videoTogglePlay(this)" autoplay="" loop="" controls="" muted="" poster="/file/464001822/10cd0/EvtvjnhA-kA.132475/e285952b505535d85a" style="max-width: 400px;" title="Language Support" alt="Video: Language Support">
|
||||
<source src="/file/464001083/105cd/NF4ViAHfTJc.3601652.mp4/0fd787953c11a6371d" type="video/mp4">
|
||||
</source></video>
|
||||
</video>
|
||||
</div>
|
||||
|
||||
<blockquote>
|
||||
<p>The <em>language_code</em> is an <strong>optional field</strong> – it could be empty.
|
||||
If you target the general public, your code should always fall back to either the last recorded language tag or English (in this order) when the field is missing for a specific user. </p>
|
||||
<p>The <em>language_code</em> is an <strong>optional field</strong> – it could be empty.<br>If you target the general public, your code should always fall back to either the last recorded language tag or English (in this order) when the field is missing for a specific user. </p>
|
||||
</blockquote>
|
||||
<hr>
|
||||
<h3><a class="anchor" href="#bot-management" id="bot-management" name="bot-management"><i class="anchor-icon"></i></a>Bot Management</h3>
|
||||
<h4><a class="anchor" href="#privacy-mode" id="privacy-mode" name="privacy-mode"><i class="anchor-icon"></i></a>Privacy Mode</h4>
|
||||
<h3><a class="anchor" name="bot-management" href="#bot-management"><i class="anchor-icon"></i></a>Bot Management</h3>
|
||||
<h4><a class="anchor" name="privacy-mode" href="#privacy-mode"><i class="anchor-icon"></i></a>Privacy Mode</h4>
|
||||
<p>Bots are frequently added to groups to perform basic tasks or assist moderators – like automatically posting company announcements or even celebrating birthdays. By default, <strong>all bots</strong> added to groups run in Privacy Mode and only see relevant messages and commands:</p>
|
||||
<ul>
|
||||
<li>Commands explicitly meant for them (e.g., <code>/command@this_bot</code>).</li>
|
||||
|
@ -396,20 +440,21 @@ If you target the general public, your code should always fall back to either th
|
|||
<li>All messages from private chats.</li>
|
||||
<li>All messages from channels where they are a member.</li>
|
||||
</ul>
|
||||
<p>Privacy mode is <strong>enabled by default</strong> for all bots, except bots that were added to a group as admins (bot admins always receive <strong>all messages</strong>). It can be disabled so that the bot receives all messages like an ordinary user (the bot will need to be re-added to the group for this change to take effect). We only recommend doing this in cases where it is <strong>absolutely necessary</strong> for your bot to work. In most cases, using the force reply option for the bot's messages should be more than enough.</p>
|
||||
<p>Privacy mode is <strong>enabled by default</strong> for all bots, except bots that were added to a group as admins (bot admins always receive <strong>all messages</strong>). It can be disabled so that the bot receives all messages like an ordinary user (the bot will need to be re-added to the group for this change to take effect). We only recommend doing this in cases where it is <strong>absolutely necessary</strong> for your bot to work. In most cases, using the force reply option for the bot's messages should be more than enough.</p>
|
||||
<div>
|
||||
<a href="/file/464001338/107af/JdbERa0BATg.62371/28977e9a96aed3860a" target="_blank"><img src="/file/464001338/107af/JdbERa0BATg.62371/28977e9a96aed3860a" title="Privacy Mode" class="dev_page_image" width="50%/"></a>
|
||||
<a href="/file/464001338/107af/JdbERa0BATg.62371/28977e9a96aed3860a" target="_blank"><img src="/file/464001338/107af/JdbERa0BATg.62371/28977e9a96aed3860a" title="Privacy Mode" class="dev_page_image" width=50%/></a>
|
||||
</div>
|
||||
|
||||
<blockquote>
|
||||
<p>This mode not only increases user privacy, but also makes the bot more efficient by reducing the number of inputs it needs to process. Users can always see a bot’s current privacy setting in the list of group members.</p>
|
||||
</blockquote>
|
||||
<h3><a class="anchor" href="#testing-your-bot" id="testing-your-bot" name="testing-your-bot"><i class="anchor-icon"></i></a>Testing your bot</h3>
|
||||
<h3><a class="anchor" name="testing-your-bot" href="#testing-your-bot"><i class="anchor-icon"></i></a>Testing your bot</h3>
|
||||
<p>You can quickly test your bot <strong>without interfering</strong> with its users by simply running another instance of your code on a different bot account. To do so, create a <em>new bot</em> via <a href="https://t.me/botfather">@BotFather</a>, obtain its token and use it in the testing instance of your code.</p>
|
||||
<p>All further testing and debugging can happen privately on the new bot, without affecting the original instance.</p>
|
||||
<blockquote>
|
||||
<p>If you need to share file references across bots, note that the <code>file_id</code> field is tied to a single bot id, so your test instance cannot use a shared <code>file_id</code> database to quickly send media – files must be individually reuploaded.</p>
|
||||
</blockquote>
|
||||
<h4><a class="anchor" href="#dedicated-test-environment" id="dedicated-test-environment" name="dedicated-test-environment"><i class="anchor-icon"></i></a>Dedicated test environment</h4>
|
||||
<h4><a class="anchor" name="dedicated-test-environment" href="#dedicated-test-environment"><i class="anchor-icon"></i></a>Dedicated test environment</h4>
|
||||
<p>Telegram also offers a dedicated <strong>test environment</strong> suitable for more advanced testing. Bots and users in this environment generally have more flexible restrictions – for example:</p>
|
||||
<ul>
|
||||
<li>When working with the test environment, you may use HTTP links without TLS to test your <a href="https://core.telegram.org/bots/features#web-apps">Web Apps</a> or <a href="https://core.telegram.org/bots/features#web-login">Web Login</a>.</li>
|
||||
|
@ -417,62 +462,55 @@ If you target the general public, your code should always fall back to either th
|
|||
<blockquote>
|
||||
<p><strong>Flood limits</strong> are not raised in the test environment, and may at times be stricter. To minimize how this impacts your bot, you should make sure that it handles errors with retry policies and does not depend on hardcoded limit values.</p>
|
||||
</blockquote>
|
||||
<h4><a class="anchor" href="#creating-a-bot-in-the-test-environment" id="creating-a-bot-in-the-test-environment" name="creating-a-bot-in-the-test-environment"><i class="anchor-icon"></i></a>Creating a bot in the test environment</h4>
|
||||
<h4><a class="anchor" name="creating-a-bot-in-the-test-environment" href="#creating-a-bot-in-the-test-environment"><i class="anchor-icon"></i></a>Creating a bot in the test environment</h4>
|
||||
<p>The test environment is <strong>completely separate</strong> from the main environment, so you will need to create a new user account and a new bot with <a href="https://t.me/botfather">@BotFather</a>.</p>
|
||||
<p>To create an account and log in, use either of the following:</p>
|
||||
<ul>
|
||||
<li><strong>iOS</strong>: tap 10 times on the Settings icon > Accounts > Login to another account > Test.</li>
|
||||
<li><strong>Telegram Desktop</strong>: open ☰ Settings > Shift + Alt + Right click 'Add Account' and select 'Test Server'.</li>
|
||||
<li><strong>macOS</strong>: click the Settings icon 10 times to open the Debug Menu, ⌘ + click 'Add Account' and log in via phone number.</li>
|
||||
<li><strong>Telegram Desktop</strong>: open ☰ Settings > Shift + Alt + Right click 'Add Account' and select 'Test Server'.</li>
|
||||
<li><strong>macOS</strong>: click the Settings icon 10 times to open the Debug Menu, ⌘ + click 'Add Account' and log in via phone number.</li>
|
||||
</ul>
|
||||
<p>After logging in, simply <a href="#creating-a-new-bot">create a new bot</a> following the standard procedure and send your requests to the Test Bot API in this format:</p>
|
||||
<pre><code>https://api.telegram.org/bot<token>/test/METHOD_NAME</code></pre>
|
||||
<blockquote>
|
||||
<p>When working with the test environment, you may use HTTP links without TLS in the <code>url</code> field of both <a href="/bots/api#loginurl">LoginUrl</a> and <a href="/bots/api#webappinfo">WebAppInfo</a>.</p>
|
||||
</blockquote>
|
||||
<h4><a class="anchor" href="#status-alerts" id="status-alerts" name="status-alerts"><i class="anchor-icon"></i></a>Status alerts</h4>
|
||||
<h4><a class="anchor" name="status-alerts" href="#status-alerts"><i class="anchor-icon"></i></a>Status alerts</h4>
|
||||
<p>Millions choose Telegram for its speed. To best benefit users, your bot also <strong>needs to be responsive</strong>. In order to help developers keep their bots in shape, <a href="https://t.me/botfather">@BotFather</a> will send <strong>status alerts</strong> if it sees something is wrong.</p>
|
||||
<p>We check the number of replies and the <em>request/response</em> conversion rate for popular bots (~300 requests per minute, this value may change in the future). If your bot returns an <strong>abnormally low number</strong>, you will receive a notification from <a href="https://t.me/botfather">@BotFather</a>.</p>
|
||||
<h5><a class="anchor" href="#responding-to-alerts" id="responding-to-alerts" name="responding-to-alerts"><i class="anchor-icon"></i></a>Responding to alerts</h5>
|
||||
<h5><a class="anchor" name="responding-to-alerts" href="#responding-to-alerts"><i class="anchor-icon"></i></a>Responding to alerts</h5>
|
||||
<p>By default, <strong>you will only get one alert per bot per hour</strong>. </p>
|
||||
<p>Each alert has the following buttons:</p>
|
||||
<ul>
|
||||
<li><strong>Fixed</strong> - Use this if you found an issue with your bot and fixed it. If you press the fix button, we will resume sending alerts in the regular way so that you can see if your fix worked within 5-10 minutes instead of having to wait for an hour.</li>
|
||||
<li><strong>Support</strong> - Use this to open a chat with <a href="https://t.me/botsupport">@BotSupport</a> if you don't see any issues with your bot or if you think the problem is on our side.</li>
|
||||
<li><strong>Mute for 8h/1w</strong> - Use this if you can't fix your bot at the moment. This will disable all alerts for the bot in question for the specified period of time. <strong>We do not recommend</strong> using this option since your users may migrate to a more stable bot. You can unmute alerts in your bot's settings via <a href="https://t.me/botfather">@BotFather</a>.</li>
|
||||
<li><strong>Support</strong> - Use this to open a chat with <a href="https://t.me/botsupport">@BotSupport</a> if you don't see any issues with your bot or if you think the problem is on our side.</li>
|
||||
<li><strong>Mute for 8h/1w</strong> - Use this if you can't fix your bot at the moment. This will disable all alerts for the bot in question for the specified period of time. <strong>We do not recommend</strong> using this option since your users may migrate to a more stable bot. You can unmute alerts in your bot's settings via <a href="https://t.me/botfather">@BotFather</a>.</li>
|
||||
</ul>
|
||||
<h5><a class="anchor" href="#monitored-issues" id="monitored-issues" name="monitored-issues"><i class="anchor-icon"></i></a>Monitored issues</h5>
|
||||
<h5><a class="anchor" name="monitored-issues" href="#monitored-issues"><i class="anchor-icon"></i></a>Monitored issues</h5>
|
||||
<p>We currently notify you about the following issues:</p>
|
||||
<ul>
|
||||
<li>
|
||||
<p><strong>Too few private messages are sent.</strong> Value: <strong>{value}</strong> - Your bot is sending far fewer messages than it did in previous weeks. This is useful for newsletter-style bots that send messages without prompts from users. The larger the value, the more significant the difference.</p>
|
||||
<li><p><strong>Too few private messages are sent.</strong> Value: <strong>{value}</strong> - Your bot is sending far fewer messages than it did in previous weeks. This is useful for newsletter-style bots that send messages without prompts from users. The larger the value, the more significant the difference.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Too few replies to incoming private messages</strong>. Conversion rate: <strong>{value}</strong> - Your bot is not replying to all messages that are being sent to it (the request/response conversion rate for your bot was too low for at least two of the last three 5-minute periods). </p>
|
||||
<li><p><strong>Too few replies to incoming private messages</strong>. Conversion rate: <strong>{value}</strong> - Your bot is not replying to all messages that are being sent to it (the request/response conversion rate for your bot was too low for at least two of the last three 5-minute periods). </p>
|
||||
</li>
|
||||
</ul>
|
||||
<blockquote>
|
||||
<p>To provide a good user experience, please respond to all messages that are sent to your bot. Respond to message updates by calling send… methods (e.g. <a href="/bots/api#sendmessage">sendMessage</a>).</p>
|
||||
</blockquote>
|
||||
<ul>
|
||||
<li>
|
||||
<p><strong>Too few answers to inline queries</strong>. Conversion rate: <strong>{value}</strong> - Your bot is not replying to all inline queries that are being sent to it, calculated in the same way as above. Respond to <code>inline_query</code> updates by calling <a href="/bots/api#answerinlinequery">answerInlineQuery</a>.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Too few answers to callback queries</strong>. Conversion rate: <strong>{value}</strong></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Too few answers to callback game queries</strong>. Conversion rate: <strong>{value}</strong> - Your bot is not replying to all callback queries that are being sent to it (with or without games), calculated in the same way as above. Respond to <code>callback_query</code> updates by calling <a href="/bots/api#answercallbackquery">answerCallbackQuery</a>.</p>
|
||||
</li>
|
||||
<li><strong>Too few answers to inline queries</strong>. Conversion rate: <strong>{value}</strong> - Your bot is not replying to all inline queries that are being sent to it, calculated in the same way as above. Respond to <code>inline_query</code> updates by calling <a href="/bots/api#answerinlinequery">answerInlineQuery</a>.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#local-bot-api" id="local-bot-api" name="local-bot-api"><i class="anchor-icon"></i></a>Local Bot API</h4>
|
||||
<p>You can host and work with <strong>your own instance</strong> of our open-source <a href="/bots/api">Bot API</a>.
|
||||
The <strong>source code</strong> is available <a href="https://github.com/tdlib/telegram-bot-api">here</a>, along with a quick <a href="https://github.com/tdlib/telegram-bot-api#installation">installation guide</a>.</p>
|
||||
<ul>
|
||||
<li><strong>Too few answers to callback queries</strong>. Conversion rate: <strong>{value}</strong></li>
|
||||
<li><strong>Too few answers to callback game queries</strong>. Conversion rate: <strong>{value}</strong> - Your bot is not replying to all callback queries that are being sent to it (with or without games), calculated in the same way as above. Respond to <code>callback_query</code> updates by calling <a href="/bots/api#answercallbackquery">answerCallbackQuery</a>.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" name="local-bot-api" href="#local-bot-api"><i class="anchor-icon"></i></a>Local Bot API</h4>
|
||||
<p>You can host and work with <strong>your own instance</strong> of our open-source <a href="/bots/api">Bot API</a>.<br>The <strong>source code</strong> is available <a href="https://github.com/tdlib/telegram-bot-api">here</a>, along with a quick <a href="https://github.com/tdlib/telegram-bot-api#installation">installation guide</a>.</p>
|
||||
<p>After <strong>installing the server</strong>, remember to use the <a href="/bots/api#logout">logOut</a> method before <strong>redirecting requests</strong> to your new local API URL.</p>
|
||||
<blockquote>
|
||||
<p>Your local instance runs on port <code>8081</code> by default and will only accept HTTP requests, so a TLS termination proxy has to be used to handle remote HTTPS requests.</p>
|
||||
</blockquote>
|
||||
<p>By hosting our API locally you'll gain access to <strong>some upgrades</strong>, including:</p>
|
||||
<p>By hosting our API locally you'll gain access to <strong>some upgrades</strong>, including:</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -504,36 +542,31 @@ The <strong>source code</strong> is available <a href="https://github.com/tdlib/
|
|||
</tbody>
|
||||
</table>
|
||||
<blockquote>
|
||||
<p>You can find an exhaustive list <a href="/bots/api#using-a-local-bot-api-server">here</a>.
|
||||
All limits may be subject to change in the future, so make sure to follow <a href="https://t.me/botnews">@BotNews</a>.</p>
|
||||
<p>You can find an exhaustive list <a href="/bots/api#using-a-local-bot-api-server">here</a>.<br>All limits may be subject to change in the future, so make sure to follow <a href="https://t.me/botnews">@BotNews</a>.</p>
|
||||
</blockquote>
|
||||
<hr>
|
||||
<h3><a class="anchor" href="#botfather" id="botfather" name="botfather"><i class="anchor-icon"></i></a>BotFather</h3>
|
||||
<h3><a class="anchor" name="botfather" href="#botfather"><i class="anchor-icon"></i></a>BotFather</h3>
|
||||
<p>Below is a detailed guide to using <a href="https://t.me/botfather">@BotFather</a>, Telegram’s tool for <strong>creating</strong> and <strong>managing</strong> bots.</p>
|
||||
<h4><a class="anchor" href="#creating-a-new-bot" id="creating-a-new-bot" name="creating-a-new-bot"><i class="anchor-icon"></i></a>Creating a new bot</h4>
|
||||
<h4><a class="anchor" name="creating-a-new-bot" href="#creating-a-new-bot"><i class="anchor-icon"></i></a>Creating a new bot</h4>
|
||||
<p>Use the <code>/newbot</code> command to create a new bot. <a href="https://t.me/botfather">@BotFather</a> will ask you for a name and username, then generate an authentication token for your new bot.</p>
|
||||
<ul>
|
||||
<li>
|
||||
<p>The <strong>name</strong> of your bot is displayed in contact details and elsewhere.</p>
|
||||
<li><p>The <strong>name</strong> of your bot is displayed in contact details and elsewhere.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>The <strong>username</strong> is a short name, used in search, mentions and t.me links. Usernames are 5-32 characters long and not case sensitive – but may only include Latin characters, numbers, and underscores. Your bot's username must end in 'bot’, like 'tetris_bot' or 'TetrisBot'.</p>
|
||||
<li><p>The <strong>username</strong> is a short name, used in search, mentions and t.me links. Usernames are 5-32 characters long and not case sensitive – but may only include Latin characters, numbers, and underscores. Your bot's username must end in 'bot’, like 'tetris_bot' or 'TetrisBot'.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>The <strong>token</strong> is a string, like <code>110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw</code>, which is required to authorize the bot and send requests to the Bot API. Keep your token secure and store it safely, it can be used by anyone to control your bot. </p>
|
||||
<li><p>The <strong>token</strong> is a string, like <code>110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw</code>, which is required to authorize the bot and send requests to the Bot API. Keep your token secure and store it safely, it can be used by anyone to control your bot. </p>
|
||||
</li>
|
||||
</ul>
|
||||
<blockquote>
|
||||
<p>Unlike the bot’s name, the username cannot be changed later – so choose it carefully.
|
||||
When sending a request to api.telegram.org, remember to prefix the word ‘bot’ to your token.</p>
|
||||
<p>Unlike the bot’s name, the username cannot be changed later – so choose it carefully.<br>When sending a request to api.telegram.org, remember to prefix the word ‘bot’ to your token.</p>
|
||||
</blockquote>
|
||||
<h4><a class="anchor" href="#about-text-description-and-profile-media" id="about-text-description-and-profile-media" name="about-text-description-and-profile-media"><i class="anchor-icon"></i></a>About text, description and profile media</h4>
|
||||
<p>When new users open your bot, they will be met with a helpful description in a box titled "What can this bot do?".</p>
|
||||
<h4><a class="anchor" name="about-text-description-and-profile-media" href="#about-text-description-and-profile-media"><i class="anchor-icon"></i></a>About text, description and profile media</h4>
|
||||
<p>When new users open your bot, they will be met with a helpful description in a box titled “What can this bot do?”.</p>
|
||||
<p>Properly <a href="#edit-bots">setting this field</a> in <a href="https://t.me/botfather">@BotFather</a> allows everyone to immediately get an idea of what your bot can do – your description should be <strong>brief</strong>, <strong>to the point</strong> and <strong>on topic</strong>.</p>
|
||||
<blockquote>
|
||||
<p>You can also add a photo or video to this field with <code>Edit Description Picture</code> in <a href="https://t.me/botfather">@BotFather</a>.</p>
|
||||
</blockquote>
|
||||
<p>Additionally, just like normal users, bots also come with a <strong>short bio</strong> available on their profile. If you didn't specify this field while first creating your bot, you can set it at any time with the <code>/setabouttext</code> command in <a href="https://t.me/botfather">@BotFather</a>. Users can interact with many bots and they won't have access to their description after starting them – having a quick reminder of the bot's purpose can be very useful.</p>
|
||||
<p>Additionally, just like normal users, bots also come with a <strong>short bio</strong> available on their profile. If you didn't specify this field while first creating your bot, you can set it at any time with the <code>/setabouttext</code> command in <a href="https://t.me/botfather">@BotFather</a>. Users can interact with many bots and they won't have access to their description after starting them – having a quick reminder of the bot's purpose can be very useful.</p>
|
||||
<blockquote>
|
||||
<p>Note that both the <strong>Description</strong> and the <strong>About text</strong> can be <a href="https://core.telegram.org/bots/api#setmydescription">natively localized</a> – each user will automatically see the correct translation for their language.</p>
|
||||
</blockquote>
|
||||
|
@ -541,38 +574,36 @@ When sending a request to api.telegram.org, remember to prefix the word ‘bot
|
|||
<blockquote>
|
||||
<p>Starting from April 21, 2023 (<a href="https://telegram.org/blog/shareable-folders-custom-wallpapers">Telegram 9.6</a>), you can edit your bot directly from its profile page – including setting a custom <strong>profile video</strong>.</p>
|
||||
</blockquote>
|
||||
<h4><a class="anchor" href="#generating-an-authentication-token" id="generating-an-authentication-token" name="generating-an-authentication-token"><i class="anchor-icon"></i></a>Generating an authentication token</h4>
|
||||
<h4><a class="anchor" name="generating-an-authentication-token" href="#generating-an-authentication-token"><i class="anchor-icon"></i></a>Generating an authentication token</h4>
|
||||
<p>If your existing token is <strong>compromised</strong> or <strong>you lost it</strong> for some reason, use the <code>/token</code> command to generate a new one.</p>
|
||||
<h4><a class="anchor" href="#transfer-ownership" id="transfer-ownership" name="transfer-ownership"><i class="anchor-icon"></i></a>Transfer ownership</h4>
|
||||
<p>You can transfer ownership of your bot <strong>to another user</strong>.
|
||||
To do this, send <code>/mybots</code>, select your bot, then <em>transfer ownership</em>.
|
||||
You can only transfer a bot to users who have interacted with it at least once.</p>
|
||||
<h4><a class="anchor" name="transfer-ownership" href="#transfer-ownership"><i class="anchor-icon"></i></a>Transfer ownership</h4>
|
||||
<p>You can transfer ownership of your bot <strong>to another user</strong>.<br>To do this, send <code>/mybots</code>, select your bot, then <em>transfer ownership</em>.<br>You can only transfer a bot to users who have interacted with it at least once.</p>
|
||||
<blockquote>
|
||||
<p>Transferring ownership will give full control of the bot to another user – they will be able to access the bot’s messages and even delete it. The transfer is permanent, so please consider it carefully.</p>
|
||||
</blockquote>
|
||||
<h4><a class="anchor" href="#botfather-commands" id="botfather-commands" name="botfather-commands"><i class="anchor-icon"></i></a>BotFather commands</h4>
|
||||
<h4><a class="anchor" name="botfather-commands" href="#botfather-commands"><i class="anchor-icon"></i></a>BotFather commands</h4>
|
||||
<p>The remaining commands are pretty self-explanatory:</p>
|
||||
<ul>
|
||||
<li>/mybots – returns a list of your bots with handy controls to edit their settings.</li>
|
||||
<li>/mygames – does the same for your games.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#edit-bots" id="edit-bots" name="edit-bots"><i class="anchor-icon"></i></a>Edit bots</h4>
|
||||
<h4><a class="anchor" name="edit-bots" href="#edit-bots"><i class="anchor-icon"></i></a>Edit bots</h4>
|
||||
<p>To edit your bot, you have two options.</p>
|
||||
<p>You can use the available commands:</p>
|
||||
<ul>
|
||||
<li>/setname – change your bot's <strong>name</strong>.</li>
|
||||
<li>/setdescription – change the bot's <strong>description</strong> (short text up to 512 characters). Users will see this text at the beginning of the conversation with the bot, titled '<em>What can this bot do?</em>'.</li>
|
||||
<li>/setabouttext – change the bot's <strong>about info</strong>, a shorter text up to 120 characters. Users will see this text on the bot's profile page. When they share your bot with someone, this text is sent together with the link.</li>
|
||||
<li>/setuserpic – change the bot's <strong>profile picture</strong>. </li>
|
||||
<li>/setname – change your bot's <strong>name</strong>.</li>
|
||||
<li>/setdescription – change the bot's <strong>description</strong> (short text up to 512 characters). Users will see this text at the beginning of the conversation with the bot, titled '<em>What can this bot do?</em>'.</li>
|
||||
<li>/setabouttext – change the bot's <strong>about info</strong>, a shorter text up to 120 characters. Users will see this text on the bot's profile page. When they share your bot with someone, this text is sent together with the link.</li>
|
||||
<li>/setuserpic – change the bot's <strong>profile picture</strong>. </li>
|
||||
<li>/setcommands – change the list of <strong>commands</strong> supported by your bot. Users will see these commands as suggestions when they type <code>/</code> in the chat with your bot. See <a href="#commands">commands</a> for more info.</li>
|
||||
<li>/setdomain – link a <strong>website domain</strong> to your bot. See the <a href="#login-widget">login widget</a> section.</li>
|
||||
<li>/deletebot – delete your bot and <strong>free its username</strong>. Cannot be undone.</li>
|
||||
</ul>
|
||||
<p>Or you can use the <code>/mybots</code> command, tap on your bot and use the modern inline interface to edit it.</p>
|
||||
<blockquote>
|
||||
<p>Starting from April 21, 2023 (<a href="https://telegram.org/blog/shareable-folders-custom-wallpapers">Telegram 9.6</a>), you can edit your bot's public-facing info directly from its profile page – including setting a custom <strong>profile video</strong>.</p>
|
||||
<p>Starting from April 21, 2023 (<a href="https://telegram.org/blog/shareable-folders-custom-wallpapers">Telegram 9.6</a>), you can edit your bot's public-facing info directly from its profile page – including setting a custom <strong>profile video</strong>.</p>
|
||||
</blockquote>
|
||||
<h4><a class="anchor" href="#edit-settings" id="edit-settings" name="edit-settings"><i class="anchor-icon"></i></a>Edit settings</h4>
|
||||
<h4><a class="anchor" name="edit-settings" href="#edit-settings"><i class="anchor-icon"></i></a>Edit settings</h4>
|
||||
<ul>
|
||||
<li>/setinline – toggle <strong>inline mode</strong> for your bot.</li>
|
||||
<li>/setinlinegeo – request <strong>location data</strong> to provide location-based inline results.</li>
|
||||
|
@ -580,7 +611,7 @@ You can only transfer a bot to users who have interacted with it at least once.<
|
|||
<li>/setinlinefeedback – toggle whether the API should <strong>send updates about the results</strong> chosen by users. See an in-depth explanation <a href="/bots/inline#collecting-feedback">here</a>.</li>
|
||||
<li>/setprivacy – set which messages your bot will receive when added to a group. See <a href="#privacy-mode">privacy-mode</a> for more info.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#manage-games" id="manage-games" name="manage-games"><i class="anchor-icon"></i></a>Manage games</h4>
|
||||
<h4><a class="anchor" name="manage-games" href="#manage-games"><i class="anchor-icon"></i></a>Manage games</h4>
|
||||
<ul>
|
||||
<li>/newgame – create a new game.</li>
|
||||
<li>/listgames – see a list of your games.</li>
|
||||
|
@ -594,8 +625,9 @@ You can only transfer a bot to users who have interacted with it at least once.<
|
|||
<p>With this information, you are ready to proceed to our <a href="/bots/api">Full API Reference for Developers</a>.</p>
|
||||
<ul>
|
||||
<li>If you have any questions, check out our <a href="/bots/faq">Bot FAQ</a>.</li>
|
||||
<li>If you're experiencing issues with our API, please contact <a href="https://t.me/botsupport">@BotSupport</a> on Telegram.</li>
|
||||
</ul></div>
|
||||
<li>If you're experiencing issues with our API, please contact <a href="https://t.me/botsupport">@BotSupport</a> on Telegram.</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
@ -47,341 +47,209 @@
|
|||
</blockquote>
|
||||
<p>This page lists some libraries and frameworks <strong>developed by the Telegram community</strong> – you should take care to report any bugs you may find to the respective developers, as these projects are not maintained by Telegram.</p>
|
||||
<p>Ping us on <a href="https://telegram.me/botsupport">@BotSupport</a> if you would like your library to appear on this page.</p>
|
||||
<h4><a class="anchor" href="#php" id="php" name="php"><i class="anchor-icon"></i></a>PHP</h4>
|
||||
<h4><a class="anchor" name="php" href="#php"><i class="anchor-icon"></i></a>PHP</h4>
|
||||
<ul>
|
||||
<li>
|
||||
<p><strong>Nutgram</strong>. The Telegram bot framework that doesn't drive you nuts.
|
||||
<a href="https://github.com/nutgram/nutgram">https://github.com/nutgram/nutgram</a></p>
|
||||
<li><p><strong>Nutgram</strong>. The Telegram bot framework that doesn't drive you nuts.<br><a href="https://github.com/nutgram/nutgram">https://github.com/nutgram/nutgram</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Telegraph</strong>. A Laravel package for fluently interacting with Telegram Bots.
|
||||
<a href="https://github.com/def-studio/telegraph">https://github.com/def-studio/telegraph</a></p>
|
||||
<li><p><strong>Telegraph</strong>. A Laravel package for fluently interacting with Telegram Bots.<br><a href="https://github.com/def-studio/telegraph">https://github.com/def-studio/telegraph</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>tgWebValid</strong>. Library for Telegram Web App User Validation and Telegram Login Widget for PHP.
|
||||
<a href="https://github.com/CrazyTapok-bit/tgWebValid">https://github.com/CrazyTapok-bit/tgWebValid</a></p>
|
||||
<li><p><strong>tgWebValid</strong>. Library for Telegram Web App User Validation and Telegram Login Widget for PHP.<br><a href="https://github.com/CrazyTapok-bit/tgWebValid">https://github.com/CrazyTapok-bit/tgWebValid</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>BPT</strong>. A simple library for working with Telegram Api.
|
||||
<a href="https://github.com/BPTproto/BPT">https://github.com/BPTproto/BPT</a>
|
||||
<a href="https://github.com/BPTproto/BPT-Multi">https://github.com/BPTproto/BPT-Multi</a></p>
|
||||
<li><p><strong>BPT</strong>. A simple library for working with Telegram Api.<br><a href="https://github.com/BPTproto/BPT">https://github.com/BPTproto/BPT</a><br><a href="https://github.com/BPTproto/BPT-Multi">https://github.com/BPTproto/BPT-Multi</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>LaraGram</strong>. An advanced framework for Telegram Bot development.
|
||||
<a href="https://github.com/laraXgram/LaraGram">https://github.com/laraXgram/LaraGram</a></p>
|
||||
<li><p><strong>LaraGram</strong>. An advanced framework for Telegram Bot development.<br><a href="https://github.com/laraXgram/LaraGram">https://github.com/laraXgram/LaraGram</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>BotAPI</strong>. SDK for the Telegram Bot API.
|
||||
<a href="https://github.com/TelegramSDK/BotAPI">https://github.com/TelegramSDK/BotAPI</a></p>
|
||||
<li><p><strong>BotAPI</strong>. SDK for the Telegram Bot API.<br><a href="https://github.com/TelegramSDK/BotAPI">https://github.com/TelegramSDK/BotAPI</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>TuriBot</strong>. A simple way to communicate with Telegram APIs in PHP.
|
||||
<a href="https://github.com/davtur19/TuriBot">https://github.com/davtur19/TuriBot</a></p>
|
||||
<li><p><strong>TuriBot</strong>. A simple way to communicate with Telegram APIs in PHP.<br><a href="https://github.com/davtur19/TuriBot">https://github.com/davtur19/TuriBot</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>TelegramBotsApi</strong>. SDK for Telegram Bot API.
|
||||
<a href="https://github.com/kuvardin/TelegramBotsApi">https://github.com/kuvardin/TelegramBotsApi</a></p>
|
||||
<li><p><strong>TelegramBotsApi</strong>. SDK for Telegram Bot API.<br><a href="https://github.com/kuvardin/TelegramBotsApi">https://github.com/kuvardin/TelegramBotsApi</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>PHP Telegram Bot</strong>. PHP Telegram Bot based on the official Telegram Bot API.
|
||||
<a href="https://github.com/php-telegram-bot/core">https://github.com/php-telegram-bot/core</a></p>
|
||||
<li><p><strong>Telegram Bot API for PHP</strong>. PHP library to interact with Telegram Bot API.<br><a href="https://github.com/vjik/telegram-bot-api/">https://github.com/vjik/telegram-bot-api/</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Telegram Bot PHP</strong>. A library that makes using Telegram Bot API much easier.
|
||||
<a href="https://github.com/telegram-bot-php/core">https://github.com/telegram-bot-php/core</a></p>
|
||||
<li><p><strong>PHP Telegram Bot</strong>. PHP Telegram Bot based on the official Telegram Bot API.<br><a href="https://github.com/php-telegram-bot/core">https://github.com/php-telegram-bot/core</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>PHP Telegram API</strong>. A complete async capable Telegram Bot API implementation for PHP7.
|
||||
<a href="https://github.com/unreal4u/telegram-api">https://github.com/unreal4u/telegram-api</a></p>
|
||||
<li><p><strong>Telegram Bot PHP</strong>. A library that makes using Telegram Bot API much easier.<br><a href="https://github.com/telegram-bot-php/core">https://github.com/telegram-bot-php/core</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Bot API PHP SDK</strong>. Telegram Bot API PHP SDK. Supports Laravel out of the box.
|
||||
<a href="https://github.com/irazasyed/telegram-bot-sdk">https://github.com/irazasyed/telegram-bot-sdk</a></p>
|
||||
<li><p><strong>PHP Telegram API</strong>. A complete async capable Telegram Bot API implementation for PHP7.<br><a href="https://github.com/unreal4u/telegram-api">https://github.com/unreal4u/telegram-api</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>klev-o/telegram-bot-api</strong>. Simple and convenient object-oriented implementation Telegram Bot API with PHP version ^7.4 support.
|
||||
<a href="https://github.com/klev-o/telegram-bot-api">https://github.com/klev-o/telegram-bot-api</a></p>
|
||||
<li><p><strong>Bot API PHP SDK</strong>. Telegram Bot API PHP SDK. Supports Laravel out of the box.<br><a href="https://github.com/irazasyed/telegram-bot-sdk">https://github.com/irazasyed/telegram-bot-sdk</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>TeleBot</strong>. Easy way to create Telegram bots in PHP. Rich Laravel support out of the box.
|
||||
<a href="https://github.com/westacks/telebot">https://github.com/westacks/telebot</a></p>
|
||||
<li><p><strong>klev-o/telegram-bot-api</strong>. Simple and convenient object-oriented implementation Telegram Bot API.<br><a href="https://github.com/klev-o/telegram-bot-api">https://github.com/klev-o/telegram-bot-api</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>TgBotLib</strong>. Telegram Bot Library for ncc.
|
||||
<a href="https://github.com/nosial/TgBotLib">https://github.com/nosial/TgBotLib</a></p>
|
||||
<li><p><strong>TeleBot</strong>. Easy way to create Telegram bots in PHP. Rich Laravel support out of the box.<br><a href="https://github.com/westacks/telebot">https://github.com/westacks/telebot</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>NeleBot X Framework</strong>. Framework for Telegram Bot API.
|
||||
<a href="https://github.com/NeleB54Gold/NeleBotX">https://github.com/NeleB54Gold/NeleBotX</a></p>
|
||||
<li><p><strong>TgBotLib</strong>. Telegram Bot Library for ncc.<br><a href="https://github.com/nosial/TgBotLib">https://github.com/nosial/TgBotLib</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>PHP Telegram Bot Api</strong>. Native PHP Wrapper for Telegram BOT API.
|
||||
<a href="https://github.com/TelegramBot/Api">https://github.com/TelegramBot/Api</a></p>
|
||||
<li><p><strong>NeleBot X Framework</strong>. Framework for Telegram Bot API.<br><a href="https://github.com/NeleB54Gold/NeleBotX">https://github.com/NeleB54Gold/NeleBotX</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>NovaGram</strong>. An Object-Oriented PHP library for Telegram Bots.
|
||||
<a href="https://github.com/skrtdev/NovaGram">https://github.com/skrtdev/NovaGram</a></p>
|
||||
<li><p><strong>PHP Telegram Bot Api</strong>. Native PHP Wrapper for Telegram BOT API.<br><a href="https://github.com/TelegramBot/Api">https://github.com/TelegramBot/Api</a></p>
|
||||
</li>
|
||||
<li><p><strong>NovaGram</strong>. An Object-Oriented PHP library for Telegram Bots.<br><a href="https://github.com/skrtdev/NovaGram">https://github.com/skrtdev/NovaGram</a></p>
|
||||
</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#go" id="go" name="go"><i class="anchor-icon"></i></a>Go</h4>
|
||||
<h4><a class="anchor" name="go" href="#go"><i class="anchor-icon"></i></a>Go</h4>
|
||||
<ul>
|
||||
<li>
|
||||
<p><strong>Golang Telegram Bot library</strong>. An autogenerated wrapper for the Telegram Bot API. Inspired by the python-telegram-bot library.
|
||||
<a href="https://github.com/paulsonoflars/gotgbot">https://github.com/paulsonoflars/gotgbot</a></p>
|
||||
<li><p><strong>Golang Telegram Bot library</strong>. An autogenerated wrapper for the Telegram Bot API.<br><a href="https://github.com/paulsonoflars/gotgbot">https://github.com/paulsonoflars/gotgbot</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Telego</strong>. Telegram Bot API library.
|
||||
<a href="https://github.com/mymmrac/telego">https://github.com/mymmrac/telego</a></p>
|
||||
<li><p><strong>Telego</strong>. Telegram Bot API library.<br><a href="https://github.com/mymmrac/telego">https://github.com/mymmrac/telego</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Golang Telegram Bot</strong>. Telegram Bot API Go framework.
|
||||
<a href="https://github.com/go-telegram/bot">https://github.com/go-telegram/bot</a></p>
|
||||
<li><p><strong>Golang Telegram Bot</strong>. Telegram Bot API Go framework.<br><a href="https://github.com/go-telegram/bot">https://github.com/go-telegram/bot</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>go-tg</strong>. Library for accessing Telegram Bot API, with batteries for building complex bots included.
|
||||
<a href="https://github.com/mr-linch/go-tg">https://github.com/mr-linch/go-tg</a></p>
|
||||
<li><p><strong>go-tg</strong>. Library for accessing Telegram Bot API, with batteries for building complex bots included.<br><a href="https://github.com/mr-linch/go-tg">https://github.com/mr-linch/go-tg</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Telegram Bot API: Go implementation</strong>. A Telegram IM bots API implementation.
|
||||
<a href="https://github.com/temoon/telegram-bots-api">https://github.com/temoon/telegram-bots-api</a></p>
|
||||
<li><p><strong>Telegram Bot API: Go implementation</strong>. A Telegram IM bots API implementation.<br><a href="https://github.com/temoon/telegram-bots-api">https://github.com/temoon/telegram-bots-api</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>echotron</strong>. An elegant and concurrent library for the Telegram Bot API.
|
||||
<a href="https://github.com/NicoNex/echotron">https://github.com/NicoNex/echotron</a></p>
|
||||
<li><p><strong>echotron</strong>. An elegant and concurrent library for the Telegram Bot API.<br><a href="https://github.com/NicoNex/echotron">https://github.com/NicoNex/echotron</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Telegram Bot API helper for Golang</strong>. A Telegram Bot API wrapper.
|
||||
<a href="https://github.com/meinside/telegram-bot-go">https://github.com/meinside/telegram-bot-go</a></p>
|
||||
<li><p><strong>Telegram Bot API helper for Golang</strong>. A Telegram Bot API wrapper.<br><a href="https://github.com/meinside/telegram-bot-go">https://github.com/meinside/telegram-bot-go</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>telebot</strong>. A Telegram bot framework.
|
||||
<a href="https://github.com/tucnak/telebot">https://github.com/tucnak/telebot</a></p>
|
||||
<li><p><strong>telebot</strong>. A Telegram bot framework.<br><a href="https://github.com/tucnak/telebot">https://github.com/tucnak/telebot</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Telegrambot</strong>. Telegram Bot API in Go, but with more clean code.
|
||||
<a href="https://github.com/nickname76/telegrambot">https://github.com/nickname76/telegrambot</a></p>
|
||||
<li><p><strong>Telegrambot</strong>. Telegram Bot API in Go, but with more clean code.<br><a href="https://github.com/nickname76/telegrambot">https://github.com/nickname76/telegrambot</a></p>
|
||||
</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#python" id="python" name="python"><i class="anchor-icon"></i></a>Python</h4>
|
||||
<h4><a class="anchor" name="python" href="#python"><i class="anchor-icon"></i></a>Python</h4>
|
||||
<ul>
|
||||
<li>
|
||||
<p><strong>AIOGram</strong>. A pretty simple and fully asynchronous library for Telegram Bot API written with asyncio and aiohttp.
|
||||
<a href="https://github.com/aiogram/aiogram">https://github.com/aiogram/aiogram</a></p>
|
||||
<li><p><strong>AIOGram</strong>. A pretty simple and fully asynchronous library for Telegram Bot API written with asyncio and aiohttp.<br><a href="https://github.com/aiogram/aiogram">https://github.com/aiogram/aiogram</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>python-telegram-bot</strong>. A wrapper you can't refuse.
|
||||
<a href="https://github.com/python-telegram-bot/python-telegram-bot">https://github.com/python-telegram-bot/python-telegram-bot</a></p>
|
||||
<li><p><strong>python-telegram-bot</strong>. A wrapper you can't refuse.<br><a href="https://github.com/python-telegram-bot/python-telegram-bot">https://github.com/python-telegram-bot/python-telegram-bot</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>pyTelegramBotAPI</strong>. A simple, but extensible Python implementation for the Telegram Bot API.
|
||||
<a href="https://github.com/eternnoir/pyTelegramBotAPI">https://github.com/eternnoir/pyTelegramBotAPI</a></p>
|
||||
<li><p><strong>pyTelegramBotAPI</strong>. A simple, but extensible Python implementation for the Telegram Bot API.<br><a href="https://github.com/eternnoir/pyTelegramBotAPI">https://github.com/eternnoir/pyTelegramBotAPI</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>telegram-text</strong>. A Python markup module, which can be used with other frameworks.
|
||||
<a href="https://github.com/SKY-ALIN/telegram-text">https://github.com/SKY-ALIN/telegram-text</a></p>
|
||||
<li><p><strong>Wonda</strong>. A light, blazing fast framework for developing capable bots.<br><a href="https://github.com/wondergram-org/wonda">https://github.com/wondergram-org/wonda</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>TGramBot</strong>. A partially auto-generated and asynchronous Minimal Telegram Bot API framework.
|
||||
<a href="https://github.com/KeralaBots/TGramBot">https://github.com/KeralaBots/TGramBot</a></p>
|
||||
<li><p><strong>pure-teleapi</strong>. Pure declarative Telegram Bot API implementation with Pydantic models.<br><a href="https://github.com/AntonOvsyannikov/pure-teleapi">https://github.com/AntonOvsyannikov/pure-teleapi</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>OrigamiBot</strong>. A pythonic Telegram bot API library.
|
||||
<a href="https://github.com/cmd410/OrigamiBot">https://github.com/cmd410/OrigamiBot</a></p>
|
||||
<li><p><strong>telegram-text</strong>. A Python markup module, which can be used with other frameworks.<br><a href="https://github.com/SKY-ALIN/telegram-text">https://github.com/SKY-ALIN/telegram-text</a></p>
|
||||
</li>
|
||||
<li><p><strong>OrigamiBot</strong>. A pythonic Telegram bot API library.<br><a href="https://github.com/cmd410/OrigamiBot">https://github.com/cmd410/OrigamiBot</a></p>
|
||||
</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#rust" id="rust" name="rust"><i class="anchor-icon"></i></a>Rust</h4>
|
||||
<h4><a class="anchor" name="rust" href="#rust"><i class="anchor-icon"></i></a>Rust</h4>
|
||||
<ul>
|
||||
<li>
|
||||
<p><strong>Frankenstein</strong>. A Telegram Bot API client.
|
||||
<a href="https://github.com/ayrat555/frankenstein">https://github.com/ayrat555/frankenstein</a></p>
|
||||
<li><p><strong>Frankenstein</strong>. A Telegram Bot API client.<br><a href="https://github.com/ayrat555/frankenstein">https://github.com/ayrat555/frankenstein</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>teloxide</strong>. An elegant Telegram bots framework.
|
||||
<a href="https://github.com/teloxide/teloxide">https://github.com/teloxide/teloxide</a></p>
|
||||
<li><p><strong>Ferrisgram</strong>. An asynchronous autogenerated wrapper for the Telegram Bot API.<br><a href="https://github.com/ferrisgram/ferrisgram">https://github.com/ferrisgram/ferrisgram</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Ferrisgram</strong>. An asynchronous autogenerated wrapper for the Telegram Bot API.
|
||||
<a href="https://github.com/ferrisgram/ferrisgram">https://github.com/ferrisgram/ferrisgram</a></p>
|
||||
<li><p><strong>botapi-rs</strong>, A mildly competent autogenerated telegram api wrapper.<br><a href="https://github.com/fmeef/botapi-rs">https://github.com/fmeef/botapi-rs</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>tgbotapi</strong>. A library for using the Telegram Bot API.
|
||||
<a href="https://github.com/Syfaro/tgbotapi-rs">https://github.com/Syfaro/tgbotapi-rs</a></p>
|
||||
<li><p><strong>carapax</strong>. A Telegram Bot API framework.<br><a href="https://github.com/tg-rs/carapax">https://github.com/tg-rs/carapax</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>carapax</strong>. A Telegram Bot API framework.
|
||||
<a href="https://github.com/tg-rs/carapax">https://github.com/tg-rs/carapax</a></p>
|
||||
<li><p><strong>teloxide</strong>. An elegant Telegram bots framework.<br><a href="https://github.com/teloxide/teloxide">https://github.com/teloxide/teloxide</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>MOBOT</strong>. A Telegram Bot Library in Rust.
|
||||
<a href="https://github.com/0xfe/mobot">https://github.com/0xfe/mobot</a></p>
|
||||
<li><p><strong>tgbotapi</strong>. A library for using the Telegram Bot API.<br><a href="https://github.com/Syfaro/tgbotapi-rs">https://github.com/Syfaro/tgbotapi-rs</a></p>
|
||||
</li>
|
||||
<li><p><strong>MOBOT</strong>. A Telegram Bot Library in Rust.<br><a href="https://github.com/0xfe/mobot">https://github.com/0xfe/mobot</a></p>
|
||||
</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#net" id="net" name="net"><i class="anchor-icon"></i></a>.NET</h4>
|
||||
<h4><a class="anchor" name="net" href="#net"><i class="anchor-icon"></i></a>.NET</h4>
|
||||
<ul>
|
||||
<li>
|
||||
<p><strong>Telegram.bot</strong>. .NET Client for Telegram Bot API.
|
||||
<a href="https://github.com/TelegramBots/Telegram.Bot">https://github.com/TelegramBots/Telegram.Bot</a></p>
|
||||
<li><p><strong>Telegram.bot</strong>. .NET Client for Telegram Bot API.<br><a href="https://github.com/TelegramBots/Telegram.Bot">https://github.com/TelegramBots/Telegram.Bot</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Telegram.BotAPI for NET</strong>. One of the most complete libraries available to interact with the Telegram Bot API.
|
||||
<a href="https://github.com/Eptagone/Telegram.BotAPI">https://github.com/Eptagone/Telegram.BotAPI</a></p>
|
||||
<li><p><strong>Telegram.BotAPI for NET</strong>. One of the most complete libraries available to interact with the Telegram Bot API.<br><a href="https://github.com/Eptagone/Telegram.BotAPI">https://github.com/Eptagone/Telegram.BotAPI</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Telegram Bot Framework</strong>. A context based application framework for the C# TelegramBot library.
|
||||
<a href="https://github.com/MajMcCloud/TelegramBotFramework">https://github.com/MajMcCloud/TelegramBotFramework</a></p>
|
||||
<li><p><strong>Telegram Bot Framework</strong>. A context based application framework for the C# TelegramBot library.<br><a href="https://github.com/MajMcCloud/TelegramBotFramework">https://github.com/MajMcCloud/TelegramBotFramework</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>RxTelegram.Bot</strong>. RxTelegram uses a reactive approach to make Updates available.
|
||||
<a href="https://github.com/RxTelegram/RxTelegram.Bot">https://github.com/RxTelegram/RxTelegram.Bot</a></p>
|
||||
<li><p><strong>RxTelegram.Bot</strong>. RxTelegram uses a reactive approach to make Updates available.<br><a href="https://github.com/RxTelegram/RxTelegram.Bot">https://github.com/RxTelegram/RxTelegram.Bot</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Telegram.Bots</strong>. A .NET 5 wrapper for the Telegram Bot API.
|
||||
<a href="https://github.com/TelegramBotsAPI/Telegram.Bots">https://github.com/TelegramBotsAPI/Telegram.Bots</a></p>
|
||||
<li><p><strong>Telegram.Bots</strong>. A .NET 5 wrapper for the Telegram Bot API.<br><a href="https://github.com/TelegramBotsAPI/Telegram.Bots">https://github.com/TelegramBotsAPI/Telegram.Bots</a></p>
|
||||
</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#kotlin" id="kotlin" name="kotlin"><i class="anchor-icon"></i></a>Kotlin</h4>
|
||||
<h4><a class="anchor" name="kotlin" href="#kotlin"><i class="anchor-icon"></i></a>Kotlin</h4>
|
||||
<ul>
|
||||
<li>
|
||||
<p><strong>TelegramBotAPI</strong>. Type-safe library for work with Telegram Bot API.
|
||||
<a href="https://github.com/InsanusMokrassar/TelegramBotAPI">https://github.com/InsanusMokrassar/TelegramBotAPI</a></p>
|
||||
<li><p><strong>TelegramBotAPI</strong>. Type-safe library for work with Telegram Bot API.<br><a href="https://github.com/InsanusMokrassar/TelegramBotAPI">https://github.com/InsanusMokrassar/TelegramBotAPI</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Kotlin Telegram Bot</strong>. Telegram Bot API wrapper, with handy Kotlin DSL.
|
||||
<a href="https://github.com/vendelieu/telegram-bot">https://github.com/vendelieu/telegram-bot</a></p>
|
||||
<li><p><strong>Kotlin Telegram Bot</strong>. Telegram Bot API wrapper, with handy Kotlin DSL.<br><a href="https://github.com/vendelieu/telegram-bot">https://github.com/vendelieu/telegram-bot</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Kotlin Telegram Bot</strong>. A wrapper for the Telegram Bot API.
|
||||
<a href="https://github.com/kotlin-telegram-bot/kotlin-telegram-bot">https://github.com/kotlin-telegram-bot/kotlin-telegram-bot</a></p>
|
||||
<li><p><strong>Kotlin Telegram Bot</strong>. Library for creating scalable and expandable applications with hepful features.<br><a href="https://github.com/DEHuckaKpyT/telegram-bot">https://github.com/DEHuckaKpyT/telegram-bot</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>kt-telegram-bot</strong>. Telegram Bot API library for Kotlin language.
|
||||
<a href="https://github.com/elbekD/kt-telegram-bot">https://github.com/elbekD/kt-telegram-bot</a></p>
|
||||
<li><p><strong>Kotlin Telegram Bot</strong>. A wrapper for the Telegram Bot API.<br><a href="https://github.com/kotlin-telegram-bot/kotlin-telegram-bot">https://github.com/kotlin-telegram-bot/kotlin-telegram-bot</a></p>
|
||||
</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#c" id="c" name="c"><i class="anchor-icon"></i></a>C++</h4>
|
||||
<h4><a class="anchor" name="c" href="#c"><i class="anchor-icon"></i></a>C++</h4>
|
||||
<ul>
|
||||
<li>
|
||||
<p><strong>QTelegramBotAPI</strong>. Telegram Bot API on C++ and Qt.
|
||||
<a href="https://github.com/Modersi/TelegramBotAPI">https://github.com/Modersi/TelegramBotAPI</a></p>
|
||||
<li><p><strong>QTelegramBotAPI</strong>. Telegram Bot API on C++ and Qt.<br><a href="https://github.com/Modersi/TelegramBotAPI">https://github.com/Modersi/TelegramBotAPI</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>tgbot</strong>. A library for Telegram Bot API with generated API types and methods.
|
||||
<a href="https://github.com/egorpugin/tgbot">https://github.com/egorpugin/tgbot</a></p>
|
||||
<li><p><strong>tgbot</strong>. A library for Telegram Bot API with generated API types and methods.<br><a href="https://github.com/egorpugin/tgbot">https://github.com/egorpugin/tgbot</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>tgbot-cpp</strong>. A library for Telegram Bot API.
|
||||
<a href="https://github.com/reo7sp/tgbot-cpp">https://github.com/reo7sp/tgbot-cpp</a></p>
|
||||
<li><p><strong>tgbot-cpp</strong>. A library for Telegram Bot API.<br><a href="https://github.com/reo7sp/tgbot-cpp">https://github.com/reo7sp/tgbot-cpp</a></p>
|
||||
</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#ruby" id="ruby" name="ruby"><i class="anchor-icon"></i></a>Ruby</h4>
|
||||
<h4><a class="anchor" name="ruby" href="#ruby"><i class="anchor-icon"></i></a>Ruby</h4>
|
||||
<ul>
|
||||
<li>
|
||||
<p><strong>telegram-bot-ruby</strong>. Ruby wrapper for Telegram's Bot API.
|
||||
<a href="https://github.com/atipugin/telegram-bot-ruby">https://github.com/atipugin/telegram-bot-ruby</a></p>
|
||||
<li><p><strong>telegram-bot-ruby</strong>. Ruby wrapper for Telegram's Bot API.<br><a href="https://github.com/atipugin/telegram-bot-ruby">https://github.com/atipugin/telegram-bot-ruby</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Telegram::Bot</strong>. Ruby gem for building Telegram Bot with optional Rails integration.
|
||||
<a href="https://github.com/telegram-bot-rb/telegram-bot">https://github.com/telegram-bot-rb/telegram-bot</a></p>
|
||||
<li><p><strong>Telegram::Bot</strong>. Ruby gem for building Telegram Bot with optional Rails integration.<br><a href="https://github.com/telegram-bot-rb/telegram-bot">https://github.com/telegram-bot-rb/telegram-bot</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>TelegramWorkflow</strong>. A simple utility to help you organize the code to create Telegram bots.
|
||||
<a href="https://github.com/rsamoilov/telegram_workflow">https://github.com/rsamoilov/telegram_workflow</a></p>
|
||||
<li><p><strong>TelegramWorkflow</strong>. A simple utility to help you organize the code to create Telegram bots.<br><a href="https://github.com/rsamoilov/telegram_workflow">https://github.com/rsamoilov/telegram_workflow</a></p>
|
||||
</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#nodejs" id="nodejs" name="nodejs"><i class="anchor-icon"></i></a>Node.js</h4>
|
||||
<h4><a class="anchor" name="node-js" href="#node-js"><i class="anchor-icon"></i></a>Node.js</h4>
|
||||
<ul>
|
||||
<li>
|
||||
<p><strong>Telegraf</strong>. Modern Telegram Bot Framework for Node.js.
|
||||
<a href="https://github.com/telegraf/telegraf">https://github.com/telegraf/telegraf</a></p>
|
||||
<li><p><strong>Telegraf</strong>. Modern Telegram Bot Framework for Node.js.<br><a href="https://github.com/telegraf/telegraf">https://github.com/telegraf/telegraf</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Telenode</strong>. Lightweight Telegram API framework for Node.js.
|
||||
<a href="https://github.com/NivEz/telenode">https://github.com/NivEz/telenode</a></p>
|
||||
<li><p><strong>Telenode</strong>. Lightweight Telegram API framework for Node.js.<br><a href="https://github.com/NivEz/telenode">https://github.com/NivEz/telenode</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Node-Telegram-bot</strong>. Node.js module to interact with the official Telegram Bot API.
|
||||
<a href="https://github.com/yagop/node-telegram-bot-api">https://github.com/yagop/node-telegram-bot-api</a></p>
|
||||
<li><p><strong>Node-Telegram-bot</strong>. Node.js module to interact with the official Telegram Bot API.<br><a href="https://github.com/yagop/node-telegram-bot-api">https://github.com/yagop/node-telegram-bot-api</a></p>
|
||||
</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#typescript" id="typescript" name="typescript"><i class="anchor-icon"></i></a>TypeScript</h4>
|
||||
<h4><a class="anchor" name="typescript" href="#typescript"><i class="anchor-icon"></i></a>TypeScript</h4>
|
||||
<ul>
|
||||
<li>
|
||||
<p><strong>grammY</strong>. The Telegram Bot Framework.
|
||||
<a href="https://github.com/grammyjs/grammY">https://github.com/grammyjs/grammY</a></p>
|
||||
<li><p><strong>grammY</strong>. The Telegram Bot Framework.<br><a href="https://github.com/grammyjs/grammY">https://github.com/grammyjs/grammY</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>puregram</strong>. Powerful and modern telegram bot api sdk for node.js and typescript.
|
||||
<a href="https://github.com/nitreojs/puregram">https://github.com/nitreojs/puregram</a></p>
|
||||
<li><p><strong>puregram</strong>. Powerful and modern telegram bot api sdk for node.js and typescript.<br><a href="https://github.com/nitreojs/puregram">https://github.com/nitreojs/puregram</a></p>
|
||||
</li>
|
||||
<li><p><strong>typescript-telegram-bot-api</strong>. Telegram Bot API wrapper for Node.js written in TypeScript.<br><a href="https://github.com/Borodin/typescript-telegram-bot-api">https://github.com/Borodin/typescript-telegram-bot-api</a></p>
|
||||
</li>
|
||||
<li><p><strong>GramIO</strong>. Powerful, extensible and really type-safe Telegram Bot API framework.<br><a href="https://github.com/gramiojs/gramio">https://github.com/gramiojs/gramio</a></p>
|
||||
</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#java" id="java" name="java"><i class="anchor-icon"></i></a>Java</h4>
|
||||
<h4><a class="anchor" name="java" href="#java"><i class="anchor-icon"></i></a>Java</h4>
|
||||
<ul>
|
||||
<li>
|
||||
<p><strong>TelegramBots</strong>. A simple to use library to create Telegram Bots.
|
||||
<a href="https://github.com/rubenlagus/TelegramBots">https://github.com/rubenlagus/TelegramBots</a></p>
|
||||
<li><p><strong>TelegramBots</strong>. A simple to use library to create Telegram Bots.<br><a href="https://github.com/rubenlagus/TelegramBots">https://github.com/rubenlagus/TelegramBots</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Java API</strong>. Telegram Bot API for Java.
|
||||
<a href="https://github.com/pengrad/java-telegram-bot-api">https://github.com/pengrad/java-telegram-bot-api</a></p>
|
||||
<li><p><strong>Java API</strong>. Telegram Bot API for Java.<br><a href="https://github.com/pengrad/java-telegram-bot-api">https://github.com/pengrad/java-telegram-bot-api</a></p>
|
||||
</li>
|
||||
<li><p><strong>Teleight Bots</strong>. The most lightweight java telegram bot wrapper.<br><a href="https://github.com/Teleight/TeleightBots">https://github.com/Teleight/TeleightBots</a></p>
|
||||
</li>
|
||||
<li><p><strong>Telebof</strong>. Easy and modern Java Telegram Bot API.<br><a href="https://github.com/natanimn/Telebof">https://github.com/natanimn/Telebof</a></p>
|
||||
</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#scala" id="scala" name="scala"><i class="anchor-icon"></i></a>Scala</h4>
|
||||
<h4><a class="anchor" name="scala" href="#scala"><i class="anchor-icon"></i></a>Scala</h4>
|
||||
<ul>
|
||||
<li>
|
||||
<p><strong>bot4s.telegram</strong>. Simple, extensible, strongly-typed wrapper for the Telegram Bot API.
|
||||
<a href="https://github.com/bot4s/telegram">https://github.com/bot4s/telegram</a></p>
|
||||
<li><p><strong>bot4s.telegram</strong>. Simple, extensible, strongly-typed wrapper for the Telegram Bot API.<br><a href="https://github.com/bot4s/telegram">https://github.com/bot4s/telegram</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>F[Tg] - Telegramium</strong>. Pure functional Telegram Bot API implementation.
|
||||
<a href="https://github.com/apimorphism/telegramium">https://github.com/apimorphism/telegramium</a></p>
|
||||
<li><p><strong>F[Tg] - Telegramium</strong>. Pure functional Telegram Bot API implementation.<br><a href="https://github.com/apimorphism/telegramium">https://github.com/apimorphism/telegramium</a></p>
|
||||
</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#lua" id="lua" name="lua"><i class="anchor-icon"></i></a>Lua</h4>
|
||||
<h4><a class="anchor" name="lua" href="#lua"><i class="anchor-icon"></i></a>Lua</h4>
|
||||
<ul>
|
||||
<li>
|
||||
<p><strong>ggram</strong>. Lua library for the Telegram bot API. You can even use it in Garry's Mod.
|
||||
<a href="https://github.com/TRIGONIM/ggram">https://github.com/TRIGONIM/ggram</a></p>
|
||||
<li><p><strong>ggram</strong>. Lua library for the Telegram bot API. You can even use it in Garry's Mod.<br><a href="https://github.com/TRIGONIM/ggram">https://github.com/TRIGONIM/ggram</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>telegram-bot-lua</strong>. A feature-filled Telegram Bot API library.
|
||||
<a href="https://github.com/wrxck/telegram-bot-lua">https://github.com/wrxck/telegram-bot-lua</a></p>
|
||||
<li><p><strong>telegram-bot-lua</strong>. A feature-filled Telegram Bot API library.<br><a href="https://github.com/wrxck/telegram-bot-lua">https://github.com/wrxck/telegram-bot-lua</a></p>
|
||||
</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#other-languages" id="other-languages" name="other-languages"><i class="anchor-icon"></i></a>Other Languages</h4>
|
||||
<h4><a class="anchor" name="other-languages" href="#other-languages"><i class="anchor-icon"></i></a>Other Languages</h4>
|
||||
<ul>
|
||||
<li>
|
||||
<p>Swift. <strong>Telegram Vapor Bot</strong>. The wrapper for the Telegram Bot API written in Swift with Vapor.
|
||||
<a href="https://github.com/nerzh/telegram-vapor-bot">https://github.com/nerzh/telegram-vapor-bot</a></p>
|
||||
<li><p>Swift. <strong>Telegram Vapor Bot</strong>. The wrapper for the Telegram Bot API written in Swift with Vapor.<br><a href="https://github.com/nerzh/telegram-vapor-bot">https://github.com/nerzh/telegram-vapor-bot</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Elixir. <strong>ExGram</strong>. Telegram Bot API low level API and framework.
|
||||
<a href="https://github.com/rockneurotiko/ex_gram">https://github.com/rockneurotiko/ex_gram</a></p>
|
||||
<li><p>Elixir. <strong>ExGram</strong>. Telegram Bot API low level API and framework.<br><a href="https://github.com/rockneurotiko/ex_gram">https://github.com/rockneurotiko/ex_gram</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Dart. <strong>TeleDart</strong>. A library interfacing with the latest Telegram Bot API.
|
||||
<a href="https://github.com/DinoLeung/TeleDart">https://github.com/DinoLeung/TeleDart</a></p>
|
||||
<li><p>Dart. <strong>TeleDart</strong>. A library interfacing with the latest Telegram Bot API.<br><a href="https://github.com/DinoLeung/TeleDart">https://github.com/DinoLeung/TeleDart</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Pascal. <strong>TGBotMini</strong>. Telegram Bot Mini API.
|
||||
<a href="https://github.com/HemulGM/TGBotMini">https://github.com/HemulGM/TGBotMini</a></p>
|
||||
<li><p>Pascal. <strong>TGBotMini</strong>. Telegram Bot Mini API.<br><a href="https://github.com/HemulGM/TGBotMini">https://github.com/HemulGM/TGBotMini</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Clojure. <strong>telegrambot-lib</strong>. A library for interacting with the Telegram Bot API.
|
||||
<a href="https://github.com/wdhowe/telegrambot-lib">https://github.com/wdhowe/telegrambot-lib</a></p>
|
||||
<li><p>Clojure. <strong>telegrambot-lib</strong>. A library for interacting with the Telegram Bot API.<br><a href="https://github.com/wdhowe/telegrambot-lib">https://github.com/wdhowe/telegrambot-lib</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p>OCaml. <strong>TelegraML</strong>. A library for creating bots for Telegram.
|
||||
<a href="https://github.com/nv-vn/TelegraML">https://github.com/nv-vn/TelegraML</a></p>
|
||||
<li><p>OCaml. <strong>TelegraML</strong>. A library for creating bots for Telegram.<br><a href="https://github.com/nv-vn/TelegraML">https://github.com/nv-vn/TelegraML</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Haskell. <strong>haskell-telegram-api</strong>. High-level bindings to the Telegram Bot API based on <a href="https://haskell-servant.github.io/">servant</a> library.
|
||||
<a href="https://github.com/klappvisor/haskell-telegram-api">https://github.com/klappvisor/haskell-telegram-api</a></p>
|
||||
<li><p>Haskell. <strong>haskell-telegram-api</strong>. High-level bindings to the Telegram Bot API based on <a href="https://haskell-servant.github.io/">servant</a> library.<br><a href="https://github.com/klappvisor/haskell-telegram-api">https://github.com/klappvisor/haskell-telegram-api</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Perl. <strong>Telegram Bot</strong>. A genuine Perl 6 client for the Telegram's Bot API.
|
||||
<a href="https://github.com/GildedHonour/TelegramBot">https://github.com/GildedHonour/TelegramBot</a></p>
|
||||
<li><p>Perl. <strong>Telegram Bot</strong>. A genuine Perl 6 client for the Telegram's Bot API.<br><a href="https://github.com/GildedHonour/TelegramBot">https://github.com/GildedHonour/TelegramBot</a></p>
|
||||
</li>
|
||||
</ul></div>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
@ -45,33 +45,33 @@ If you have questions, try our FAQ or check out this…">
|
|||
<h1 id="dev_page_title">Hellobot</h1>
|
||||
|
||||
<div id="dev_page_content"><blockquote>
|
||||
<p>This sample PHP bot demonstrates the basics of the <a href="/bots/api">Telegram Bot API</a>.
|
||||
If you have questions, try our <a href="/bots/faq">FAQ</a> or check out <a href="/bots/samples">this page</a> for more examples.</p>
|
||||
<p>This sample PHP bot demonstrates the basics of the <a href="/bots/api">Telegram Bot API</a>.<br>If you have questions, try our <a href="/bots/faq">FAQ</a> or check out <a href="/bots/samples">this page</a> for more examples.</p>
|
||||
</blockquote>
|
||||
<div><br></div>
|
||||
|
||||
<pre><code><?php
|
||||
|
||||
define('BOT_TOKEN', '12345678:replace-me-with-real-token');
|
||||
define('API_URL', 'https://api.telegram.org/bot'.BOT_TOKEN.'/');
|
||||
define('BOT_TOKEN', '12345678:replace-me-with-real-token');
|
||||
define('API_URL', 'https://api.telegram.org/bot'.BOT_TOKEN.'/');
|
||||
|
||||
function apiRequestWebhook($method, $parameters) {
|
||||
if (!is_string($method)) {
|
||||
error_log("Method name must be a string\n");
|
||||
error_log("Method name must be a string\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$parameters) {
|
||||
$parameters = array();
|
||||
} else if (!is_array($parameters)) {
|
||||
error_log("Parameters must be an array\n");
|
||||
error_log("Parameters must be an array\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
$parameters["method"] = $method;
|
||||
$parameters["method"] = $method;
|
||||
|
||||
$payload = json_encode($parameters);
|
||||
header('Content-Type: application/json');
|
||||
header('Content-Length: '.strlen($payload));
|
||||
header('Content-Type: application/json');
|
||||
header('Content-Length: '.strlen($payload));
|
||||
echo $payload;
|
||||
|
||||
return true;
|
||||
|
@ -83,7 +83,7 @@ function exec_curl_request($handle) {
|
|||
if ($response === false) {
|
||||
$errno = curl_errno($handle);
|
||||
$error = curl_error($handle);
|
||||
error_log("Curl returned error $errno: $error\n");
|
||||
error_log("Curl returned error $errno: $error\n");
|
||||
curl_close($handle);
|
||||
return false;
|
||||
}
|
||||
|
@ -97,17 +97,17 @@ function exec_curl_request($handle) {
|
|||
return false;
|
||||
} else if ($http_code != 200) {
|
||||
$response = json_decode($response, true);
|
||||
error_log("Request has failed with error {$response['error_code']}: {$response['description']}\n");
|
||||
error_log("Request has failed with error {$response['error_code']}: {$response['description']}\n");
|
||||
if ($http_code == 401) {
|
||||
throw new Exception('Invalid access token provided');
|
||||
throw new Exception('Invalid access token provided');
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
$response = json_decode($response, true);
|
||||
if (isset($response['description'])) {
|
||||
error_log("Request was successful: {$response['description']}\n");
|
||||
if (isset($response['description'])) {
|
||||
error_log("Request was successful: {$response['description']}\n");
|
||||
}
|
||||
$response = $response['result'];
|
||||
$response = $response['result'];
|
||||
}
|
||||
|
||||
return $response;
|
||||
|
@ -115,14 +115,14 @@ function exec_curl_request($handle) {
|
|||
|
||||
function apiRequest($method, $parameters) {
|
||||
if (!is_string($method)) {
|
||||
error_log("Method name must be a string\n");
|
||||
error_log("Method name must be a string\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$parameters) {
|
||||
$parameters = array();
|
||||
} else if (!is_array($parameters)) {
|
||||
error_log("Parameters must be an array\n");
|
||||
error_log("Parameters must be an array\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -132,7 +132,7 @@ function apiRequest($method, $parameters) {
|
|||
$val = json_encode($val);
|
||||
}
|
||||
}
|
||||
$url = API_URL.$method.'?'.http_build_query($parameters);
|
||||
$url = API_URL.$method.'?'.http_build_query($parameters);
|
||||
|
||||
$handle = curl_init($url);
|
||||
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
|
||||
|
@ -144,18 +144,18 @@ function apiRequest($method, $parameters) {
|
|||
|
||||
function apiRequestJson($method, $parameters) {
|
||||
if (!is_string($method)) {
|
||||
error_log("Method name must be a string\n");
|
||||
error_log("Method name must be a string\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$parameters) {
|
||||
$parameters = array();
|
||||
} else if (!is_array($parameters)) {
|
||||
error_log("Parameters must be an array\n");
|
||||
error_log("Parameters must be an array\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
$parameters["method"] = $method;
|
||||
$parameters["method"] = $method;
|
||||
|
||||
$handle = curl_init(API_URL);
|
||||
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
|
||||
|
@ -163,47 +163,47 @@ function apiRequestJson($method, $parameters) {
|
|||
curl_setopt($handle, CURLOPT_TIMEOUT, 60);
|
||||
curl_setopt($handle, CURLOPT_POST, true);
|
||||
curl_setopt($handle, CURLOPT_POSTFIELDS, json_encode($parameters));
|
||||
curl_setopt($handle, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
|
||||
curl_setopt($handle, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
|
||||
|
||||
return exec_curl_request($handle);
|
||||
}
|
||||
|
||||
function processMessage($message) {
|
||||
// process incoming message
|
||||
$message_id = $message['message_id'];
|
||||
$chat_id = $message['chat']['id'];
|
||||
if (isset($message['text'])) {
|
||||
$message_id = $message['message_id'];
|
||||
$chat_id = $message['chat']['id'];
|
||||
if (isset($message['text'])) {
|
||||
// incoming text message
|
||||
$text = $message['text'];
|
||||
$text = $message['text'];
|
||||
|
||||
if (strpos($text, "/start") === 0) {
|
||||
apiRequestJson("sendMessage", array('chat_id' => $chat_id, "text" => 'Hello', 'reply_markup' => array(
|
||||
'keyboard' => array(array('Hello', 'Hi')),
|
||||
'one_time_keyboard' => true,
|
||||
'resize_keyboard' => true)));
|
||||
} else if ($text === "Hello" || $text === "Hi") {
|
||||
apiRequest("sendMessage", array('chat_id' => $chat_id, "text" => 'Nice to meet you'));
|
||||
} else if (strpos($text, "/stop") === 0) {
|
||||
if (strpos($text, "/start") === 0) {
|
||||
apiRequestJson("sendMessage", array('chat_id' => $chat_id, "text" => 'Hello', 'reply_markup' => array(
|
||||
'keyboard' => array(array('Hello', 'Hi')),
|
||||
'one_time_keyboard' => true,
|
||||
'resize_keyboard' => true)));
|
||||
} else if ($text === "Hello" || $text === "Hi") {
|
||||
apiRequest("sendMessage", array('chat_id' => $chat_id, "text" => 'Nice to meet you'));
|
||||
} else if (strpos($text, "/stop") === 0) {
|
||||
// stop now
|
||||
} else {
|
||||
apiRequestWebhook("sendMessage", array('chat_id' => $chat_id, "reply_to_message_id" => $message_id, "text" => 'Cool'));
|
||||
apiRequestWebhook("sendMessage", array('chat_id' => $chat_id, "reply_to_message_id" => $message_id, "text" => 'Cool'));
|
||||
}
|
||||
} else {
|
||||
apiRequest("sendMessage", array('chat_id' => $chat_id, "text" => 'I understand only text messages'));
|
||||
apiRequest("sendMessage", array('chat_id' => $chat_id, "text" => 'I understand only text messages'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
define('WEBHOOK_URL', 'https://my-site.example.com/secret-path-for-webhooks/');
|
||||
define('WEBHOOK_URL', 'https://my-site.example.com/secret-path-for-webhooks/');
|
||||
|
||||
if (php_sapi_name() == 'cli') {
|
||||
if (php_sapi_name() == 'cli') {
|
||||
// if run from console, set or delete webhook
|
||||
apiRequest('setWebhook', array('url' => isset($argv[1]) && $argv[1] == 'delete' ? '' : WEBHOOK_URL));
|
||||
apiRequest('setWebhook', array('url' => isset($argv[1]) && $argv[1] == 'delete' ? '' : WEBHOOK_URL));
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$content = file_get_contents("php://input");
|
||||
$content = file_get_contents("php://input");
|
||||
$update = json_decode($content, true);
|
||||
|
||||
if (!$update) {
|
||||
|
@ -211,9 +211,10 @@ if (!$update) {
|
|||
exit;
|
||||
}
|
||||
|
||||
if (isset($update["message"])) {
|
||||
processMessage($update["message"]);
|
||||
}</code></pre></div>
|
||||
if (isset($update["message"])) {
|
||||
processMessage($update["message"]);
|
||||
}</code></pre>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
@ -44,19 +44,21 @@
|
|||
|
||||
<div id="dev_page_content"><!-- scroll_nav -->
|
||||
|
||||
<p>This guide will walk you through everything you need to know to build your first <strong>Telegram Bot</strong>.
|
||||
If you already know your way around some of the basic steps, you can jump directly to the part you're missing. Equivalent examples are available in <a href="https://gitlab.com/Athamaxy/telegram-bot-tutorial/-/blob/main/TutorialBot.cs">C#</a>, <a href="https://gitlab.com/Athamaxy/telegram-bot-tutorial/-/blob/main/TutorialBot.py">Python</a>, <a href="https://gitlab.com/Athamaxy/telegram-bot-tutorial/-/blob/main/TutorialBot.go">Go</a> and <a href="https://gitlab.com/Athamaxy/telegram-bot-tutorial/-/tree/main/Nodejs">TypeScript</a> .</p>
|
||||
<p>This guide will walk you through everything you need to know to build your first <strong>Telegram Bot</strong>.<br>If you already know your way around some of the basic steps, you can jump directly to the part you're missing. Equivalent examples are available in <a href="https://gitlab.com/Athamaxy/telegram-bot-tutorial/-/blob/main/TutorialBot.cs">C#</a>, <a href="https://gitlab.com/Athamaxy/telegram-bot-tutorial/-/blob/main/TutorialBot.py">Python</a>, <a href="https://gitlab.com/Athamaxy/telegram-bot-tutorial/-/blob/main/TutorialBot.go">Go</a> and <a href="https://gitlab.com/Athamaxy/telegram-bot-tutorial/-/tree/main/Nodejs">TypeScript</a> .</p>
|
||||
<ul>
|
||||
<li><a href="#introduction">Introduction</a></li>
|
||||
<li><a href="#getting-ready"><strong>Basic Tutorial</strong></a></li>
|
||||
</ul>
|
||||
<div id="dev_page_content">
|
||||
|
||||
<ul style="padding-left: 30px;">
|
||||
<li style="margin-top: -5px"><a href="#getting-ready">Environment</a></li>
|
||||
<li><a href="#first-run">First Run</a></li>
|
||||
<li><a href="#echo-bot">Echo Bot</a></li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<ul>
|
||||
<li><a href="#executing-commands"><strong>Advanced Tutorial</strong></a></li>
|
||||
</ul>
|
||||
|
@ -66,51 +68,50 @@ If you already know your way around some of the basic steps, you can jump direct
|
|||
<li><a href="#navigation">Navigation</a></li>
|
||||
<li><a href="#database">Database</a></li>
|
||||
<li><a href="#hosting">Hosting</a></li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<ul>
|
||||
<li><a href="#further-reading">Further Reading</a></li>
|
||||
</ul>
|
||||
<hr>
|
||||
<h3><a class="anchor" href="#introduction" id="introduction" name="introduction"><i class="anchor-icon"></i></a>Introduction</h3>
|
||||
<h3><a class="anchor" name="introduction" href="#introduction"><i class="anchor-icon"></i></a>Introduction</h3>
|
||||
<p>At its core, you can think of the Telegram <a href="api">Bot API</a> as software that provides <a href="https://en.wikipedia.org/wiki/JSON">JSON-encoded</a> responses to your queries.</p>
|
||||
<p>A bot, on the other hand, is essentially a routine, software or script that queries the API by means of an <a href="https://core.telegram.org/bots/api#making-requests">HTTPS request</a> and waits for a response. There are several types of <a href="api#available-methods">requests</a> you can make, as well as many different <a href="api#available-types">objects</a> that you can use and receive as responses.</p>
|
||||
<p>Since <strong>your browser</strong> is capable of sending HTTPS requests, you can use it to quickly try out the API. After <a href="#obtain-your-bot-token">obtaining your token</a>, try pasting this string into your browser:</p>
|
||||
<pre><code>https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getMe</code></pre>
|
||||
<p>In theory, you could interact with the API with <strong>basic requests</strong> like this, either via your browser or other tailor-made tools like <a href="https://curl.se/">cURL</a>. While this can work for simple requests like the example above, it's not practical for larger applications and doesn't scale well.
|
||||
For that reason, this guide will show you how to use <a href="samples">libraries and frameworks</a>, along with some <strong>basic programming skills</strong>, to build a more robust and scalable project.</p>
|
||||
<p>If you know how to code, you'll fly right through each step in no time – and if you're just starting out, this guide will show you everything you need to learn.</p>
|
||||
<p>In theory, you could interact with the API with <strong>basic requests</strong> like this, either via your browser or other tailor-made tools like <a href="https://curl.se/">cURL</a>. While this can work for simple requests like the example above, it's not practical for larger applications and doesn't scale well.<br>For that reason, this guide will show you how to use <a href="samples">libraries and frameworks</a>, along with some <strong>basic programming skills</strong>, to build a more robust and scalable project.</p>
|
||||
<p>If you know how to code, you'll fly right through each step in no time – and if you're just starting out, this guide will show you everything you need to learn.</p>
|
||||
<blockquote>
|
||||
<p>We will use <a href="https://en.wikipedia.org/wiki/Java_%28programming_language%29">Java</a> throughout this guide as it's one of the most popular programming languages, however, you can follow along with any language as all the steps are fundamentally the same.
|
||||
Since Java is fully cross-platform, each code example will work with any operating system.
|
||||
If you pick another language, equivalent examples are available in <a href="https://gitlab.com/Athamaxy/telegram-bot-tutorial/-/blob/main/TutorialBot.cs">C#</a>, <a href="https://gitlab.com/Athamaxy/telegram-bot-tutorial/-/blob/main/TutorialBot.py">Python</a>, <a href="https://gitlab.com/Athamaxy/telegram-bot-tutorial/-/blob/main/TutorialBot.go">Go</a> and <a href="https://gitlab.com/Athamaxy/telegram-bot-tutorial/-/tree/main/Nodejs">TypeScript</a> .</p>
|
||||
<p>We will use <a href="https://en.wikipedia.org/wiki/Java_%28programming_language%29">Java</a> throughout this guide as it's one of the most popular programming languages, however, you can follow along with any language as all the steps are fundamentally the same.<br>Since Java is fully cross-platform, each code example will work with any operating system.<br>If you pick another language, equivalent examples are available in <a href="https://gitlab.com/Athamaxy/telegram-bot-tutorial/-/blob/main/TutorialBot.cs">C#</a>, <a href="https://gitlab.com/Athamaxy/telegram-bot-tutorial/-/blob/main/TutorialBot.py">Python</a>, <a href="https://gitlab.com/Athamaxy/telegram-bot-tutorial/-/blob/main/TutorialBot.go">Go</a> and <a href="https://gitlab.com/Athamaxy/telegram-bot-tutorial/-/tree/main/Nodejs">TypeScript</a> .</p>
|
||||
</blockquote>
|
||||
<h3><a class="anchor" href="#getting-ready" id="getting-ready" name="getting-ready"><i class="anchor-icon"></i></a>Getting Ready</h3>
|
||||
<h3><a class="anchor" name="getting-ready" href="#getting-ready"><i class="anchor-icon"></i></a>Getting Ready</h3>
|
||||
<p>First, we will briefly cover how to <strong>create your first project</strong>, obtain your <strong>API token</strong> and download all necessary <strong>dependencies and libraries</strong>.</p>
|
||||
<p>For the purposes of this guide, a copy of the bot you will be creating is also live at <a href="https://t.me/tutorialbot">@TutorialBot</a> – feel free to check it out along the way to see how your own implementation should look after each step.</p>
|
||||
<h4><a class="anchor" href="#obtain-your-bot-token" id="obtain-your-bot-token" name="obtain-your-bot-token"><i class="anchor-icon"></i></a>Obtain Your Bot Token</h4>
|
||||
<h4><a class="anchor" name="obtain-your-bot-token" href="#obtain-your-bot-token"><i class="anchor-icon"></i></a>Obtain Your Bot Token</h4>
|
||||
<p>In this context, a <strong>token</strong> is a string that authenticates your bot (not your account) on the bot API. Each bot has a unique token which can also be revoked at any time via <a href="https://t.me/botfather">@BotFather</a>.</p>
|
||||
<p>Obtaining a token is as simple as contacting <a href="https://t.me/botfather">@BotFather</a>, issuing the <code>/newbot</code> command and following the steps until you're given a new token. You can find a step-by-step guide <a href="features#creating-a-new-bot">here</a>.</p>
|
||||
<p>Obtaining a token is as simple as contacting <a href="https://t.me/botfather">@BotFather</a>, issuing the <code>/newbot</code> command and following the steps until you're given a new token. You can find a step-by-step guide <a href="features#creating-a-new-bot">here</a>.</p>
|
||||
<p>Your token will look something like this:</p>
|
||||
<pre><code>4839574812:AAFD39kkdpWt3ywyRZergyOLMaJhac60qc</code></pre>
|
||||
<blockquote>
|
||||
<p>Make sure to save your token in a secure place, treat it like a password and <strong>don't share it with anyone</strong>.</p>
|
||||
<p>Make sure to save your token in a secure place, treat it like a password and <strong>don't share it with anyone</strong>.</p>
|
||||
</blockquote>
|
||||
<h4><a class="anchor" href="#download-an-ide" id="download-an-ide" name="download-an-ide"><i class="anchor-icon"></i></a>Download an IDE</h4>
|
||||
<p>To program in Java you'll need an <a href="https://en.wikipedia.org/wiki/Integrated_development_environment">IDE</a> – a special text editor that will let you write, compile and run your code.
|
||||
In this tutorial, we'll use IntelliJ – there are several free, open source alternatives like <a href="https://www.eclipse.org/ide/">Eclipse</a> or <a href="https://netbeans.apache.org/download/index.html">NetBeans</a> which work in the exact same way.</p>
|
||||
<p>You will also need a <a href="https://en.wikipedia.org/wiki/Java_Development_Kit">JDK</a>, a software kit that allows your Java code to run.
|
||||
Most IDEs don't include a JDK, so you should download a version compatible with your operating system separately. You can find a free, open source version <a href="https://adoptium.net/temurin/releases/">here</a>.</p>
|
||||
<h4><a class="anchor" name="download-an-ide" href="#download-an-ide"><i class="anchor-icon"></i></a>Download an IDE</h4>
|
||||
<p>To program in Java you'll need an <a href="https://en.wikipedia.org/wiki/Integrated_development_environment">IDE</a> – a special text editor that will let you write, compile and run your code.<br>In this tutorial, we'll use IntelliJ – there are several free, open source alternatives like <a href="https://www.eclipse.org/ide/">Eclipse</a> or <a href="https://netbeans.apache.org/download/index.html">NetBeans</a> which work in the exact same way.</p>
|
||||
<p>You will also need a <a href="https://en.wikipedia.org/wiki/Java_Development_Kit">JDK</a>, a software kit that allows your Java code to run.<br>Most IDEs don't include a JDK, so you should download a version compatible with your operating system separately. You can find a free, open source version <a href="https://adoptium.net/temurin/releases/">here</a>.</p>
|
||||
<blockquote>
|
||||
<p>If you use another language, the steps are identical. You will just have to download a different IDE and software development kit.</p>
|
||||
</blockquote>
|
||||
<h4><a class="anchor" href="#pick-a-framework-or-library" id="pick-a-framework-or-library" name="pick-a-framework-or-library"><i class="anchor-icon"></i></a>Pick a Framework or Library</h4>
|
||||
<h4><a class="anchor" name="pick-a-framework-or-library" href="#pick-a-framework-or-library"><i class="anchor-icon"></i></a>Pick a Framework or Library</h4>
|
||||
<p>You can think of a framework as software that handles all the low-level logic for you, including the API calls, and lets you focus on your bot-specific logic.</p>
|
||||
<p>In this tutorial, we'll use <a href="https://github.com/rubenlagus/TelegramBots">TelegramBots</a>, but you can follow along with any equivalent implementation, since all the underlying methods are either similar or exactly the same.</p>
|
||||
<p>In this tutorial, we'll use <a href="https://github.com/rubenlagus/TelegramBots">TelegramBots</a>, but you can follow along with any equivalent implementation, since all the underlying methods are either similar or exactly the same.</p>
|
||||
<blockquote>
|
||||
<p>You can find many frameworks, along with code examples, in <a href="samples">our dedicated list</a>.</p>
|
||||
</blockquote>
|
||||
<h4><a class="anchor" href="#create-your-project" id="create-your-project" name="create-your-project"><i class="anchor-icon"></i></a>Create Your Project</h4>
|
||||
<h4><a class="anchor" name="create-your-project" href="#create-your-project"><i class="anchor-icon"></i></a>Create Your Project</h4>
|
||||
<p>In IntelliJ, go to <code>File > New > Project</code>.</p>
|
||||
<p>Fill in the fields accordingly:</p>
|
||||
<ul>
|
||||
|
@ -118,7 +119,7 @@ Most IDEs don't include a JDK, so you should download a version compatible with
|
|||
<li><strong>Location</strong> - Where to store your project. You can use the default value.</li>
|
||||
<li><strong>Language</strong> - Java</li>
|
||||
<li><strong>Build System</strong> - The framework that will handle your dependencies. Pick <em>Maven</em>.</li>
|
||||
<li><strong>JDK</strong> - Pick whichever version you downloaded. We'll be using version <em>17</em>.</li>
|
||||
<li><strong>JDK</strong> - Pick whichever version you downloaded. We'll be using version <em>17</em>.</li>
|
||||
<li><strong>Add Sample Code</strong> - Leave this <strong>selected</strong>, it will generate some needed files for you.</li>
|
||||
<li><strong>Advanced Settings > GroupId</strong> - We suggest <em>tutorial</em>.</li>
|
||||
<li><strong>Advanced Settings > ArtifactId</strong> - You can use the default value.</li>
|
||||
|
@ -133,16 +134,12 @@ Most IDEs don't include a JDK, so you should download a version compatible with
|
|||
│ └─ Main
|
||||
└─ pom.xml</code></pre>
|
||||
<blockquote>
|
||||
<p>Other IDEs will follow a similar pattern. Your dependency management system will have a different name (or no name at all if it's built-in) depending on the language you chose.</p>
|
||||
<p>Other IDEs will follow a similar pattern. Your dependency management system will have a different name (or no name at all if it's built-in) depending on the language you chose.</p>
|
||||
</blockquote>
|
||||
<p>If this looks scary, don't worry. We will only be using the <code>Main</code> file and the <code>pom.xml</code> file.
|
||||
In fact, to check that everything is working so far, double click on <em>Main</em> and click on the small green arrow on the left of <em>public class Main</em>, then select the first option.
|
||||
If you followed the steps correctly, <em>Hello world!</em> should appear in the console below.</p>
|
||||
<h4><a class="anchor" href="#add-framework-dependency" id="add-framework-dependency" name="add-framework-dependency"><i class="anchor-icon"></i></a>Add Framework Dependency</h4>
|
||||
<p>We will now instruct the IDE to download and configure everything needed to work with the API.
|
||||
This is very easy and happens automatically behind the scenes.</p>
|
||||
<p>First, locate your <code>pom.xml</code> file on the left side of the screen.
|
||||
Open it by double-clicking and simply add:</p>
|
||||
<p>If this looks scary, don't worry. We will only be using the <code>Main</code> file and the <code>pom.xml</code> file.<br>In fact, to check that everything is working so far, double click on <em>Main</em> and click on the small green arrow on the left of <em>public class Main</em>, then select the first option.<br>If you followed the steps correctly, <em>Hello world!</em> should appear in the console below.</p>
|
||||
<h4><a class="anchor" name="add-framework-dependency" href="#add-framework-dependency"><i class="anchor-icon"></i></a>Add Framework Dependency</h4>
|
||||
<p>We will now instruct the IDE to download and configure everything needed to work with the API.<br>This is very easy and happens automatically behind the scenes.</p>
|
||||
<p>First, locate your <code>pom.xml</code> file on the left side of the screen.<br>Open it by double-clicking and simply add:</p>
|
||||
<pre><code><dependencies>
|
||||
<dependency>
|
||||
<groupId>org.telegram</groupId>
|
||||
|
@ -151,17 +148,14 @@ Open it by double-clicking and simply add:</p>
|
|||
</dependency>
|
||||
</dependencies></code></pre>
|
||||
<p>right after the <code></properties></code> tag.</p>
|
||||
<p>When you're done, your <code>pom.xml</code> should look something like <a href="https://gitlab.com/Athamaxy/telegram-bot-tutorial/-/blob/main/pom.xml">this</a>.</p>
|
||||
<h3><a class="anchor" href="#start-coding" id="start-coding" name="start-coding"><i class="anchor-icon"></i></a>Start Coding</h3>
|
||||
<p>We are ready to start coding. If you're a beginner, consider that being familiar with your language of choice will greatly help. With this tutorial, you'll be able to teach your bot basic behaviors, though more advanced features will require some coding experience.</p>
|
||||
<h4><a class="anchor" href="#creating-a-bot-class" id="creating-a-bot-class" name="creating-a-bot-class"><i class="anchor-icon"></i></a>Creating a Bot Class</h4>
|
||||
<p>If you're familiar with <a href="https://en.wikipedia.org/wiki/Object-oriented_programming">object-oriented programming</a>, you'll know what a class is.
|
||||
If you've never heard of it before, consider a class as a file where you write some logic.</p>
|
||||
<p>When you're done, your <code>pom.xml</code> should look something like <a href="https://gitlab.com/Athamaxy/telegram-bot-tutorial/-/blob/main/pom.xml">this</a>.</p>
|
||||
<h3><a class="anchor" name="start-coding" href="#start-coding"><i class="anchor-icon"></i></a>Start Coding</h3>
|
||||
<p>We are ready to start coding. If you're a beginner, consider that being familiar with your language of choice will greatly help. With this tutorial, you'll be able to teach your bot basic behaviors, though more advanced features will require some coding experience.</p>
|
||||
<h4><a class="anchor" name="creating-a-bot-class" href="#creating-a-bot-class"><i class="anchor-icon"></i></a>Creating a Bot Class</h4>
|
||||
<p>If you're familiar with <a href="https://en.wikipedia.org/wiki/Object-oriented_programming">object-oriented programming</a>, you'll know what a class is.<br>If you've never heard of it before, consider a class as a file where you write some logic.</p>
|
||||
<p>To <strong>create the class</strong> that will contain the bot logic, right click on <em>tutorial</em> from the project tree on the left and select <em>New > Java Class</em>. Name it <em>Bot</em> and hit enter.</p>
|
||||
<p>Now we have to connect this class to the bot framework. In other words, we must make sure it extends <code>TelegramLongPollingBot</code>. To do that, just add <em>extends TelegramLongPollingBot</em> right after <em>Bot</em>.
|
||||
A red line will appear – it simply means we're missing some important methods.</p>
|
||||
<p>To fix this, hover over the red line, click on <em>implement methods</em>, then hit OK.
|
||||
Depending on the IDE, this option may be called <em>implement missing methods</em> or something similar.</p>
|
||||
<p>Now we have to connect this class to the bot framework. In other words, we must make sure it extends <code>TelegramLongPollingBot</code>. To do that, just add <em>extends TelegramLongPollingBot</em> right after <em>Bot</em>.<br>A red line will appear – it simply means we're missing some important methods.</p>
|
||||
<p>To fix this, hover over the red line, click on <em>implement methods</em>, then hit OK.<br>Depending on the IDE, this option may be called <em>implement missing methods</em> or something similar.</p>
|
||||
<p>You should end up with this – if something went wrong, feel free to copy it from here and paste it in your class:</p>
|
||||
<pre><code>package tutorial;
|
||||
import org.telegram.telegrambots.bots.TelegramLongPollingBot;
|
||||
|
@ -184,55 +178,53 @@ public class Bot extends TelegramLongPollingBot {
|
|||
|
||||
}</code></pre>
|
||||
<blockquote>
|
||||
<p>If you get a red line under TelegramLongPollingBot, it means you didn't set up your pom.xml correctly. If this is the case, restart from <a href="#add-framework-dependency">here</a>.</p>
|
||||
<p>If you get a red line under TelegramLongPollingBot, it means you didn't set up your pom.xml correctly. If this is the case, restart from <a href="#add-framework-dependency">here</a>.</p>
|
||||
</blockquote>
|
||||
<h4><a class="anchor" href="#available-methods" id="available-methods" name="available-methods"><i class="anchor-icon"></i></a>Available Methods</h4>
|
||||
<p>Let's look into these 3 methods one by one.</p>
|
||||
<h4><a class="anchor" name="available-methods" href="#available-methods"><i class="anchor-icon"></i></a>Available Methods</h4>
|
||||
<p>Let's look into these 3 methods one by one.</p>
|
||||
<ul>
|
||||
<li><strong>getBotUsername</strong> - This method must be edited to always return your bot's username. You should replace the <em>null</em> return value with it.</li>
|
||||
<li><strong>getBotUsername</strong> - This method must be edited to always return your bot's username. You should replace the <em>null</em> return value with it.</li>
|
||||
<li><strong>getBotToken</strong> - This method will be used by the framework to retrieve your bot token. You should replace the <em>null</em> return value with the token.</li>
|
||||
<li><strong>onUpdateReceived</strong> - This is the most important method. It will be called automatically whenever a new Update is available. Let's add a <code>System.out.println(update);</code> call in there to quickly show what we are getting.</li>
|
||||
<li><strong>onUpdateReceived</strong> - This is the most important method. It will be called automatically whenever a new Update is available. Let's add a <code>System.out.println(update);</code> call in there to quickly show what we are getting.</li>
|
||||
</ul>
|
||||
<p>After you've replaced all the strings, you should end up with this:</p>
|
||||
<p>After you've replaced all the strings, you should end up with this:</p>
|
||||
<pre><code>@Override
|
||||
public String getBotUsername() {
|
||||
return "TutorialBot";
|
||||
return "TutorialBot";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBotToken() {
|
||||
return "4839574812:AAFD39kkdpWt3ywyRZergyOLMaJhac60qc";
|
||||
return "4839574812:AAFD39kkdpWt3ywyRZergyOLMaJhac60qc";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateReceived(Update update) {
|
||||
System.out.println(update);
|
||||
}</code></pre>
|
||||
<p>At this point, the bot is configured and ready to go – time to register it on the API and start processing updates.</p>
|
||||
<p>At this point, the bot is configured and ready to go – time to register it on the API and start processing updates.</p>
|
||||
<blockquote>
|
||||
<p>In the future, you should consider storing your token in a dedicated settings file or in <a href="https://en.wikipedia.org/wiki/Environment_variable">environment variables</a>. Keeping it in the code is fine for the scope of this tutorial, however, it's not very versatile and is generally considered bad practice. </p>
|
||||
<p>In the future, you should consider storing your token in a dedicated settings file or in <a href="https://en.wikipedia.org/wiki/Environment_variable">environment variables</a>. Keeping it in the code is fine for the scope of this tutorial, however, it's not very versatile and is generally considered bad practice. </p>
|
||||
</blockquote>
|
||||
<h4><a class="anchor" href="#registering-the-bot" id="registering-the-bot" name="registering-the-bot"><i class="anchor-icon"></i></a>Registering the Bot</h4>
|
||||
<h4><a class="anchor" name="registering-the-bot" href="#registering-the-bot"><i class="anchor-icon"></i></a>Registering the Bot</h4>
|
||||
<p>To <strong>register the bot</strong> on the API, simply add a couple of lines <strong>in the main method</strong> that will launch the application. If you named your class <code>Bot</code>, this is what your main method should look like:</p>
|
||||
<pre><code>public static void main(String[] args) throws TelegramApiException {
|
||||
TelegramBotsApi botsApi = new TelegramBotsApi(DefaultBotSession.class);
|
||||
botsApi.registerBot(new Bot());
|
||||
}</code></pre>
|
||||
<blockquote>
|
||||
<p>You can place this method in any class. Since we have an auto-generated <code>main</code> method in the Main class, we'll be using that one for this tutorial.</p>
|
||||
<p>You can place this method in any class. Since we have an auto-generated <code>main</code> method in the Main class, we'll be using that one for this tutorial.</p>
|
||||
</blockquote>
|
||||
<h3><a class="anchor" href="#first-run" id="first-run" name="first-run"><i class="anchor-icon"></i></a>First Run</h3>
|
||||
<p>It's time to <strong>run your bot</strong> for the first time.
|
||||
Hit the green arrow to the left of <code>public static void main</code> and select the first option.</p>
|
||||
<p><em>And then there was nothing</em>. Yes, a bit anticlimactic.
|
||||
This is because your bot <strong>has nothing to print</strong> – there are <strong>no new updates</strong> because nobody messaged it yet.</p>
|
||||
<p>If you try messaging the bot on Telegram, you'll then see <strong>new updates</strong> pop up in the console. At this point, you have your very own Telegram Bot – quite the achievement. Now, on to making it a bit more intelligent.</p>
|
||||
<h3><a class="anchor" name="first-run" href="#first-run"><i class="anchor-icon"></i></a>First Run</h3>
|
||||
<p>It's time to <strong>run your bot</strong> for the first time.<br>Hit the green arrow to the left of <code>public static void main</code> and select the first option.</p>
|
||||
<p><em>And then there was nothing</em>. Yes, a bit anticlimactic.<br>This is because your bot <strong>has nothing to print</strong> – there are <strong>no new updates</strong> because nobody messaged it yet.</p>
|
||||
<p>If you try messaging the bot on Telegram, you'll then see <strong>new updates</strong> pop up in the console. At this point, you have your very own Telegram Bot – quite the achievement. Now, on to making it a bit more intelligent.</p>
|
||||
<blockquote>
|
||||
<p>If nothing pops up, make sure you messaged the right bot and that the token you pasted in the code is correct.</p>
|
||||
</blockquote>
|
||||
<h3><a class="anchor" href="#receiving-messages" id="receiving-messages" name="receiving-messages"><i class="anchor-icon"></i></a>Receiving Messages</h3>
|
||||
<p>Every time someone sends a <strong>private message</strong> to your bot, your <code>onUpdateReceived</code> method will be called automatically and you'll be able to handle the <code>update</code> parameter, which contains the <strong>message</strong>, along with a great deal of other info which you can see detailed <a href="api#update">here</a>.</p>
|
||||
<p>Let's focus on two values for now:</p>
|
||||
<h3><a class="anchor" name="receiving-messages" href="#receiving-messages"><i class="anchor-icon"></i></a>Receiving Messages</h3>
|
||||
<p>Every time someone sends a <strong>private message</strong> to your bot, your <code>onUpdateReceived</code> method will be called automatically and you'll be able to handle the <code>update</code> parameter, which contains the <strong>message</strong>, along with a great deal of other info which you can see detailed <a href="api#update">here</a>.</p>
|
||||
<p>Let's focus on two values for now:</p>
|
||||
<ul>
|
||||
<li><strong>The user</strong> - Who sent the message. Access it via <code>update.getMessage().getFrom()</code>.</li>
|
||||
<li><strong>The message</strong> - What was sent. Access it via <code>update.getMessage()</code>.</li>
|
||||
|
@ -243,21 +235,21 @@ public void onUpdateReceived(Update update) {
|
|||
var msg = update.getMessage();
|
||||
var user = msg.getFrom();
|
||||
|
||||
System.out.println(user.getFirstName() + " wrote " + msg.getText());
|
||||
System.out.println(user.getFirstName() + " wrote " + msg.getText());
|
||||
}</code></pre>
|
||||
<p>This is just a basic example – you can now play around with all the methods to see everything you can pull out of these objects. You can try <code>getUsername</code>, <code>getLanguageCode</code>, and dozens more.</p>
|
||||
<p>Knowing how to receive, process and print <strong>incoming messages</strong>, now it's time to learn how to <strong>answer them</strong>.</p>
|
||||
<p>Knowing how to receive, process and print <strong>incoming messages</strong>, now it's time to learn how to <strong>answer them</strong>.</p>
|
||||
<blockquote>
|
||||
<p>Remember to stop and re-launch your bot after each change to the code.</p>
|
||||
</blockquote>
|
||||
<h3><a class="anchor" href="#sending-messages" id="sending-messages" name="sending-messages"><i class="anchor-icon"></i></a>Sending Messages</h3>
|
||||
<h3><a class="anchor" name="sending-messages" href="#sending-messages"><i class="anchor-icon"></i></a>Sending Messages</h3>
|
||||
<p>To send a private text message, you generally need <strong>three things</strong>:</p>
|
||||
<ul>
|
||||
<li>The user <strong>must</strong> have contacted your bot first. (Unless the user sent a join request to a group where your bot is an admin, but that's a more advanced scenario).</li>
|
||||
<li>The user <strong>must</strong> have contacted your bot first. (Unless the user sent a join request to a group where your bot is an admin, but that's a more advanced scenario).</li>
|
||||
<li>You <strong>must</strong> have previously saved the <strong>User ID</strong> (<code>user.getId()</code>)</li>
|
||||
<li>A <code>String</code> object containing the message text, 1-4096 characters.</li>
|
||||
</ul>
|
||||
<p>With that out of the way, let's create a <strong>new method</strong> to send the first message:</p>
|
||||
<p>With that out of the way, let's create a <strong>new method</strong> to send the first message:</p>
|
||||
<pre><code>public void sendText(Long who, String what){
|
||||
SendMessage sm = SendMessage.builder()
|
||||
.chatId(who.toString()) //Who are we sending a message to
|
||||
|
@ -268,23 +260,20 @@ public void onUpdateReceived(Update update) {
|
|||
throw new RuntimeException(e); //Any error will be printed here
|
||||
}
|
||||
}</code></pre>
|
||||
<p>And proceed to run this in the <code>main</code> method, right after registering the bot.
|
||||
For this example, we'll assume your User ID is <code>1234</code>.</p>
|
||||
<p>And proceed to run this in the <code>main</code> method, right after registering the bot.<br>For this example, we'll assume your User ID is <code>1234</code>.</p>
|
||||
<pre><code>public static void main(String[] args) throws TelegramApiException {
|
||||
TelegramBotsApi botsApi = new TelegramBotsApi(DefaultBotSession.class);
|
||||
Bot bot = new Bot(); //We moved this line out of the register method, to access it later
|
||||
botsApi.registerBot(bot);
|
||||
bot.sendText(1234L, "Hello World!"); //The L just turns the Integer into a Long
|
||||
bot.sendText(1234L, "Hello World!"); //The L just turns the Integer into a Long
|
||||
}</code></pre>
|
||||
<p>If you did everything correctly, your bot should text you <em>Hello World!</em> every time you launch your code. Sending messages to groups or channels – assuming you have the relevant permissions – is as simple as replacing <code>1234</code> with the ID of the respective chat.</p>
|
||||
<blockquote>
|
||||
<p>Try experimenting with other types of messages, like SendPhoto, SendSticker, SendDice...
|
||||
A full list is available starting <a href="https://core.telegram.org/bots/api#sendmessage">here</a>.</p>
|
||||
<p>Try experimenting with other types of messages, like SendPhoto, SendSticker, SendDice…<br>A full list is available starting <a href="https://core.telegram.org/bots/api#sendmessage">here</a>.</p>
|
||||
</blockquote>
|
||||
<h3><a class="anchor" href="#echo-bot" id="echo-bot" name="echo-bot"><i class="anchor-icon"></i></a>Echo Bot</h3>
|
||||
<p>Let's practice everything we tried so far by coding an <strong>Echo Bot</strong>.
|
||||
Its functionality will be rather simple: every text message it receives will be sent right back to the user.</p>
|
||||
<h4><a class="anchor" href="#copying-text" id="copying-text" name="copying-text"><i class="anchor-icon"></i></a>Copying Text</h4>
|
||||
<h3><a class="anchor" name="echo-bot" href="#echo-bot"><i class="anchor-icon"></i></a>Echo Bot</h3>
|
||||
<p>Let's practice everything we tried so far by coding an <strong>Echo Bot</strong>.<br>Its functionality will be rather simple: every text message it receives will be sent right back to the user.</p>
|
||||
<h4><a class="anchor" name="copying-text" href="#copying-text"><i class="anchor-icon"></i></a>Copying Text</h4>
|
||||
<p>The most intuitive way of coding this is saving the User ID and calling <code>sendText</code> right after each update.</p>
|
||||
<p>In other words:</p>
|
||||
<pre><code>@Override
|
||||
|
@ -296,12 +285,11 @@ public void onUpdateReceived(Update update) {
|
|||
sendText(id, msg.getText());
|
||||
}</code></pre>
|
||||
<p>This works for text but can be extended to stickers, media and files.</p>
|
||||
<h4><a class="anchor" href="#copying-everything" id="copying-everything" name="copying-everything"><i class="anchor-icon"></i></a>Copying Everything</h4>
|
||||
<p>There are more specific functions that can be used to copy messages and send them back.
|
||||
Let's build a method to do just that:</p>
|
||||
<h4><a class="anchor" name="copying-everything" href="#copying-everything"><i class="anchor-icon"></i></a>Copying Everything</h4>
|
||||
<p>There are more specific functions that can be used to copy messages and send them back.<br>Let's build a method to do just that:</p>
|
||||
<pre><code>public void copyMessage(Long who, Integer msgId){
|
||||
CopyMessage cm = CopyMessage.builder()
|
||||
.fromChatId(who.toString()) //We copy from the user
|
||||
.fromChatId(who.toString()) //We copy from the user
|
||||
.chatId(who.toString()) //And send it back to him
|
||||
.messageId(msgId) //Specifying what message
|
||||
.build();
|
||||
|
@ -315,28 +303,25 @@ Let's build a method to do just that:</p>
|
|||
<blockquote>
|
||||
<p>This tutorial assumes that updates always contain messages for the sake of simplicity. This may not always be true – be sure to implement all the proper checks in your code to handle every type of update with the appropriate methods.</p>
|
||||
</blockquote>
|
||||
<h3><a class="anchor" href="#executing-commands" id="executing-commands" name="executing-commands"><i class="anchor-icon"></i></a>Executing Commands</h3>
|
||||
<p>To learn what a command is and how it works, we recommend reading this <a href="features#commands">dedicated summary</a>.
|
||||
In this guide, we'll focus on the technical side of things.</p>
|
||||
<h4><a class="anchor" href="#creating-your-command" id="creating-your-command" name="creating-your-command"><i class="anchor-icon"></i></a>Creating Your Command</h4>
|
||||
<p>Begin by opening <a href="https://t.me/botfather">@BotFather</a>.
|
||||
Type <code>/mybots</code> > <em>Your_Bot_Name</em> > Edit Bot > Edit Commands.</p>
|
||||
<p>Now send a new command, followed by a brief description.
|
||||
For the purpose of this tutorial, we'll implement two simple commands:</p>
|
||||
<pre><code>scream - Speak, I'll scream right back
|
||||
<h3><a class="anchor" name="executing-commands" href="#executing-commands"><i class="anchor-icon"></i></a>Executing Commands</h3>
|
||||
<p>To learn what a command is and how it works, we recommend reading this <a href="features#commands">dedicated summary</a>.<br>In this guide, we'll focus on the technical side of things.</p>
|
||||
<h4><a class="anchor" name="creating-your-command" href="#creating-your-command"><i class="anchor-icon"></i></a>Creating Your Command</h4>
|
||||
<p>Begin by opening <a href="https://t.me/botfather">@BotFather</a>.<br>Type <code>/mybots</code> > <em>Your_Bot_Name</em> > Edit Bot > Edit Commands.</p>
|
||||
<p>Now send a new command, followed by a brief description.<br>For the purpose of this tutorial, we'll implement two simple commands:</p>
|
||||
<pre><code>scream - Speak, I'll scream right back
|
||||
whisper - Shhhhhhh</code></pre>
|
||||
<h4><a class="anchor" href="#command-logic" id="command-logic" name="command-logic"><i class="anchor-icon"></i></a>Command Logic</h4>
|
||||
<p>We want the <strong>Echo Bot</strong> to reply in uppercase when it's in <strong>scream mode</strong> and normally otherwise.</p>
|
||||
<p>First, let's <strong>create a variable</strong> to store the current mode.</p>
|
||||
<h4><a class="anchor" name="command-logic" href="#command-logic"><i class="anchor-icon"></i></a>Command Logic</h4>
|
||||
<p>We want the <strong>Echo Bot</strong> to reply in uppercase when it's in <strong>scream mode</strong> and normally otherwise.</p>
|
||||
<p>First, let's <strong>create a variable</strong> to store the current mode.</p>
|
||||
<pre><code>public class Bot extends TelegramLongPollingBot {
|
||||
|
||||
private boolean screaming = false;
|
||||
|
||||
[...]
|
||||
}</code></pre>
|
||||
<p>Then, let's change some logic to <strong>account for this mode</strong>.</p>
|
||||
<p>Then, let's change some logic to <strong>account for this mode</strong>.</p>
|
||||
<pre><code>public void onUpdateReceived(Update update) {
|
||||
[...] //Same variables as the previous versions
|
||||
[...] //Same variables as the previous versions
|
||||
if(screaming) //If we are screaming
|
||||
scream(id, update.getMessage()); //Call a custom method
|
||||
else
|
||||
|
@ -347,28 +332,26 @@ private void scream(Long id, Message msg) {
|
|||
if(msg.hasText())
|
||||
sendText(id, msg.getText().toUpperCase());
|
||||
else
|
||||
copyMessage(id, msg.getMessageId()); //We can't really scream a sticker
|
||||
copyMessage(id, msg.getMessageId()); //We can't really scream a sticker
|
||||
}</code></pre>
|
||||
<p>Finally, let's add a couple more lines to the <code>onUpdateReceived</code> method to process each command before replying.</p>
|
||||
<p>Finally, let's add a couple more lines to the <code>onUpdateReceived</code> method to process each command before replying.</p>
|
||||
<pre><code>if(msg.isCommand()){
|
||||
if(msg.getText().equals("/scream")) //If the command was /scream, we switch gears
|
||||
if(msg.getText().equals("/scream")) //If the command was /scream, we switch gears
|
||||
screaming = true;
|
||||
else if (msg.getText().equals("/whisper")) //Otherwise, we return to normal
|
||||
else if (msg.getText().equals("/whisper")) //Otherwise, we return to normal
|
||||
screaming = false;
|
||||
|
||||
return; //We don't want to echo commands, so we exit
|
||||
return; //We don't want to echo commands, so we exit
|
||||
}</code></pre>
|
||||
<p>As you can see, it checks if the message <strong>is a command</strong>. If it is, the bot enters <strong>scream mode</strong>.
|
||||
In the update method, we check <strong>which mode we are in</strong> and either copy the message or convert it to upper case before <strong>sending it back</strong>.</p>
|
||||
<p>And that's it. Now the bot can <strong>execute commands</strong> and change its behavior accordingly.</p>
|
||||
<p>Naturally, this simplified logic will change the bot's behavior for <strong>everyone</strong> – not just the person who sent the command. This can be fun for this tutorial but <strong>won't work in a production environment</strong> – consider using a Map, dictionary or equivalent data structure to assign settings for individual users.</p>
|
||||
<p>As you can see, it checks if the message <strong>is a command</strong>. If it is, the bot enters <strong>scream mode</strong>.<br>In the update method, we check <strong>which mode we are in</strong> and either copy the message or convert it to upper case before <strong>sending it back</strong>.</p>
|
||||
<p>And that's it. Now the bot can <strong>execute commands</strong> and change its behavior accordingly.</p>
|
||||
<p>Naturally, this simplified logic will change the bot's behavior for <strong>everyone</strong> – not just the person who sent the command. This can be fun for this tutorial but <strong>won't work in a production environment</strong> – consider using a Map, dictionary or equivalent data structure to assign settings for individual users.</p>
|
||||
<blockquote>
|
||||
<p>Remember to always implement a few basic <a href="features#global-commands">global commands</a>.
|
||||
You can practice by implementing a simple feedback to the <code>/start</code> command, which we intentionally left out.</p>
|
||||
<p>Remember to always implement a few basic <a href="features#global-commands">global commands</a>.<br>You can practice by implementing a simple feedback to the <code>/start</code> command, which we intentionally left out.</p>
|
||||
</blockquote>
|
||||
<h3><a class="anchor" href="#buttons-and-keyboards" id="buttons-and-keyboards" name="buttons-and-keyboards"><i class="anchor-icon"></i></a>Buttons and Keyboards</h3>
|
||||
<h3><a class="anchor" name="buttons-and-keyboards" href="#buttons-and-keyboards"><i class="anchor-icon"></i></a>Buttons and Keyboards</h3>
|
||||
<p>To streamline and simplify user interaction with your bot, you can replace many text-based exchanges with handy buttons. These buttons can perform a wide variety of actions and can be customized for each user.</p>
|
||||
<h4><a class="anchor" href="#button-types" id="button-types" name="button-types"><i class="anchor-icon"></i></a>Button Types</h4>
|
||||
<h4><a class="anchor" name="button-types" href="#button-types"><i class="anchor-icon"></i></a>Button Types</h4>
|
||||
<p>There are two main types of buttons:</p>
|
||||
<ul>
|
||||
<li><strong>Reply Buttons</strong> - used to provide a list of predefined text <a href="features#keyboards">reply options</a>.</li>
|
||||
|
@ -376,27 +359,27 @@ You can practice by implementing a simple feedback to the <code>/start</code> co
|
|||
</ul>
|
||||
<p>Using these buttons is as easy as attaching a <code>ReplyKeyboardMarkup</code> or an <code>InlineKeyboardMarkup</code> to your <code>SendMessage</code> object.</p>
|
||||
<p>This guide will focus on <strong>inline buttons</strong> since they only require a few extra lines of code.</p>
|
||||
<h4><a class="anchor" href="#creating-buttons" id="creating-buttons" name="creating-buttons"><i class="anchor-icon"></i></a>Creating Buttons</h4>
|
||||
<p>First of all, let's create some buttons.</p>
|
||||
<h4><a class="anchor" name="creating-buttons" href="#creating-buttons"><i class="anchor-icon"></i></a>Creating Buttons</h4>
|
||||
<p>First of all, let's create some buttons.</p>
|
||||
<pre><code> var next = InlineKeyboardButton.builder()
|
||||
.text("Next").callbackData("next")
|
||||
.text("Next").callbackData("next")
|
||||
.build();
|
||||
|
||||
var back = InlineKeyboardButton.builder()
|
||||
.text("Back").callbackData("back")
|
||||
.text("Back").callbackData("back")
|
||||
.build();
|
||||
|
||||
var url = InlineKeyboardButton.builder()
|
||||
.text("Tutorial")
|
||||
.url("https://core.telegram.org/bots/api")
|
||||
.text("Tutorial")
|
||||
.url("https://core.telegram.org/bots/api")
|
||||
.build();</code></pre>
|
||||
<p>Let's go back through the fields we specified:</p>
|
||||
<p>Let's go back through the fields we specified:</p>
|
||||
<ul>
|
||||
<li><strong>Text</strong> - This is what the user will see, the text that appears on the button</li>
|
||||
<li><strong>Callback Data</strong> - This will be sent back to the code instance as part of a new <code>Update</code>, so we can quickly identify what button was clicked.</li>
|
||||
<li><strong>Url</strong> - A button that specifies a URL doesn't specify callbackdata since its behavior is predefined – it will open the given link when tapped.</li>
|
||||
<li><strong>Url</strong> - A button that specifies a URL doesn't specify callbackdata since its behavior is predefined – it will open the given link when tapped.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#creating-keyboards" id="creating-keyboards" name="creating-keyboards"><i class="anchor-icon"></i></a>Creating Keyboards</h4>
|
||||
<h4><a class="anchor" name="creating-keyboards" href="#creating-keyboards"><i class="anchor-icon"></i></a>Creating Keyboards</h4>
|
||||
<p>The <strong>buttons</strong> we created can be assembled into two <strong>keyboards</strong>, which will then be used to navigate back and forth between two <strong>sample menus</strong>.</p>
|
||||
<p>First, <strong>add two fields</strong> to store the necessary keyboards.</p>
|
||||
<pre><code>private boolean screaming = false;
|
||||
|
@ -413,13 +396,13 @@ keyboardM2 = InlineKeyboardMarkup.builder()
|
|||
.keyboardRow(List.of(url))
|
||||
.build();</code></pre>
|
||||
<blockquote>
|
||||
<p>You can place this code wherever you prefer, the important thing is making sure that keyboard variables are accessible from the method call that will send the new menu. If you're confused by this concept and don't know where to put them, just paste them above the command processing flow.</p>
|
||||
<p>You can place this code wherever you prefer, the important thing is making sure that keyboard variables are accessible from the method call that will send the new menu. If you're confused by this concept and don't know where to put them, just paste them above the command processing flow.</p>
|
||||
</blockquote>
|
||||
<h4><a class="anchor" href="#sending-keyboards" id="sending-keyboards" name="sending-keyboards"><i class="anchor-icon"></i></a>Sending Keyboards</h4>
|
||||
<h4><a class="anchor" name="sending-keyboards" href="#sending-keyboards"><i class="anchor-icon"></i></a>Sending Keyboards</h4>
|
||||
<p>Sending a keyboard only requires specifying a reply markup for the message.</p>
|
||||
<pre><code>public void sendMenu(Long who, String txt, InlineKeyboardMarkup kb){
|
||||
SendMessage sm = SendMessage.builder().chatId(who.toString())
|
||||
.parseMode("HTML").text(txt)
|
||||
.parseMode("HTML").text(txt)
|
||||
.replyMarkup(kb).build();
|
||||
|
||||
try {
|
||||
|
@ -429,33 +412,30 @@ keyboardM2 = InlineKeyboardMarkup.builder()
|
|||
}
|
||||
}</code></pre>
|
||||
<blockquote>
|
||||
<p>You may have noticed that we also added a new parameter, <code>HTML</code>.
|
||||
This is called a <a href="api#formatting-options">formatting option</a> and will allow us to use HTML tags and add formatting to the text later on.</p>
|
||||
<p>You may have noticed that we also added a new parameter, <code>HTML</code>.<br>This is called a <a href="api#formatting-options">formatting option</a> and will allow us to use HTML tags and add formatting to the text later on.</p>
|
||||
</blockquote>
|
||||
<h4><a class="anchor" href="#menu-trigger" id="menu-trigger" name="menu-trigger"><i class="anchor-icon"></i></a>Menu Trigger</h4>
|
||||
<p>We could send a new menu for each new user, but for simplicity let's add a new command that will spawn a menu. We can achieve this by adding a new <strong>else clause</strong> to the previous command flow.</p>
|
||||
<h4><a class="anchor" name="menu-trigger" href="#menu-trigger"><i class="anchor-icon"></i></a>Menu Trigger</h4>
|
||||
<p>We could send a new menu for each new user, but for simplicity let's add a new command that will spawn a menu. We can achieve this by adding a new <strong>else clause</strong> to the previous command flow.</p>
|
||||
<pre><code> var txt = msg.getText();
|
||||
if(msg.isCommand()) {
|
||||
if (txt.equals("/scream"))
|
||||
if (txt.equals("/scream"))
|
||||
screaming = true;
|
||||
else if (txt.equals("/whisper"))
|
||||
else if (txt.equals("/whisper"))
|
||||
screaming = false;
|
||||
else if (txt.equals("/menu"))
|
||||
sendMenu(id, "<b>Menu 1</b>", keyboardM1);
|
||||
else if (txt.equals("/menu"))
|
||||
sendMenu(id, "<b>Menu 1</b>", keyboardM1);
|
||||
return;
|
||||
}</code></pre>
|
||||
<p>Try sending <code>/menu</code> to your bot now. If you did everything correctly, you should see a brand new menu pop up.</p>
|
||||
<blockquote>
|
||||
<p>In a production environment, commands should be handled with an appropriate design pattern that isolates them into different executor classes – modular and separated from the main logic.</p>
|
||||
</blockquote>
|
||||
<h3><a class="anchor" href="#navigation" id="navigation" name="navigation"><i class="anchor-icon"></i></a>Navigation</h3>
|
||||
<h3><a class="anchor" name="navigation" href="#navigation"><i class="anchor-icon"></i></a>Navigation</h3>
|
||||
<p>When building complex bots, navigation is essential. Your users must be able to move seamlessly from one menu to the next. </p>
|
||||
<p>In this example, we want the <code>Next</code> button to lead the user to the second menu.
|
||||
The <code>Back</code> button will send us back.
|
||||
To do that, we will start processing incoming <code>CallbackQueries</code>, which are the results we get after the user taps on a button.</p>
|
||||
<p>In this example, we want the <code>Next</code> button to lead the user to the second menu.<br>The <code>Back</code> button will send us back.<br>To do that, we will start processing incoming <code>CallbackQueries</code>, which are the results we get after the user taps on a button.</p>
|
||||
<p>A <code>CallbackQuery</code> is essentially composed of three main parameters:</p>
|
||||
<ul>
|
||||
<li><strong>queryId</strong> - Needed to close the query. You <strong>must always</strong> close new queries after processing them – if you don't, a loading symbol will keep showing on the user's side on top of each button.</li>
|
||||
<li><strong>queryId</strong> - Needed to close the query. You <strong>must always</strong> close new queries after processing them – if you don't, a loading symbol will keep showing on the user's side on top of each button.</li>
|
||||
<li><strong>data</strong> - This identifies which button was pressed.</li>
|
||||
<li><strong>from</strong> - The user who pressed the button.</li>
|
||||
</ul>
|
||||
|
@ -465,16 +445,16 @@ To do that, we will start processing incoming <code>CallbackQueries</code>, whic
|
|||
|
||||
EditMessageText newTxt = EditMessageText.builder()
|
||||
.chatId(id.toString())
|
||||
.messageId(msgId).text("").build();
|
||||
.messageId(msgId).text("").build();
|
||||
|
||||
EditMessageReplyMarkup newKb = EditMessageReplyMarkup.builder()
|
||||
.chatId(id.toString()).messageId(msgId).build();
|
||||
|
||||
if(data.equals("next")) {
|
||||
newTxt.setText("MENU 2");
|
||||
if(data.equals("next")) {
|
||||
newTxt.setText("MENU 2");
|
||||
newKb.setReplyMarkup(keyboardM2);
|
||||
} else if(data.equals("back")) {
|
||||
newTxt.setText("MENU 1");
|
||||
} else if(data.equals("back")) {
|
||||
newTxt.setText("MENU 1");
|
||||
newKb.setReplyMarkup(keyboardM1);
|
||||
}
|
||||
|
||||
|
@ -485,29 +465,21 @@ To do that, we will start processing incoming <code>CallbackQueries</code>, whic
|
|||
execute(newTxt);
|
||||
execute(newKb);
|
||||
}</code></pre>
|
||||
<p>With this handler, whenever a button is tapped, your bot will automatically navigate between inline menus.
|
||||
Expanding on this concept allows for endless combinations of navigable submenus, settings and dynamic pages.</p>
|
||||
<h3><a class="anchor" href="#database" id="database" name="database"><i class="anchor-icon"></i></a>Database</h3>
|
||||
<p>With this handler, whenever a button is tapped, your bot will automatically navigate between inline menus.<br>Expanding on this concept allows for endless combinations of navigable submenus, settings and dynamic pages.</p>
|
||||
<h3><a class="anchor" name="database" href="#database"><i class="anchor-icon"></i></a>Database</h3>
|
||||
<p>Telegram <strong>does not</strong> host an update database for you – once you process and consume an update, it will no longer be available. This means that features like user lists, message lists, current user inline menu, settings, etc. <strong>have to be implemented and maintained</strong> by bot developers.</p>
|
||||
<p>If your bot needs one of these features and you want to get started on <strong>data persistence</strong>, we recommend that you look into <a href="https://en.wikipedia.org/wiki/Serialization">serialization</a> practices and libraries for your language of choice, as well as available databases.</p>
|
||||
<p>Implementing a database is out of scope for this guide, however, several guides are available online for simple embedded <strong>open source</strong> software solutions like <a href="https://www.sqlite.org/index.html">SQLite</a>, <a href="https://hsqldb.org/">HyperSQL</a>, <a href="https://db.apache.org/derby/">Derby</a> and many more.</p>
|
||||
<blockquote>
|
||||
<p>Your language of choice will also influence which databases are available and supported – the list above assumes you followed this Java tutorial.</p>
|
||||
</blockquote>
|
||||
<h3><a class="anchor" href="#hosting" id="hosting" name="hosting"><i class="anchor-icon"></i></a>Hosting</h3>
|
||||
<p>So far, your bot has been running on your <strong>local machine</strong> – your PC. While this may be good for <strong>developing</strong>, <strong>testing</strong> and <strong>debugging</strong>, it is not ideal for a production environment.
|
||||
You'll want your bot to be available and responsive at all times, but your computer might not always be online.</p>
|
||||
<h3><a class="anchor" name="hosting" href="#hosting"><i class="anchor-icon"></i></a>Hosting</h3>
|
||||
<p>So far, your bot has been running on your <strong>local machine</strong> – your PC. While this may be good for <strong>developing</strong>, <strong>testing</strong> and <strong>debugging</strong>, it is not ideal for a production environment.<br>You'll want your bot to be available and responsive at all times, but your computer might not always be online.</p>
|
||||
<p>This can be done in four steps:</p>
|
||||
<ul>
|
||||
<li>
|
||||
<p><strong>Package your code</strong>
|
||||
Making your bot <strong>easy to move</strong> and <strong>runnable</strong> outside of an IDE is essential to <strong>host it elsewhere</strong>.
|
||||
If you followed this tutorial, this <a href="https://www.jetbrains.com/help/idea/compiling-applications.html#run_packaged_jar">standard guide</a> will work for you. If you didn't, look into <strong>export or packaging guides</strong> for your IDE and language of choice – procedures may vary but the end result is the same.</p>
|
||||
<li><p><strong>Package your code</strong><br>Making your bot <strong>easy to move</strong> and <strong>runnable</strong> outside of an IDE is essential to <strong>host it elsewhere</strong>.<br>If you followed this tutorial, this <a href="https://www.jetbrains.com/help/idea/compiling-applications.html#run_packaged_jar">standard guide</a> will work for you. If you didn't, look into <strong>export or packaging guides</strong> for your IDE and language of choice – procedures may vary but the end result is the same.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Purchase a VPS or equivalent service</strong>
|
||||
A server is essentially a machine that is always online and running, without you having to worry about anything. To host your bot, you can opt for a <a href="https://en.wikipedia.org/wiki/Virtual_private_server">VPS</a> which serves this purpose and can be rented from several different providers.
|
||||
Another option would be to purchase a network-capable <a href="https://en.wikipedia.org/wiki/Microcontroller">microcontroller</a>, which come in all different specs and sizes depending on your needs.</p>
|
||||
<li><p><strong>Purchase a VPS or equivalent service</strong><br>A server is essentially a machine that is always online and running, without you having to worry about anything. To host your bot, you can opt for a <a href="https://en.wikipedia.org/wiki/Virtual_private_server">VPS</a> which serves this purpose and can be rented from several different providers.<br>Another option would be to purchase a network-capable <a href="https://en.wikipedia.org/wiki/Microcontroller">microcontroller</a>, which come in all different specs and sizes depending on your needs.</p>
|
||||
</li>
|
||||
</ul>
|
||||
<blockquote>
|
||||
|
@ -516,8 +488,7 @@ Another option would be to purchase a network-capable <a href="https://en.wikipe
|
|||
<ul>
|
||||
<li><strong>Upload your executable/package</strong></li>
|
||||
</ul>
|
||||
<p>Once you have a working <a href="https://en.wikipedia.org/wiki/Secure_Shell">ssh</a> connection between your machine and your new server, you should upload your executable and all associated files.
|
||||
We will assume the runnable jar <code>TutorialBot.jar</code> and its database <code>dbase.db</code> are currently in the <code>/TBot</code> folder.</p>
|
||||
<p>Once you have a working <a href="https://en.wikipedia.org/wiki/Secure_Shell">ssh</a> connection between your machine and your new server, you should upload your executable and all associated files.<br>We will assume the runnable jar <code>TutorialBot.jar</code> and its database <code>dbase.db</code> are currently in the <code>/TBot</code> folder.</p>
|
||||
<pre><code>$ scp -r /TBot/ username@server_ip:/bots/TBotRemote/</code></pre>
|
||||
<ul>
|
||||
<li><strong>Run your application</strong></li>
|
||||
|
@ -525,23 +496,23 @@ We will assume the runnable jar <code>TutorialBot.jar</code> and its database <c
|
|||
<p>Depending on which language you chose, you might have to configure your server environment differently. If you chose Java, you just need to install a compatible JDK.</p>
|
||||
<pre><code>$ apt install openjdk-17-jre
|
||||
$ java -version</code></pre>
|
||||
<p>If you did everything correctly, you should see a Java version as the output, along with a few other values. This means you're ready to run your application.</p>
|
||||
<p>If you did everything correctly, you should see a Java version as the output, along with a few other values. This means you're ready to run your application.</p>
|
||||
<p>Now, to run the executable:</p>
|
||||
<pre><code>$ cd /bots/TBotRemote/
|
||||
$ java -jar TutorialBot.jar</code></pre>
|
||||
<p>Your bot is now online and users can interact with it at any time.</p>
|
||||
<blockquote>
|
||||
<p>To streamline and modularize this process, you could employ a specialized <a href="https://www.docker.com/resources/what-container/">docker container</a> or equivalent service.
|
||||
If you followed along in one of the equivalent examples (<a href="https://gitlab.com/Athamaxy/telegram-bot-tutorial/-/blob/main/TutorialBot.cs">C#</a>, <a href="https://gitlab.com/Athamaxy/telegram-bot-tutorial/-/blob/main/TutorialBot.py">Python</a>, <a href="https://gitlab.com/Athamaxy/telegram-bot-tutorial/-/blob/main/TutorialBot.go">Go</a> and <a href="https://gitlab.com/Athamaxy/telegram-bot-tutorial/-/tree/main/Nodejs">TypeScript</a>) you can find a detailed set of instructions to export and run your code <a href="https://gitlab.com/Athamaxy/telegram-bot-tutorial/-/tree/main/">here</a>.</p>
|
||||
<p>To streamline and modularize this process, you could employ a specialized <a href="https://www.docker.com/resources/what-container/">docker container</a> or equivalent service.<br>If you followed along in one of the equivalent examples (<a href="https://gitlab.com/Athamaxy/telegram-bot-tutorial/-/blob/main/TutorialBot.cs">C#</a>, <a href="https://gitlab.com/Athamaxy/telegram-bot-tutorial/-/blob/main/TutorialBot.py">Python</a>, <a href="https://gitlab.com/Athamaxy/telegram-bot-tutorial/-/blob/main/TutorialBot.go">Go</a> and <a href="https://gitlab.com/Athamaxy/telegram-bot-tutorial/-/tree/main/Nodejs">TypeScript</a>) you can find a detailed set of instructions to export and run your code <a href="https://gitlab.com/Athamaxy/telegram-bot-tutorial/-/tree/main/">here</a>.</p>
|
||||
</blockquote>
|
||||
<h3><a class="anchor" href="#further-reading" id="further-reading" name="further-reading"><i class="anchor-icon"></i></a>Further Reading</h3>
|
||||
<h3><a class="anchor" name="further-reading" href="#further-reading"><i class="anchor-icon"></i></a>Further Reading</h3>
|
||||
<p>If you got this far, you might be interested in these additional guides and docs:</p>
|
||||
<ul>
|
||||
<li><a href="/bots">General Bot Platform Overview</a></li>
|
||||
<li><a href="/bots/features">Detailed List of Bot Features</a></li>
|
||||
<li><a href="/bots/api">Full API Reference</a></li>
|
||||
</ul>
|
||||
<p>If you encounter any issues while following this guide, you can contact us on Telegram at <a href="https://t.me/botsupport">@BotSupport</a>.</p></div>
|
||||
<p>If you encounter any issues while following this guide, you can contact us on Telegram at <a href="https://t.me/botsupport">@BotSupport</a>.</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
@ -57,6 +57,33 @@
|
|||
</blockquote>
|
||||
<hr>
|
||||
<h3><a class="anchor" name="recent-changes" href="#recent-changes"><i class="anchor-icon"></i></a>Recent changes</h3>
|
||||
<h4><a class="anchor" name="september-6-2024" href="#september-6-2024"><i class="anchor-icon"></i></a>September 6, 2024</h4>
|
||||
<p><strong>Bot API 7.10</strong></p>
|
||||
<ul>
|
||||
<li>Added the field <em>SecondaryButton</em> to the class <a href="#initializing-mini-apps">WebApp</a>.</li>
|
||||
<li>Added the event <em>secondaryButtonClicked</em>.</li>
|
||||
<li>Renamed the class <em>MainButton</em> to the class <a href="#bottombutton">BottomButton</a>.</li>
|
||||
<li>Added the field <em>bottomBarColor</em> and the method <em>setBottomBarColor</em> to the class <a href="#initializing-mini-apps">WebApp</a>.</li>
|
||||
<li>Added the field <em>bottom_bar_bg_color</em> to the class <a href="#themeparams">ThemeParams</a>.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" name="july-31-2024" href="#july-31-2024"><i class="anchor-icon"></i></a>July 31, 2024</h4>
|
||||
<p><strong>Bot API 7.8</strong></p>
|
||||
<ul>
|
||||
<li>Added the option for bots to set a <a href="#launching-the-main-mini-app">Main Mini App</a>, which can be previewed and launched directly from a button in the bot's profile or a link.</li>
|
||||
<li>Added the method <em>shareToStory</em> to the class <a href="#initializing-mini-apps">WebApp</a>.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" name="july-7-2024" href="#july-7-2024"><i class="anchor-icon"></i></a>July 7, 2024</h4>
|
||||
<p><strong>Bot API 7.7</strong></p>
|
||||
<ul>
|
||||
<li>Added the field <em>isVerticalSwipesEnabled</em> and the methods <em>enableVerticalSwipes</em>, <em>disableVerticalSwipes</em> to the class <a href="#initializing-mini-apps">WebApp</a>.</li>
|
||||
<li>Added the event <em>scanQrPopupClosed</em>.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" name="july-1-2024" href="#july-1-2024"><i class="anchor-icon"></i></a>July 1, 2024</h4>
|
||||
<p><strong>Bot API 7.6</strong></p>
|
||||
<ul>
|
||||
<li>Added the field <em>section_separator_color</em> to the class <a href="#themeparams">ThemeParams</a>.</li>
|
||||
<li>Changed the default opening mode for <a href="#direct-link-mini-apps">Direct Link Mini Apps</a>.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" name="march-31-2024" href="#march-31-2024"><i class="anchor-icon"></i></a>March 31, 2024</h4>
|
||||
<p><strong>Bot API 7.2</strong></p>
|
||||
<ul>
|
||||
|
@ -132,7 +159,7 @@
|
|||
</ul>
|
||||
<hr>
|
||||
<h3><a class="anchor" name="implementing-mini-apps" href="#implementing-mini-apps"><i class="anchor-icon"></i></a>Implementing Mini Apps</h3>
|
||||
<p>Telegram currently supports six different ways of launching Mini Apps: from a <a href="#keyboard-button-mini-apps">keyboard button</a>, from an <a href="#inline-button-mini-apps">inline button</a>, from the <a href="#launching-mini-apps-from-the-menu-button">bot menu button</a>, via <a href="#inline-mode-mini-apps">inline mode</a>, from a <a href="#direct-link-mini-apps">direct link</a> – and even from the <a href="#launching-mini-apps-from-the-attachment-menu">attachment menu</a>.</p>
|
||||
<p>Telegram currently supports seven different ways of launching Mini Apps: the main Mini App from a <a href="#launching-the-main-mini-app">profile button</a>, from a <a href="#keyboard-button-mini-apps">keyboard button</a>, from an <a href="#inline-button-mini-apps">inline button</a>, from the <a href="#launching-mini-apps-from-the-menu-button">bot menu button</a>, via <a href="#inline-mode-mini-apps">inline mode</a>, from a <a href="#direct-link-mini-apps">direct link</a> – and even from the <a href="#launching-mini-apps-from-the-attachment-menu">attachment menu</a>.</p>
|
||||
<div>
|
||||
<a href="/file/464001388/10b1a/IYpn0wWfggw.1156850/fd9a32baa81dcecbe4" target="_blank"><img src="/file/464001388/10b1a/IYpn0wWfggw.1156850/fd9a32baa81dcecbe4" title="" alt="Types of buttons" class="dev_page_image" /></a>
|
||||
</div>
|
||||
|
@ -182,6 +209,29 @@
|
|||
<blockquote>
|
||||
<p><a href="https://t.me/durgerkingbot">@DurgerKingBot</a> allows launching its Mini App both from an inline button and from the menu button.</p>
|
||||
</blockquote>
|
||||
<h4><a class="anchor" name="launching-the-main-mini-app" href="#launching-the-main-mini-app"><i class="anchor-icon"></i></a>Launching the main Mini App</h4>
|
||||
<blockquote>
|
||||
<p><strong>TL;DR:</strong> If your bot is a mini app, you can add a prominent <strong>Launch app</strong> button as well as high-quality demo videos and screenshots to the bot’s profile. To do this, go to <a href="https://t.me/botfather">@BotFather</a> and set up your bot's <strong>Main Mini App</strong>.</p>
|
||||
</blockquote>
|
||||
<p>If your bot is a mini app, you can unlock a number of features that streamline and simplify the way in which users view and interact with it. To do this, go to <a href="https://t.me/botfather">@BotFather</a> and set up your bot's <strong>Main Mini App</strong>.</p>
|
||||
<p>After setting a main mini app, you'll be able to upload detailed <strong>media preview demos</strong> to publicly highlight your app's key features on its profile. A <strong>Launch app</strong> button will also appear, allowing users to open your app directly from its profile. Bots that enabled a main mini app will be displayed in the <em>Apps</em> tab of the search for users who have launched them.</p>
|
||||
<blockquote>
|
||||
<p>Media previews support <a href="https://core.telegram.org/bots/features#mini-app-previews">multiple languages</a> – so you can upload <strong>translated versions</strong> of your previews that will be shown to users based on their <strong>app language</strong>.</p>
|
||||
</blockquote>
|
||||
<p>A bot's <strong>main Mini App</strong> can also be opened in the current chat by direct link in the format <code>https://t.me/botusername?startapp</code>. If a non-empty <em>startapp</em> parameter is included in the link, it will be passed to the Mini App in the <em>start_param</em> field and in the GET parameter <em>tgWebAppStartParam</em>. </p>
|
||||
<p><strong>Examples</strong></p>
|
||||
<p><code>https://t.me/botusername?startapp</code><br><code>https://t.me/botusername?startapp=command</code><br><code>https://t.me/botusername?startapp=command&mode=compact</code></p>
|
||||
<p>In this mode, Mini Apps can use the <em>chat_type</em> and <em>chat_instance</em> parameters to keep track of the current chat context. This introduces support for <strong>concurrent</strong> and <strong>shared</strong> usage by multiple chat members – to create live whiteboards, group orders, multiplayer games and similar apps.</p>
|
||||
<p>By default, the main Mini App opens to full-screen height, and users cannot reduce them to half-height. However, you can change this behavior via <a href="https://t.me/botfather">@BotFather</a> or by including the parameter <code>mode=compact</code> in the link to the Mini App, in which case it will open to half-screen height by default.</p>
|
||||
<p><strong>Good for:</strong></p>
|
||||
<ul>
|
||||
<li>Fully-fledged web services and integrations that any user can open in one tap.</li>
|
||||
<li>Cooperative, multiplayer or teamwork-oriented services within a chat context.</li>
|
||||
<li>The use cases are effectively <strong>unlimited</strong>.</li>
|
||||
</ul>
|
||||
<blockquote>
|
||||
<p>Successful bots which <strong>enable</strong> a main Mini App and <strong>accept payments</strong> in <a href="https://core.telegram.org/bots/payments-stars">Telegram Stars</a> may be featured in the Telegram <a href="https://t.me/BotNews/99">Mini App Store</a>. To increase the chances of being featured, we recommend uploading high-quality media showcasing your app on your bot's profile and following our <a href="#design-guidelines">design guidelines</a>.</p>
|
||||
</blockquote>
|
||||
<h4><a class="anchor" name="inline-mode-mini-apps" href="#inline-mode-mini-apps"><i class="anchor-icon"></i></a>Inline Mode Mini Apps</h4>
|
||||
<blockquote>
|
||||
<p><strong>TL;DR:</strong> Mini Apps launched via <strong>web_app</strong> type <a href="/bots/api#inlinequeryresultsbutton">InlineQueryResultsButton</a> can be used anywhere in inline mode. Users can create content in a web interface and then seamlessly send it to the current chat via inline mode.</p>
|
||||
|
@ -199,8 +249,9 @@
|
|||
<p>You can use direct links to <strong>open a Mini App</strong> directly in the current chat. If a non-empty <em>startapp</em> parameter is included in the link, it will be passed to the Mini App in the <em>start_param</em> field and in the GET parameter <em>tgWebAppStartParam</em>.</p>
|
||||
<p>In this mode, Mini Apps can use the <em>chat_type</em> and <em>chat_instance</em> parameters to keep track of the current chat context. This introduces support for <strong>concurrent</strong> and <strong>shared</strong> usage by multiple chat members – to create live whiteboards, group orders, multiplayer games and similar apps.</p>
|
||||
<p>Mini Apps opened from a direct link have <strong>no access</strong> to the chat – they can't read messages or send new ones on behalf of the user. To send messages, the user must be redirected to <strong>inline mode</strong> and actively pick a result.</p>
|
||||
<p>Starting from <mark>Bot API 7.6</mark>, by default, Mini Apps of this type open to full-screen height, and users cannot reduce them to half-height. However, you can change this behavior by including the parameter <code>mode=compact</code> in the link to the Mini App, in which case it will open to half-screen height by default.</p>
|
||||
<p><strong>Examples</strong></p>
|
||||
<p><code>https://t.me/botusername/appname</code><br><code>https://t.me/botusername/appname?startapp=command</code></p>
|
||||
<p><code>https://t.me/botusername/appname</code><br><code>https://t.me/botusername/appname?startapp=command</code><br><code>https://t.me/botusername/appname?startapp=command&mode=compact</code></p>
|
||||
<p><strong>Good for:</strong></p>
|
||||
<ul>
|
||||
<li>Fully-fledged web services and integrations that any user can open in one tap.</li>
|
||||
|
@ -290,21 +341,36 @@
|
|||
<td>Current background color in the <code>#RRGGBB</code> format.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>bottomBarColor</td>
|
||||
<td>String</td>
|
||||
<td>Current bottom bar color in the <code>#RRGGBB</code> format.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>isClosingConfirmationEnabled</td>
|
||||
<td>Boolean</td>
|
||||
<td><em>True</em>, if the confirmation dialog is enabled while the user is trying to close the Mini App. <em>False</em>, if the confirmation dialog is disabled.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>isVerticalSwipesEnabled <sup><mark>NEW</mark></sup></td>
|
||||
<td>Boolean</td>
|
||||
<td><em>True</em>, if vertical swipes to close or minimize the Mini App are enabled. <em>False</em>, if vertical swipes to close or minimize the Mini App are disabled. In any case, the user will still be able to minimize and close the Mini App by swiping the Mini App's header.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>BackButton</td>
|
||||
<td><a href="#backbutton">BackButton</a></td>
|
||||
<td>An object for controlling the back button which can be displayed in the header of the Mini App in the Telegram interface.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>MainButton</td>
|
||||
<td><a href="#mainbutton">MainButton</a></td>
|
||||
<td><a href="#bottombutton">BottomButton</a></td>
|
||||
<td>An object for controlling the main button, which is displayed at the bottom of the Mini App in the Telegram interface.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SecondaryButton</td>
|
||||
<td><a href="#bottombutton">BottomButton</a></td>
|
||||
<td>An object for controlling the secondary button, which is displayed at the bottom of the Mini App in the Telegram interface.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SettingsButton</td>
|
||||
<td><a href="#settingsbutton">SettingsButton</a></td>
|
||||
<td>An object for controlling the Settings item in the context menu of the Mini App in the Telegram interface.</td>
|
||||
|
@ -320,7 +386,7 @@
|
|||
<td>An object for controlling cloud storage.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>BiometricManager <sup><mark>NEW</mark></sup></td>
|
||||
<td>BiometricManager</td>
|
||||
<td><a href="#biometricmanager">BiometricManager</a></td>
|
||||
<td>An object for controlling biometrics on the device.</td>
|
||||
</tr>
|
||||
|
@ -340,6 +406,11 @@
|
|||
<td><mark>Bot API 6.1+</mark> A method that sets the app background color in the <code>#RRGGBB</code> format. You can also use keywords <em>bg_color</em> and <em>secondary_bg_color</em>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>setBottomBarColor(color)</td>
|
||||
<td>Function</td>
|
||||
<td><mark>Bot API 7.10+</mark> A method that sets the app's bottom bar color in the <code>#RRGGBB</code> format. You can also use the keywords <em>bg_color</em>, <em>secondary_bg_color</em> and <em>bottom_bar_bg_color</em>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>enableClosingConfirmation()</td>
|
||||
<td>Function</td>
|
||||
<td><mark>Bot API 6.2+</mark> A method that enables a confirmation dialog while the user is trying to close the Mini App.</td>
|
||||
|
@ -350,6 +421,16 @@
|
|||
<td><mark>Bot API 6.2+</mark> A method that disables the confirmation dialog while the user is trying to close the Mini App.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>enableVerticalSwipes() <sup><mark>NEW</mark></sup></td>
|
||||
<td>Function</td>
|
||||
<td><mark>Bot API 7.7+</mark> A method that enables vertical swipes to close or minimize the Mini App. For user convenience, it is recommended to always enable swipes unless they conflict with the Mini App's own gestures.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>disableVerticalSwipes() <sup><mark>NEW</mark></sup></td>
|
||||
<td>Function</td>
|
||||
<td><mark>Bot API 7.7+</mark> A method that disables vertical swipes to close or minimize the Mini App. This method is useful if your Mini App uses swipe gestures that may conflict with the gestures for minimizing and closing the app.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>onEvent(eventType, eventHandler)</td>
|
||||
<td>Function</td>
|
||||
<td>A method that sets the app event handler. Check <a href="#events-available-for-mini-apps">the list of available events</a>.</td>
|
||||
|
@ -385,6 +466,11 @@
|
|||
<td><mark>Bot API 6.1+</mark> A method that opens an invoice using the link <em>url</em>. The Mini App will receive the <a href="#events-available-for-mini-apps">event</a> <em>invoiceClosed</em> when the invoice is closed. If an optional <em>callback</em> parameter was passed, the <em>callback</em> function will be called and the invoice status will be passed as the first argument.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>shareToStory(media_url[, params])</td>
|
||||
<td>Function</td>
|
||||
<td><mark>Bot API 7.8+</mark> A method that opens the native story editor with the media specified in the <em>media_url</em> parameter as an HTTPS URL. An optional <em>params</em> argument of the type <a href="#storyshareparams">StoryShareParams</a> describes additional sharing settings.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>showPopup(params[, callback])</td>
|
||||
<td>Function</td>
|
||||
<td><mark>Bot API 6.2+</mark> A method that shows a native popup described by the <em>params</em> argument of the type <a href="#popupparams">PopupParams</a>. The Mini App will receive the <a href="#events-available-for-mini-apps">event</a> <em>popupClosed</em> when the popup is closed. If an optional <em>callback</em> parameter was passed, the <em>callback</em> function will be called and the field <em>id</em> of the pressed button will be passed as the first argument.</td>
|
||||
|
@ -402,7 +488,7 @@
|
|||
<tr>
|
||||
<td>showScanQrPopup(params[, callback])</td>
|
||||
<td>Function</td>
|
||||
<td><mark>Bot API 6.4+</mark> A method that shows a native popup for scanning a QR code described by the <em>params</em> argument of the type <a href="#scanqrpopupparams">ScanQrPopupParams</a>. The Mini App will receive the <a href="#events-available-for-mini-apps">event</a> <em>qrTextReceived</em> every time the scanner catches a code with text data. If an optional <em>callback</em> parameter was passed, the <em>callback</em> function will be called and the text from the QR code will be passed as the first argument. Returning <em>true</em> inside this callback function causes the popup to be closed.</td>
|
||||
<td><mark>Bot API 6.4+</mark> A method that shows a native popup for scanning a QR code described by the <em>params</em> argument of the type <a href="#scanqrpopupparams">ScanQrPopupParams</a>. The Mini App will receive the <a href="#events-available-for-mini-apps">event</a> <em>qrTextReceived</em> every time the scanner catches a code with text data. If an optional <em>callback</em> parameter was passed, the <em>callback</em> function will be called and the text from the QR code will be passed as the first argument. Returning <em>true</em> inside this callback function causes the popup to be closed. Starting from <mark>Bot API 7.7</mark>, the Mini App will receive the <em>scanQrPopupClosed</em> event if the user closes the native popup for scanning a QR code.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>closeScanQrPopup()</td>
|
||||
|
@ -493,6 +579,11 @@
|
|||
<td><em>Optional</em>. <mark>Bot API 7.0+</mark> Header background color in the <code>#RRGGBB</code> format.<br>Also available as the CSS variable <code>var(--tg-theme-header-bg-color)</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>bottom_bar_bg_color</td>
|
||||
<td>String</td>
|
||||
<td><em>Optional</em>. <mark>Bot API 7.10+</mark> Bottom background color in the <code>#RRGGBB</code> format.<br>Also available as the CSS variable <code>var(--tg-theme-bottom-bar-bg-color)</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>accent_text_color</td>
|
||||
<td>String</td>
|
||||
<td><em>Optional</em>. <mark>Bot API 7.0+</mark> Accent text color in the <code>#RRGGBB</code> format.<br>Also available as the CSS variable <code>var(--tg-theme-accent-text-color)</code>.</td>
|
||||
|
@ -508,6 +599,11 @@
|
|||
<td><em>Optional</em>. <mark>Bot API 7.0+</mark> Header text color for the section in the <code>#RRGGBB</code> format.<br>Also available as the CSS variable <code>var(--tg-theme-section-header-text-color)</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>section_separator_color</td>
|
||||
<td>String</td>
|
||||
<td><em>Optional</em>. <mark>Bot API 7.6+</mark> Section separator color in the <code>#RRGGBB</code> format.<br>Also available as the CSS variable <code>var(--tg-theme-section-separator-color)</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>subtitle_text_color</td>
|
||||
<td>String</td>
|
||||
<td><em>Optional</em>. <mark>Bot API 7.0+</mark> Subtitle text color in the <code>#RRGGBB</code> format.<br>Also available as the CSS variable <code>var(--tg-theme-subtitle-text-color)</code>.</td>
|
||||
|
@ -520,9 +616,74 @@
|
|||
</tbody>
|
||||
</table>
|
||||
<div>
|
||||
<a href="/file/464001695/11185/DAwyUjA7LNA.215601/26f4c8ebf862ae860d" target="_blank"><img src="/file/464001695/11185/DAwyUjA7LNA.215601/26f4c8ebf862ae860d" title="WebViewColors explained" class="dev_page_image" /></a>
|
||||
<a href="/file/400780400851/2/6GwDkk6T-aY.416569/b591d589108b487d63" target="_blank"><img src="/file/400780400851/2/6GwDkk6T-aY.416569/b591d589108b487d63" title="WebViewColors explained" class="dev_page_image" /></a>
|
||||
</div>
|
||||
|
||||
|
||||
<h4><a class="anchor" name="storyshareparams" href="#storyshareparams"><i class="anchor-icon"></i></a>StoryShareParams</h4>
|
||||
<p>This object describes additional sharing settings for the native story editor.</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Field</th>
|
||||
<th>Type</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>text</td>
|
||||
<td>String</td>
|
||||
<td><em>Optional</em>. The caption to be added to the media, 0-200 characters for regular users and 0-2048 characters for <a href="https://telegram.org/faq_premium#telegram-premium">premium</a> subscribers.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>widget_link</td>
|
||||
<td><a href="#storywidgetlink">StoryWidgetLink</a></td>
|
||||
<td><em>Optional</em>. An object that describes a widget link to be included in the story. Note that only <a href="https://telegram.org/faq_premium#telegram-premium">premium</a> subscribers can post stories with links.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h4><a class="anchor" name="storywidgetlink" href="#storywidgetlink"><i class="anchor-icon"></i></a>StoryWidgetLink</h4>
|
||||
<p>This object describes a widget link to be included in the story.</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Field</th>
|
||||
<th>Type</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>url</td>
|
||||
<td>String</td>
|
||||
<td>The URL to be included in the story.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>name</td>
|
||||
<td>String</td>
|
||||
<td><em>Optional</em>. The name to be displayed for the widget link, 0-48 characters.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h4><a class="anchor" name="scanqrpopupparams" href="#scanqrpopupparams"><i class="anchor-icon"></i></a>ScanQrPopupParams</h4>
|
||||
<p>This object describes the native popup for scanning QR codes.</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Field</th>
|
||||
<th>Type</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>text</td>
|
||||
<td>String</td>
|
||||
<td><em>Optional</em>. The text to be displayed under the 'Scan QR' heading, 0-64 characters.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h4><a class="anchor" name="popupparams" href="#popupparams"><i class="anchor-icon"></i></a>PopupParams</h4>
|
||||
<p>This object describes the native popup.</p>
|
||||
<table class="table">
|
||||
|
@ -551,24 +712,6 @@
|
|||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h4><a class="anchor" name="scanqrpopupparams" href="#scanqrpopupparams"><i class="anchor-icon"></i></a>ScanQrPopupParams</h4>
|
||||
<p>This object describes the native popup for scanning QR codes.</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Field</th>
|
||||
<th>Type</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>text</td>
|
||||
<td>String</td>
|
||||
<td><em>Optional</em>. The text to be displayed under the 'Scan QR' heading, 0-64 characters.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h4><a class="anchor" name="popupbutton" href="#popupbutton"><i class="anchor-icon"></i></a>PopupButton</h4>
|
||||
<p>This object describes the native popup button.</p>
|
||||
<table class="table">
|
||||
|
@ -636,8 +779,8 @@
|
|||
</tbody>
|
||||
</table>
|
||||
<p>All these methods return the BackButton object so they can be chained.</p>
|
||||
<h4><a class="anchor" name="mainbutton" href="#mainbutton"><i class="anchor-icon"></i></a>MainButton</h4>
|
||||
<p>This object controls the main button, which is displayed at the bottom of the Mini App in the Telegram interface.</p>
|
||||
<h4><a class="anchor" name="bottombutton" href="#bottombutton"><i class="anchor-icon"></i></a>BottomButton</h4>
|
||||
<p>This object controls the button that is displayed at the bottom of the Mini App in the Telegram interface.</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -648,19 +791,24 @@
|
|||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>type</td>
|
||||
<td>String</td>
|
||||
<td><em>Readonly.</em> Type of the button. It can be either <em>main</em> for the main button or <em>secondary</em> for the secondary button.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>text</td>
|
||||
<td>String</td>
|
||||
<td>Current button text. Set to <em>CONTINUE</em> by default.</td>
|
||||
<td>Current button text. Set to <em>Continue</em> for the main button and <em>Cancel</em> for the secondary button by default.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>color</td>
|
||||
<td>String</td>
|
||||
<td>Current button color. Set to <em>themeParams.button_color</em> by default.</td>
|
||||
<td>Current button color. Set to <em>themeParams.button_color</em> for the main button and <em>themeParams.bottom_bar_bg_color</em> for the secondary button by default.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>textColor</td>
|
||||
<td>String</td>
|
||||
<td>Current button text color. Set to <em>themeParams.button_text_color</em> by default.</td>
|
||||
<td>Current button text color. Set to <em>themeParams.button_text_color</em> for the main button and <em>themeParams.button_color</em> for the secondary button by default.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>isVisible</td>
|
||||
|
@ -673,6 +821,16 @@
|
|||
<td>Shows whether the button is active. Set to <em>true</em> by default.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>hasShineEffect</td>
|
||||
<td>Boolean</td>
|
||||
<td><mark>Bot API 7.10+</mark> Shows whether the button has a shine effect. Set to <em>false</em> by default.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>position</td>
|
||||
<td>String</td>
|
||||
<td><mark>Bot API 7.10+</mark> Position of the secondary button. Not defined for the main button. It applies only if both the main and secondary buttons are visible. Set to <em>left</em> by default.<br>Supported values:<br>- <em>left</em>, displayed to the left of the main button,<br>- <em>right</em>, displayed to the right of the main button,<br>- <em>top</em>, displayed above the main button,<br>- <em>bottom</em>, displayed below the main button.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>isProgressVisible</td>
|
||||
<td>Boolean</td>
|
||||
<td><em>Readonly.</em> Shows whether the button is displaying a loading indicator.</td>
|
||||
|
@ -685,12 +843,12 @@
|
|||
<tr>
|
||||
<td>onClick(callback)</td>
|
||||
<td>Function</td>
|
||||
<td>A method that sets the button press event handler. An alias for <code>Telegram.WebApp.onEvent('mainButtonClicked', callback)</code></td>
|
||||
<td>A method that sets the button's press event handler. An alias for <code>Telegram.WebApp.onEvent('mainButtonClicked', callback)</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>offClick(callback)</td>
|
||||
<td>Function</td>
|
||||
<td>A method that removes the button press event handler. An alias for <code>Telegram.WebApp.offEvent('mainButtonClicked', callback)</code></td>
|
||||
<td>A method that removes the button's press event handler. An alias for <code>Telegram.WebApp.offEvent('mainButtonClicked', callback)</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>show()</td>
|
||||
|
@ -725,11 +883,11 @@
|
|||
<tr>
|
||||
<td>setParams(params)</td>
|
||||
<td>Function</td>
|
||||
<td>A method to set the button parameters. The <em>params</em> parameter is an object containing one or several fields that need to be changed:<br><strong>text</strong> - button text;<br><strong>color</strong> - button color;<br><strong>text_color</strong> - button text color;<br><strong>is_active</strong> - enable the button;<br><strong>is_visible</strong> - show the button.</td>
|
||||
<td>A method to set the button parameters. The <em>params</em> parameter is an object containing one or several fields that need to be changed:<br><strong>text</strong> - button text;<br><strong>color</strong> - button color;<br><strong>text_color</strong> - button text color;<br><strong>has_shine_effect</strong> - <mark>Bot API 7.10+</mark> enable shine effect;<br><strong>position</strong> - position of the secondary button;<br><strong>is_active</strong> - enable the button;<br><strong>is_visible</strong> - show the button.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>All these methods return the MainButton object so they can be chained.</p>
|
||||
<p>All these methods return the BottomButton object so they can be chained.</p>
|
||||
<h4><a class="anchor" name="settingsbutton" href="#settingsbutton"><i class="anchor-icon"></i></a>SettingsButton</h4>
|
||||
<p>This object controls the <strong>Settings</strong> item in the context menu of the Mini App in the Telegram interface.</p>
|
||||
<table class="table">
|
||||
|
@ -843,7 +1001,7 @@
|
|||
</table>
|
||||
<p>All these methods return the <a href="#cloudstorage">CloudStorage</a> object, so they can be chained.</p>
|
||||
<h4><a class="anchor" name="biometricmanager" href="#biometricmanager"><i class="anchor-icon"></i></a>BiometricManager</h4>
|
||||
<p><sup><mark>NEW</mark></sup> This object controls biometrics on the device. Before the first use of this object, it needs to be initialized using the <em>init</em> method.</p>
|
||||
<p>This object controls biometrics on the device. Before the first use of this object, it needs to be initialized using the <em>init</em> method.</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -1148,7 +1306,11 @@ if (hex(HMAC_SHA256(data_check_string, secret_key)) == hash) {
|
|||
</tr>
|
||||
<tr>
|
||||
<td><code>mainButtonClicked</code></td>
|
||||
<td>Occurs when the <a href="#mainbutton">main button</a> is pressed.<br><em>eventHandler</em> receives no parameters.</td>
|
||||
<td>Occurs when the <a href="#bottombutton">main button</a> is pressed.<br><em>eventHandler</em> receives no parameters.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>secondaryButtonClicked</code></td>
|
||||
<td><mark>Bot API 7.10+</mark> Occurs when the <a href="#bottombutton">secondary button</a> is pressed.<br><em>eventHandler</em> receives no parameters.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>backButtonClicked</code></td>
|
||||
|
@ -1171,6 +1333,10 @@ if (hex(HMAC_SHA256(data_check_string, secret_key)) == hash) {
|
|||
<td><mark>Bot API 6.4+</mark> Occurs when the QR code scanner catches a code with text data.<br><em>eventHandler</em> receives an object with the single field <em>data</em> containing text data from the QR code.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>scanQrPopupClosed</code></td>
|
||||
<td><mark>Bot API 7.7+</mark> Occurs when the QR code scanner popup is closed by the user.<br><em>eventHandler</em> receives no parameters.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>clipboardTextReceived</code></td>
|
||||
<td><mark>Bot API 6.4+</mark> Occurrs when the <code>readTextFromClipboard</code> method is called.<br><em>eventHandler</em> receives an object with the single field <em>data</em> containing text data from the clipboard. If the clipboard contains non-text data, the field <em>data</em> will be an empty string. If the Mini App has no access to the clipboard, the field <em>data</em> will be <em>null</em>.</td>
|
||||
</tr>
|
||||
|
@ -1235,7 +1401,7 @@ if (hex(HMAC_SHA256(data_check_string, secret_key)) == hash) {
|
|||
</ul>
|
||||
<p><strong>Telegram Desktop on Windows and Linux</strong></p>
|
||||
<ul>
|
||||
<li>Download and launch the <a href="https://desktop.telegram.org/changelog#beta-version">Beta Version</a> of Telegram Desktop.</li>
|
||||
<li>Download and launch the <a href="https://desktop.telegram.org/changelog#beta-version">Beta Version</a> of Telegram Desktop on <strong>Windows</strong> or <strong>Linux</strong> (not supported on Telegram Desktop for macOS yet).</li>
|
||||
<li>Go to <em>Settings > Advanced > Experimental settings > Enable webview inspection</em>.</li>
|
||||
<li>Right click in the WebView and choose <em>Inspect</em>.</li>
|
||||
</ul>
|
||||
|
|
Loading…
Add table
Reference in a new issue