Create three scripts in Python and place them inside the folder downloaded in Step 2:
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.
Run the first script "createGroup" manually. The system will require the user's authorization, do it.
A "Router Session On" file is created.
On the SimpleOne instance
Go to the System Properties (sys_property) table, set the value true for the itsm.telegram.swarming property.
Create a new server in the MID Server (MID_server) table.
Create a script to create a group in Telegram in the MID Scripts(MID_script) table. To do so:
Click New and in the new Script Form.
Add a name of the script (for example, createTelegram).
Add the path to the script on your computer in the Script field.
Repeat the previous step to add the scripts to close and delete a group.
Go to System Properties(sys_property) table and add the IDs of the three created scripts to the corresponding properties as their values.
Go to a major incident form. Now there appears a Start Swarming button. Click it for the first time, and a record with a corresponding name appears in the MID Queue(sys_mid_queue) table.
Field
Description
Request
BotUserId, the incident name and the first message content that is sent to the Swarming Session participants
Server
TgBotMIDServer.
Script
The name of the executed script
Response
A chat ID created and a lint to the group. The chat ID is stored in the Telegram Chat Bindings with Incident table.
State
Done when executed
Processed at
Date and time of the execution
A closeGroup record in the MID Queue(sys_mid_queue) table appears when the incident state is changed to Done. Commenting in the group is unavailable, but the participants can read the messages.
Field
Description
Request
Server
TgBotMIDServer.
Script
The name of the executed script
Response
No response
State
Done when executed
Processed at
Date and time of the execution
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 Done, the telegram group is deleted.