Inform Rocket.Chat users about ticket events
Robert Ullrich09. May 2018 | Best PracticesConsultingCyber SecurityMiscellaneousUse cases
Disclaimer:
The practical examples presented in our technical blog (blog.otrs.com) and now in the expert category in our FAQ blog section serve as a source of ideas and documentation to show what is theoretically possible with OTRS in concrete scenarios or sometimes even for more exotic configurations. All configurations presented here were developed under laboratory conditions as a proof of concept.
We can only guarantee testing and implementation of these concepts to be error-free and productive if implemented in a workshop with one of our OTRS consultants. Without this, the responsibility lies with the customer himself. Please note that configurations from older OTRS versions may not work in the newer ones.
Many of my customers are using Rocket.Chat for their internal team chats. Last week I had a customer, who asked me if it’s possible to get a notification in their Rocket.Chat if there’s a new ticket in OTRS. I call this integration “Rocket.ChatConnector”.
The answer is… YES!
In the first part of a smaller blog article series, I’ll show you how to post messages in Rocket.Chat channels.
Like in former blog posts, there are several requirements for this HowTo:
- running OTRS 6.0.x system
- running RocketChat system
OTRS Requirements for this HowTo:
OTRS Framework
- at least OTRS 6.0.x
OTRS Packages
You need the following OTRS Feature Add-on:
- OTRSTicketInvoker
(Adds new invoker for TicketCreate and TicketUpdate in the GenericInterface.)
Third Party Software
You need this third-party software:
- XML::Simple
- XML::LibXML
- XML::LibXSLT
Rocket.Chat Requirements for this HowTo:
- a working Rocket.Chat (I’m using RocketChat 0.64.1)
Prepare Rocket.Chat for the integration
Go to Administration -> Integration and click on “New integration” in the right upper corner and click on “Incoming WebHook”
I’ve attached the configuration of my webhook:
If you want, you can send the example JSON string to your incoming webhook with a local REST client. I’m using “Boomerang” which is an addon for Google Chrome.
The answer is a simple “success”: true
That’s all regarding the Rocket.Chat preparation. Let’s continue with OTRS.
Configuring the Rocket.ChatConnector on OTRS side
At first, we’ve to create a new web service. I’ll call it “Rocket.ChatConnector”.
Afterwards, we need a new invoker. Attached you’ll find my config:
The most important part is the XSLT mapping. The following example is tested and working:
The last part for the invoker is the used event trigger. Because I only want to inform my users if there’s a new ticket with a very high priority, I’m using the “TicketCreate” event with a condition (Priority = 5 very high):
That’s all for the invoker configuration. The next part is the configuration of the transport. I’m using a small workaround to make the integration possible. My token in Rocket.Chat is “9HHhoQYYEo2unZQrm/e4tWQgxcKkZdryfcMA325unkNrC2R6JPSmJXtuknhbQ4TYZh”. I’ve added the first part until the “/” to my endpoint address and the second part including the “/” I’ve added to the controller mapping. Don’t forget to set “POST” as request command.
Apply all changes. Congratulations! You’re done with the first part.
Testing the Rocket.ChatConnector
Let’s test our new web service. Create a new ticket with a priority = 5 very high and see if the invoker is triggered:
The output in the OTRS debugger should look like the following:
Because of the received JSON data from Rocket.Chat, we should also see the message now in our RocketChat channel
More information about the Rocket.Chat REST API
You can also use other resources which are provided by the RocketChat REST API.
Please go to the following website, if you need more information: https://rocket.chat/docs/developer-guides/rest-api/
Jens Bothe at 14.06.2019, 13:01
It is part of our commercial offering
Ant at 07.06.2019, 06:12
You need the following OTRS Feature Add-on: OTRSTicketInvoker Where is this?
Jens Bothe at 28.11.2018, 23:41
On the OTRS server
Chris at 22.11.2018, 08:19
Hello, where do i have to install the 3rd Party Software? XML::Simple XML::LibXML XML::LibXSLT At OTRS Server oder RocketChat?