Inform Rocket.Chat users about ticket events

Robert Ullrich09. May 2018 | Best PracticesConsultingCyber SecurityMiscellaneousUse cases

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:

rocketchatconnector preparing incoming webhook 1rocketchatconnector preparing incoming webhook 1

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.

rocketchatconnector webhook request

 

The answer is a simple “success”: truerocketchatconnector webhook answer

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”.

rocketchatconnector OTRS general config

Afterwards, we need a new invoker. Attached you’ll find my config:

rocketchatconnector OTRS invoker config

The most important part is the XSLT mapping. The following example is tested and working:

rocketchatconnector OTRS invoker xsltXmapping

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):

rocketchatconnector OTRS invoker event trigger

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.

rocketchatconnector OTRS transport config

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:

rocketchatconnector OTRS create ticket

 

The output in the OTRS debugger should look like the following:

rocketchatconnector OTRS debug outputBecause of the received JSON data from Rocket.Chat, we should also see the message now in our RocketChat channel

rocketchatconnector OTRS rocketchat message

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/

Your email address will not be published. Required fields are marked *

This site uses cookies. By continuing to use the site, you agree to the use of cookies. More information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close