2022-02-24 19:51:11 +01:00
<!DOCTYPE html>
< html class = "" >
< head >
< meta charset = "utf-8" >
< title > Bots< / title >
< meta name = "viewport" content = "width=device-width, initial-scale=1.0" >
< meta property = "description" content = "Working with bots , using the MTProto API .
See here for more info about bots.
Please note that you can also use the simplified…">
< meta property = "og:title" content = "Bots" >
< meta property = "og:image" content = "" >
< meta property = "og:description" content = "Working with bots , using the MTProto API .
See here for more info about bots.
Please note that you can also use the simplified…">
< link rel = "shortcut icon" href = "/favicon.ico?4" type = "image/x-icon" / >
< link href = "/css/bootstrap.min.css?3" rel = "stylesheet" >
2022-03-03 21:00:19 +01:00
< link href = "/css/telegram.css?219" rel = "stylesheet" media = "screen" >
2022-02-24 19:51:11 +01:00
< style >
< / style >
< / head >
< body class = "preload" >
< div class = "dev_page_wrap" >
< div class = "dev_page_head navbar navbar-static-top navbar-tg" >
< div class = "navbar-inner" >
< div class = "container clearfix" >
< ul class = "nav navbar-nav navbar-right hidden-xs" > < li class = "navbar-twitter" > < a href = "https://twitter.com/telegram" target = "_blank" data-track = "Follow/Twitter" onclick = "trackDlClick(this, event)" > < i class = "icon icon-twitter" > < / i > < span > Twitter< / span > < / a > < / li > < / ul >
< ul class = "nav navbar-nav" >
< li > < a href = "//telegram.org/" > Home< / a > < / li >
< li class = "hidden-xs" > < a href = "//telegram.org/faq" > FAQ< / a > < / li >
< li class = "hidden-xs" > < a href = "//telegram.org/apps" > Apps< / a > < / li >
< li class = "active" > < a href = "/api" > API< / a > < / li >
< li class = "" > < a href = "/mtproto" > Protocol< / a > < / li >
< li class = "" > < a href = "/schema" > Schema< / a > < / li >
< / ul >
< / div >
< / div >
< / div >
< div class = "container clearfix" >
< div class = "dev_page" >
< div id = "dev_page_content_wrap" class = " " >
< div class = "dev_page_bread_crumbs" > < ul class = "breadcrumb clearfix" > < li > < a href = "/api" > API< / a > < / li > < i class = "icon icon-breadcrumb-divider" > < / i > < li > < a href = "/api/bots" > Bots< / a > < / li > < / ul > < / div >
< h1 id = "dev_page_title" > Bots< / h1 >
< div id = "dev_page_content" > <!-- scroll_nav -->
< p > Working with bots, using the MTProto API.< / p >
< p > See < a href = "/bots" > here< / a > for more info about bots. < / p >
< p > Please note that you can also use the simplified < a href = "/bots/api" > HTTP Bot API< / a > to use bots, see < a href = "/bots" > here for more info »< / a > .< / p >
< h3 > < a class = "anchor" href = "#login" id = "login" name = "login" > < i class = "anchor-icon" > < / i > < / a > Login< / h3 >
< pre > < code > ---functions---
< a href = '/method/auth.importBotAuthorization' > auth.importBotAuthorization< / a > #67a3ff2c flags:< a href = '/type/int' > int< / a > api_id:< a href = '/type/int' > int< / a > api_hash:< a href = '/type/string' > string< / a > bot_auth_token:< a href = '/type/string' > string< / a > = < a href = '/type/auth.Authorization' > auth.Authorization< / a > ;< / code > < / pre >
< p > In order to login as a bot, instead of using the < a href = "/api/auth" > standard login code flow< / a > , simply provide the < a href = "/bots#creating-a-new-bot" > bot token< / a > generated by < a href = "https://t.me/botfather" > @botfather< / a > .< br >
You must still provide your < a href = "/api/obtaining_api_id#obtaining-api-id" > API ID< / a > , as per user logins. < / p >
< p > After successful authorization, you will be able to use < a href = "/methods" > most MTProto API methods< / a > , just as any normal user.< br >
Methods that can be called by bots will have a < strong > Bots can use this method< / strong > notice. < / p >
< h3 > < a class = "anchor" href = "#commands" id = "commands" name = "commands" > < i class = "anchor-icon" > < / i > < / a > < a href = "/api/bots/commands" > Commands< / a > < / h3 >
< p > < a href = "/bots" > Bots< / a > offer a set of commands that can be used by users in private, or in a chat. < / p >
< h3 > < a class = "anchor" href = "#buttons" id = "buttons" name = "buttons" > < i class = "anchor-icon" > < / i > < / a > < a href = "/api/bots/buttons" > Buttons< / a > < / h3 >
< p > Users can interact with your bot via < strong > buttons< / strong > or even < strong > inline buttons< / strong > , straight from inline < strong > messages< / strong > in < strong > any< / strong > chat. < / p >
< h3 > < a class = "anchor" href = "#inline-queries" id = "inline-queries" name = "inline-queries" > < i class = "anchor-icon" > < / i > < / a > < a href = "/api/bots/inline" > Inline queries< / a > < / h3 >
< p > Users can interact with your bot via < strong > inline queries< / strong > , straight from the < strong > text input field< / strong > in < strong > any< / strong > chat. < / p >
< h3 > < a class = "anchor" href = "#games" id = "games" name = "games" > < i class = "anchor-icon" > < / i > < / a > < a href = "/api/bots/games" > Games< / a > < / h3 >
< p > Bots can offer users HTML5 games to play solo or to compete against each other in groups and one-on-one chats; how to work with games in the MTProto API.< / p > < / div >
< / div >
< / div >
< / div >
< div class = "footer_wrap" >
< div class = "footer_columns_wrap footer_desktop" >
< div class = "footer_column footer_column_telegram" >
< h5 > Telegram< / h5 >
< div class = "footer_telegram_description" > < / div >
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
< / div >
< div class = "footer_column" >
< h5 > < a href = "//telegram.org/faq" > About< / a > < / h5 >
< ul >
< li > < a href = "//telegram.org/faq" > FAQ< / a > < / li >
< li > < a href = "//telegram.org/blog" > Blog< / a > < / li >
< li > < a href = "//telegram.org/jobs" > Jobs< / a > < / li >
< / ul >
< / div >
< div class = "footer_column" >
< h5 > < a href = "//telegram.org/apps#mobile-apps" > Mobile Apps< / a > < / h5 >
< ul >
< li > < a href = "//telegram.org/dl/ios" > iPhone/iPad< / a > < / li >
< li > < a href = "//telegram.org/dl/android" > Android< / a > < / li >
< li > < a href = "//telegram.org/dl/wp" > Windows Phone< / a > < / li >
< / ul >
< / div >
< div class = "footer_column" >
< h5 > < a href = "//telegram.org/apps#desktop-apps" > Desktop Apps< / a > < / h5 >
< ul >
< li > < a href = "//desktop.telegram.org/" > PC/Mac/Linux< / a > < / li >
< li > < a href = "//macos.telegram.org/" > macOS< / a > < / li >
< li > < a href = "//telegram.org/dl/web" > Web-browser< / a > < / li >
< / ul >
< / div >
< div class = "footer_column footer_column_platform" >
< h5 > < a href = "/" > Platform< / a > < / h5 >
< ul >
< li > < a href = "/api" > API< / a > < / li >
< li > < a href = "//translations.telegram.org/" > Translations< / a > < / li >
< li > < a href = "//instantview.telegram.org/" > Instant View< / a > < / li >
< / ul >
< / div >
< / div >
< div class = "footer_columns_wrap footer_mobile" >
< div class = "footer_column" >
< h5 > < a href = "//telegram.org/faq" > About< / a > < / h5 >
< / div >
< div class = "footer_column" >
< h5 > < a href = "//telegram.org/blog" > Blog< / a > < / h5 >
< / div >
< div class = "footer_column" >
< h5 > < a href = "//telegram.org/apps" > Apps< / a > < / h5 >
< / div >
< div class = "footer_column" >
< h5 > < a href = "/" > Platform< / a > < / h5 >
< / div >
< div class = "footer_column" >
< h5 > < a href = "https://twitter.com/telegram" target = "_blank" data-track = "Follow/Twitter" onclick = "trackDlClick(this, event)" > Twitter< / a > < / h5 >
< / div >
< / div >
< / div >
< / div >
< script src = "/js/main.js?43" > < / script >
< script src = "/js/jquery.min.js?1" > < / script >
< script src = "/js/bootstrap.min.js?1" > < / script >
< script > w i n d o w . i n i t D e v P a g e N a v & & i n i t D e v P a g e N a v ( ) ;
backToTopInit("Go up");
removePreloadInit();
< / script >
< / body >
< / html >