1. Home
  2. Integrations
  3. Zendesk Integration Guide – VictorOps

Zendesk Integration Guide – VictorOps

Requirements

Versions Supported: N/A (SaaS)

VictorOps Version Required: Enterprise

What you need to know:  This integration makes use of a feature, Outbound Webhooks. To get more information about this feature please reach out to your account executive or the VictorOps support team. 

The following guide will walk you through all the available features and functionality available with the bi-directional integration with Zendesk and VictorOps. Starting in Zendesk when tickets are created and/or opened, a VictorOps incident is created paging the appropriate teams. You can then update the Zendesk ticket by acknowledging/resolving it in VictorOps and/or leaving a comment in the incident timeline. Depending on your desired workflow you may choose to only implement some aspects of this integration.


In VictorOps

In VictorOps we will be making 3 Outbound Webhooks to create a connection between Zendesk and VictorOps.

From the main timeline select Settings, Alert Behavior then Outbound Webhooks then select + Add Webhook.

The first webhook you will setup is going to change the severity of the Zendesk ticket when a user acknowledges the incident in Victorops. In the example below, we will change the status to “pending”.

Set the webhook “Event” to Incident-Acknowledged.
Set the “Method” to PUT
Set the “Content-type” to application/json
In the “To” input you be using the “Update Many Tickets” API call. You must include the basic auth as part of the URL, and you must url encode aspects of that as well. Zendesk allows you to use an API key or username:password for basic auth. Both are options in the URL. For example:

 

Custom Outbound Webhooks

 

Username and password:

https://name%40email.com:password@suburl.zendesk.com/api/v2/tickets/update_many.json

Zendesk API Token:

https://name%40email.com%2Ftoken:YOUR_TOKEN@suburl.zendesk.com/api/v2/tickets/update_many.json

In the “Payload” box paste in the following JSON:

{"tickets": [{"id": "${{ALERT.ticket_id}}", "status": "pending"}]}

Next select Save.

Next we will add a webhook for posting a comment to the Zendesk Ticket directly from the incident in VictorOps.

Create a new webhook.
Set the webhook “Event” to Incident-Chats.
Set the “Method” to PUT
Set the “Content-type” to application/json
In the “To” input you must put your Zendesk API URL. (see previous example).
In the “Payload” box paste the following JSON:

{"tickets": [{"id": "${{ALERT.ticket_id}}",  "comment": { "body": "${{CHAT.TEXT}}", "public": true }}]}

Then select Save. 

Finally we will add a webhook for when incidents are manually resolved in VictorOps, to go and update the Zendesk ticket to “Solved”.

Create a new webhook.
Set the webhook “Event” to Incident-Resolved.
Set the “Method” to PUT
Set the “Content-type” to application/json
In the “To” input you must put your Zendesk API URL. (see previous example).
In the “Payload” box paste the following JSON:

{"tickets": [{"id": "${{ALERT.ticket_id}}", "status": "solved"}]}

Select Save and you’re done.


 In Zendesk

In Zendesk, you will first need to create a VictorOps Extension. From your Zendesk portal select the settings Gear in the lower left hand corner and then select Extensions. 

zendesk1

Select the Targets tab and then add target.

zendesk2

Select the HTTP Target.

zendesk3

 

In VictorOps, please direct your attention to Settings, Integrations, and Zendesk and enable the integration.

 

Back in Zendesk, give the target a title and then paste the Service API Endpoint, found in VictorOps, into the box labeled “URL”. Set the method to type to POST and the content type to JSON. To test the target you can place in the following JSON.

1
2
3
4
{
   "message_type":"info",
   "state_message":"testing from Zendesk"
}

After testing to make sure the integration is successful, Switch from “Test Target” to “Create target” and hit Submit. 

zendesk6

Next you will need to create a “Trigger”. In Zendesk in the left sidebar under “Business Rules” select Triggers. Then select add trigger.

zendesk7

Give the trigger a name. Under the “Meet any” section set the following rules:

– Ticket Status is New
– Ticket is Created

Then set the “Perform these actions” option to the VictorOps HTTP target you set up earlier.

Finally paste the following JSON body into the box:

1
2
3
4
5
6
7
8
9
10
11
12
{
  "entity_id":"{{ticket.title}}",
  "message_type":"CRITICAL",
  "state_message":"{{ticket.comments_formatted}}",
  "monitoring_tool":"Zendesk",
  "alert_url":"{{ticket.link}}",
  "ticket_id":"{{ticket.id}}",
  "Ticket External I.D.":"{{ticket.external_id}}",
  "Ticket Origin":"{{ticket.via}}",
  "Ticket Status":"{{ticket.status}}",
  "Ticket Priority":"{{ticket.priority}}"
}

The end result should look like this.
zendesk8

Lastly select Create trigger.

Now all Zendesk tickets will create VictorOps incidents when they are created or opened. If needed, adjust the conditions to fit your teams workflow.

Additional triggers can be added if you would like the ability to acknowledge and resolve VictorOps incidents from Zendesk. Again, depending on your teams workflow, set the appropriate conditions and then you can use the following two payloads to acknowledge and resolve VictorOps incidents.

Acknowledge

1
2
3
4
5
6
7
8
9
10
11
12
{
  "entity_id":"{{ticket.title}}",
  "message_type":"ACKNOWLEDGEMENT",
  "state_message":"{{ticket.comments_formatted}}",
  "monitoring_tool":"Zendesk",
  "alert_url":"{{ticket.link}}",
  "ticket_id":"{{ticket.id}}",
  "Ticket External I.D.":"{{ticket.external_id}}",
  "Ticket Origin":"{{ticket.via}}",
  "Ticket Status":"{{ticket.status}}",
  "Ticket Priority":"{{ticket.priority}}"
}

Resolve

1
2
3
4
5
6
7
8
9
10
11
12
{
  "entity_id":"{{ticket.title}}",
  "message_type":"RECOVERY",
  "state_message":"{{ticket.comments_formatted}}",
  "monitoring_tool":"Zendesk",
  "alert_url":"{{ticket.link}}",
  "ticket_id":"{{ticket.id}}",
  "Ticket External I.D.":"{{ticket.external_id}}",
  "Ticket Origin":"{{ticket.via}}",
  "Ticket Status":"{{ticket.status}}",
  "Ticket Priority":"{{ticket.priority}}"
}

If you have any questions please contact VictorOps support.

Updated on May 18, 2017

Was this article helpful?

Related Articles