This guide will help you set up a webhook integration to send alerts from Dotcom-Monitor to your Jira tickets. Dotcom-Monitor leverages the HTTP Webhook alert delivery method to connect Dotcom-Monitor alerting system and Jira tickets via webhook requests.

To set up the integration, ensure you have the necessary permissions to create issues in your Jira project.

Integration Setup

 Generate Jira API Token:

  1. Please visit the Basic auth for REST APIs page of the Atlassian Developer portal to learn how to generate an API token and set up basic authentication with Jira.
  2. Save the generated API token for use in the authorization header in Dotcom-Monitor.

Configure the Webhook in Dotcom-Monitor

When using API requests, particularly with authentication headers, JIRA sometimes requires an additional header to bypass CSRF protection. To address this, include the X-Atlassian-Token header with the value no-check in your webhook request.

  1. Log in to your Dotcom-Monitor Account and go to the Delivery Address Groups configuration (Manage > Delivery Address Group).
  2. Create a new group or open an existing one for editing. Add Webhook as Delivery Address. Please visit the HTTP Webhook Integration article to learn how to send Dotcom-Monitor alert messages to a dedicated webhook URL.
  3. In the Webhook URL field, enter: https://your-domain.atlassian.net/rest/api/3/issue
  4. Set the Request Type to POST.
  5. Leave Authentication section empty.
  6. In the Headers section, add the following headers. Make sure to BASE64 encode the useremail:api_token string.:
    • Authorization: Basic [useremail:api_token]
    • Content-Type: application/json
    • X-Atlassian-Token: no-check
  7. In the Payload field, enter the JSON data structure that will be sent to Jira. Here is an example payload:
    @{
    string _text = "";
    foreach (var sessionResponse in Model.SessionResponses)
    {
        foreach (var response in sessionResponse.Children)
        {
            _text += "Task Type: " + response.Task.TaskType_Name + ", " +
                     "Details Url: " + Model.DMUserLink + "/client/response-details/hit?id=" + response.ID + "&rootId=" + Model.RootResponse.ID + "&cuid=" + Model.OnlineReportCUID + ", " +
                     "View Task Url: " + Model.DMUserLink + "/v2/EditLegacyTask/" + response.Device.ID + "/" + response.Task.ID + ", " +
                     "Task Name: " + response.Name + ", " +
                     "Target: " + response.Target + ", ";
    
            if (response.AllErrors != null)
            {
                foreach (var error in response.AllErrors)
                {
                    _text += error.ErrorType + " (" + error.ErrorCode + ") " + error.Reason;
                }
            }
        }
    }
    }
    {
      "fields": {
        "project": {
          "key": "JIRA_PROJECT_KEY"
        },
        "summary": "Alert from Dotcom-Monitor",
        "description": {
          "type": "doc",
          "version": 1,
          "content": [
            {
              "type": "paragraph",
              "content": [
                {
                  "text":"@_text",
                  "type": "text"
                }
              ]
            }
          ]
        },
        "issuetype": {
          "name": "Task"
        },
        "components": [
          {
            "name": "Default Component"
          }
        ]
      }
    }
    
  8. Replace "PROJECT_KEY" with the key of your Jira project.

Test the Webhook

Once the webhook integration has been configured, we recommend testing your monitoring device by sending a test alert:

  1. In the device list, hover over the monitoring device you want to test.
  2. Click the Options menu (⋮) > Send Test Alert > Down.
  3. Check your Jira project to see if the alert has created a new ticket.

 Using Dynamic Variables in the Alert Template

If you need to include dynamic Dotcom-Monitor variables in your JSON payload, please check the Adding Dynamic Variables to Alert Template article.

If you encounter any issues or have specific requirements, please reach out to Dotcom-Monitor support for further assistance.