I am very new to slack api integration using node js. I am trying to get channels history. Even I tried with chat.postMessage. But it threw me the following error every time:
{ 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' ]*** } }
Here is my code snippet,
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);
Could someone please help me what i am missing here?
- When should i use "Bot User OAuth Access Token" and "OAuth Access Token"?
- What is channel ID?
- Is APP ID called as channel ID?
Thanks in advance