How to make your own modifications or simply just take a look onto the implementation to get an idea of how everything works?
The following explanations will refer to the VBScript version, the Lua version however is more or less identical in its structure.
The entire code of this integration is located in one single file, FreshserviceIntegration.vbs.
All functionality is encapsulated in a class (FreshsericeClass), which defines properties for all parameters (with some validation) as also private and public methods.
To make use of the FreshserviceClass class the FreshserviceIntegration.vbs file must be included first. This is done in the "Start" block of the GSE Action or your own GSE rule.
'#inlcude "FreshserviceIntegration.vbs"
Afterwards the class needs to get instantiated, its properties set and the needed public method/function called. The return value of the function is either "0" (ok) or "1" (failed), so it can be used directly for the exits of a "Insert Script Code" or "Run GSE Action" block.
And this is exactly what the GSE actions of this project are doing.
In order to make modifications it is not simply possible to modify the FreshserviceIntegration.vbs file and re-upload it again into the SwyxWare database. This is because the file is digitally signed, which is necessary to get it included with the #include statement.
The easiest way to do your own modifications is to forget about the FreshserviceIntegration.vbs file all together and use just its content within a start block of a GSE rule (instead of the #include statement), but without the digital signature.
You can strip the signature yourself from the code (first line and all lines from the bottom), or simply use the content of the start.vbs file from the "vbs" folder or the download package.
VBScript based\vbs\start.vbs
So just do all your modifications within the start.vbs file and afterwards just copy & paste the entire content of the file into the "Start" block
and then use the Insert "Insert Script Code" block to instantiate the FreshserviceClass and call its functionality
Dim c, sReturn Set c = new FreshserviceClass with c .sDomain = "mycompany" .sAPIKey = "1234567890123" .sContactEmail = "test@test.com" .sSubject = "My first Ticket" .sDescription = "Please call me asap!" .nSource = 3 .nStatus = 2 .nPriority = 2 sReturn = .CreateTicket end with Set c = Nothing UseExit = sReturn
It is highly recommended to not do any code modifications directly in the Start block, but instead use a proper editor like VS Code or Notepad++.
You are now free to to any modifications within the code and use it afterwards in your own GSE rules.
If you want to update the FreshserviceIntegration.vbs in the end, you need to update its signature as well. This can be done with the "SignScript" tool which can be found in the Enreach Partner Net (you need a partner login).
In order to get get your own .vbs file signed, make sure that the text encoding is UTF-8-BOM. This can easily be checked/configured with Notepad++.
Please feel free to ask any questions regarding the code, implementation or distribution (signing, including, etc.) in the Open ECR Extensions forum.
Most of the above mentioned is also true for the following extensions. So there is lots more to explore
- Azure Translate (REST API usage, OAuth2 authentication)
- Azure TTS (text-to-speech) (REST API usage, OAuth2 authentication)
- Freshdesk Integration (REST API usage, API Key/Token authentication)
- Invision Power Services (IPS) Integration (REST API usage, API Key/Token authentication)
- Jira Service Integration (REST API usage, API Key/Token authentication)
- Longest Waiting (Database usage)
- Open Queue (Database usage)
- Zendesk Integration (REST API usage, API Key/Token authentication)
By Tom Wellige