Sign inSign up

beetaone/telegram

By beetaone

Updated almost 2 years ago

Image
0

138

beetaone/telegram repository overview

Telegram

NameTelegram
Versionv1.0.0
DockerHubbeetaone/telegram
authorsJakub Grzelak

Table of Content


Description

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 beetaone Edge Application.

Creating Telegram Bot

Getting your Telegram Bot TOKEN:

  1. Open your telegram app and search for BotFather. (A built-in Telegram bot that helps users create custom Telegram bots)
  2. Type /newbot to create a new bot
  3. Give your bot a name and a username
  4. Copy your new Telegram bot’s token in the message received from BotFather

Getting your Telegram Bot CHAT ID:

  1. Open Telegram via web (https://web.telegram.org/) on your Desktop Browser and log in.
  2. 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.
  3. 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

  1. 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)
  2. 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())
  1. Copy the chat ID from a JSON object received in the previous step.

Environment Variables

Module Specific

The following module configurations can be provided in a data service designer section on beetaone platform:

NameEnvironment VariablestypeDescription
TokenTOKENstringYour Telegram bot token.
Chat IDCHAT_IDstringYour chat with bot ID.
Message LabelMESSAGE_LABELstringLabel in incoming data that holds the message to be sent.
Set by the beetaone Agent on the edge-node

Other features required for establishing the inter-container communication between modules in a data service are set by beetaone agent.

Environment VariablestypeDescription
MODULE_NAMEstringName of the module
MODULE_TYPEstringType of the module (Input, Processing, Output)
INGRESS_HOSTstringHost to which data will be received
INGRESS_PORTstringPort to which data will be received

Dependencies

bottle
requests

Input

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"
}

Output

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.

Tag summary

Content type

Image

Digest

sha256:ad1c79552

Size

49.2 MB

Last updated

almost 2 years ago

docker pull beetaone/telegram:v1.0.0