Chris Seiber

Basic Freshdesk Integration

Recommended Posts

The following guide is an example of a custom http integration using the Freshdesk API along with some of LogicMonitor's token values. 


To start off I would recommend reviewing the following resources. 

LogicMonitor Custom HTTP Delivery Documentation:
https://www.logicmonitor.com/support/settings/integrations/custom-http-delivery/

LogicMonitor Tokens: NOTE: (In this guide I create a token ##freshdesk.requesterid## using a custom property on the device. This allows me to pass this value through the integration. This can be very useful if you need to use the same integration to create tickets as multiple organizations or users. I've included a screenshot below detailing where this is set on the device.)
https://www.logicmonitor.com/support/settings/logicmodules/tokens-available-in-datasource-alert-messages/

YBtDKke.png

 

Freshdesk API Documentation:
https://developer.freshdesk.com/api/

Complete these steps in Freshdesk prior to creating your integration:

Create a Freshdesk User to be used for authentication.
https://support.freshdesk.com/support/solutions/articles/37591-adding-new-support-agents-

 

In the below payloads I use the Freshdesk requester_id as a token to create, update and close tickets. You can find the requester_id for a Freshdesk user by checking the following. 

 

wfzpr1n.png

 

Configure your Freshdesk API key for authentication.
https://support.freshdesk.com/support/solutions/articles/215517-how-to-find-your-api-key

Complete these steps in LogicMonitor to create the Integration:

  • Add a new Custom HTTP Delivery under Integrations using the following payloads as a starting point.
  • Determine if you would like to use a wildcard for things such as your Freshdesk requester_id or organization_id etc.

Payload Examples:

The following examples will Create, Update and Close FreshDesk tickets with LogicMonitor Alerts.

NOTE: When authenticating with the Freshdesk api, you will only need to enter your api key in the username field, the password is blank. 

 

SPwvew5.png

 

Active: 

{ "description": "Host: ##HOST##\nDatasource: ##DATASOURCE##\nDatapoint: ##DATAPOINT##\nLevel: ##LEVEL##\n Start: ##START##\nDuration: ##DURATION##\nValue: ##VALUE##\nReason: ##DATAPOINT## ##THRESHOLD##", "subject": "##LEVEL## - ##HOST## ##INSTANCE##", "requester_id": ##freshdesk.requesterid##, "priority": 1, "status": 2 }

xRR6Gty.png

Escalated:

{ "description": "Alert Escalated/De-escalated\nHost: ##HOST##\nDatasource: ##DATASOURCE##\nDatapoint: ##DATAPOINT##\nLevel: ##LEVEL##\n Start: ##START##\nDuration: ##DURATION##\nValue: ##VALUE##\nReason: ##DATAPOINT## ##THRESHOLD##", "subject": "##LEVEL## - ##HOST## ##INSTANCE##", "requester_id": ##freshdesk.requesterid##}

isN3erl.png

 

Acknowledged:

{ "body":"Note: ##MESSAGE##" }

N9KnSdM.png

Cleared: 

{ "description": "Alert Cleared\nHost: ##HOST##\nDatasource: ##DATASOURCE##\nDatapoint: ##DATAPOINT##\nLevel: ##LEVEL##\n Start: ##START##\nDuration: ##DURATION##\nValue: ##VALUE##\nReason: ##DATAPOINT## ##THRESHOLD##", "subject": "##LEVEL## - ##HOST## ##INSTANCE##", "requester_id": ##freshdesk.requesterid##, "priority": 1, "status": 4 }

lrmacMI.png

 

 

Here we can see the finished product, a ticket generated and cleared using the above payloads. 

Active Warn:

9yG1Deo.png

Active Error:

TqARusp.png

Active Critical:

B2fd61I.png

Active Critical Ack: 

akFT9ai.png

Cleared: (Note that the Status changes to Resolved)

gQgOGp8.png

Share this post


Link to post
Share on other sites
Guest Kurt Wolf

Chris, I'm working on implementing this and the test's all work correctly.  However, tickets are not being created when alerts fire.  I have case #83246 entered to see if I can get some assistance and hopefully we can get this flushed out.

Share this post


Link to post
Share on other sites

@Chris Seiber thanks for posting this.  I have found a couple of things when setting this up and thought I'd share (and ask for feedback):

1.  To properly format the message in the ticket you need to use HTML.  In other words you need to use <br> instead of \n for a line break.

2. The JSON path you have doesn't seem valid.  I was able to use $.id to get the ticket ID... however there is an issue with that (see below).

When I get the ##EXTERNALTICKETID## it is coming back like this:

Slack Integration : -1, Freshdesk - Create and Update Tickets : 20018

Where the first part before the colon are the display names of all integrations used on the alert (note the first one is for Slack and the second is for Freshdesk).  If I only had the Freshdesk integration configured, it would likely say "Freshdesk - Create and Update Tickets".  The part after the colon is the actual ticket number.  Do you have any thoughts on how to strip off the first part?  I know you support regular expressions but then that doesn't seem to be usable at teh same time as JSON for the ##EXTERNALTICKETID## mapping.  Is this a bug in your software that is including this in the property to begin with given I don't see how we could possibly get those values (the integration labels) from the JSON response itself (I don't see them when I do a test).

Share this post


Link to post
Share on other sites

Correction on the above - I do see that "id" can also work but results in the same thing.  I was just going off of what I was aware of as "proper" path syntax... but in any case, it still seems to work that way.  So, again, the main issue now seems to be the extra text added to the ##EXTERNALTICKETID## property which has nothing to do with the JSON response AFAIK.  

Share this post


Link to post
Share on other sites

I've also just done a test to create a new escalation chain with only the ticket update integration on it, but no improvement.  I get this for ##EXTERNALTICKETID##:

Freshdesk - Create and Update Tickets : 20024

I will report back if I find anything new.

Share this post


Link to post
Share on other sites

@Chris Seiber - It looks like this is actually working despite the above now.  I think the problem was I had some additional attributes set for Freshdesk that despite being supported by the API didn't seem to go through (which caused the entire update to fail).  So I think I'm good now on this but do still think the HTML formatting I mentioned may be helpful to others.

Share this post


Link to post
Share on other sites
Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.