Slack API - 当机器人没有对话历史记录时如何获得 bot_id?

Slack API - How to get bot_id when bot has no conversation history?

我正在尝试获取没有对话历史记录的机器人的 bot_id 值。

根据 documentation:

the bot_id fields appear in bot_message message event subtypes and in the response of methods like conversations.history.

这很有意义并且有效。

但是当机器人没有对话历史记录时,是否有可能获得这个 bot_id 值?

例如,假设 Slackbot 和我的机器人之间的频道没有对话历史记录。对该频道的 conversations.history 请求的响应如下,其中不包括 bot_id 值。

{
    "ok": true,
    "channel": {
        "id": "DC6N8Q1BK",
        "created": 1534129098,
        "is_im": true,
        "is_org_shared": false,
        "user": "USLACKBOT",
        "last_read": "0000000000.000000",
        "latest": null,
        "unread_count": 0,
        "unread_count_display": 0,
        "is_open": true,
        "priority": 0
    }
}

还有其他获取 bot_id 值的方法吗?

如果有机器人用户,您可以使用 users.list 从普通用户列表中获取它。但这不包括其他应用程序。

然后是非官方的API方法bots.list。这将为您提供所有机器人的列表,但它不受官方支持,您将需要一个遗留令牌才能与许多未记录的方法一起使用。