Webhooks

Webhooks allow your service to receive requests about specific resources, depending on your selection, such as installation, issues, and alerts:

Sentry integration webhook checkbox

Headers

All webhooks will contain the following set of request headers:

Copied
{
  "Content-Type": "application/json",
  "Request-ID": "<request_uuid>",
  "Sentry-Hook-Resource": "<resource>",
  "Sentry-Hook-Timestamp": "<timestamp>",
  "Sentry-Hook-Signature": "<generated_signature>"
}

The Sentry-Hook-Resource and Sentry-Hook-Signature are described below.

Sentry-Hook-Resource

This is the resource that triggered the action. The action will be in the payload. The possible resources are listed below:

  • installation
  • event_alert
  • issue
  • metric_alert
  • error
  • comment

Sentry-Hook-Signature

A hash generated using your Client Secret and the request itself. Used to verify the authenticity of the request.

Verifying the Signature

Copied
const crypto = require("crypto");

function verifySignature(request, secret = "") {
  const hmac = crypto.createHmac("sha256", secret);
  hmac.update(JSON.stringify(request.body), "utf8");
  const digest = hmac.digest("hex");
  return digest === request.headers["Sentry-Hook-Signature"];
}

Request Structure

All webhook requests have some common elements.

action
The action that corresponds with the resource in the header. For example, if the resource is issue the action could be created.

installation
An object with the uuid of the installation so that you can map the webhook request to the appropriate installation.

data
The data object contains information about the resource and will differ in content depending on the type of webhook. This payload may be able to be customized via UI components.

actor
The actor is who, if anyone, triggered the webhook. If a user in Sentry triggered the action, the actor is the user. If the Sentry integration itself triggers the action, the actor is the integration. If the action is triggered automatically within Sentry, the actor is "Sentry".

Copied
# Sample cases:

# User installs Sentry integration
"actor": {
    "type": "user",
    "id": <user-id>,
    "name": <user-name>,
}

# Sentry integration makes request to assign an issue
"actor": {
    "type": "application",
    "id": <sentry-app-uuid>,
    "name": <sentry-app-name>,
}

# Sentry (sentry.io) auto resolves an issue
"actor": {
    "type": "application",
    "id": "sentry",
    "name": "Sentry",
}

Event Types

Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) to suggesting an update ("yeah, this would be better").