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.
Mentioning users in messages The user mentioning syntax <@W123|bronte> is now deprecated and will eventually be removed. Slack will use the "display name" when rendering all mentions. Use the simpler user ID-only form <@W123> instead. Using link_names when posting messages is also deprecated.
Message options Incoming webhooks allow you to add context to your messages by attaching helpful content and links. Things like images, websites, or other pieces of data make these messages more useful for your team.
Webhooks are safe as long as they remain secret since the webhook URL itself is unguessable. We also recommend workspace owners and admins use these best practices for storing credentials safely and that they review this guide to sending messages using incoming webhooks.
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?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With