How to register phone number in new Whatsapp Cloud API?
I'm in process of registering phone number to be used with Whatsapp API, when I try to generate access token for my phone number, I'm greeted with this alert.
There was a problem registering (my phone number). Unsupported post request. Object with ID '(phone_number_id)' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api
There also this message that tells me the phone number needs to be registered.
When I attempt to follow the link, it brings me to this page, it has instruction to follow and "certificate".
The these instruction link lead to documentation on how to register the phone number, however the top of documentation clearly state that this instruction no longer valid as of now because it is using on premise API. So I tried to find the one valid for cloud API, I found this documentation → https://developers.facebook.com/docs/whatsapp/cloud-api/reference/registration/
The documentation offers a way to register the phone number through API, below is the snippets I copied from the documentation.
curl 'https://graph.facebook.com/v21.0/106540352242922/register ' \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer EAAJB...' \ -d ' { "messaging_product": "whatsapp", "pin": "212834" }
The question is how do I get phone number ID if my phone number is not "registered" to begin with ? I tried to retrieve the phone number ID by following the link here → https://developers.facebook.com/docs/whatsapp/business-management-api/manage-phone-numbers#get-all-phone-numbers, but it only list the test phone number, my phone number does not appear.
{ "data": [ { "verified_name": "Test Number", "code_verification_status": "NOT_VERIFIED", "display_phone_number": "+1 555-131-8955", "quality_rating": "GREEN", "platform_type": "CLOUD_API", "throughput": { "level": "STANDARD" }, "id": "375420581369195" } ], "paging": { "cursors": { "before": "xxxx", "after": "xxxx" } } }
I created an account just to share the solution to this issue, as we spent two days figuring it out.
This worked as of today:
Go to your Business Portfolio > Accounts > Apps and click Open in App Dashboard. This will take you to the Meta Developer Console.
Navigate to WhatsApp > API Setup. Under the “From” section, you’ll see the phone number you added, and just below it, the “Phone Number ID.”
Now make a POST request to: https://graph.facebook.com/v21.0/<phone_number_id>/register
with the following JSON body:
{ "messaging_product": "whatsapp", "certificate": "cert", "pin": "xxxxxx" }Replace xxxxxx with your 2FA. Make sure you've set up 2FA for your account, as it’s required for this step.
If everything is set up correctly, the expected response will be:
{ "success": true }This worked for me with API version 21.0.
I can't get it to work with your instructions. I had responded with screenshots but they deleted my response. Could you tell us what token you used?
@NachoBadia by tokken what token will you referring to? The certificate is what is used as parameters in registering an whatsapp business api account. ALthough there is no documnetation found to support this method of registeration on the whatsapp cloud api
To proceed, you need to create a permanent token for an admin system user. 1. Navigate to Business Portfolio > Users > System Users. 2. Create an admin user and assign The App and the WhatsApp account with full control. 3. Click Generate Token to create the permanent token. This token will be used as a Bearer token by adding the following header to your requests: Authorization: Bearer Additionally, ensure that you replace "cert" in the request body with the certificate found under Phone Numbers > Certificate.
Thanks! The problem was the token, I didn't have the application permissions assigned.
How can i get this 2FA authenication pin ?
Seems like meta are having some problem. Same happened here. But our team manage to at least send messages completing this register with:
POST https://graph.facebook.com/v20.0/[phone-number-id]/register
{ "messaging_product": "whatsapp", "pin": "000000", "data_localization_region": "you_country_code" }You can set any pin if you don't have one. v21 seems like this won't work.
How to get the phone number ID though ? When I try that command, I get this return: There was a problem registering (my phone number). Unsupported post request. Object with ID '(phone_number_id)' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api
Hi Liso, where you able to find a way arounf this as I went ahead to delete the number from whatsapp manager
@Torch Not yet, I still can't add my number to meta
So I reached out to Meta via their business chat and I open a case and appealed once agian. I am waiting for feedback
@Torch is there any follow up from them ? I still can't add phone number, it's insane meta has made this process so difficult.
You can find your phone id by selecting the phone in your application
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
Not sure if relevant now, but phone number ID can be found on Meta Developer Account, when you click on your application -> Whatsapp -> API Setup.
On Step 1 you will see your numbers, including your phone number ID and business account ID: screenshot