Is it possible to automate a message to a slack channel with all of the results of a JQL query?

Holly Schomann February 10, 2021

For example, I have a filter that provides me a view of all tickets that are in the code in review status for more than 2 days.  I would like to automate a slack message to the team channel to include a list of all of those ticket numbers that are provided by the JQL query.

I know how to create an automated message per individual ticket, however I simply want one message to include all of the results of that query.

The slack integration only allows the ability to automate when a trigger occurs, e.g. moved to this status, which is not what I am looking for.  Any suggestions?

1 answer

1 accepted

0 votes
Answer accepted
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 10, 2021

Hi @Holly Schomann 

You can do this with Automation for Jira, creating a scheduled trigger rule, use Lookup Issues with your JQL search, and send the message to Slack.

Please look here for information to get you started:

https://community.atlassian.com/t5/Automation-articles/Jira-Automation-all-the-resources-you-need-in-one-page/ba-p/1388465

https://www.atlassian.com/software/jira/automation-template-library/slack-ms-teams

https://www.atlassian.com/software/jira/automation-template-library#/label/all/1453

Best regards,

Bill

Holly Schomann February 10, 2021

thanks so much for responding.  Unfortunately, I don't believe that this can help me. I am able to create one message per ticket, but am unable to use this to group mutlple results into one message.  

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 10, 2021

Hi, Holly.  

That is where LookupIssue can help.  You use it with your JQL, and it treats the results as a set.  For example, this would list the keys for them all, which could be sent in one message:

{{#lookupIssues}}
* {{key}}
{{/}}

Please look here to see which fields are available for LookupIssues:

https://support.atlassian.com/jira-software-cloud/docs/smart-values-general/

Thanks,

Bill

Holly Schomann February 11, 2021

Bill, I really appreciate your help, as I am new to automations, can you provide more details to help me get there?

As you can see I have this automation set (for email for testing).  Where do i insert the lookup issues? I add this to the description of the email but it still sent individual emails.

Thank you so much for your help.  If i could get this done, it would be so helpful for my entire company.

holly

Jira Screen shot.png

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 11, 2021

Sure, I will try to help with more details.

I see that you are using a JQL statement to limit your scheduled trigger in the rule.  After the trigger, you may add the LookupIssues action, and use the same JQL.  Then your email body may use the LookupIssues results. So your rule pieces, in order, would be:

  1. Trigger: Scheduled with JQL
  2. Action: lookup issues with the same JQL
  3. Action: send email, using the lookup issues 

For example, the following in your email body will give you a bulleted list of the issues with a link to each showing the Key and Summary.  If you wanted something simpler, you could use my earlier example with just the Key.

<ul>
{{#lookupIssues}}
<li><a href="{{url}}">{{key}} - {{summary}}</a></li>
{{/}}
</ul>

Try this first to get it working.  You can then replace (or add) the Send Slack Message action, per your question.  Please see the information in that action to configure the connection to Slack.

Please let me know if this works for you.

Like Holly Schomann likes this
Holly Schomann February 11, 2021

Bill,

This is amazing! So helpful.  I removed my JQL trigger, just scheduled a cron trigger, followed by the look up issues results and it worked!! Thank you so much for the detailed instructions.

The issue that I have now, is that I can't simply replicate this to send a message to slack, and need to create a webhook, which I don't know how to do.  I am so close! sigh.

Thank you again for your help getting me this far.

Holly

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 12, 2021

Hi Holly,

I am glad to here it is working!  If you look at this how-to page below, and select the incoming webhooks link, it will help you set it up for Slack messaging.  If you do not have permissions, please check with whoever set up your Slack instance.

https://support.atlassian.com/jira-software-cloud/docs/use-automation-with-slack/

Best regards,

Bill

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events