diff --git a/app/adapters/whats_app_adapter/three_sixty_dialog_inbound.rb b/app/adapters/whats_app_adapter/three_sixty_dialog_inbound.rb index 5326edabd..716a6f7ad 100644 --- a/app/adapters/whats_app_adapter/three_sixty_dialog_inbound.rb +++ b/app/adapters/whats_app_adapter/three_sixty_dialog_inbound.rb @@ -8,7 +8,7 @@ class ThreeSixtyDialogInbound REQUEST_TO_RECEIVE_MESSAGE = :request_to_receive_message UNSUBSCRIBE_CONTRIBUTOR = :unsubscribe_contributor RESUBSCRIBE_CONTRIBUTOR = :resubscribe_contributor - UNSUPPORTED_CONTENT_TYPES = %w[location contacts application].freeze + UNSUPPORTED_CONTENT_TYPES = %w[location contacts application sticker].freeze attr_reader :sender, :text, :message, :organization diff --git a/app/controllers/whats_app/three_sixty_dialog_webhook_controller.rb b/app/controllers/whats_app/three_sixty_dialog_webhook_controller.rb index bdd337d38..ce3cc2b84 100644 --- a/app/controllers/whats_app/three_sixty_dialog_webhook_controller.rb +++ b/app/controllers/whats_app/three_sixty_dialog_webhook_controller.rb @@ -45,6 +45,7 @@ def message_params { contacts: [{ org: {} }, { addresses: [] }, { emails: [] }, { ims: [] }, { phones: %i[phone type wa_id] }, { urls: [] }, { name: %i[first_name formatted_name last_name] }] }, + { sticker: %i[id mime_type sha256 animated] }, { context: %i[from id] }], statuses: [:id, :status, :timestamp, :expiration_timestamp, :recipient_id, { conversation: [:id, { origin: [:type] }] }, diff --git a/spec/adapters/whats_app_adapter/three_sixty_dialog_inbound_spec.rb b/spec/adapters/whats_app_adapter/three_sixty_dialog_inbound_spec.rb index 3e2b58315..5d9ddbea2 100644 --- a/spec/adapters/whats_app_adapter/three_sixty_dialog_inbound_spec.rb +++ b/spec/adapters/whats_app_adapter/three_sixty_dialog_inbound_spec.rb @@ -475,6 +475,26 @@ it { should have_received(:call).with(contributor) } end + + context 'sticker' do + let(:sticker) do + { + mime_type: 'image/webp', + sha256: 'sha256_hash', + id: 'some_valid_id', + animated: false + } + end + + before do + message[:type] = 'sticker' + message[:sticker] = sticker + end + + it 'triggers the unsupported content callback' do + expect(subject).to have_received(:call).with(contributor) + end + end end end diff --git a/spec/jobs/whats_app_adapter/three_sixty_dialog/process_webhook_job_spec.rb b/spec/jobs/whats_app_adapter/three_sixty_dialog/process_webhook_job_spec.rb index 0ce097ee5..085979007 100644 --- a/spec/jobs/whats_app_adapter/three_sixty_dialog/process_webhook_job_spec.rb +++ b/spec/jobs/whats_app_adapter/three_sixty_dialog/process_webhook_job_spec.rb @@ -450,6 +450,26 @@ expect { subject.call }.to have_enqueued_job(WhatsAppAdapter::ThreeSixtyDialogOutbound::Text).with(text_payload) end end + + context 'stickers' do + let(:sticker) do + { + mime_type: 'image/webp', + sha256: 'sha256_hash', + id: 'some_valid_id', + animated: false + } + end + + before do + message[:type] = 'sticker' + message[:sticker] = sticker + end + + it 'sends a message to contributor to let them know the message type is not supported' do + expect { subject.call }.to have_enqueued_job(WhatsAppAdapter::ThreeSixtyDialogOutbound::Text).with(text_payload) + end + end end end end