Introduction
Telegram is a widespread messaging service for all kinds of platforms and devices (similar to WhatsApp).
While WhatsApp only supports sending end-to-end messages from one physical mobile phone number to another, Telegram allows the creation of custom "Bots".
Bots are special accounts that do not require a mobile phone number and can be used to send messages to your own mobile phone.
Telegram provides a public API which will be used by the NETx BMS Core Server to programmatically send messages.
Essentially, it works like this:
- Inside the Telegram app on your mobile phone, you create a custom bot, which can then be used to publish messages to
- The created bot has a unique "Token" and "Chat ID", which can be seen as a physical mobile phone number of a contact
- The NETx BMS Core Server can now send messages to your bot, which you will instantly receive on your mobile phone
Things to keep in mind
Just like with a mobile phone number, everyone knowing your secret "Token" and "Chat ID" is able to push messages to your mobile phone.
You are always able to deactivate and remove a bot, but just keep in mind to treat this information confidently.
Prerequisites
- A Telegram account is required
- Download the telegram app for your operating system on your mobile phone
- Follow the instructions to create an account or use your existing account, if you already have one
Create a custom Telegram bot
In this tutorial, the configuration of the custom bot is performed on iOS, but works similarly on other operating systems, such as Android.
Telegram uses a special account called "BotFather", which is used to create and manage custom bots on your mobile phone.
To create a custom bot, open the Telegram application and search for "BotFather", click the BotFather account to open the chat.
BotFather initially shows a list of all available commands. All commands need to start with a slash ( / ). To create a new bot, we need to use the
/newbot
command.
As you start typing, BotFather will automatically suggest available commands. Click the "newbot" command. The BotFather will then ask you to provide some information for your new bot.
Once you're done giving your bot a username and a name (the username of the bot needs to end in "bot"), the BotFather will text you the unique token of your bot.
As mentioned in the introduction, this is the unique identifier of your bot, which you will need to send messages to your bot.
Copy or write down the token now, because we will need it later on when configuring Telegram for the NETx BMS Core Server.