Before creating an Outbound Integration, ensure there is a JIRA Inbound Integration.

Names of fields may vary in this guide, make sure the variables/field names are consistent in your environment.

Add Custom Fields

To begin creating an Outbound Integration for JIRA, several non-standard items must be created, some in JIRA, some in AlertOps.  In JIRA, create the following:

In AlertOps, a Template is used to create custom attributes.  In most cases, where only a small number of Attributes are created, extending the Standard Template is sufficient, though you can create a new one if you choose.  Create the following Attributes:

JIRA Outbound Integration Configuration

  1. We will create the Outbound Integration, with the following Methods:

To do this, we expand the Integrations menu and select Outbound Integrations, then press Add Outbound Integration.

Integration Name: JIRA
Web Security Type: Basic
UserName: AlertOps API (would be the emailID you would use to login to your JIRA portal/ usually admin)
Password: the API Token for your Jira account (Can be obtained from your Jira profile settings)

Press Save.

2. Add the Methods:

JIRA Create Issue 

  • Give any name. Give web method as 'POST' and response data type as 'JSON'

  • Make sure the URI is of the format https://your-domain.atlassian.net/rest/api/2/issue/ where <your-domain> refers to your specific sub-domain for Jira

  • Paste the following in the Request Data section,

{ "fields": { "project": { "key": "SMAXISSUES" }, "summary": "AOID <<MessageThread.MessageThreadID>>","issuetype": { "id": "10005" }} }

,where the field "key" should have the value exactly matching the Issue Key you would have specified in JIRA. The field "summary" can be edited with a value that you would want by utilizing the available fields.

  • Paste the following in the Response Data section,

    {"id":"<<Attribute.JIRA Issue ID>>","key":"<<Attribute.JIRA Issue Key>>","self":"<<MessageThread.SourceURL>"}

The field "id" and "key" should have the custom created JIRA fields that you did in the first step. The response values obtained would be mapped to those fields.

  • Make sure the 'Update Alert Fields' checkbox is enabled.

  • Update!

JIRA Resolve Issue

  • Give any name. Give web method as 'POST' and response data type as 'JSON'

  • Make sure the URI is of the format https://your-domain.atlassian.net/rest/api/2/issue/<<Attribute.JIRA Issue ID>>/transitions where <your-domain> refers to your specific sub-domain for Jira. The "Attribute.JIRA Issue ID" is the custom field that you would have created, and can be obtained from the available fields below.

  • Paste the following in the Request Data section,

    {"update": {"comment": [{"add": {"body" : "AO ID <<MessageThread.MessageThreadID>> <<MessageThread.Resolution>>."}}]},"fields" : {"resolution" : {"name" : "Fixed" }},"transition" : {"id" : "41"}}}

    where the 'body' field can be modified as needed using the available fields.

  • Update!

Add Issue Comment (Optional)

  • Give any name. Give web method as 'POST' and response data type as 'JSON'

  • Make sure the URI is of the format https://your-domain.atlassian.net/rest/api/2/issue/<<Attribute.JIRA Issue ID>>/comment where <your-domain> refers to your specific sub-domain for Jira. The "Attribute.JIRA Issue ID" is the custom field that you would have created, and can be obtained from the available fields below.

  • Paste the following in the Request Data section,

    { "body": "The issue has been assigned: Status = <<MessageThread.MessageThreadStatusType>>. Owner = <<MessageThread.OwnerName>>"}

    where the 'body' field can be modified as needed using the available fields.

  • Update!

Workflow Configuration

We will now create the Workflows that will apply the Outbound Integration.  For each workflow, select Workflow from the Menu and press Add Workflow.  

1. Create Issue Workflow

Name: JIRA Create Issue
Type: MessageThread
Template: choose the Template where the custom JIRA fields were added (above).
Schedued: checked - Recurrence Interval 0

Press Save.

Start Conditions: Use Match All Conditions, add the following conditions:

JIRAIssueID (Template field) is blank (prevent creating a duplicate issue in JIRA).

MessageThreadStatusType IS NOT Closed.

MessageThreadTimeFromBeginning is 1 (Workflow do not fire when an alert is first created, minimum wait time is 1 minute).

Workflow Action is Outbound Service Notification – JIRA Create Issue. (whatever action/outbound integration method you defined in the previous set of steps)

Press Enable in the top right of the window, then Save.

2. Resolve Issue Workflow

Name: JIRA Resolve Issue
Type: MessageThread
Template: choose the Template where the custom JIRA fields were added (above).
Scheduled: unchecked

Press Save.

Start Conditions: Use Match All Conditions, add the following conditions:

JIRAIssueID IS NOT empty (only close if we have JIRAIssueID).

MessageThreadStatusType is Closed (fires when the alert is closed)

Workflow Action is Outbound Service Notification – JIRA Resolve Issue. (whatever action/outbound integration method you defined in the previous set of steps)

Press Enable in the top right of the window, then Save.

3. Add Note on Assignment Workflow (optional)

You can add comments or notes to a JIRA Issue.
Name: JIRA Add Note on Assignment
Type: MessageThread
Scheduled: unchecked

Start Conditions: Use Match All Conditions, add the following conditions:

MessageThreadStatusType is Assigned (fires on assignment).

Workflow Action is Outbound Service Notification – JIRA Add Issue Comment. (whatever action/outbound integration method you defined in the previous set of steps)

JSON body for the outbound method action (optional):
{ "body": "Delivery status update for <<DeliveryAttempt.ContactName>> contact method <<DeliveryAttempt.ContactType>> at <<DeliveryAttempt.SentDate>> status <<DeliveryAttempt.Status>>"}

Press Enable in the top right of the window, then Save.

4. Add Note on Delivery Workflow (optional)
To add a note to the JIRA Issue when a Delivery event occurs (sent, acknowledged, failed, or delivered):

Name: JIRA Add Note on Delivery
Type: Delivery Attempt

Start Conditions: Use Match Any Conditions, add conditions you want notated:

Workflow Action is Outbound Service Notification – JIRA Add Issue Comment. (whatever action/outbound integration method you defined in the previous set of steps)

JSON body for the outbound method action (optional):
{ "body": "Delivery status update for <<DeliveryAttempt.ContactName>> contact method <<DeliveryAttempt.ContactType>> at <<DeliveryAttempt.SentDate>> status <<DeliveryAttempt.Status>>"}

JIRA Configuration

!IMPORTANT!

If you are implementing two-way integrations (creating JIRA Issues from AlertOps and creating AlertOps Alerts from JIRA), you must include the AlertOps ID field in your JIRA implementation and also include the filter in your JIRA Business Rule.

Add a custom field to JIRA for the AlertOps ID.

Type: Text Field (single line)

Issue Type(s): Global (all issues), or choose a specific JIRA template.

Webhook to Send an Issue to AlertOps when Created

The Webhooks for close and open use the same Inbound Integration endpoint.

AlertOps may route requests to and endpoint to different (cloned) integrations.

The status value in the JIRA request to AlertOps tells AlertOps which action must be done.

Webhook to Send an Issue to AlertOps when Closed

The Webhooks for close and open use the same Inbound Integration endpoint.

AlertOps may route requests to and endpoint to different (cloned) integrations.

The status value in the JIRA request to AlertOps tells AlertOps which action must be done.

Reference: JIRA Cloud Rest API Docs

Did this answer your question?