chore: Handle attachments in Whatsapp Channel (#3299)

send and receive attachments in 360Dialog WhatsApp channels
This commit is contained in:
Sojan Jose
2021-11-11 11:33:48 +04:00
committed by GitHub
parent b3e313a200
commit a4c87f2052
33 changed files with 422 additions and 45 deletions

View File

@@ -199,6 +199,10 @@ describe ::ContactInboxBuilder do
end
describe 'facebook inbox' do
before do
stub_request(:post, /graph.facebook.com/)
end
let!(:facebook_channel) { create(:channel_facebook_page, account: account) }
let!(:facebook_inbox) { create(:inbox, channel: facebook_channel, account: account) }

View File

@@ -3,6 +3,10 @@ require 'rails_helper'
describe ::Messages::Facebook::MessageBuilder do
subject(:message_builder) { described_class.new(incoming_fb_text_message, facebook_channel.inbox).perform }
before do
stub_request(:post, /graph.facebook.com/)
end
let!(:facebook_channel) { create(:channel_facebook_page) }
let!(:message_object) { build(:incoming_fb_text_message).to_json }
let!(:incoming_fb_text_message) { Integrations::Facebook::MessageParser.new(message_object) }
@@ -16,7 +20,7 @@ describe ::Messages::Facebook::MessageBuilder do
first_name: 'Jane',
last_name: 'Dae',
account_id: facebook_channel.inbox.account_id,
profile_pic: 'https://via.placeholder.com/250x250.png'
profile_pic: 'https://chatwoot-assets.local/sample.png'
}.with_indifferent_access
)
message_builder

View File

@@ -3,6 +3,10 @@ require 'rails_helper'
describe ::Messages::Instagram::MessageBuilder do
subject(:instagram_message_builder) { described_class }
before do
stub_request(:post, /graph.facebook.com/)
end
let!(:account) { create(:account) }
let!(:instagram_channel) { create(:channel_instagram_fb_page, account: account, instagram_id: 'chatwoot-app-user-id-1') }
let!(:instagram_inbox) { create(:inbox, channel: instagram_channel, account: account, greeting_enabled: false) }
@@ -19,7 +23,7 @@ describe ::Messages::Instagram::MessageBuilder do
name: 'Jane',
id: 'Sender-id-1',
account_id: instagram_inbox.account_id,
profile_pic: 'https://via.placeholder.com/250x250.png'
profile_pic: 'https://chatwoot-assets.local/sample.png'
}.with_indifferent_access
)
messaging = dm_params[:entry][0]['messaging'][0]