Documentation for C-Werk 2.0.

Previous page Notifications  Push notification Next page

C-Werk allows you to send text notifications to Telegram chat when any event occurs from the objects registered in the C-Werk objects tree. Once configured, the notification sending is initiated by the C-Werk macro.

Before configuring notifications sending from C-Werk to Telegram, create a bot and a group chat with this bot in Telegram. For the distribution package and manuals on working with Telegram, see the developer's official website telegram.org.

Note

For the correct operation of Telegram bot and notification sending, the user who created the bot must have @username specified in Telegram.

To configure notification sending in Telegram bot, do the following:

  1. Configure the conditions to start a macro (see Configuring filters for event-driven macros).
  2. Select the "General: Execute web-query" action.

  3. Select the authentication method: Basic or Digest (1). By default, the Basic authentication method is selected.


  4. Select the query type (2). Four types are supported: POST, GET, PUT, DELETE. By default, the POST query type is selected.
  5. Select the server protocol: HTTP or HTTPS (3). For the correct notifications sending, select the HTTPS protocol.
  6. Enter the IP address of the server (4). The address of the Telegram server is api.telegram.org.
  7. Enter the port of the server (5). The port of the Telegram server is 443.
  8. Enter the path of the query (6). The path of the query should look like this: /bot<BOTToken>/sendMessage?chat_id=<СhatID>&&text=<Text>, where <BOTToken> is an ID of the bot in Telegram;

    Note

    The ID is provided when you create the bot

    <СhatID> is the ID of the chat;

    Note

    To learn the ID of the chat, add the @RawDataBot bot to the chat. After adding, the bot will send a message to the chat that will contain the result of the execution of the getUpdates function. Find ChatId in the message. Then remove the @RawDataBot bot from the chat.

    <Text> is a notification text. You can enter the set of US-ASCII characters (Latin characters and digits) in the notification text. For the notification text to display correctly with other characters and punctuation marks, you need to encode them. The encoding is described in the RFC 3986 standard and called URL-encoding, URLencoded, or percent-encoding. For example, a space character is encoded as %20.

When using the "General: Execute web-query" action, all fields for sending a web-query to the specified server can be filled in (see Executing a web query). However, the Username, Password and Query fields are not required for sending a notification via Telegram bot.

  • No labels