Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
445 views
in Technique[技术] by (71.8m points)

Slack 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. Queried the list of channels with conversations.list (this worked fine)
  3. From the output of conversations.list, I found a channel that I use and copied the id
  4. Used the conversations.history api with the channelid from step 3

Result:

{ "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?

question from:https://stackoverflow.com/questions/60198159/slack-api-conversations-history-returns-error-not-in-channel

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

After a long time of investigations (~2 hours), I found an easy approach. For Caleb's answer, I didn't understand how to invite a Bot to the channel. Hence, I am posting this answer.

Go to your Slack Channel and type the following as a message.

/invite @BOT_NAME

Eg: If your Bot name is SRE Incident Manager the command would be as follows.

/invite @sre_incident_manager

As soon as you start typing @, Slack will automatically suggest. So it becomes easy. For this, the Bot needs to be added to your Slack Workspace.

PS: Original answer.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...