feat: Add message support for input_select type in Facebook (#11627)

This commit is contained in:
mix5003
2025-06-10 17:45:11 +07:00
committed by GitHub
parent cf1d0de294
commit c710cbe370
2 changed files with 46 additions and 1 deletions

View File

@@ -166,5 +166,33 @@ describe Facebook::SendOnFacebookService do
expect(message.status).not_to eq('failed')
end
end
context 'with input_select' do
it 'if message with input_select is sent from chatwoot and is outgoing' do
message = build(
:message,
message_type: 'outgoing',
inbox: facebook_inbox,
account: account,
conversation: conversation,
content_type: 'input_select',
content_attributes: { 'items' => [{ 'title' => 'text 1', 'value' => 'value 1' }, { 'title' => 'text 2', 'value' => 'value 2' }] }
)
described_class.new(message: message).perform
expect(bot).to have_received(:deliver).with({
recipient: { id: contact_inbox.source_id },
message: {
text: message.content,
quick_replies: [
{ content_type: 'text', payload: 'text 1', title: 'text 1' },
{ content_type: 'text', payload: 'text 2', title: 'text 2' }
]
},
messaging_type: 'MESSAGE_TAG',
tag: 'ACCOUNT_UPDATE'
}, { page_id: facebook_channel.page_id })
end
end
end
end