Is there a way to route notifications to a Slack channel when a specific user is tagged in comments?
Asked by Karissa:

I know there is already an integration with Slack to get notifications when cards are updated, however, I was wondering if I could be more specific with this through automation.

I'm looking to create an automation that once a specific user is mentioned/tagged in a comment that it brings the information to a private Slack channel showing which card they were tagged in a comment on.


Answers:
author: Bill Sheboy
body: Hi [@Karissa](/t5/user/viewprofilepage/user-id/4785719)

Do you mean...

1. for a single, specific user (e.g., you) who is mentioned in a comment, send a specific direct mention to them in Slack, or...
2. for any single user mentioned, send a direct mention to them

I suspect #1 can be done by using a rule condition to look for the specific user's accountId in a mention, and then send to a channel specifically for them...which you specify.

For #2, I recall some posts where people solved this by also storing the Slack user id values in entity properties for the Jira users, and then referencing them when needed in rules. I have not tired this, so I cannot confirm its effectiveness.

Kind regards,  
Bill

comments: author: Karissa
body: I'd like to set it up for one or two specific users so I think #1 from your question is more proper. Just wondering what the automation setup would look like for this since there's not an obvious option given.

If using the JQL, (involving the account id which I do have) how do I reference the actual comment tag and not a field/custom field which are shown in any examples in past questions for this type of automation?


author: Bill Sheboy
body: Mentions in comments put in text like below, including the user's accountId value:

\[\~accountid:*theUsersAccountId* \]

And so your rule could be triggered on issue commented, and then use the [match() function](https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/#match--) to find if your specific user(s) accountId was used. You can find their accountId by trying a JQL search for them by name and Jira will replace the name with the id.

So the rule could be something like this:

* trigger: issue commented
* advanced compare condition: use match() to check if the user was mentioned
* action: send your Slack message

Please let me know how that works for you. Thanks!


author: Karissa
body: [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313) This worked thank you so much!


author: David Pezet
body: (Just mentioning for others who might find themselves here looking for options.) Depending on if the mentioned user and the slack user are the same person, what else needs to happen, or how many people you need to set this up for (Bill's answer allows for a lot of flexibility!), you might consider recommending people add the [Jira app on the Slack](https://slack.com/apps/A2RPP3NFR-jira-cloud?tab=more_info) side (if your IT allows it). This can be set to automatically post a slack notification to the user when there are mentions (among other things). Downside is it is user configurable so they could turn it off --again, just depends on the needs.

There is also the [Slack integration for Jira](https://marketplace.atlassian.com/apps/1216863/jira-cloud-for-slack-official?tab=overview&hosting=cloud) that is handy.


Tags: slack