Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Set up email alerts for your JSM queues.

This workaround is intended to people that would like to set up an “Alert Notification” whenever a specific issue queue has reached a certain threshold. We will make use of Automation For Jira, JQL, Rest API and Web Requests to accomplish this. I will explain the needed steps below:

1. Set up an API token for your site that will be used in your automation.

  • Initially you will need an API Token created for authentication, to send a web request to an API endpoint using your automation rule. In case you don't have any API token configured, you may check the needed steps at this document
    :warning: Once created you won't be able to see it again, so I'd advise copying the API token string to another location, we will need this later.

  • With the above token created, you will need to encode it to the authorization string. At the 2nd step from this community post there's a detailed step on how to do so, but basically we can make this through any online tool like Base64 encode or you can use a terminal session and execute the following:

    $ echo -n "<email@example.com>:<YOUR_TOKEN_HERE>" | base64

    Where you would need to replace <email@example.com> by your user’s email address and <YOUR_TOKEN_HERE> for the API token you generated at the previous step, separated by the “:” character and between the ““ characters. Once you execute this command, please save the generated string to use later.

2. Create your automation rule.

Go to your Project Settings > Automation and start a new rule in the following components:

  • In this example I will use the "Issue created" trigger.

  • The 2nd component should be a “JQL Condition” component, where you will use the same JQL set in your issue queue from your JSM project. This component is set to avoid sending the notification for every ticket that is not from the same queue that you need to alert. In this example, I’ve used the JQL from the “All Open” queue from my test project.

    JQL.png

  • The 3d component should be the “Send web request” action component. Here it gets a bit tricky, you will have to configure it with the following values:
    Web request URL:

    {{baseUrl}}/rest/api/2/search?jql=<YOUR-QUEUE-JQL>&maxResults=0

    :info: The above is your instance's API endpoint to return the number of issues based on a determined JQL. You may find additional details for this API in this link.
    :warning: Remember to replace <YOUR-QUEUE-JQL> for your queue JQL in the needed format. For my example queue, the syntax will be like this:

    {{baseUrl}}/rest/api/2/search?jql=project=TISM+AND+resolution=Unresolved&maxResults=0

    Headers:

    Accept: application/json
    Authorization: Basic <base64-token> 

    :warning: Remember to replace <base64-token> by your generated base64 encoded string at the 1st step from this post.
    HTTP Method:

    GET

    Web request body:

    Empty

    :warning: And Check the "Delay execution of subsequent rule actions until we've received a response for this web request" checkbox.

    web-request.png

  • For the 4th component we will compare the number of returned tickets, using the “Advanced compare condition” component, to check if the number of issues returned from the web request is greater than a specific number. We will use the following values:
    First value:

    {{webResponse.body.total}}

    Condition:

    greater than

    Second value:

    25

    :info: This means that I would like the alert to be triggered once the queue has reached at least 25 issues.

    compare.png

  • Finally, for the last component we will use the “Send email” action component to send an email alert to the needed recipients. In my example I will notify the users from the “administrators” group and the “email@domain.com” email address. You may also customize your email notification subject and content.

    send-email.png

After setting up your automation rule, you should have something similar to this:

rule.png

5 comments

Vitor Maldonade
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 17, 2023

Nice one, @Rodrigo Henrique !

Like # people like this
Isabelle Bossolan
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 17, 2023

Nice article @Rodrigo Henrique

Like # people like this
Jamie MacDonald January 31, 2023

Thank you so much for sharing this @Rodrigo Henrique , I have heard from many clients that they want something like this.

Like Rodrigo Henrique likes this
Martin Boehme
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 8, 2023

Nice workaround!

What could be improved: The e-mail is sent every time a new ticket is created (beyond the threshold). I would want only one e-mail.

But I can't imagine a way to do that.

Like # people like this
Airyn
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 11, 2023

Great tip! Thanks!

Like # people like this

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events