Earlier, I wrote how to
configure OTRS in the role of provider . This is when any system can access OTRS and request data.
Now I will describe how to configure OTRS in the requester role. When an event occurs in OTRS and after that an external system is accessed. As well as the problems encountered. If interested, then I ask under the cat.

So, we installed a wonderful OTRS, started working in it. But I wanted more from the system. In our case - integration with the telegram bot. The case is as follows: if a ticket comes from a VIP user, the bot must immediately inform the responsible persons.
')
And for this it is necessary that the system itself could communicate with it and report on the arrival of such tickets.
At the very beginning, we need to enable invoker. By default, there are only two, and how to do more, I did not understand. For the task and one is enough.
To do this, go to "System Configuration" and then look for.
Edit Config Settings in GenericInterface -> GenericInterface :: Invoker :: ModuleRegistration

Just turn on, do not need to change anything.
Next, go to the administration -> web services.


Create a new web service.
Enter the name of the interface
Select the HTTP :: REST network transport in the OTRS as requesting block.
Click “Save”.

After saving, it is possible to select Invoker and configure the transport.
Invoker we have one, and choose it.

After adding invoker, you will immediately be prompted to configure it.
Name - everything is clear
Then two parameters mapa . I'm not sure that they basically work, so I just set up forwarding as is.
Event trigger - I chose to create a ticket. Important - do not forget to click the plus sign. Only after that your trigger will be added. I figured out about 5 minutes why I didn’t see my trigger after restarting the settings.
The trigger can be synchronous and asynchronous. If synchronous, then until OTRS receives an answer, you will not be able to continue working with the ticket. Asynchronous - OTRS will send a request in the background.
An example of a synchronous call problem:
Set up a trigger to change the service in the ticket.
We open the service change window in the ticket, change the service.
Until the external system gives an answer, the window will not close. Although it should be closed immediately.

Next, set up the transport

Specify the address of the receiving system with the port. In the next line, the name of the servlet and TicketID. According to the instructions, you can also transfer other parameters from the ticket, but I did not succeed. Therefore, all we have is a ticket number. About this below.

This completes the settings. When an event occurs, our external system received a request.

During setup, 2 things surfaced:
- If you do not send requests and in the “Got no TicketNumber” logs, then you need to find the file Test.pm on the server and change “TicketNumber” to “TicketID” everywhere. In my case, it was here - / opt / otrs / Kernel / GenericInterface / Invoker / Test.
Thanks to these guys for the advice. - OTRS only sends the ticket ID when an event occurs. Stated that you can pass other parameters. However, this was not possible. As a result, upon the occurrence of an event, the external system receives the TicketID, and it itself calls the OTRS for complete information. The guys from the forum did much the same. It breeds additional appeals, but in our case it is not critical.
If someone has interesting comments, comments - welcome :)