Skip to content

Get a bot API

Sahri Riza Umami edited this page Sep 27, 2016 · 10 revisions

The reason why is merbot must be accompanied by a Telegram bot API is because of message formatting.
Formatted message (bold, italic, monospace, and link) is lovely. Unfortunately, telegram-cli and normal accounts unable to send a formatted message.
A kind of simple but also complicated way so merbot could send formatted message is by utilize a bot API to send the messages.

Before proceed to deploy merbot, please keep a bot api key handy. If not yet have it, please register a bot account to @botfather.

Register a bot API account

  1. Message @botfather with the following text: /newbot
    If you don't know how to message by username, click the search field on your Telegram app and type @botfather, you should be able to initiate a conversation.
    Be careful not to send it to the wrong contact, because some users has similar usernames to botfather.
    If you're using Telegram Desktop or Telegram Web, just click @botfather words in this page.

  2. @botfather replies with:

Alright, a new bot. How are we going to call it? Please choose a name for your bot.

  1. Type whatever name you want for your bot. For example: Merbot.

  2. @botfather replies with:

Good. Now let's choose a username for your bot. It must end in `bot`. Like this, for example: TetrisBot or tetris_bot.

  1. Type whatever username you want for your bot. Bot username must adhere to the following rules: (1) at least five characters long, (2) only contain letters, digits and underscores, and (3) must end with bot. For example: i_am_merbot

  2. @botfather replies with:

Done! Congratulations on your new bot. You will find it at telegram.me/i_am_merbot. You can now add a description, about section and profile picture for your bot, see /help for a list of commands.

Use this token to access the HTTP API:
123456789:AAG90e14-0f8-40183D-18491dDE

For a description of the Bot API, see this page: https://core.telegram.org/bots/api

conversation with botfather

  1. Note down the token mentioned above and keep this key secret!.
    Everyone with your API key can take full control of your bot. You can always revoke your bot token, but it's not fun.