Slack integration Not Working - Not in Channel Error

AI-generated summary

A user, dnichk, is experiencing issues with their Slack integration in Discourse, receiving a “not in channel” error when trying to send posts to their Slack channel. Despite partial integration success, they are unable to resolve the issue. anirvan suggests a solution, recommending that the integration bot be added to the specific Slack channel using the /invite @discourse_integration command, replacing @discourse_integration with the actual integration handle if necessary.

Hi there - I was following the chat integration docs to set up with our slack. I ran through the instructions a few times, but I seem to have an issue.

When a post (in discourse) attempts to push into our channel, the rules area in Discourse shows the error Some channels for this provider failed last time messages were sent. Click the error icon(s) to learn more.

Now, if I click the icon, I get a window coming up showing some JSON output.

I have included the raw error below as well.

{
  "error_key": null,
  "request": "",
  "response_code": "200",
  "response_body": "{\"ok\":false,\"error\":\"not_in_channel\"}"
}

If I edit the rule and attempt to send a test message, I simply get a discourse chat - provider error shown.

I know the integration is at least “partially” working as if in slack I issue a /discourse watch a command (a does not exist on purpose), it will return a list of categories. The second confirmation is that I set up my rules from within slack and they were propagated back into the admin discourse interface.

Since I am a new user, I cannot post more than a single screenshot - so I put the screenshots up on Imgur. Discourse Issues - Album on Imgur

Any suggestion? Thank you for your time.

To solve this, you need to add your integration bot to the particular Slack channel.
Go to the channel in Slack and type in the following command:

/invite @discourse_integration

NOTE: if you’ve named your integration something else, you’ll need to use that handle.