How to connect OTRS with Zendesk
Robert Ullrich15. Jun 2017 | ConsultingUse 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.
With the OTRS Business Solution™ 5s, you have the possibility to connect OTRS with Zendesk. The following article will explain how to configure the ZendeskConnector to establish a connection between OTRS and Zendesk.
To complete this Howto, you need a running OTRS & a valid Zendesk-System. Furthermore, you need a valid agent login. The REST/JSON API of Zendesk is activated by default. We should use the “Password Access” method.
OTRS Requirements for this HowTo:
The following OTRS framework is required:
You need the following Freely selectable Features of the OTRS Business Solution™ 5s :
(Adds new invoker for TicketCreate and TicketUpdate in the GenericInterface.)
(Contains additional functionalities to add conditions to events of invokers.)
Third Party Software
You need this third party software:
- DynamicField “ZendeskID” of type „TEXT“
- DynamicField “ZendeskIDJSON” of type „TEXT“
- another DynamicField “ZendeskState” of type “TEXT”
Configuring the ZendeskConnector in OTRS
When you’re done with the pre-requirements, you have to create a new web service within OTRS. Afterward, we’ll set up the needed requester invokers.
The name of the new web service could be ZendeskConnector:
Configuring the Invoker “TicketCreate”
Now we’re ready to start the configuration of our Invokers. To be able to create tickets in Zendesk, we’ve to set up our first Invoker called “TicketCreate”. Select all the needed data for your outgoing requests and use “XSLT” as mapping for your outgoing and incoming response data.
For the incoming response data, we’ve to use the two dynamic fields, which we created before.
Now we can configure our outgoing XSLT-mapping. If you need a working XSLT-mapping, you can use the following example:
You also need an XSLT-mapping for the incoming response data, because we need to store the Zendesk Ticket ID in two ways:
The Zendesk Issue ID is stored in the dynamic field “ZendeskID” and is afterward shown in the OTRS TicketZoom.
For updating/comment on Tickets in Zendesk, we need to store the TicketID + the ending “.json” in the second dynamic field “ZendeskIDJSON”. With the <xsl:value-of> element we’re modifying the response value:
<xsl:value-of select=”concat(//issue/id, ‘.json’)”/>
The last point for this invoker is the used “Event trigger”. Just select one and you’re done with the first Invoker.
Configuring the Invoker “TicketUpdate”
The next invoker is “UpdateIssue”. Select all the needed data for your outgoing requests (please don’t forget the dynamic field “ZendeskIDJSON” in the “Ticket dynamic fields” dropdown) and use “XSLT” as a mapping for your outgoing data.
As outgoing XSLT-mapping you can use my example:
A mapping for the incoming response data is not necessary, but maybe a good idea. ;-)
The last point for this invoker is the used “Event trigger”. Just select one and you’re done with the second Invoker.
Configuring the Invoker “TicketGet”
The next invoker is “TicketGet”. The only field we need is the dynamic field “ZendeskIDJSON”, because we want to receive the latest data from Zendesk.
As outgoing XSLT-mapping you can use my example:
We need a mapping for the incoming response data because we want to show some values in OTRS. In my example I want to see the latest Zendesk ticket state in OTRS:
The last point for this invoker is the used “Event trigger”. Just select one and you’re done with the next Invoker.
Configuring the “Network Transport”
It’s necessary to configure the network transport because we’ve to use the right requests commands towards Zendesk. But it’s quite easy as you can see:
It’s important to use “BasicAuth” as an authentication module. Please use a valid Zendesk user for authentication!
Afterward just click on “Save and finish”.
Testing the ZendeskConnector
Finally, we can do some tests. Just create or take an already existing ticket and trigger the “TicketCreate” Invoker.
As result you should see something similar in the OTRS Debugger:
In Zendesk you’ll now see this Incident:
If we now trigger the Invoker “TicketUpdate” we’ll see the following in the Debugger:
And the last the Invoker “TicketGet”:
We should now see the Zendesk ticket state in OTRS.
The invoker “TicketGet” can be triggered regularly. For example with the freely selectable OTRS Business Solution™ feature “Advanced GenericAgent”. This feature allows relative timestamps for date/datetime dynamic fields.
More information about the Zendesk API
You can also use other resources which are provided by the Zendesk Core API.
Please go to the following website, if you need more information: https://developer.zendesk.com/rest_api/docs/core/introduction
Exported web service configuration
I’ve uploaded the web service configuration. You can download it directly from this blog article. :-)