# Introduction to the API(翻譯) ###### tags: `telegram` `bot` > [name=shaoe.chen] [time=Thu, Feb 6, 2020 5:07 PM] :::danger [官方文件](https://github.com/python-telegram-bot/python-telegram-bot/wiki/Introduction-to-the-API) ::: API透過類別[telegram.Bot](https://github.com/python-telegram-bot/python-telegram-bot/blob/master/telegram/bot.py)公開。這些方法與官方[Telegram Bot API](https://core.telegram.org/bots/api)所說的方法snake_cae等效。為了你方便,還可以使用Telegram文件中確切的駝峰方法的名稱。舉例來說,`telegram.Bot.send_message`與`telegram.Bot.sendMessage`相同。 要生成Access Token,你必須與[BotFather](https://t.me/botfather)交談,然後依照一些簡單的步驟([見此說明](https://core.telegram.org/bots#6-botfather))。 詳細的資料請參閱官方文件[Bots: An introduction for developers](https://core.telegram.org/bots) **Hello, Telegram!** 感受一下API且瞭解如何搭配`python-telegram-bot`一起使用,請開啟一個Python command line,並跟著下面幾個步驟。 首先,建立一個`telegram.Bot`實例。將`Token`以你從`@BotFather`得到的API token取代掉: ```python >>> import telegram >>> bot = telegram.Bot(token='TOKEN') ``` 確認你的憑證是否正確,呼叫API方法[getMe](https://core.telegram.org/bots/api#getme): ```python >>> print(bot.get_me()) {"first_name": "Toledo's Palace Bot", "username": "ToledosPalaceBot"} ``` **注意:** 機器人無法發起與用戶的對話。用戶必須將它們加入群組或先給它一個訊息。使用者可以使用`telegram.me/<bot_username>`連結或username來找到你的機器人。 下一步該讀什麼? 要實際並使用類別`telegram.ext`開始建置你的第一個機器人,閱讀[Extensions – Your first Bot](https://github.com/python-telegram-bot/python-telegram-bot/wiki/Extensions-%E2%80%93-Your-first-Bot) 如果你希望繼續學習API,閱讀[Code snippets](https://github.com/python-telegram-bot/python-telegram-bot/wiki/Code-snippets)。