From 64138ef2205049b037a5aadc084bf6773b719a6e Mon Sep 17 00:00:00 2001 From: Muhsin Keloth Date: Wed, 10 Jan 2024 04:00:17 +0530 Subject: [PATCH] chore: Rescue `Slack::Web::Api::Errors::NotInChannel` error (#8670) The primary cause of this issue is when Chatwoot sends a message to a channel that has either been deleted or is unauthorized. So, we will prompt reauthorization when this error occurs. Fixes https://linear.app/chatwoot/issue/CW-2930/slackwebapierrorsnotinchannel-not-in-channel --- lib/integrations/slack/send_on_slack_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/integrations/slack/send_on_slack_service.rb b/lib/integrations/slack/send_on_slack_service.rb index c840dd1d9..50a69e02b 100644 --- a/lib/integrations/slack/send_on_slack_service.rb +++ b/lib/integrations/slack/send_on_slack_service.rb @@ -97,7 +97,7 @@ class Integrations::Slack::SendOnSlackService < Base::SendOnChannelService post_message if message_content.present? upload_file if message.attachments.any? rescue Slack::Web::Api::Errors::AccountInactive, Slack::Web::Api::Errors::MissingScope, Slack::Web::Api::Errors::InvalidAuth, - Slack::Web::Api::Errors::ChannelNotFound => e + Slack::Web::Api::Errors::ChannelNotFound, Slack::Web::Api::Errors::NotInChannel => e Rails.logger.error e hook.prompt_reauthorization! hook.disable