Disciples
Disciples

Reputation: 703

Mentioning users via slack in webhooks

I'm building somewhat integration github with slack, which will notify users (reviewers of pull request) and send them link in #general chat.

And I'm struggling with mentioning users, right now I found only one way to mention them: via username in Slack, however to know this username, I must ask person to give it to me. Mentioning via <@display_name> doesn't seem to work, even with link_names: 1 parameter.

Upvotes: 25

Views: 21434

Answers (2)

Alejandro Barone
Alejandro Barone

Reputation: 2151

If you have the email you can also use the syntax mentioned by @Achyut but just with the "email" part. At least for me that helps a lot as finding the user/memberId is somewhat annoying.

Email -> [email protected]

To the bot:

{
 "text": "Hello <@someuser>"
}

This works even if the user has another "alias" in their name.

Cheers!

Upvotes: 4

Achyut
Achyut

Reputation: 733

You can mention users through <@memberID> as text in the Slack webhook. This will post a username as a string.

For example, if there is a user named John with memberID UC6B12Z4N, then pass <@UC6B12Z4N> in the Slack webhook. This will mention @John with the correct link.

How to find my Member ID in Slack workspace?

Upvotes: 38

Related Questions