Example configuration for a web service to notify agents about new tickets by using the generic ticket invoker and the Web Service Transport for ticket notifications.
Before you start, you need a webhook. See the Mattermost manual  how to create one. Keep the Webhook URL.
Enable the setting
PreferencesGroups###MattermostUsername in the system configuration and agent’s are able to maintain their Mattermost username in the user preferences:
Import and Configuration#
Open the Web Service Management in the from the Admin Overview and click on Add Web Service.
Select Mattermost notification and click on the button below to import the predefined web service.
Now the webhook URL needs to be added to the web service. Click on the name of the web service and configure the network transport of the Requester section:
Replace YOURHOST in the Endpoint setting with the hostname of the webhook and YOURHOOK of the controller endpoint with the corresponding part of the webhook:
Both settings together must match your webhook. If the webhook looks like this:
https://mattermost.znuny.org/hooks/qjx7yo62hskgzdp17stjn5m5r5o then YOURHOST is
mattermost.znuny.org and YOURHOOK
By adding the new created web service to an existing notification we finalize this example. Open the existing ticket notification Ticket create notification and scroll down block Web Service of the section Notification Methods. Select your web service and the invoker, check asynchronous and save your changes:
The used XSLT for the outbound mapping contains some interesting parts:
1<?xml version="1.0" encoding="UTF-8"?> 2<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="http://exslt.org/dates-and-times" extension-element-prefixes="date"> 3 <xsl:output method="xml" encoding="utf-8" indent="yes"/> 4 <xsl:template match="RootElement"> 5 <xsl:copy> 6 <username><OTRS_CONFIG_ProductName></username> 7 <icon_url>https://www.znuny.org/favicon.ico</icon_url> 8 <channel>@<xsl:value-of select="//Recipient/MattermostUsername" /></channel> 9 <text>A new ticket has been created in queue **<xsl:value-of select="//Ticket/Queue" />** with the title **<xsl:value-of select="//Ticket/Title" />**.</text> 10 </xsl:copy> 11 </xsl:template> 12</xsl:transform>
In line 6 we use a new feature, system configuration values. Scalar values can be accessed via <OTRS_CONFIG_ConfigurationName>. It’s XML so the < and > needs to be encoded.
The agent’s Mattermost username is taken from the incoming date in line 8. Check the web service debugger and discover which values are available. The node Recipient contains nearly everything about the agent oder customer.
Links to external documentation