I'm happy to help explain the updated process for verifying your number with the WhatsApp Business API on-premises. The process now involves obtaining a registration code and using it to register your phone number. Here’s a simple step-by-step guide:
Step 1: Set Up the WhatsApp Business API Client
Before you begin, ensure that:
WhatsApp Business API Client is Installed: The client should be set up on your on-premises server or environment. This involves installing the necessary Docker containers or binaries as per the installation guide.
Access Credentials: You have your WhatsApp Business API client's access credentials, like the Base URL and access tokens.
Step 2: Request a Registration Code
You need to request a registration code that will be sent to your phone number via SMS or voice call.
How to Request the Code:
API Endpoint: Use the GET /v1/account endpoint with the type=code parameter.
Parameters:
type=code: Specifies that you are requesting a registration code.
method=sms or method=voice: Choose how you want to receive the code.
Example API Call to Request Code via SMS:
bash
curl -X GET 'https://your-whatsapp-api-host:your-port/v1/account?type=code&method=sms' \
-H 'Authorization: Bearer your-auth-token'
Replace your-whatsapp-api-host:your-port with your API host and port.
Replace your-auth-token with your authentication token.
Step 3: Receive the Registration Code
Check Your Phone: You will receive a 6-digit registration code on the phone number you're registering.
Time Limit: The code is typically valid for a limited time (e.g., 5 minutes).
Step 4: Register Your Phone Number Using the Code
Now use the registration code to register your phone number.
How to Register:
API Endpoint: Use the POST /v1/account endpoint.
Request Body:
json
{
"type": "register",
"code": "123456"
}
Replace "123456" with the actual registration code you received.
Success Response: If registration is successful, you'll receive a confirmation response from the API.
Error Handling: If there's an error, the API will return an error message. Common issues include expired codes or incorrect codes.
Additional Notes:
Phone Number Association: Ensure that the phone number you're registering is associated with your WhatsApp Business Account in the Facebook Business Manager.
Permissions: Verify that you have the necessary permissions to manage the phone number.
Time Synchronization: Make sure your server's time is correctly synchronized, as time discrepancies can cause authentication issues.
Network Configuration: Ensure that your server can communicate with WhatsApp servers, and necessary ports are open.
Summary of the Steps:
Install and Set Up the WhatsApp Business API client.
Request the Registration Code via the API.
Receive the Code on your phone number.
Register your phone number by submitting the code via the API.
Confirm that registration was successful.
Troubleshooting Tips:
Invalid Code Error: Double-check the code and ensure it's entered correctly and hasn't expired.
Authentication Errors: Ensure your API calls include the correct authentication tokens and headers.
API Endpoint Errors: Verify that you're using the correct API endpoints and HTTP methods (GET for requesting the code, POST for registering).
Check Logs: Consult the WhatsApp Business API logs on your server for detailed error messages.
Refer to the Official Documentation
For the most accurate and detailed instructions, refer to the official documentation at the link you provided: