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







