Table of Contents |
---|
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".
...
Warning |
---|
Keep in mind that everyone knowing your secret "Token" and "Chat ID" is able to push messages to your bot. |
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
Info |
---|
In this tutorial, the configuration of the custom bot is performed on iOS, but works similarly on other operating systems, such as Android. |
...
Great! You have created a custom bot.
Add the bot to your contacts and initiate a conversation
Now that you've added a custom bot, we need to add it to your contact list and initiate a conversation so that it's ready to receive messages from us.
Enter the name or username of your new bot in the search bar (both "NETxTutorialBot" in our case) and click it. The conversation opens.
Click the "Start" button to initiate the conversation and send an initial messages so that everything's set up correctly (for example "hello").
Perfect. You have initiated a conversation with your new bot. This means that it's almost ready to be used. The last step is to retrieve the chat ID, which is the unique identifier of the initiated conversation.
Retrieve the chat ID
This one is a bit tricky. As already mentioned, the chat ID represents the unique identifier of the initiated conversation between you and your bot. The reason that you also need a chat ID is,
that you could, for example, add your bot to a group conversation as well. Therefore, the bot token itself is not enough to identify where to push the message to. So in order to know where to publish messages to,
Telegram requires a combination of both the token (unique identifier of YOUR bot) plus the chat ID of a conversation (in this case, the 1:1 conversation with you and your bot).
...
Well done, you have now finished setting everything up. Now let's configure your telegram bot within the NETx BMS Core Server.
Configure your Telegram bot within the NETx BMS Core Server
Open the [Live] Twitter configuration within the Messenger Module menu entry and add a new definition (right click, Insert new definition).
...
All done. You are now able to send messages to your custom bot within the NETx BMS Platform.
Send a message via XLogic
As mentioned in the Messenger module configuration, NETx BMS Platform ships with pre-built messenger Commands.
We can use the "MESSENGER.SENDTELEGRAMMESSAGE" Command to send a test message to our bot.
...
You can now use this Telegram messenger profile whenever you want to send a message to your bot (for example in an action within the Web Manager).
Send a message via LUA
you can send telegram message within LUA scripts. To do so, you have to use the LUA function XMessage.
...