stack api conversations.history returns error: not_in_channel

I'm starting out with the slack API and trying to just get a list of messages. Here are my steps:

  1. Created a slack app and gave it channels:read and channels:history scope (also re-installed it)
  2. Queryied the list of channels with conversations.list (this worked fine)
  3. From the output of conversations.list, Found a channel that I use and copied the id
  4. Used the conversations.history api with the channelid from step 3


{ "ok": false, "error": "not_in_channel" }

I'm not at all sure what is happening here. I definitely have messages in the channel, and the documentation page for that api does not say anything about this "not_in_channel" error code.

What am I doing wrong?

1 answer

  • answered 2020-02-13 17:36 Caleb Njiiri

    This error arises when you are using the bot oauth token and the bot is not invited to the channel. To solve this you need to

    • Invite the bot(slack app) to join the channel.
    • Use the OAuth Access Token instead