Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mention Users Group via Slack API

I would like to mention Users Group via Slack API (Rest), is it possible? I tried via @admins, <@admins>, <@ID>, <!admins>

But it still is showed as a standard text, without mention. Any ideas?

like image 332
Paweł Kaczorowski Avatar asked Jan 21 '19 06:01

Paweł Kaczorowski


2 Answers

User Groups follow the format <!subteam^ID|handle>. (subteam is literal text. ID and handle are replaced with the details of the group.) These indicate a User Group message, and should cause a notification to be displayed by the client. User Group IDs can be determined from the usergroups.list API endpoint. For example, if you have a User Group named happy-peeps with ID of S012345, then you would use the command <!subteam^S012345|happy-peeps> to mention that user group in a message.

https://api.slack.com/reference/surfaces/formatting#mentioning-groups

like image 57
Colm Doyle Avatar answered Sep 19 '22 14:09

Colm Doyle


The easier way to get a usergroup ID is as following documentation; https://api.slack.com/reference/surfaces/formatting#mentioning-groups

In short, open Slack via web browser (not app), then check usergourp link.

image from Slack documentation

With above usergroup ID, the message could be This is message :smile: <!subteam^SAZ94GDB8>.

The whole format is <!subteam^ID|handle> but handle is optional. It is correctly replaced with usergroup name (ie, @dev-team) without handle.

like image 22
Youngjae Avatar answered Sep 16 '22 14:09

Youngjae