fix: Update the message status to failed if the outgoing Facebook message fails. (#8258)
This commit is contained in:
@@ -11,6 +11,7 @@ class Facebook::SendOnFacebookService < Base::SendOnChannelService
|
|||||||
rescue Facebook::Messenger::FacebookError => e
|
rescue Facebook::Messenger::FacebookError => e
|
||||||
# TODO : handle specific errors or else page will get disconnected
|
# TODO : handle specific errors or else page will get disconnected
|
||||||
handle_facebook_error(e)
|
handle_facebook_error(e)
|
||||||
|
message.update!(status: :failed, external_error: e.message)
|
||||||
end
|
end
|
||||||
|
|
||||||
def send_message_to_facebook(delivery_params)
|
def send_message_to_facebook(delivery_params)
|
||||||
|
|||||||
@@ -58,6 +58,8 @@ describe Facebook::SendOnFacebookService do
|
|||||||
described_class.new(message: message).perform
|
described_class.new(message: message).perform
|
||||||
|
|
||||||
expect(facebook_channel.authorization_error_count).to eq(1)
|
expect(facebook_channel.authorization_error_count).to eq(1)
|
||||||
|
expect(message.reload.status).to eq('failed')
|
||||||
|
expect(message.reload.external_error).to eq('Error validating access token')
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'if message with attachment is sent from chatwoot and is outgoing' do
|
it 'if message with attachment is sent from chatwoot and is outgoing' do
|
||||||
|
|||||||
Reference in New Issue
Block a user