Post Ticket Events to Slack Channels
Robert Ullrich19. Sep 2018 | Case studyConsultingCyber SecurityUse cases
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.
During my vacation, I thought about new integration use cases I can show you. Because I’m also evaluating Phantom at the moment and was invited to join their Slack community, I thought this would be a nice use case. So let’s start with our “SlackConnector”.
Like in former blog posts, there are several requirements for this HowTo:
- running OTRS 6.0.x system
- a valid Slack workspace
Prepare Slack for the integration
Follow the instructions and create a new incoming webhook.
Configure the SlackConnector on OTRS side
At first, we’ve to create the new web service.
Afterward, we need a new invoker. Attached you’ll find the first part of my config:
The most important part is (as always) the XSLT mapping. The following example is tested and working:
Here’s the XSL stylesheet:
<?xml version="1.0" encoding="UTF-8" ?> <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:output method="xml" doctype-public="XSLT-compat" omit-xml-declaration="yes" encoding="UTF-8" indent="yes" /> <xsl:template match="RootElement"> <xsl:copy> <text>New Ticket [Ticket#<xsl:value-of select="//TicketNumber"/>] created! Title: <xsl:value-of select="//Ticket/Title"/> Priority: <xsl:value-of select="//Ticket/Priority"/> </text> <attachments> <title>https://storm-demo.managed-otrs.com/otrs/index.pl?Action=AgentTicketZoom;TicketID=<xsl:value-of select="//TicketID"/></title> <title_link>https://storm-demo.managed-otrs.com/otrs/index.pl?Action=AgentTicketZoom;TicketID=<xsl:value-of select="//TicketID"/></title_link> <text>Go to ticket to see more information!</text> </attachments> <attachments/> </xsl:copy> </xsl:template> </xsl:transform>
The last part for the invoker is the used event trigger. Because I want to inform my Slack users every time when a new ticket is created, I’m using the “TicketCreate” event without any event filters:
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 Slack token is “T0X829D7E/BBYH0BEE4/nAFuXxXxXxXxXxXxXxXxXxX2”. I’ve added the first part until the “/” to my endpoint address and the second part including the “/” I added to the controller mapping. Don’t forget to set “POST” as request command.
Apply all changes. Congratulations! You’re done with the invoker.
Test the SlackConnector
Let’s test our new web service. Create a new ticket 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 Slack, we should also see the message now in our Slack channel
More information about the Slack REST API
You can also use other resources which are provided by the Slack REST API.
Please go to the following website, if you need more information: https://api.slack.com/web
Jens Bothe at 23.07.2019, 15:26
Commercial version is required for invokers
Nate at 18.07.2019, 21:02
Same as previous poster. Can we get some clarification on how to do this in the community edition please?
Davide at 27.03.2019, 12:57
Hi, the invokers requires extra features which are available only in the Business Edition? I´m trying to set the SlackConnector but the invoker field is not editable (I can´t add invokers). Thank, Davide
Tapash Raha at 01.03.2019, 12:02
Hi, Unable to create invoker in Community edition. The option to create invoker is disable. Could you please confirm that the option is not available due to community version?