Telegram Node
The Telegram Node allows a workflow to send Telegram messages.
Telegram
Telegram is a cloud-based mobile and desktop messaging app.
To use it with WEGnology, it is necessary to perform some steps.
Firstly, download the Telegram app on your device. You can find the correct version for your operating system on the official Telegram website.
After installing the app, open it on your device. You will be prompted to provide your phone number. Enter your number and click “Next.” You will receive a verification code via SMS to enter it in the app. You will be asked to enter your first and last name. Once done, your Telegram account will be ready to use.
How to Create a Telegram Bot and Add It to a Group
-
Create a bot with BotFather:
- Open Telegram and search for “@BotFather”.
- Start a conversation with BotFather and send the command “/newbot”.
- Follow the instructions to choose a name and username for your bot.
- After creation, BotFather will provide you with a unique access token for your bot. Keep this token in a secure place, as you will need it to configure the bot in the group.
-
Create a group in Telegram:
- Open Telegram and go to the main screen.
- Tap the pencil icon in the bottom right corner and select “New Group”.
- Choose the members you want to add to the group and set a name for the group.
- Create the group and open the group chat.
-
Add the bot as an administrator to the group:
- In the group chat, tap the group name at the top to access the group settings.
- Select “Edit” and then “Add administrator”.
- Search for your bot’s username (the one you set when creating the bot) and select it.
- Grant the necessary permissions to the bot (e.g., “Ban users”, “Add members”, etc.) and confirm the addition.
-
Find the chat ID:
- To be able to get the chat ID, send any message in the group where the bot is.
- Open a web browser and access ”https://api.telegram.org/botTOKEN/getUpdates”, replacing “TOKEN” with your bot’s token. Look for the “chat” field in the response and copy the “id” inside “chat” to use in the node configuration.
Your bot is now configured in the group and ready to send messages using WEGnology!
Node Properties
The Telegram Node has two main configuration sections:
Configuration
- Message (Required): The contents of the message.
- Bot Token (Required): The Telegram bot token given when you created the bot with BotFather.
- Chat Id (Required): The chat_id of the group where you added the bot to receive messages. See how to create a telegram bot to find the chat ID.
- Silent (Optional): If checked, the receiver will not be notified for the message. The default value is false (unchecked).
All fields support string templates, and so can be dynamically determined from the payload of the currently executing workflow.
Result Path
You may optionally store an indication of success or failure of the Telegram messaging operation at a path on the payload.
Node Example
If the result path has been configured, the success or failure of the operation will be placed at that path like so:
Success
{
...
"working": {
"telegram": {
"ok": true,
"result": {
"chat": {
"all_members_are_administrators": true,
"id": <your chat group id>,
"title": "Your Chat Group Name",
"type": "group"
},
"date": 1715342183,
"from": {
"first_name": "Your Telegram bot name",
"id": 6452660705,
"is_bot": true,
"username": "our Telegram bot username"
},
"message_id": 35,
"text": "You have a device that requires your attention!"
}
}
}
}
Failure
{
...
"working": {
"telegram": {
"error": {
"message": "No chat was found. Please, review the Bot Token and ensure the bot has Admin privileges at the Telegram group."
}
}
}
...
}
Was this page helpful?
Still looking for help? You can also search the WEGnology Forums or submit your question there.