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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,462,809
Community Members
 
Community Events
176
Community Groups

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

3 comments

Nice one, @Rodrigo Henrique !

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

Comment

Log in or Sign up to comment
TAGS

Atlassian Community Events