Cloud Elements currently supports events via polling or webhooks depending on the endpoint.
n
minutes and captures the changed information.If you would like to see more information on our Events framework, please see the Event Management Guide.
Freshservice requires an extra specification to be entered once an Element instance has been created. The Freshservice Instance ID must be 64 base encoded, then included in the webhook callback URL. This document will walk you through the entire workflow:
To provision your Freshservice Element, use the /instances API.
Below is an example of the provisioning API call.
Description: An Element token is returned upon successful execution of this API. This token needs to be retained by the application for all subsequent requests involving this element instance.
A sample request illustrating the /instances API is shown below.
HTTP Headers:
Authorization: User <INSERT_USER_SECRET>, Organization <INSERT_ORGANIZATION_SECRET>
This instance.json file must be included with your instance request. Please fill your information to provision. The “key” into Cloud Elements Freshservice is “freshdesk”. This will need to be entered in the “key” field below depending on which Element you wish to instantiate.
{
"element": {
"key": "freshservice"
},
"configuration": {
"username": "<INSERT_FRESHSERVICE_USERNAME>",
"password": "<INSERT_FRESHSERVICE_PASSWORD>",
"subdomain": "<INSERT_FRESHSERVICE_SUBDOMAIN_NAME_ONLY>",
"event.notification.enabled": "true",
"event.notification.callback.url": "<INSERT_EVENT_CALLBACK_URL>"
},
"tags": [
"<INSERT_TAGS>"
],
"name": "<INSERT_INSTANCE_NAME>",
"eventsEnabled": "true"
}
Here is an example cURL command to create an instance using /instances API.
Example Request:
curl -X POST
-H 'Authorization: User <INSERT_USER_SECRET>, Organization <INSERT_ORGANIZATION_SECRET>'
-H 'Content-Type: application/json'
-d @instance.json
'https://api.cloud-elements.com/elements/api-v2/instances'
If the user does not specify a required config entry, an error will result notifying her of which entries she is missing.
Below is a successful JSON response:
"id": 1234,
"name": "Freshservice Test",
"token": "/sO6vVsB2eXhOlgvNR/p+G7wC/+rhY5M=",
"element": {
"id": 130,
"name": "Freshservice Beta",
"key": "freshservice",
"description": "Add a Freshservice Instance to connect your existing Freshservice account to the Help Desk Hub, allowing you to manage your incidents, priorities, statuses, users, etc. across multiple Help Desk Elements. You will need your Freshservice account information to add an instance.",
"image": "https://pbs.twimg.com/profile_images/3159951933/1511f0f59e3f239a8ef707b1db3a42e3.png",
"active": true,
"deleted": false,
"typeOauth": false,
"trialAccount": false,
"hub": "helpdesk",
"parameters": [
{
"id": 38,
"createdDate": "2015-04-08T19:53:48Z",
"name": "subdomain",
"vendorName": "subdomain",
"type": "configuration",
"vendorType": "path",
"source": "request",
"elementId": 130,
"required": false
}
]
},
"provisionInteractions": [],
"valid": true,
"disabled": false,
"maxCacheSize": 0,
"cacheTimeToLive": 0,
"configuration": {
"base.url": "https://{subdomain}.freshservice.com",
"pagination.offset": "false",
"password": "password",
"pagination.max": "30",
"subdomain": "https://sample.freshservice.com",
"username": "sample@sample.com",
"event.notification.callback.url": "https//www.mycoolapp.com/events"
},
"eventsEnabled": true,
"cachingEnabled": false
}
Note: Make sure you have straight quotes in your JSON files and cURL commands. Please use plain text formatting in your code. Make sure you do not have spaces after the in the cURL command.
Retrieve Instance ID from the create instance response:
Copy the Instance ID and go to a 64Base Encoding website.
Here is a sample site that will 64 base encode your instance ID: https://www.base64encode.org/.
Copy the ID, encode it, then copy the encoded ID.
Place the ID in the following URL:
https://api.cloud-elements.com/elements/api-v2/events/freshservice/{INSERT_64BASE_ENCODED_INSTANCE_ID}
An example of the URL once the Instance ID has been encoded:
https://api.cloud-elements.com/elements/api-v2/events/freshservice/MjA5MzE=
Log in to your Freshservice domain.
Click “Admin”
Under Helpdesk Productivity, select “Observer”
Select “New Rule”
Name the Rule
Add an Event
Select person to perform events
Select condition(s)
Under “Select Actions”
Choose “Trigger Webhook”
Select POST
Insert the following URL with the base64 encoded Instance ID: https://api.cloud-elements.com/elements/api-v2/events/freshservice/{INSERT_BASE64_ENCODED_INSTANCE_ID}
Content should be set to JSON
Select Content
Click “Save”
Events are now implemented for Freshservice.