From 6d168f3c96796456b4603792494c159c286f6a9f Mon Sep 17 00:00:00 2001 From: Tanmay Deep Sharma Date: Wed, 6 May 2026 16:00:04 +0700 Subject: [PATCH] fix(voice): use action: 'connect' for outbound WhatsApp call initiate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Meta's Calls API documents `action: 'connect'` (alongside `pre_accept`, `accept`, `reject`, `terminate`) as the required field on POST /calls for business-initiated calls. The previous body used `type: 'audio'`, which is the /messages media shape — Meta currently accepts it because unknown fields are ignored, but that's an implicit contract that could break the moment validation tightens. --- .../enterprise/whatsapp/providers/whatsapp_cloud_service.rb | 2 +- .../whatsapp/providers/whatsapp_cloud_service_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/enterprise/app/services/enterprise/whatsapp/providers/whatsapp_cloud_service.rb b/enterprise/app/services/enterprise/whatsapp/providers/whatsapp_cloud_service.rb index b21f58494..ec29a5a38 100644 --- a/enterprise/app/services/enterprise/whatsapp/providers/whatsapp_cloud_service.rb +++ b/enterprise/app/services/enterprise/whatsapp/providers/whatsapp_cloud_service.rb @@ -76,7 +76,7 @@ module Enterprise::Whatsapp::Providers::WhatsappCloudService def initiate_call_body(to_phone_number, sdp_offer) { - messaging_product: 'whatsapp', to: to_phone_number, type: 'audio', + messaging_product: 'whatsapp', to: to_phone_number, action: 'connect', session: { sdp: sdp_offer, sdp_type: 'offer' } }.to_json end diff --git a/spec/enterprise/services/enterprise/whatsapp/providers/whatsapp_cloud_service_spec.rb b/spec/enterprise/services/enterprise/whatsapp/providers/whatsapp_cloud_service_spec.rb index 9c90d9ccb..4cbfd27e8 100644 --- a/spec/enterprise/services/enterprise/whatsapp/providers/whatsapp_cloud_service_spec.rb +++ b/spec/enterprise/services/enterprise/whatsapp/providers/whatsapp_cloud_service_spec.rb @@ -40,7 +40,7 @@ describe Whatsapp::Providers::WhatsappCloudService do describe '#initiate_call' do it 'returns the parsed body on success' do stub_request(:post, calls_url) - .with(body: { messaging_product: 'whatsapp', to: '15551234567', type: 'audio', + .with(body: { messaging_product: 'whatsapp', to: '15551234567', action: 'connect', session: { sdp: 'sdp_offer', sdp_type: 'offer' } }.to_json) .to_return(status: 200, body: { messages: [{ id: 'wacall_1' }] }.to_json, headers: headers)