feat: Add preview for attachment messages (#1562)

Add preview for pending messages and attachments

Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
This commit is contained in:
Nithin David Thomas
2021-01-06 17:56:29 +05:30
committed by GitHub
parent db189e3c26
commit 3d2db95417
17 changed files with 434 additions and 250 deletions

View File

@@ -58,7 +58,21 @@ describe Facebook::SendOnFacebookService do
attachment.file.attach(io: File.open(Rails.root.join('spec/assets/avatar.png')), filename: 'avatar.png', content_type: 'image/png')
message.save!
::Facebook::SendOnFacebookService.new(message: message).perform
expect(bot).to have_received(:deliver)
expect(bot).to have_received(:deliver).with({
recipient: { id: contact_inbox.source_id },
message: { text: message.content }
}, { access_token: facebook_channel.page_access_token })
expect(bot).to have_received(:deliver).with({
recipient: { id: contact_inbox.source_id },
message: {
attachment: {
type: 'image',
payload: {
url: attachment.file_url
}
}
}
}, { access_token: facebook_channel.page_access_token })
end
end
end