Automating your Mobile Presence with a Telegram Bot
Telegram is an open platform for chat on mobile and other platforms. Telegram lets you chat on your mobile phone or online for free, with no ads, and no SMS charges, with anyone, on any platform. Telegram is one of the top 10 mobile chat platforms with over 100 million users.
Bots lets you automatically respond to messages, or post content. The Bot Libre platform supports bots on many different platforms including Twitter and Facebook, and now supports Telegram bots. Bot Libre's Telegram support lets you manage a Telegram channel to post updates from your business, organization, school, club, family, or any other type of group. Your bot can also be connected to a Telegram bot account that lets it chat with your users, customers, friends, or any users on Telegram.
You can chat with some of our bots on Telegram, or join our Telegram channel.
You can also watch this video on How to create a chatbot for Telegram.
To create a Telegram bot, the first thing you need is to create a Telegram account, and a Telegram bot.
To create a Telegram account, just download the app from Google Play, the Apple App Store, or your favorite app store. You can also sign up online at, https://telegram.org/. To sign up you will need a phone number, and Telegram will send you a SMS message code, so have your mobile phone handy. If you don't have a mobile phone, I think it can also call a land line, or you can use a free online SMS phone (google "free virtual sms").
Creating a Bot on Telegram
Once you have downloaded your client and signed up, you can now create a bot. Bots on Telegram must use special bot accounts, you cannot create a bot for a regular user account (well maybe you could, but it would not be kosher). To create a bot on Telegram you actually have to chat with a Telegram bot.
To create a bot chat with the @BotFather.
Send BotFather the command "/newbot" to create a bot. Give your bot a name, and user id. BotFather will create your bot, and give you an access token. Save this access token, as you will need it later.
Creating a Bot on Bot Libre
Next create a bot on Bot Libre. You can create a bot here, is it free.
For more information on creating a bot on Bot Libre see, How to create your own chat bot in 10 clicks.
Linking you Bot to Telegram
To connect your Bot Libre bot to your Telegram bot, go to your bot's Admin Console. Make sure you login and go to your bot's page first.
In your bot's Admin Console click on the Telegram link.
On your bot's Telegram page paste your Telegram bot's token. If you forgot to save the token, that is ok, just talk with @BotFather. Send him the command "/token", and he will list your bots and give you their token.
Next click "Connect" to connect your bot. If successful, it will auto fill your bot's name, and your webhook URL. (Ensure webhook box is checked)
Your bot can respond to chat messages, or post to a channel. To have your bot respond to messages, you can either click "Check messages (poll)", or "Realtime messages (webhook)".
If you use polling, our server will cycle through all of the Telegram bots, and every cycle your bot will check its messages and reply. How long the cycle is depend on which of our servers you use, and if you upgrade your account or not. See Upgrade.
The other option is realtime messaging using a webhook. Realtime messages will use your user application id. Your application id supports a limited number of API calls per day. You can upgrade your account to get more API calls. See Upgrade.
Note for realtime messaging you need to register your webhook. To do this just click on "Save", then click "Disconnect", then "Connect" again. This will send Telegram your webhook, and now your bot should respond instantly to messages on Telegram.
A Telegram channel is like a bulletin board where you can post information about your business, organization, school, club, family, or any other type of group. You can create a channel from your Telegram client (I was only able to create a channel from the mobile app, the web client didn't seem to have that option).
To connect your bot to your channel enter the channel name on your bot's Telegram page. Your bot can post to your channel from an RSS feed, or auto post.
An RSS feed is an XML content page of news or articles. Most blogs, forums, and news services support RSS feeds. You can add multiple RSS feeds to your bot, and enter keywords to only post articles with the matching keywords.
Your bot can also randomly post from a list of posts you define every set number of hours. You can enter "-1" to post more than once per hour (if your account has been upgraded). Your auto posts can contain script code in Self or AIML to do funky stuff.
Now you can review your bot's conversation from its "Training & Chat Logs" page in its Admin Console. You can also add new responses and correct your bots responses. Training your bot does not require any programming, but if you want to write code, you can script your bot using Self, or AIML.
When a new user connects to your bot it will send it a "/start" message to start. It is a good idea to define a respond for "/start" for your bot to greet the user.
That's it your done, having fun with your bot and don't forget to list it in our bot directory under Telegram.
If you encountered any issues, or would like help setting up your bot please email us at [email protected] or upgrade to our Platinum service and we can build your bot for you.