Skip to main content

Telegram

Telegram is a cloud-based instant messaging and voice over IP service. It was developed by the Russian entrepreneur Pavel Durov and his brother Nikolai Durov, who were also the founders of VK.com and Odnoklassniki.

Telegram is one of the most popular messaging apps in the world. It has over 500 million active users and is available in 20 different languages.

Telegram

How to connect to Telegram 🔗

To connect to Telegram, you need to create a Telegram bot. You can do this by following the instructions in the Telegram documentation. The instructions are as follows:

  1. Open Telegram and search for @BotFather.
  2. Click on the bot to start a chat.
  3. Send the /newbot command to create a new bot.
  4. Follow the instructions to create a new bot.

Once you have created a bot, you will receive a token. This token is used to authenticate your bot with Telegram.

In this guide we are going to use Sarufi to connect to Telegram. Sarufi is a platform that allows you to create chatbots without any coding knowledge. It is a no-code platform that allows you to create chatbots using a simple drag-and-drop interface. You will be able to deploy your chatbot directly to Telegram using Sarufi Dashboard. You have also the option to use your own server to host your chatbot as custom deployment.

Gettting started

Deploying your chatbot to Telegram is easy. You can deploy your chatbot to Telegram using Sarufi Dashboard or using your own server. We are going to cover both methods in this guide.

Sarufi Dashboard provides a simple interface to deploy your chatbot to Telegram. You can create a chatbot from scratch or use one of the templates available in Sarufi Dashboard. Assuming that you already have a chatbot created in Sarufi Dashboard, you can deploy it to Telegram by following the steps below:

  1. Log in to Sarufi Dashboard.

  2. Click on the chatbot you want to deploy to Telegram.

  3. Navigate to settings >> Integrations >> Telegram.

  4. Add your Telegram credentials/Bot's Token

    Copy your bot's token obtained from BotFather.

    You have a section to add a Start Message which will be the bot's reponse when a user sends the /start command to your bot. You can customize the message according to your preferences. You have the following variables to use in your message:-

    • {name} - User's name. This is the name the user has on Telegram
    • {bot_name} - Bot's name from Sarufi Dashboard

    Here is an example of a start message:-

    Hi {name}, Welcome To {bot_name}, How can I help you?

    Adding Telegram credentials

    Click save then Deploy

  5. Wait for your job to finish. Once done, you will have the section status change to Live

    Telegram deployment status

    This means that your bot is live on Telegram. You can now test your bot by opening it in Telegram app. You have a section to view your bot's Logs. You can view the logs to see what your bot is doing.

  6. Test your Telegram Bot by opening it in Telegram.

    To make changes to your bot, you can edit your bot in Sarufi Dashboard, Update then Re-deploy it to Telegram. You can view your bot logs by clicking View Logs button.

    Take look at the sample bot we have been working on here.

note

The Start Message will be bot's reponse when a user sends /start command to your bot.

You can customize the message to your preference. You have the following variable that you can use in your start message to make it more personalized:-

  • {name} - User's name. This is the name the user has on Telegram
  • {bot_name} - Bot's name from Sarufi Dashboard

Here is example of a start message:

Hi {name}, welcome to {bot_name}. How can I help you?

Test Your Telegram Bot

To test your Telegram chatbot, you can send a message to your bot on the Telegram app. You can also use the Telegram API to send messages to your bot.

  1. Open Telegram and search for your bot by name.
  2. Click on the bot to start a chat.
  3. Send a message to your bot and see how it responds.

Here is the test sample of our PizzaBot we have been working on.

PizzaBot test

What you learned 👨🏽‍💻

In this tutorial, you learned how to connect Sarufi to Telegram and how to configure and run your chatbot in Telegram. You also learned how to test your chatbot by sending messages to it through the Telegram app or using the Telegram API. With this knowledge, you can now create your own custom chatbot and connect it to Telegram using Sarufi.