diff --git a/app/services/whatsapp/providers/whatsapp_cloud_service.rb b/app/services/whatsapp/providers/whatsapp_cloud_service.rb index 00f7446a1..8844606f8 100644 --- a/app/services/whatsapp/providers/whatsapp_cloud_service.rb +++ b/app/services/whatsapp/providers/whatsapp_cloud_service.rb @@ -156,7 +156,7 @@ class Whatsapp::Providers::WhatsappCloudService < Whatsapp::Providers::BaseServi process_response(response, message) end - def send_attachment_message(phone_number, message) # rubocop:disable Metrics/MethodLength + def send_attachment_message(phone_number, message) attachment = message.attachments.first type = %w[image audio video].include?(attachment.file_type) ? attachment.file_type : 'document' type_content = { @@ -164,7 +164,8 @@ class Whatsapp::Providers::WhatsappCloudService < Whatsapp::Providers::BaseServi } type_content['caption'] = message.outgoing_content unless %w[audio sticker].include?(type) type_content['filename'] = attachment.file.filename if type == 'document' - type_content['voice'] = true if type == 'audio' && attachment.meta&.dig('is_recorded_audio') + # FIXME: This requires transcoding to opus/ogg. + # type_content['voice'] = true if type == 'audio' && attachment.meta&.dig('is_recorded_audio') response = HTTParty.post( "#{phone_id_path('v24.0')}/messages", headers: api_headers,