Feat: send fb message outside of standard messaging window (#4439)

This commit is contained in:
Tejaswini Chile
2022-04-19 12:21:20 +05:30
committed by GitHub
parent d2d838afd1
commit 1ccd29140d
6 changed files with 26 additions and 9 deletions

View File

@@ -57,7 +57,6 @@ describe Webhooks::InstagramEventsJob do
instagram_webhook.perform_now(test_params[:entry])
instagram_inbox.reload
expect(instagram_inbox.messages.count).to be 1
expect(instagram_inbox.messages.last.content).to eq('This is a test message from facebook.')
end

View File

@@ -489,7 +489,7 @@ RSpec.describe Conversation, type: :model do
let!(:conversation) { create(:conversation, inbox: facebook_inbox, account: facebook_channel.account) }
it 'returns false if there are no incoming messages' do
expect(conversation.can_reply?).to eq false
expect(conversation.can_reply?).to eq true
end
it 'return false if last incoming message is outside of 24 hour window' do
@@ -500,7 +500,7 @@ RSpec.describe Conversation, type: :model do
conversation: conversation,
created_at: Time.now - 25.hours
)
expect(conversation.can_reply?).to eq false
expect(conversation.can_reply?).to eq true
end
it 'return true if last incoming message is inside 24 hour window' do

View File

@@ -60,7 +60,9 @@ describe Facebook::SendOnFacebookService do
::Facebook::SendOnFacebookService.new(message: message).perform
expect(bot).to have_received(:deliver).with({
recipient: { id: contact_inbox.source_id },
message: { text: message.content }
message: { text: message.content },
messaging_type: 'MESSAGE_TAG',
tag: 'ACCOUNT_UPDATE'
}, { page_id: facebook_channel.page_id })
expect(bot).to have_received(:deliver).with({
recipient: { id: contact_inbox.source_id },
@@ -71,7 +73,9 @@ describe Facebook::SendOnFacebookService do
url: attachment.file_url
}
}
}
},
messaging_type: 'MESSAGE_TAG',
tag: 'ACCOUNT_UPDATE'
}, { page_id: facebook_channel.page_id })
end
end