在 slack 上用机器人标记只知道名字的用户组

Tag User group knowing only name with a bot on slack

On slack - 我可以使用以下文本语法直接从我的两者中标记用户:

hello Francois <@francois>

我想对群组执行同样的操作(不幸的是,我的应用程序只知道群组名称,不知道群组 ID)。是否有这样做的语法 - 以下语法不起作用:

hello group <@group>

这取决于您所说的 "group" 是什么意思。

  1. 私人频道被 Slack API 称为群组(例如 groups.list)
  2. 可以将用户分配到称为用户组的功能组 由 Slack api 内部(仅向 Slack 付费,例如 usergroups.list)

对于 1) @mention 将不起作用。相反,您可以将 <!channel> 发送到私人频道以获得相同的效果。

对于 2) 语法是 <!subteam^ID|handle>

请参阅 documentation 关于如何使用它们的摘录:

For paid account there is an additional command for User Groups that follows the format . (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 to mention that user group in a message.

如果只有用户组名需要ID可以使用usergroups.list获取对应的ID