Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

To set up a Telegram group for a major incident, do the following:

On the Administrator's computer


  1. Download and set up Infrastructure Agent.
  2. Create a Telegram client. 

    Info

    To create a Telegram client, complete the steps below:

    1. Get registered in Telegram, using any client name.

    2. Follow the https://my.telegram.org link for authorization.

    3. Complete the form on the https://my.telegram.org/apps website to receive the URL and parameters of api_id and api_hash needed for the users' authorization.

    It is possible to link only one api_id to the telephone number.


  3. Download a script archive, and add the scripts to the SIMPLE_MID_SERVER folder downloaded at the Step 1. 
    The four scripts in the folder are:
    • createGroup – to create a group,
    • cancelGroup – to restrict commenting upon the completion of the incident and changing its state to Completed,
    • deleteGroup – to delete a Telegram group,
    • clientInformation – to store api_id and api_hash.
  4. Open the "clientInformation" script and add the api_id and api_hash values received when creating a Telegram client.
  5. Run the "createGroup" script manually.
  6. Complete the user's authorization that the system will require. As a result, in the SIMPLE_MID_SERVER folder, a "router.session" file is created.

On the SimpleOne instance


  1. Create a new server record in the MID Server (sys_mid_server) table. To do so, click New and complete the fields of the new record as follows:

    FieldDescription
    NameTgBotMIDServer
    Host NameA host name
    UserA user with the admin role


  2. Create three scripts in the MID Scripts (sys_mid_script)table. To do so:
    1. In the MID Scripts (sys_mid_script)table, click New. A new Script form opens.
    2. Add   "createGroup" as the name of the script.
    3. Add the path to the script on your computer and the parameters, as shown below.


    4. Repeat the Steps a-c to add "cancelGroup" and "deleteGroup" scripts.

      createGroup
      Script C C:\User's Path\createGroup.py $botUserName $incidentDispalyName $titleMessage $mainInformation



      cancelGroup
      ScriptC:\User's Path\cancelGroup.py $chatId


      deleteGroup
      ScriptC:\User's Path\deleteGroup.py $chatId


  3. Go to the System Properties (sys_property) table, set the following values for the properties:

    System PropertyValue
    itsm.telegram_bot.swarming_session   true
    itsm.telegram_bot.mid_server_idMID Server Record ID  
    itsm.telegram_bot.mid_create_group_script_idMID Scripts Record ID for a group creation (createGroup script)
    itsm.telegram_bot.mid_close_group_script_idMID Scripts Record ID for comments restriction (cancelGroup script)
    itsm.telegram_bot.mid_delete_group_script_id:MID Scripts Record ID for a group removal (deleteGroup script)


  4. Go to a major incident form. Click the Start Swarming button on the top of the page

  5. The modal window that appears, contains a list of the recipients of the invitation to the Telegram group. Clicking Start Swarming on the modal window initiates a Telegram group, and a createGroup record appears in the MID Queue (sys_mid_queue)table. The Description field of the createGroup record is automatically filled with the incident number.

    FieldDescription
    RequestBotUserId, the incident name and the first message content that is sent to the Swarming Session participants
    ServerTgBotMIDServer.
    ScriptThe name of the executed script
    ResponseA chat ID created and a lint to the group. The chat ID is stored in the Telegram Chat Bindings with Incident (sys_telegram_chat_bindings_with_incidents) table.
    StateDone when executed
    Processed atDate and time of the script execution
    DescriptionIncident number

    If the connection with the Telegram bot is lost or failed, (see the ITSM Telegram Bot article for more information) a toast message "Telegram bot not connected" appears, and a modal window does not open.


  6. When the incident state is changed to Completed,closeGroup record in the MID Queue (sys_mid_queue) table appears. Since then, commenting in the group is unavailable, but the participants can read the messages.

    FieldDescription
    RequestA chatId parameter
    ServerTgBotMIDServer
    ScriptThe name of the executed script
    ResponseNo response
    StateDone when executed
    Processed atDate and time of the execution
    DescriptionEmpty



  7. When the incident state is changed to Closed,a deleteGroup record in the MID Queue (sys_mid_queue)table appears. The linked Telegram group is deleted.

    FieldDescription
    Request

    A chatId parameter

    ServerTgBotMIDServer
    ScriptThe name of the executed script
    ResponseNo response
    StateDone when executed
    Processed atDate and time of the execution
    DescriptionEmpty


Table of Contents