Provision the WhatsApp deployment
Before you begin
Prior to deploying the WhatsApp cluster, you must gather some information from the Settings page on the WhatsApp Business dashboard, including:
WhatsApp Business Account ID
- Navigate to your business settings page and select Accounts > WhatsApp Accounts.
- Select the WhatsApp Business account you are provisioning.
- Your WhatsApp Business Account ID is located at the top of the page, below WhatsApp Business Account Name.
Phone Number
- Navigate to your business settings page and select Accounts > WhatsApp Accounts.
- Select the WhatsApp Business account you are provisioning.
- Under the Settings tab, open WhatsApp Manager > Phone numbers.
- Locate the desired phone number in the list.
Certificate (associated with your phone number)
- Navigate to your business settings page and select Accounts > WhatsApp Accounts.
- Select the WhatsApp Business account you are provisioning.
- Under the Settings tab, open WhatsApp Manager > Phone numbers.
- Locate the desired phone number in the list.
- Click the View button (in the Certificate column).
- Copy the associated certificate to your clipboard and paste it in a separate document. You will need it in a subsequent step.
Create a Vonage Application
A Vonage API application contains the security and configuration information you need to connect to Vonage endpoints and use the Vonage APIs. In this case, you must create an application that uses the Vonage Messages API.
Note: Your WhatsApp account must be connected to your Vonage account before you can link it to a Vonage application. You can connect your WhatsApp account to your Vonage account via the Vonage API Dashboard.
- Both CLI and Dashboard examples are here
Generate your JWT
TIP: You only need to do this step if you are testing with Curl, as the Client and Server SDKs generate JWTs as needed for you.
Once you have created a Vonage API Application you can use the Application ID and the private key file, private.key,
to generate a JWT.
To create a JWT token using the Vonage CLI, use this command
# A command with parameters
vonage jwt create `
--app-id='00000000-0000-0000-0000-000000000000' `
--private-key=./private.key
# Will produce a token
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MzYyODE5NDYsImp0aSI6IjBmZjcwZDNmLTAzN2EtNGY4MC04ODZjLWI3MmM3MmQyMWNmMiIsImlhdCI6MTczNjI4MTA0NiwiYXBwbGljYXRpb25faWQiOiIwMDAwMDAwMC0wMDAwLTAwMDAtMDAwMC0wMDAwMDAwMDAwMDAifQ.gA7jClpqaZ2OoS0iri-zGCbda4jO7C0M8mka0EnSyjlds1EeY8fNoBEx3FTXHfkkzzrj0TskrWc_dcs1wuM8Kx55c5rLQ7taVpDAYopKSc_CeeOaad8S6aWnRkTUTNeduO4aIn-0CbyRTluBYsH1RBqYBQvobuQIDEwbFw8xBgx0UfREMMN6DAWknR57eiVXN9x_oD6CGQJ1yV3025nGboeMsP9YgX4Nwc-rE2r8c1ZGwCLO81x8i19Qil3Nwu5q1nzouyavQjIw00B_TZkushnI1ufdi_GNqk-h5q2HvGkg7Pj9bVkZHFdVTO8im03JYNyJmcV83vnpjOLuCFRzxQ
REM A command with parameters
vonage jwt create ^
--app-id='00000000-0000-0000-0000-000000000000' ^
--private-key=./private.key
REM Will produce a token
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MzYyODE5NDYsImp0aSI6IjBmZjcwZDNmLTAzN2EtNGY4MC04ODZjLWI3MmM3MmQyMWNmMiIsImlhdCI6MTczNjI4MTA0NiwiYXBwbGljYXRpb25faWQiOiIwMDAwMDAwMC0wMDAwLTAwMDAtMDAwMC0wMDAwMDAwMDAwMDAifQ.gA7jClpqaZ2OoS0iri-zGCbda4jO7C0M8mka0EnSyjlds1EeY8fNoBEx3FTXHfkkzzrj0TskrWc_dcs1wuM8Kx55c5rLQ7taVpDAYopKSc_CeeOaad8S6aWnRkTUTNeduO4aIn-0CbyRTluBYsH1RBqYBQvobuQIDEwbFw8xBgx0UfREMMN6DAWknR57eiVXN9x_oD6CGQJ1yV3025nGboeMsP9YgX4Nwc-rE2r8c1ZGwCLO81x8i19Qil3Nwu5q1nzouyavQjIw00B_TZkushnI1ufdi_GNqk-h5q2HvGkg7Pj9bVkZHFdVTO8im03JYNyJmcV83vnpjOLuCFRzxQ
Alternatively, you can use our JWT web app to generate a JWT.
TIP: You can test your generated JWT at jwt.io
Provision WhatsApp Deployment
| Key | Description |
|---|---|
country_code | The international dialing code of the number being provisioned. |
number | The WhatsApp number being provisioned. |
vname_certificate | The certificate, which you can retrieve from your WhatsApp Business dashboard. > NOTE: Each time you click the View button, the certificate will change. Either download or copy your certificate so you can use it in a subsequent step. |
method | The method for delivering the one time password (OTP). Must be either sms or voice. |
waba_id | The WhatsApp Business Account ID of the WhatsApp Number. |
curl -X POST https://api.nexmo.com/v0.1/whatsapp-manager/deployments\
-H "Authorization: Bearer "$JWT\
-H "Content-Type: application/json"\
-d '{
"country_code": "44",
"number": "7877001122",
"vname_certificate": "CnQKMAj669nb79e",
"method": "sms",
"waba_id": "345676589250625"
}'
Once provisioned, the WhatsApp cluster progresses through the following deployment stages: INITIALIZING, CREATING_CLUSTER and CLUSTER_CREATED. When the CLUSTER_CREATED stage is reached an OTP voice call or SMS is sent to the specified number and the deployment status becomes CODE_SENT. When the OTP is received, call the Verify API to complete the process.
Verify OTP
| Key | Description |
|---|---|
code | The one time password being submitted for verification. |
curl -X POST https://api.nexmo.com/v0.1/whatsapp-manager/$DEPLOYMENT_ID/verify\
-H "Authorization: Bearer "$JWT\
-H "Content-Type: application/json"\
-d '{ "code": "$CODE" }'
Now that the WhatsApp cluster has been successfully deployed, you may manage your WhatsApp Business profile.