feat: Ability to customize the base url for Whatsapp Cloud Service (#6622)
Configure a custom endpoint for Whatsapp Cloud Service via `WHATSAPP_CLOUD_BASE_URL`. refs: #5142
This commit is contained in:
committed by
GitHub
parent
0fe05dc1b9
commit
eb4da33cdc
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user