Blog

How to create a Telegram bot in BotFather and connect it

BotFather is Telegram's official bot for creating new bots and getting their token, the bot's key. Konnekt (konnekt.uz) is an Instagram and Telegram automation service for businesses in Uzbekistan. You do not need a developer to connect your own Telegram bot to Konnekt: you create the bot in BotFather, copy its token and paste it into Konnekt. Here are those three steps in order.

Before you start

You need two things: a Telegram account and a Konnekt account.

  • Telegram Premium is not needed. Premium is only required for Telegram Business, not for your own bot.
  • If the bot already works in another service, it stops working there once you connect it to Konnekt. The connect window warns you about this: "If this bot is used by another service, it stops working there."

How to connect a Telegram bot: 3 steps

Step 1: create the bot in @BotFather

Open @BotFather in Telegram and send /newbot. BotFather asks for two things:

  • The bot's name, which customers see in the chat, for example your business name.
  • A username, which is the bot's address. It must end in "bot", for example nurshop_bot.

Step 2: copy the token

Once the bot is created, BotFather sends a long code that looks like 123456789:AA.... This is the token, your bot's key. Do not share it with anyone: whoever has the token controls the bot. Konnekt stores the token encrypted.

Copy the whole code, with no spaces at the start or end.

Step 3: connect it in Konnekt

  1. Open the "Channels" page in the Konnekt panel.
  2. Choose the "Telegram: separate bot" tab and click "Connect".
  3. In the "Connect your bot" window, paste the token into the "Code from BotFather" field.
  4. Click "Connect".

The window lists the same steps and has an "Open Telegram" button that takes you to BotFather. Konnekt checks the code with Telegram, and if it is correct, the bot is connected.

If it does not connect

Konnekt tells you the reason:

  • "This token is not valid." Telegram did not accept the code. Usually the code was copied incompletely, or a space was left at the start or end. Copy it again from BotFather's message.
  • "This bot is connected to another company." This bot is already connected in Konnekt to a different company. Delete it there or create a new bot.
  • "This company already has a bot. Delete it first to connect another one." Each company connects one bot of its own.
  • Your plan's channel limit. If your plan has no channels left, the bot does not connect, and Konnekt tells you so.

What the bot does right after connecting

If the bot has no flows yet, Konnekt adds one active flow called "Welcome". It starts on "Customer opens the bot (/start)" and sends the customer: "Hi {{first_name}}! How can we help?"

So the bot answers /start as soon as it is connected. Edit this flow on the canvas, or start from a ready template.

Konnekt also fills in the bot's command menu itself, using the flows that start on "Bot menu command".

What starts the bot's flows

Every flow starts from an event. A bot has these:

  • "Customer opens the bot (/start)": a plain /start or a "Start link" with a code. Start links with a code show which ad, post or bio link brought each customer.
  • "Bot menu command": the customer picks a command from the menu.
  • "Message contains a keyword".
  • "First message from a customer".
  • "Any message".
  • "Default reply (nothing else answers)".
  • "Customer has been quiet for some days".
  • "On a date from a contact field".
  • "Started by a broadcast only".

FAQ

Do I need Telegram Premium? No. Your own bot does not need Premium. It is only required for Telegram Business, because Telegram requires it.

The bot was connected to another service. What happens? Once you connect it to Konnekt, it stops working there, and Konnekt receives its messages from then on.

Can one company connect two bots? No. Each company connects one bot of its own. To connect another one, delete the current bot first.

It says the token is not valid. What do I do? Copy the token again from BotFather's message, in full and with no spaces, and click "Connect" again.

Read next: the Telegram bot in Konnekt, Telegram bot or Telegram Business.