La API de instalaciones locales dejará de estar disponible. Consulta nuestro documento Fin de la API de instalaciones locales para conocer los detalles y descubrir cómo migrar a nuestra nueva generación de API de la nube.
This document shows you how to deploy the WhatsApp Business Platform API on Microsoft Azure.
Before you start you will need to:
{ "cloudName": "AzureCloud", "homeTenantId": "home-Tenant-Id", "id": "Subscription-Id", "isDefault": true, "managedByTenants": [], "name": "Subscription-Name", "state": "Enabled", "tenantId": "Tenant-Id", "user": { "name": "your-username@domain.com", "type": "user" } }
map_db_class
variable in variables.tf. For instance, if you configure the throughput value to be 120
, it should map to the DB machine type Standard_E8as_v4
. innodb_buffer_pool_size
, innodb_buffer_pool_instances
, query_cache_size
values in the scripts/my.cnf file. For instance, if you configure the throughput value to be 120
, its DB machine type is Standard_E8as_v4
, then you should comment out the default settings (based on Standard_E8as_v4
) and uncomment the settings for Standard_E8as_v4
as shown in the following script code:
# current value is based on Standard_E16as_v4 (16vCPU,128GB) # innodb_buffer_pool_size = 103079215104 # innodb_buffer_pool_instances = 32 # query_cache_size = 8589934592 # Standard_E8as_v4 (8vCPU,64GB) innodb_buffer_pool_size = 51539607552 innodb_buffer_pool_instances = 16 query_cache_size = 4294967296
~/biz/azure
, run terraform init
to install external dependencies required by the template. Optionally, you can also run terraform validate
to validate if the template syntax is correct.terraform plan
to generate a plan and check if all required variables are properly set. Make sure there is no error shown in this step.terraform apply
and you need to approve the deployment by typing yes
upon prompt. Alternatively, you could run terraform apply -auto-approve
to skip interactive approval of the plan before applying.
Do you want to perform these actions? Terraform will perform the actions described above. Only 'yes' will be accepted to approve. Enter a value: yes
Parameter Name | Description |
---|---|
| Required. Specifies the name of the cluster. Notes:
Default: |
| Required. Specifies Azure regions to deploy the cluster in. List of all values can be found in terraform-azurerm-regions/REGIONS.md at master · claranet/terraform-azurerm-regions (github.com). Default: |
| Required. Specifies the owner user of the cluster. Notes:
Default: |
| Required. Specifies the SSH public key used to authenticate to compute machines created in the cluster. Follow the Get Started section on instructions to create an SSH key pair. |
Name | Description |
---|---|
| Required. Options: Specifies the number of messages to send per second. Together with the |
| Required. Options: Specifies the dominant message type to send. Together with the |
Name | Description |
---|---|
| Required. Specifies the version of the WhatsApp Business Platform On-Premises API. We recommend you use the latest stable version. For more information relating to the latest stable version, see the changelog. Default: |
| Required. Specifies the WhatsApp Business API Username. Default: |
| Required. Specifies the WhatsApp Business API Password. This should be the new password after you change the default password at your first login. |
Name | Description |
---|---|
| Required. Specifies the database admin user name. Default: |
| Required. Specifies the database admin user password. |
| Optional. Specifies the client certificate for the database connection. For more information on database communication security, see Security - WhatsApp Business Platform On-Premises API. Default: |
| Optional. Specifies the CA certificate for database connection. For more information on database communication security, see Security - WhatsApp Business Platform On-Premises API. Default: |
Name | Description |
---|---|
| Required. Specifies the password that is used as the login password for the Grafana dashboard when the stack is created. |
| Optional. Indicates whether SMTP is enabled for setting up email alerts. Valid values: Default: |
| Optional. Specifies the SMTP host used in email alerts. For instance, |
| Optional. Specifies the SMTP username used for email alerts. |
| Optional. Specifies the SMTP password used for email alerts. |
Upon successful creation of stack, the following parameters are displayed:
web_server_name
: The host name to access the WA Business API endpoints. The API endpoint root URL can be accessed through https://<web_server_name>
.monitor_server_name
: The host name to access the Grafana dashboard. The Grafana dashboard can be accessed through http://<monitor_server_name>:3000
.number_of_shards
: Number of shards to configure for the WhatsApp Business API.After the WhatsApp Business Platform API client is successfully deployed, it needs to be configured to bring it into operation.
For more in-depth information about phone number registration, see Phone Number guide.
Download the base64-encoded certificate from your WhatsApp account in the Facebook Business Manager under the Phone Numbers tab of the WhatsApp Manager. Once you have the correct phone number selected and have the base64-encoded certificate, you need to register the WhatsApp Business API client through the account node. For more information, see the Registration documentation.
If the phone number is capable of receiving text messages, use the SMS method for registration code retrieval. If you have already received the registration code from WhatsApp, you can skip this step.
You need to use the shards
endpoint to increase the number of active Coreapp instances to achieve the desired throughput. The number of shards can be found in the Output section of the stack.
The configuration of WhatsApp Business Platform API web callbacks and other parameters is described in the Application Settings documentation. To achieve stable throughput, the following application settings are recommended.
{ "settings": { "application": { "callback_backoff_delay_ms": 3000, "callback_persist": true, "db_garbagecollector_enable": false, # change this to true when there are no ongoing messaging campaigns "heartbeat_interval": 5, "max_callback_backoff_delay_ms": 900000, "media": { "auto_download": [ "document", "image", "video", "voice", "sticker", "audio" ] }, "notify_user_change_number": true, "pass_through": false, "sent_status": true, "show_security_notifications": false, "skip_referral_media_download": false, "unhealthy_interval": 30, "wa_id": "12245552741", "webhooks": { "max_concurrent_requests": 24, "message": { "delivered": true, "read": true, "sent": true }, "url": "<YOUR_WEBHOOK_SERVER_URL>" } } }, "meta": { "api_status": "stable", "version": "2.41.3" } }
You will need to restart all CoreApp
pods after configuring the highlighted parameters above for them to take effect. You can do this, use the following command:
kubectl rollout restart deployment coreapp
Wait until all CoreApp
pods are back in RUNNING status.
Once the configuration and registration steps are successful, a message can be sent and received to validate the basic functionality of WhatsApp Business API client. For more information, see Messages.
Upon successful receipt of a message, the WhatsApp Business API client will POST the message status/details to the Webhook configured in Step 3.
If your message was successfully received, you have successfully completed the configuration set up. For more information on the available API endpoints, see the Reference documentation.
If you need to upgrade to a newer API version or update the template with any adjusted parameters, follow these steps:
variable "api-version" { default = "v2.43.1" }
terraform apply
and all changes are automatically updated.You can use terraform destroy
to destroy all resources created by the Terraform plan. At the prompt, enter yes
.
Do you really want to destroy all resources? Terraform will destroy all your managed infrastructure, as shown above. There is no undo. Only 'yes' will be accepted to confirm. Enter a value: yes
All resources and data stored in any resource will be destroyed. You cannot undo this action. Ensure that you have backed up any data you want to preserve before you destroy resources.
Terraform preserves already-deployed services even if the plan fails halfway. After you make a change in the same plan, run terraform apply
to resume from the failed resources.
rg-<name_prefix>-<owner>
aks-<name_prefix>-<owner>-xxxx
kubectl commands
to manage the cluster. For instance:
kubectl get pod
kubectl logs <pod_name>
kubectl logs <pod_name> -c <container_name>
Reason for Error: This error is generated because your Azure subscription does not allow multiple network watchers to be created. This error is thrown when you already have a network watcher in your Azure subscription.
Mitigation:
# resource "azurerm_network_watcher" "waNet" { # name = "production-nwwatcher" # location = azurerm_resource_group.waNet.location # resource_group_name = azurerm_resource_group.waNet.name # }
terraform apply
.Reason: This is a known issue and further work is required to fix this.
Mitigation: You can check machine specific metrics from the Azure portal instead. To check CoreApp / Web / DB machine metrics:
rg-<name_prefix>-<owner>-xxxx-aks-node
aks-coreapp-xxx-vmss
and switch to the Monitoring tab.
aks-db-xxx-vmss
.
To check media file share metrics:
rg-<name_prefix>-<owner>-xxxx-aks-node