Create an incident

Automatically create Uptime incidents from Jira by using our Incidents API and Jira Automation .

1. Creating custom fields in Jira

We'll first create custom fields for Jira: The incident_id and BU_incident_url. Those are essential in order to acknowledge and resolve the connected incident in Uptime automatically and to have a direct link to the BU in the ticket.

Please, skip this part if you don't want Jira to acknowledge/resolve Uptime incidents.

  1. Go to the Jira Dashboard β†’ Settings β†’ Issues β†’ Fields β†’ Custom fields
  2. Click on Create custom field
  3. Search for Short text (plain text only) and hit Next.
    Custom field type.png
  4. Fill in the name as incident_id, associate it with all screens, and follow the same pattern to create a BU_incident_url field.

Setting up Jira Automation Rule

  1. Go to the Jira Dashboard β†’ Project Settings β†’ Automation

    If you'd like to apply this to all your projects, switch to the Global administration and apply the following to the Global rules

  2. Click on Create rule

  3. Select the Issue created trigger and Save the changes.

    Jira Trigger.png

  4. OPTIONAL: If you'd like to, you can also add the Condition as a component to the rule - for example, create an incident in Uptime when Highest priority ticket is created. You can find all the fields under the Issue fields condition and create a variety of conditions.

    Jira Condition.png

  5. Once you're done selecting which tickets are eligible, select the New action component and search for the Send web request component.

    Jira Action.png

  6. In the Web request URL, insert the https://uptime.betterstack.com/api/v2/incidents.

  7. Fill in the Authorization Header and insert your API Bearer Token.

  8. Select the POST HTTP Method and Custom data for the Web request body.

  9. In the Custom data part, create a payload to correspond with the required payload for the Incidents API (you can find more in the Incidents API Documentation). A sample payload:

 
{
    "name": "{{issue.key}} - {{issue.summary}}",
    "summary": "{{issue.key}} - {{issue.summary}}",
    "requester_email": "{{reporter.emailAddress}}",
    "description": {{issue.description.asJsonString}},
    "policy_id": "{UPTIME_POLICY_ID}"
  }

  1. Then, make sure to check in the box Delay execution of subsequent rule actions until we've received a response for this web request, to ensure that the additional fields are fetched from the API's response.
  2. Add a new component "Edit issue".
    Jira Edit Issue.png
  3. Choose fields to set... β†’ incident_id
  4. And insert the following value to the field: {{webResponse.body.data.id}}

    This will ensure that Uptime's Incident ID will be fetched and later used to acknowledge and resolve the incident from within the Jira ticket.

  5. Then add the same condition again, this time with Choose fields to set... β†’ BU_incident_url and the following field payload: https://uptime.betterstack.com/team/{{YOUR_TEAM_ID}}/incidents/{{webResponse.body.data.id}}

That's all! πŸŽ‰

From now on, a new incident will be triggered in Uptime every time a new Jira ticket matching the conditions is created.

Need help with setting up the Jira Integration?

Please message us at hello@betterstack.com, and we will help you with all the necessary configurations.