Name | Telegram |
Version | v1.0.0 |
DockerHub | weevenetwork/telegram |
authors | Jakub Grzelak |
This modules sends messages and notifications to a selected Telegram chat. It requires setting up Telegram Bot. Additionally, we recommend running this module together with our Message Composer module that helps in writing alerts within weeve Edge Application.
Getting your Telegram Bot TOKEN:
- Open your telegram app and search for BotFather. (A built-in Telegram bot that helps users create custom Telegram bots)
- Type
/newbot
to create a new bot - Give your bot a name and a username
- Copy your new Telegram bot’s token in the message received from BotFather
Getting your Telegram Bot CHAT ID:
- Open Telegram via web (https://web.telegram.org/) on your Desktop Browser and log in.
- Select the chat you want to send the message to. This can be the individual chat with the bot or a group to which you added the bot.
- Finally, check the URL in the address bar and copy the Chat ID at the very end of the URL after the "#". Example: https://web.telegram.org/z/#1234567890 while 1234567890 is your Chat ID (Group Chat IDs sometimes start with a "-". Also copy the "-" since it belongs to the Chat ID)
Alternative Method with Python script
- Send your Telegram bot a message (any random message - if you don’t send your Telegram bot a message, your results in the next step might be empty)
- Run this Python script to find your chat ID
import requests
TOKEN = "YOUR TELEGRAM BOT TOKEN"
url = f"https://api.telegram.org/bot{TOKEN}/getUpdates"
print(requests.get(url).json())
- Copy the chat ID from a JSON object received in the previous step.
The following module configurations can be provided in a data service designer section on weeve platform:
Name | Environment Variables | type | Description |
---|---|---|---|
Token | TOKEN | string | Your Telegram bot token. |
Chat ID | CHAT_ID | string | Your chat with bot ID. |
Message Label | MESSAGE_LABEL | string | Label in incoming data that holds the message to be sent. |
Other features required for establishing the inter-container communication between modules in a data service are set by weeve agent.
Environment Variables | type | Description |
---|---|---|
MODULE_NAME | string | Name of the module |
MODULE_TYPE | string | Type of the module (Input, Processing, Output) |
INGRESS_HOST | string | Host to which data will be received |
INGRESS_PORT | string | Port to which data will be received |
bottle
requests
Input to this module is:
- JSON body single object, example:
{
"alertMessage": "Device hf238hf23h7 (in Berlin) measured temperature 12 on 2022-09-25 15:35:17.31234"
}
Message send to the selected Telegram chat. Given the above input, message will be Device hf238hf23h7 (in Berlin) measured temperature 12 on 2022-09-25 15:35:17.31234
.