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 URLs 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. Open the folder downloaded in Step 2 and run the "createGroup" script manually.
    The four scripts in the folder are:
    • createGroup – to create a group,
    • cancelGroup – to restrict commenting upon the completing of the incident and changing its state to Completed,
    • deleteGroup – to delete a Telegram group,
    • clientInformation – to store api_id and api_hash.
  4. Complete the user's authorization that the system will require. As a result, a "router.session" file is created.

On the SimpleOne instance

  1. Create a new server in the MID Server (MID_server) table.
  2. Create three scripts in the MID Scripts (MID_script) table. To do so:
    1. Click New and in the new Script Form 
    2. Add a name of the script (for example, createTelegram)
    3. Add the path to the script on your computer in the Script field. Add the parameters to the same field, as shown below:

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


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


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


  3. Go to the System Properties (sys_property) table, set the value true for the itsm.telegram.swarming

     property.
  4. Repeat the previous step to add the scripts to close and delete a group.
  5. property

    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)
    Go to System Properties (sys_property) table and add the IDs of the three created scripts to the corresponding properties as their values.


  6. Go to a major incident form. Now there appears a Start Swarming buttonClick it for the first time, and a modal window appears with 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 table.
    StateDone when executed
    Processed atDate and time of the 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.


  7. A closeGroup record in the MID Queue (sys_mid_queue) table appears when the incident state is changed to DoneCompleted. 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



  8. A deleteGroup record in the MID Queue (sys_mid_queue) table is executed automatically after a set time period in the corresponding Server Script. When the deleteGroup record is in the state Closed, the 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