1. Home
  2. Integrations
  3. JIRA Webhook Integration Guide – VictorOps

JIRA Webhook Integration Guide – VictorOps

JIRA Service Desk brings you a collaborative IT service desk with a powerful ticketing system, a self-service knowledge base and real-time reporting. This integration provides a wide range of customizable configuration options, so there is not just one way to set this up. This guide aims to provide you with all the tools you will need to setup this integration to fit your workflows.

The first step is to copy your Service API Endpoint to the clipboard. Navigate to Settings >> Alert Behavior >> Integrations and scroll down to “Jira (webhook)”

 

Next, copy the Service API Endpoint and paste it to a temporary location for later usage. Replace the $routing_key with whichever routing key is desired, leaving it blank will route to the default routing key.

 

In JIRA

From the main web interface, select the cog in the upper right hand corner and then System. 

jnew1

In the left side bar under “Advanced” select WebHooks.

jnew2

Select + Create a Webhook. Give the WebHook a name set the status to Enabled and paste in the VictorOps JIRA URL.

jnew3

You will then have the options to use specific JQL queries to send only certain issues.

Next select the events you would like to have a webhook sent to VictorOps for. In our example we have chosen to send a webhook whenever an “Issue” is created, updated or deleted.

jnew4

Finally un-check the “Exclude body” check box so that JIRA sends JSON and then select Create.

Now when an issue is created, a CRITICAL incident will be created, any updates will be sent to the timeline as an alert associated to that incident including info messages when a comment is added. When the issue is resolved or deleted in JIRA, the incident will be resolved in VictorOps. That is the out of the box functionality. Any additional functionality you desire can be accomplished through the use of custom fields and the Transmogrifier.

In VictorOps

Now that webhooks are being sent from JIRA, we have a number of options on how we can manipulate those into different types of alerts and update JIRA issues based on actions in VictorOps. We will start with a simple transmogrifier rule. For example you may want to adjust the severity level of an alert based on the priority that was set in JIRA or the jira.issue.fields.priority.name. Let’s say for all JIRA issues with a priority of Sev 4 you want to make those WARNING alerts in VictorOps. The transmogrifier rule would look like:

jnew5

Next, to send information based on actions in VictorOps back into JIRA you will need to setup Outbound Webhooks that accomplish this. You can do things such as update the status of a ticket when the incident is acknowledged in VictorOps or add a comment to the ticket. The following example will walk you through how to add a comment to a JIRA ticket when someone writes in the associated incident timeline in VictorOps.

Select Settings then Webhooks then Add a webhook.

Set the “Event” to “Incident-Chats”
Set the “Method” to POST
Set the “Content Type” to application/json
Set the “To” to the JIRA rest endpoint for issue comments. You will need to pass through authentication and the Jira Issue Key or ID in the url. The URL should look like so:

https://username:password@sub_domain.atlassian.net/rest/api/2/issue/${{ALERT.jira.issue.key}}/comment

Set the “Payload” to include the chat text from the incident timeline. The payload should look like so:

{"body": "Via VictorOps Timeline: ${{CHAT.TEXT}}"}

The final result should like like so:

jnew6

Now every time you a chat is entered into the timeline a comment will be added to the issue in JIRA.

Some important JIRA fields for both Transmogrifier and the Outbound Webhooks are:

jira.issue.fields.status.id
jira.issue.fields.status.name
jira.issue.fields.priority.id
jira.issue.fields.priority.name
jira.issue.id
jira.issue.key

For Additional information on JIRA’s API see the documentation here.

This is just one of many ways to set up this integration, if you are trying to setup a custom workflow and have any questions please contact support.

 

Updated on August 30, 2017

Was this article helpful?

Related Articles