Slack 获取特定线程的对话历史记录

Slack get conversation history for a specific thread

我正在尝试获取特定线程的对话历史记录。我正在使用

const history = await this.slack.conversations.history({
  channel,
  latest: threadTs,
});

但我正在获取整个频道的对话历史记录,而不仅仅是我传递给最新的线程。我正在尝试做的事情可能吗?我正在使用 'latest' 参数,因为它在另一个 Whosebug post.

中被建议

希望您已经自己找到了答案,但以防万一:您正在寻找的 API 方法是 conversations.replies。它需要一个 channel 和一个 ts 参数,其中后者是启动线程的消息的标识符。

来自上面链接的文档页面:

This Conversations API method returns an entire thread (a message plus all the messages in reply to it), while conversations.history method returns only parent messages.

一个小提示:如您所见,返回的列表将始终包含原始消息(您传递的 ts 消息)。