How to connect OTRS with Alfresco (Part 1)
Robert Ullrich06. Oct 2017 | ConsultingUse cases
Because I need a new challenge every month, I thought about an integration between OTRS and Alfresco to store documents, which are sent to customers via OTRS, also in Alfresco. I call this integration AlfrescoConnector. Because this integration will become very complex, I’ll split this how-to into several blog articles, which will be released regularly. In this article, I’ll show you how to create, delete sites and how to create, delete folders in Alfresco.
To complete this how-to, you need at first a running OTRS and an Alfresco system. For some operations, you need special privileges in Alfresco (e.g. administrator privileges). The REST/JSON API of Alfresco is activated by default.
Use case for this connector
The AlfrescoConnector can be useful in companies who are sending documents to their customers via OTRS and have to upload them to Alfresco. To improve this workflow and to prevent agents of manually uploading documents to Alfresco, you can use the connector if this article.
OTRS Requirements for this How-To
- at least OTRS 5.0.x
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:
- “AlfrescoSiteID” of type „TEXT“ to store the id of a site (e.g.: 1)
- “AlfrescoSiteName” of type “TEXT”
- “AlfrescoSiteVisibility” of type “DROPDOWN” with the following values:
- PRIVATE: PRIVATE
- “AlfrescoFolderName” of type “TEXT”
- “AlfrescoFolderID” of type “TEXT” to store the id of a folder
Configuring the AlfrescoConnector in OTRS
Now we can start with the configuration. The name of the new web service is “AlfrescoConnector”. Afterwards, you have to set up the needed invokers.
Configuring the Invoker “SiteCreate”
Now you’re ready to start the configuration of the Invokers. At first, we’ll create an Invoker for adding new sites to Alfresco. Set up an Invoker called “SiteCreate” and 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, you have to select the dynamic field “SiteID”, which you created before.
Now you can configure your 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 you have to store the Site ID:
The used “Event trigger” is the last point for this invoker. Just select one and you’re done with the first Invoker.
Configuring the Invoker “SiteDelete”
The next invoker is “SiteDelete”. Select all the needed data for your outgoing requests (please don’t forget the dynamic field “AlfrescoSiteID” in the “Ticket dynamic fields” drop-down) 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 because Alfresco sends an empty response.
The used “Event Trigger” is the last point for this Invoker. Just select one and you’re done with the second Invoker. In my example, I’m using a “TicketSubscribe” Event.
Configuring the Invoker “NodeCreate”
The next Invoker is “NodeCreate”. Select all the needed data for your outgoing requests and use “XSLT” as a mapping for your outgoing request and incoming response data.
Use my example as outgoing XSLT-mapping:
Furthermore, we want to store the NodeID of the response, for that reason we have to use the following mapping for incoming response data:
The “Event trigger” is the last point. Select one and you’re done with the next Invoker.
Configuring the Invoker “NodeDelete”
The next invoker is “NodeDelete”. Select all the needed data for your outgoing requests (please don’t forget the dynamic field “AlfrescoFolderID” in the “Ticket dynamic fields” drop-down) and use “XSLT” as a mapping for your outgoing data.
Use my example as outgoing XSLT-mapping:
Because the answer is empty if it was successful, you don’t need a mapping for the incoming response data.
The used “Event trigger” is the last point. Select a trigger of your choice and you’re done with the last Invoker of my tutorial.
Configuring the AlfrescoConnector “Network Transport”
It’s necessary to configure the network transport for the Invokers because we’ve to use the right requests commands towards Alfresco. Otherwise, we’ll receive errors. It’s quite easy as you can see:
Please select “BasicAuth” for authentication and use a valid user.
Afterward just click on “Save and finish”.
In the next blog article for the AlfrescoConnector, I’ll show you how to create files and additional users in Alfresco.
More information about the Alfresco API
You can also use other resources which are provided by the Alfresco API.
If you need more information, please go to the following website: https://api-explorer.alfresco.com/api-explorer/