1. General Operating Principle

In a Telegram-based alarm notification system, EOS SCADA communicates with Telegram not directly through a user account, but through a bot operating via the Telegram Bot API to communicate with Telegram.

Basic operating flow:

SCADA ALARM  →  ANS  →  TELEGRAM BOT API  →  BOT  →  TELEGRAM GROUP / USER

  1. Create a bot on Telegram.
  2. Obtain a secret Bot Token for the bot.
  3. Determine the user or group to which alarm notifications will be sent.
  4. Determine the Chat ID of the target chat.
  5. Add the bot to the target group and grant the required permissions.
  6. Enter the Telegram Bot Token and Chat ID in the ANS panel.
  7. An alarm generated in SCADA is sent by ANS through Telegram.

2. Creating a Telegram Bot – BotFather

Telegram's official bot management tool, @BotFather, is used to create and manage Telegram bots. Telegram's official documentation instructs users to interact with BotFather to create a new bot and obtain its authentication token. The official documentation describes this process.

  1. Open the Telegram application.
  2. Find the @BotFather account in the search field.
  3. Open the official BotFather account or use the Telegram BotFather link provided.
  4. Send the /start command.
  5. Send the /newbot command to start creating a new bot.

3. Setting the Bot Name and Username

BotFather requests two basic pieces of information when creating a new bot.

Bot Name

This is the name users will see in Telegram. A descriptive name reflecting the plant or system name can be preferred.

Example: EOS Energy Alarm Bot

Bot Username

This is the bot's unique username on Telegram. Bot usernames normally end with the bot suffix.

Example: eos_energy_alarm_bot

4. Obtaining the Telegram Bot Token

After the bot has been created, BotFather generates a token used to access the Telegram Bot API This token is the authentication credential required for ANS to send messages through the Telegram bot .

Format example:

123456789:AAxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

This is only a format example; it is not a real Bot Token.

Very important security warning: The Bot Token must be kept secret. According to Telegram's official documentation, anyone who possesses the token can gain full control over the bot. Do not share the token on web pages, in documentation, screenshots, or with unauthorized persons.

5. Obtaining the Telegram Chat ID

For ANS to determine where to send an alarm message, the target Telegram chat's Chat ID is required. The target may be a user, group, or another chat type supported by Telegram.

In this document, the practical method is to use the Bot API's getUpdates method. The Telegram Bot API returns updates received by the bot in JSON format.

5.1 Private Chat / User Chat ID

  1. Open the bot you created in Telegram.
  2. Press the Start button or send a message to the bot.
  3. Open the following address in your browser:
    https://api.telegram.org/bot<TOKEN>/getUpdates
  4. Find the message.chat.id value in the JSON output.

Example:

{
  "message": {
    "chat": {
      "id": 987654321,
      "type": "private"
    }
  }
}

Chat ID: 987654321

5.2 Group Chat ID

For plant alarm notifications, creating a dedicated Telegram group generally provides a more suitable operational structure. For example:

Group name: EOS_ALARM_IZLEME

Purpose: Delivery of plant alarm notifications to authorized personnel

  1. Create the Telegram group.
  2. Add authorized personnel responsible for alarm notifications to the group.
  3. Add the bot you created to the group.
  4. Ensure that the bot can send messages in the group.
  5. Send a new message in the group.
  6. Through the Bot API, check https://api.telegram.org/bot<TOKEN>/getUpdates the following call.
  7. Find the message.chat.id value of the relevant chat in the JSON output.

Example group output:

{
  "message": {
    "chat": {
      "id": -1234567890,
      "title": "EOS ALARM IZLEME",
      "type": "group"
    }
  }
}

Group Chat ID: -1234567890

Note: In classic Telegram group chats, the Chat ID value may appear as a negative number. Therefore, when copying the value, make sure that the leading - sign is not lost.

6. Receiving Group Messages and Privacy Mode

When Telegram bots are added to groups, Privacy Mode may be enabled by default. In this case, the bot receives not every message in the group, but only specific commands and messages related to it. According to Telegram's official documentation, Privacy Mode should not be disabled unless it is necessary for bot management.

In this ANS scenario, the primary requirement is not for the bot to collect messages from the group, but for ANS to send alarm messages to the group through the bot. Therefore, it may not be necessary to disable Privacy Mode solely for sending alarms.

Security approach: The bot should have only the permissions it needs and access to unnecessary group messages should not be enabled. Bot management settings should be controlled through Telegram's official BotFather options .

7. Telegram Settings in the ANS Panel

After the bot and target chat are ready, the Telegram integration is configured in the ANS panel.

ANS Parameter Value to Enter Description
Telegram API Address https://api.telegram.org Base address of the Telegram Bot API.
Bot Access Key Bot Token Secret bot access token provided by BotFather.
Chat ID Target Chat ID User or Telegram group to which alarm messages will be sent.

Field names may differ in the current ANS configuration; however, fundamentally, Telegram API adresi + Bot Token + Chat ID information must be correctly configured.

8. Alarm Notification Operating Principle

  1. The SCADA system generates an alarm.
  2. ANS detects the alarm and evaluates the relevant notification policy.
  3. If Telegram notification is selected, ANS sends a request to the Telegram Bot API.
  4. The Telegram Bot API delivers the message through the relevant bot to the target Chat ID.
  5. The message is displayed in the Telegram group or target user's chat.

SCADA → ALARM → ANS → TELEGRAM API → BOT → CHAT ID → PERSONEL

9. Use by Plant Personnel

Authorized personnel included in the alarm group can receive alarm notifications through mobile or desktop devices where the Telegram application is installed.

  • Alarm notifications can be delivered to users quickly.
  • Telegram notifications can be used on mobile devices.
  • Multiple personnel can be notified in the same alarm group.
  • Separate Telegram groups can be created for operations, maintenance, and management teams.
  • Used together with ANS notification groups, alarms can be routed to the relevant personnel.

10. Security and Operational Recommendations

  • The Bot Token must be kept strictly confidential.
  • Do not place the actual token value on web pages, screenshots, or documents.
  • If you suspect that the token has been compromised, regenerate it through BotFather.
  • Include only authorized plant personnel in alarm groups.
  • Do not unnecessarily expand the bot's permissions within the group.
  • Protect Telegram Chat ID and Bot Token values against unauthorized access in ANS configuration files.
  • For critical SCADA alarms, instead of using Telegram as the only notification channel, consider it together with alternative channels such as SMS or email according to plant requirements.

Critical alarm note: Telegram is an Internet-based notification channel. Therefore, in critical processes, the notification architecture should not depend solely on a messaging application; network access, Internet connectivity, and alternative alarm channels should be evaluated together.

11. Brief Installation Summary

BOTFATHER

CREATE BOT

OBTAIN BOT TOKEN

CREATE TELEGRAM GROUP

ADD BOT TO GROUP

DETERMINE CHAT ID

ENTER TOKEN + CHAT ID IN ANS

SCADA ALARM → TELEGRAM NOTIFICATION

Once this configuration is completed, EOS SCADA ANS can forward SCADA alarms to target Telegram chats through the Telegram Bot API according to the defined alarm notification policies. This allows plant personnel to monitor alarm events through the Telegram applications on mobile and desktop devices.

← Back to Previous Content