17

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?

Paweł Kaczorowski
  • 1,502
  • 2
  • 14
  • 25

2 Answers2

34

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

Colm Doyle
  • 3,598
  • 1
  • 20
  • 22
  • Push notifications is not being sent to users of the group if mentioned through webhook. They are notified if mentioned manually on slack. Is this a bug in slack end? – Inba Apr 21 '22 at 08:19
  • Here's how you can get the ID for a given subteam. 1. Log into slack in a webbrowser. 2. On the left bar click "People and user groups". 3. By default this screen only shows people. You need to click the tab at the top, center of the screen that lists the User Groups. 4. Click the usergroup you want the ID for. 5. The ID is the very end of your webbrowser's url. So if your URL is https://app.slack.com/client/TABCDEFGHIJKL/browse-user-groups/user_groups/S1234AB5CDEF, then the usergroup is S1234AB5CDEF. – Daniel Arnett Jul 12 '23 at 22:27
15

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.

Youngjae
  • 24,352
  • 18
  • 113
  • 198