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:
OTRS Framework
The following OTRS framework is required:
- 5.0.x
OTRS Packages
You need the following Freely selectable Features of the OTRS Business Solution™ 5s :
- OTRSGenericInterfaceInvokerTicket
(Adds new invoker for TicketCreate and TicketUpdate in the GenericInterface.)
- OTRSGenericInterfaceInvokerEventFilter
(Contains additional functionalities to add conditions to events of invokers.)
Third Party Software
You need this third party software:
- XML::Simple
- XML::LibXML
- XML::LibXSLT
DynamicFields
- 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. Afterwards we’ll set up the needed requester invokers.
The name of the new webservice 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 a 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 afterwards 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’)”/>
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 neccessary, but maybe a good idea. ;-)
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:
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 authentication module. Please use a valid Zendesk user for authentication!
Afterwards 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 similiar 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:
As a result the a new comment is added to the ticket in Zendesk. This is also visible in the Zendesk comment section:
And the last the Invoker “TicketGet”:
We should now see the Zendesk ticket state in OTRS.
Further thoughts
The invoker “TicketGet” can be triggered regulary. 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 ressources 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
The post How to connect OTRS with Zendesk appeared first on The OTRS Blog.