slack - 使用 slack 上的机器人标记仅知道名称的用户组

标签 slack slack-api

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

hello Francois <@francois>

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

hello group <@group>

最佳答案

这取决于您所说的“组”是什么意思。

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

对于 1) @提及将不起作用。相反,您可以发送 <!channel>进入私有(private) 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。

关于slack - 使用 slack 上的机器人标记仅知道名称的用户组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49577969/

相关文章:

php - 我可以找出谁安装了 Slack 应用程序吗?

gitlab - 如何将本地 GitLab 与 Slack 集成以获取通知?

slack - SlackAPIPostOperator 中的 Airflow UI 链接?

Slack App API - 我可以订阅并监控当前用户的所有 @username 提及吗?

python-3.x - 名称 'Key' 未定义用于访问 DynamoDB 的 Lambda 函数

python - Slack api 返回 `is_bot` : False for a bot. 如何检查用户是否是 bot?

c# - 添加到 dotnetcore 中的 Slack,没有 Identity Framework 错误 : The oauth state was missing or invalid

slack-api - 如何查找(并可能删除)个人文件

ubuntu - ubuntu 16.04 右上角缺少 Slack 图标

slack - 我们如何在使用 Slack Block Kit Builder 时提及或标记某人?