Contains the freshservice automation starter kit, used in the Refresh19 presentation
I hope you enjoyed refresh19 as much as I did.
We've decided to build this starterkit based on Azure Functions and make use of Powershell.
Azure Functions because it's free! Get your free account here
Powershell mostly because it's not that hard to start with and has a great community to help out with any question. Read more on powershell here if you are new to Powershell. And yes, Mac and Linux users aren't left out.
Make sure you download or clone the contents of this repo and run everything that you do from the root of that specific folder.
Signup using the link above. Without a Azure subscription we can't move forward.
Create a new service request for this demo.
- Item Name: refresh19demo
- Short Description: refresh19demo
- Description: refresh19demo
Just add a single line textbox and name it "textinput"
At the bottom of the screen edit the subject and change it to: {{item.name}}
Save and Publish
For this you can make use to GetCatalogItemDetails.ps1
Make sure you edit the script and update the following lines:
[string]$freshTenant = "" # Please enter your fresh tenantname. Example <YOUR-TENANT-NAME>.freshservice.com.
[string]$APIKey = '' # Please enter a API key here.
[int]$catalogItemNumber = # You can find your catalogItemNumber in de url.
Run the script and you can see every piece of information you might need to automate requests etc. For now, we don't need any information because we know the fieldname and thats all we need now.
If you are new to Powershell. Install powershell if you are running MacOs or a Linux distribution, if you are running windows, install the latest version of AZ-Modules
Login to your Azure Subscription using Connect-AzAccount
You can now run DeployFunction.ps1 to deploy the Tier2 funtion
When the deployment is finished, you can validate the deployment by logging in to the azure portal and take a look at the AzureFunctions section and see the deployed function.
Make sure you read the code in the deployed function, you can use it as a template to send request to backend systems.
For now it's going to update the ticket with a note that Tier2 processing was completed.
Don't forget to enter your fresh tenantname and enter a apikey.
Logon to your freshservice environment, navigate to the admin, click on the Admin and then click automator.
Create a new automator with the following steps. New Automator --> Tickets --> Name: refresh19demo --> create
- Event --> When a ServiceRequest is raised
- Condition --> And the subject is "refresh19demo"
- Action --> Set the status as pending
- Action --> Trigger webhook : Request type: Post Callback URL: The url of the azure function. This was generated during the deployment. (you can find a copy in the triggerUrl.txt in the working directory)
- Encoding: JSON
- Select SIMPLE mode
- Content : Ticket ID
Active the automator workflow.
And watch Tier2 add a note to the ticket.