422 error when sending message to private Slack channel

When I try to send a test message to a private (but previously public) channel, I get a 422 error. When I check the logs, I see this:

Test provider failed {:error_key=>"chat_integration.provider.slack.errors.channel_not_found", :request=>"", :response_code=>"200", :response_body=>"{\"ok\":false,\"error\":\"channel_not_found\"}"}

This setup worked when the channel was private. I tried re-installing the Slack app and deleting the rules and recreating them. When I use @username rule or a public channel that seems to work well.

Double check you have configured all the “scopes” listed in the plugin topic: Set up Slack notifications using the discourse-chat-integration plugin

Do slash commands work from the private channel? If so, try creating a rule using those, and see whether it appears in the Discourse admin interface.

1 Like

All scopes are configured as required by the docs.

/discourse watch private-category works from the private channel. I can see the rule get created in Discourse.

When I try to send a test message from Discourse with an ID of a topic in the private category, I get the 422.

chat integration discourse username is system

we have the same problem.

Interestingly the notifications to slack works for the newly created slack channel, but not for the old one.