How do I send a slack message via web request with one message and a list of issues from a filter?

Deanna Vazquez November 7, 2023

Screenshot 2023-11-07 at 3.09.39 PM.pngI am trying to send a slack message via web request that asks to view the list of tickets that have not been touched in 7 days. 

 

The same message sends with each issue that is found in the JQL query. I want one message and a list of tickets. 

 

{{#lookupIssues}} *<{{url}}|{{key}}> {{/}} is not working. Screenshot 2023-11-07 at 11.16.15 AM.png

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.
November 7, 2023

Hi @Deanna Vazquez -- Welcome to the Atlassian Community!

Does your scheduled trigger have a JQL statement? 

If so, the scheduled trigger will run the rule steps for each issue from the JQL.  You may remove that trigger's JQL and only one message will be sent with the issues from the Lookup Issues action.

If you are concerned about sending an empty message (when no issues are found), you may add an Advanced Compare Condition after the lookup and before the message:

  • first value: {{lookupIssue.size|0}}
  • condition: greater than
  • second value: 0

Kind regards,
Bill

Deanna Vazquez November 8, 2023

I don't think I am following. The scheduled trigger does not have Run a JQL search and execute actions for each issue in the query checked.

 

This person is asking the same question but their screen has an option to processes in bulk as shown here

 

The only way I can produce the slack messages is by putting {{issue.summary}}: {{issue.url}}. I cannot put any other wording or it will repeat with every ticket link.

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.
November 8, 2023

What version of Jira are you using: Cloud, Server, or Data Center?

Does your scheduled trigger have JQL at all?  If so, please remove the JQL as it is not needed, regardless of the options selected for processing, bulk-handling, etc.

And, the bulk-handling feature for the scheduled trigger and branches is only available for Server and Data Center, and that is not needed for this type of rule.

 

To help confirm what is happening, please post an image of your audit log details showing the rule execution.

 

I am curious: why are you using a Send Web Request action to send the Slack message?  All three versions of Jira automation rules have a built-in Send Slack Message action.

Deanna Vazquez November 8, 2023

The only way the rule is successful is with the below but then every issue has test in front of it but I want it to say:

 

Test

  Ticket

  Ticket

  Ticket


Not 


Test ticket

test ticket 

test ticket


{
"message": "Test {{issue.summary}}: {{issue.url}}"
}

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.
November 8, 2023

Deanna, please see my earlier questions in the last post as they may help to improve your rule:

  • What is your Jira version?
  • Please post and image of the audit log details
  • Why using the Send Web Request action, rather than the built-in Send Slack Message action?
  • Please post an image of the body / content of your Send Web Request action
Deanna Vazquez November 9, 2023
  • What is your Jira version?
    • I believe we are using Version 2.0, January 2004. At least that is what I found when I went to help>about Jira
  • Please post and image of the audit log details
    • Screenshot 2023-11-09 at 1.38.51 PM.png
  • Why using the Send Web Request action, rather than the built-in Send Slack Message action?
    • Our company uses Okta and it's an Okta webhook that then hits the Slack webhook so our IT team would have to help us with every Slack Message automation.
  • Please post an image of the body / content of your Send Web Request action
    • Screenshot 2023-11-09 at 1.52.44 PM.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.
November 9, 2023

Thanks for that info, Deanna!

Your rule and the audit log look okay, and based on the custom data for the Send Web Request action, the problem appears to be on the Okta side.

You can confirm this by copying the contents of that custom data, and writing it to the audit log with the rule's Log action.  If it only shows your message text, "These tickets...", once, then the problem is in how the Okta webhook is processing the message.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events