feat: Handle Facebook send message/attachments errors (#8197)
This commit is contained in:
@@ -87,6 +87,15 @@ describe Facebook::SendOnFacebookService do
|
||||
tag: 'ACCOUNT_UPDATE'
|
||||
}, { page_id: facebook_channel.page_id })
|
||||
end
|
||||
|
||||
it 'if message sent from chatwoot is failed' do
|
||||
message = create(:message, message_type: 'outgoing', inbox: facebook_inbox, account: account, conversation: conversation)
|
||||
allow(bot).to receive(:deliver).and_return({ error: { message: 'Invalid OAuth access token.', type: 'OAuthException', code: 190,
|
||||
fbtrace_id: 'BLBz/WZt8dN' } }.to_json)
|
||||
described_class.new(message: message).perform
|
||||
expect(bot).to have_received(:deliver)
|
||||
expect(message.reload.status).to eq('failed')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user