我对使用节点 js 的松弛 api 集成非常陌生。我正在尝试获取频道历史记录。即使我尝试使用 chat.postMessage。但它每次都给我抛出以下错误:
{ Error: An API error occurred: channel_not_found
at platformErrorFromResult (..\node_modules\@slack\client\dist\WebClient.js:747:42)
at __await.makeRequest.then (..\node_modules\@slack\client\dist\WebClient.js:464:39)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
code: 'slackclient_platform_error',
data:
{ ok: false,
error: 'channel_not_found',
scopes:
[ 'identify',
'bot',
'commands',
'channels:history',
'chat:write:user',
'chat:write:bot' ],
acceptedScopes: [ 'channels:history' ]*** } }
这是我的代码片段,
const { WebClient } = require('@slack/client');
const token = "OAuth Access Token"; // passing OAuth Access Token
const web = new WebClient(token);
web.channels.history({ channel: appID})
.then((res) => {
console.log('Message sent: ', res.ts);
})
.catch(console.error);
有人可以帮我这里缺少什么吗?
- 我什么时候应该使用“Bot User OAuth Access Token”和“OAuth Access Token”?
- 什么是频道 ID?
- APP ID是不是叫频道ID?
提前致谢