1. Home
  2. Alert Behavior
  3. Custom Outgoing Webhooks

Custom Outgoing Webhooks

Connect VictorOps to the tool of your choice using our custom outgoing webhooks. VictorOps’ outbound webhooks can ‘subscribe’ to a number of different VictorOps actions such as incidents or chats. The webhook URL, method, content type, and payload are all configurable. VictorOps ‘variables’ can be used as part of the payload so that the information being sent to third-party systems is dynamic. The following will walk you through setting up your first outbound webhook.

Please note: The VictorOps Outgoing Webhooks are a Full-Stack service level feature and require admin credentials to view and modify.


Getting Started

From the VictorOps timeline go to Settings >> Alert Behavior >> Outgoing Webhooks. Select Add Webhook.

Give the webhook a name and select the VictorOps “Event” type.


Event Types

The different event types are as follows:

Subscription Name Subscription Description
All-Chats Webhook will fire anytime any chat is placed into the main timeline. This includes all incident chats and any chat entered from a third party chat integration.
Any-Incident Webhook will fire anytime any incident is created, acknowledged and resolved.
Any-On-Call Webhook will fire anytime there is any form of on-call change, both going on-call and going off-call.
Any-Paging Webhook will fire anytime any user starts or stops being paged.
Incident-Acknowledged Webhook will fire anytime any user or system acknowledges an incident.
Incident-Chats Webhook will fire anytime any chat is entered into a specific incident.
Incident-Resolved Webhook will fire anytime any user or system resolves an incident.
Incident-Triggered Webhook will fire anytime any user or system triggers an incident.
Off-Call Webhook will fire anytime any user goes off-call.
On-Call Webhook will fire anytime any user goes on-call.
Paging-Start Webhook will fire anytime any user starts being paged.
Paging-Stop Webhook will fire anytime any user stops being paged.

Suggested Variables

The example variables for each “Event” will populate on the right side of the screen. Please note: although the variables are listed as Available they are, in fact, only suggestions and may be customized to fit your needs.

customoutbound3


Request Types

Next, select the appropriate method for your webhook. The available options are:

  • GET
  • POST
  • PUT
  • DELETE
  • PATCH

Enter the appropriate ‘Content Type’ for your webhook, application/json for example.

Place your endpoint URL that you want to receive these notifications in the ‘To’ field.

VictorOps parses all URL’s for basic authentication, so if your endpoint requires basic auth you can add it to the URL like so:

http://username:password@example.com/

or

http://username:api_key@example.com/

The last step is to construct your Payload. If you plan to use one of the available variables as part of your payload make sure to wrap them with ${{variable_name}}. For example, if you want to include the number of alerts in an incident you could add the following variable: ${{STATE.ALERT_COUNT}}. Other fields specific to the incident can also be used, for example, ${{ALERT.field_name}}.

Finally, hit save and you are done.

Conditionally Fire Webhooks

By combining outgoing webhooks with the power of the Transmogrifier, you can set up rules to have them only fire when a desired condition is met.

To start, you’ll navigate to the Transmogrifier under Settings –> Alert Behavior –> Transmogrifier.

From here, you’ll click the “+ Add a Rule” button and define your particular Matching Condition for the rule (the condition you want the webhook fired on).  In this example, we’ll be doing when the state_message contains the phrase “escalate to dev” anywhere in it.

In the “Transform these alert fields” portion, we’ll create a new field called “vo-webhook-field” and populate it with part of the destination URL you’re sending the webhook to.

In this example, the full destination URL we’re hoping to send to is “https://dev.oscato.com/2tn6xfh” so we’ll put “oscato.com” as the vo-webhook-field value.

Next, you’ll navigate to Outgoing Webhooks under Settings –> Alert Behavior –> Outgoing Webhooks and click “+ Add a Webhook”

Here, select the Event you want the webhook to fire on in addition to the Method and Content Type you want for it.

In the “To:” field, you’ll paste in your destination URL while replacing the part you’d pasted in the Transmogrifier rule with ${{ALERT.vo-webhook-field}}.

In this example, the full destination URL we want the webhook to go to is “https://dev.oscato.com/2tn6xfh” and we’d put “oscato.com” in the Transmogrifier rule, so the complete “To:” URL will be “https://dev.${{ALERT.vo-webhook-field}}/2tn6xfh”

This will make it so that the URL is only complete (thus allowing the webhook to successfully fire) when the “vo-webhook-field” is present, which will only be present when the Transmogrifier matching condition is met.

Fill out the Payload information with the desired fields you want included in the webhook, add an optional description, and you’re all set with a conditionally firing webhook!

 

Updated on November 14, 2018

Was this article helpful?

Related Articles