I have the following code which returns me the following error. The error says channel not found, howerver I am following the docs for a private channel to either use the name of the channel or to use the string that is in the url with a G at the beginning. I have given the correct chat write permissions to the bot for the channel and am using the correct bot api generated toekn, I was able to post via webhook before but I want to use the web-api.
This is the docs I am referring to https://api.slack.com/methods/chat.postMessage#channels
const { WebClient } = require('@slack/web-api');
const token = process.env.SLACK_BOT_TOKEN;
const web = new WebClient(token);
const conversationId = 'private-channel-name'; & tried this instead 'GCV2FGELX'
const result = await web.chat.postMessage({
text: 'Hello world!',
channel: conversationId,
});
This is the error response I am getting
{
code: 'slack_webapi_platform_error',
data: {
ok: false,
error: 'channel_not_found',
response_metadata: { scopes: [Array], acceptedScopes: [Array] }
}
}
I'm not quite sure what I am doing wrong, but doing a little digging, even when I try to use the tester get request for groups.list here https://api.slack.com/methods/groups.list/test with a auth token with the correct permissions I just get a empty response back, vs a list of groups. Not sure here.
I did note that it said this Post into any channel it has access to
for what the bot can do how do I know what channel's the bot has access to. I have given it write permissions to my whole orginization?
any help would be appreciated