Webhooks

Webhooks allow admins to send incident alerts to various systems capable of receiving HTTP(S) POST messages and handling them appropriately. These systems provide more sophisticated ways to process alert messages, as they can do escalation, and send text messages or other types of notifications, such as OpsGenie and Slack.

Webhooks can be configured for various incident types. Webhook requests include he following:

  • HTTP(S) request headers for authentication . Typically, this is token-based.

  • Additional headers

  • A request body containing a JSON object structure matching the requirements of the receiving service.

Note: The request body includes placeholder values that render dynamic data, such as error messages, into the relevant part of the JSON structure. Such a templated request body helps to adapt the request format to that of the receiving system (OpsGenie, Slack, etc).

Email This Issue for Jira has OpsGenie and Slack integration. Use pre-filled request headers and JSON body templates, customize them on the Webhook configuration UI, or create custom Webhooks to accommodate the needs of other systems, too.

Listing webhooks

To see the list of configured webhooks, go to WEBHOOKS --> Webhooks.

Adding a new webhook

To create a new webhook do the following:

1. Go to the Webhooks menu item under WEBHOOKS.

2. Click on the Add button on the upper right corner of the page and choose the service provider from the dropdown list to load the pre-filled template.

Note: Before saving webhooks are checked for basic syntax errors, for example an invalid URL pattern. However we advise for users to test the webhook.

Webhook attributes

Webhook variables

Webhooks use Apache Velocity to render headers/body content dynamically. The following variables are available and may be used in request headers and body:

Webhook templates

Email This Issue for Jira provides basic Slack and OpsGenie integration. For these service providers the templated configuration fields are pre-filled. These templates result in well-formatted messages and requests that suit most typical use cases.

Note: Templates can be adjusted and/or extended even with pre-filled Slack and OpsGenie templates, provided that the resulting template has a valid JSON syntax. In case of custom service providers, administrators should consult the documentation of the chosen service to construct the appropriate structure and content of the request.

The content of the pre-filled templates is the following:

Slack (Web API method) template

URL: https://slack.com/api/chat.postMessage

Header: Authorization: Bearer $!token

Request body:

{
    "channel": "<channel id>",
    "blocks": [
        {
            "type": "header",
            "text": {
                "type": "plain_text",
                "text": "Incident",
                "emoji": false
            }
        },
        {
            "type": "divider"
        },
        {
            "type": "section",
            "text": {
                "type": "mrkdwn",
                "text": "The $!entity.type Entity *$!entity.name* ($!entity.id) encountered an issue"
            },
            "accessory": {
                "type": "button",
                "text": {
                    "type": "plain_text",
                    "text": "Inspect entity",
                    "emoji": true
                },
                "value": "inspect_entity",
                "url": "$!entity.link",
                "action_id": "button-action"
            }
        },
        {
            "type": "context",
            "elements": [
                {
                    "type": "mrkdwn",
                    "text": "*Error:* $!message"
                }
            ]
        }
    ],
    "attachments": [
        {
            "text": "*Error Details:* $!details"
        }
    ]
}

OpsGenie template

URL: https://api.opsgenie.com/v2/alerts

Headers: Authorization: GenieKey $!token

Request body:

{
    "message": "$!message",
    "alias": "$!entity.type - $!entity.id",
    "description": "$!details",
    "tags": [
        "Critical"
    ],
    "details": {
        "Entity Name": "$!entity.name",
        "Entity Type": "$!entity.type",
        "Entity ID": "$!entity.id",
        "Entity Link": "$!entity.link",
        "Jira Base Url": "$!jiraBaseUrl",
        "Incident Timestamp": "$!timestamp"
    },
    "entity": "Email This Issue",
    "priority": "P1"
}

Custom template

URL: <specify URL>

Header: Authorization: <specify authorization details>

Request body: <specify body>

Additional webhook actions

Click the three dots next to a webhook item to access the following actions:

  • Test Webhook

  • Edit

  • Enable/disable

  • Delete

Testing a webhook

To make sure a webhook works as expected, test notifications can be sent to the configured service providers. In this case, the firing of an event is simulated, as if the event for which the webhook is configured had been triggered. The details of the simulated incident (i.e. the source of the error) can be custom-tailored, for example dummy data for the message and entity variables can be specified.

Deleting webhooks

Webhooks can be deleted manually. When deleted, all corresponding webhook execution log entries will be removed, too.

Setting up service providers

In order to connect to external receiving systems, these systems might need to be pre-configured to work with the Email This Issue for Jira application. This can include registering or authorizing them, for example. The exact steps of preparation can be found in Slack Configuration to Receive Webhooks and OpsGenie Configuration to Receive Webhooks. In case of Custom webhooks, see the documentation of the external receiving system to learn how to connect them to trusted applications.

Last updated