Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Automation: sending direct Slack or tagging multiple people in a public message using smart values

Rony Kahana December 21, 2023

Hi!

I want to send a reminder over Slack for assignees to add the missing Original Time Estimate to their tickets.

I currently found a temp solution which lets me send one Slack message to a public channel, tagging all the relevant assignees in that one message (so avoiding multiple messages to the same channel).

My questions - 

  1.  Is there a better way to do this than the one I detail below?
  2. When I try to put a smart value that should translate to a Slack ID in the "channel or user," it doesn't send the message to the specific user. Anything I'm missing? (see image for an example) 

Screenshot 2023-12-21 at 11.47.59 AM.png

The solution I currently have: message a public Slack, tagging assignees in one message. 

It requires making 3 different automation rules. 

Rule 1

Step 1: Scheduled every 2 weeks 

Step 2: Create a new issue with the summary: 

{{now.jiraDate}} slack message

Rule 2

Step 1: Scheduled every 2 weeks (later in the day than Rule 1) with a JQL searching for the issue created in Rule 1

summary~"{{now.jiraDate}} slack message"

Step 2: Lookup issues

originalestimate=EMPTY AND assignee!=EMPTY

Step 3: Advanced branching using the smart value to find the email addresses of the assignees and removing dupes:

{{lookupIssues.assignee.emailAddress.distinct}}

Screenshot 2023-12-21 at 10.49.48 AM.pngScreenshot 2023-12-21 at 10.50.15 AM.png

Step 4 (part of the advanced branch): create a lookup table with everyone's emails corresponding with their Slack IDs (which our Slack admins kindly provided. I exported the rule after creating the lookup table > copy-pasted the table from excel to the json file where the temp lookup table was > and imported the rule back to Jira) 

Step 5 (part of the advanced branch): add a comment to the issue (the one created in Rule 1, and searched for in Rule 2) with the values from the lookup table corresponding to the assignees' emails. Break down of that part of the branch: 

The lookup table was {{num}}

The variable for the branch's smart value: {{email}}

Getting the Slack ID for each email: {{num.get(email)}}

Note that it didn't need the {{ or }} before and after the "email" -- the log shows the expected values. 

Adding the formatting so that in a Slack message it will turn to tagging the user: <@{{num.get(email)}}>

The end result is that the issue will have as many comments as users and they are all <@SLACK-USER-ID> (example: <@AJHFJJD123>)

Rule 3

Step 1: Scheduled every 2 weeks (later in the day than Rule 2) with a JQL searching for the issue created in Rule 1

summary~"{{now.jiraDate}} slack message"

Step 2: Get all the comments body and remove any extra "<@>" (I don't know why but some comments only had that. Maybe the assignee isn't in my lookup table) or "," 

{{issue.comment.body. remove("<@>").remove(",")}}  Which results in a list of Slack IDs 

Step 3: Message Slack and include in the body of the message: {{issue.comment.body. remove("<@>").remove(",")}}

(ignore the multiple "refetch data" that's nervous me)

Screenshot 2023-12-21 at 11.36.08 AM.png

1 answer

1 vote
Mikael Sandberg
Community Champion
December 21, 2023

In order to send a DM to the assignee you need to use their Slack member Id, and you can do that if you use user properties and sync it with Slack. Have a look at this article that describe what you need to do.

If you want to @ mention someone in a channel you can do that by adding @firstname.lastname but that only works if the user hasn't changed their display name in Slack. If they have, then you have to use their member Id like this <@xxxxxx>

Rony Kahana January 8, 2024

Thank you! And yep I have been trying to use their member ID. I don't have it setup like the article but I'm using a lookup table of user names and their member ID. If I got it right, the pros of setting it up like in the article you linked is that I don't have to worry about updating my list? 

The issue I'm running into is using smart values in the @ field. The smart value returns the member ID but still no DM. 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events