diff --git a/app/services/whatsapp/providers/whatsapp_cloud_service.rb b/app/services/whatsapp/providers/whatsapp_cloud_service.rb index 8ca1a9672..04ddc8f02 100644 --- a/app/services/whatsapp/providers/whatsapp_cloud_service.rb +++ b/app/services/whatsapp/providers/whatsapp_cloud_service.rb @@ -37,18 +37,22 @@ class Whatsapp::Providers::WhatsappCloudService < Whatsapp::Providers::BaseServi end def media_url(media_id) - "https://graph.facebook.com/v13.0/#{media_id}" + "#{api_base_path}/v13.0/#{media_id}" end private + def api_base_path + ENV.fetch('WHATSAPP_CLOUD_BASE_URL', 'https://graph.facebook.com') + end + # TODO: See if we can unify the API versions and for both paths and make it consistent with out facebook app API versions def phone_id_path - "https://graph.facebook.com/v13.0/#{whatsapp_channel.provider_config['phone_number_id']}" + "#{api_base_path}/v13.0/#{whatsapp_channel.provider_config['phone_number_id']}" end def business_account_path - "https://graph.facebook.com/v14.0/#{whatsapp_channel.provider_config['business_account_id']}" + "#{api_base_path}/v14.0/#{whatsapp_channel.provider_config['business_account_id']}" end def send_text_message(phone_number, message)