Posts under category Facebook WhatsApp Business API

I've setup a WhatsApp Business to test their new WhatsApp API for sending messages. I've followed the getting started guide, but I'm running into an issue when trying to send a test message to my phone.

I tested sending messages using the test message call in the business settings as shown in the guide and I've created my own /messages call in Postman using a permanent token. Both calls return a 200 status, but neither of them actually sends a message to my phone.

To double check my setup, I added a colleagues phone to the setup and he receives the messages and can interact with my webhook via WhatsApp just fine.

Some posts on Stackoverflow mention having to send a message to the test number first, but I was unable to get this to work and my colleague didn't have to do this.

Is there some kind of setting or issue that could explain why I'm not receiving the messages? I've even tried re-installing WhatsApp and setting up my phonenumber again, but that didn't change anything either.


Updates:

I tried validating my phonenumber via the /contacts endpoint, but it keeps returning an auth error. Updating my token to include all Whatsapp permissions did not change this, whatsapp_business_api_data isn't an option to include.

{ "error": {     "message": "(#100) The parameter whatsapp_business_api_data is required.",     "type": "OAuthException",     "code": 100,     "fbtrace_id": "" } } 

I noticed that my webhook included a status object in change.value.statuses.[0] this mentioned the following:

{ status: 'failed', errors: [{  code: 131000, title: 'Failure due to an internal error. Please retry.' }]} 

Next I created a new app and added the Whatsapp integration, I added and validated my phonenumber via a text and tried to send a test messsage. This also doesn't start a conversation nor does it give me any feedback. If I try to add my phonenumber again, by adding it as another number, I cant and get the error Reason: VERIFIED

I'm using the following lines of code (PHP) after successfuly retriving the media URL and then storing it in the $mediaURL variable for the file request, but it's returning an empty string. Already tried with postman and it returns a 500 internal server error...

** Edited **

self::writeLog('Media URL: '.$mediaURL); self::writeLog('Preparing to download media - id: '.$media_id); $curl = curl_init($mediaURL); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $headers = array(     "Authorization: Bearer ".self::$auth_token, ); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); if (($resp = curl_exec($curl)) === false) {     self::writeLog('cURL Error: '.curl_error($curl)); } else if ($resp == '') {     self::writeLog('Empty string.');     self::writeLog('URL: '.$mediaURL);     self::writeLog('Headers: '.$headers[0]); } else {     self::writeLog($resp); }              
  • writeLog is just a method that I use to write these messages on a txt file.

Hi I want to use WhatsApp business API in my web application. I have tested it in postman.

Whenever run sample curl code when available in Facebook business page under WhatsApp tab, It run successfully with temporary access token and message delivered to recipient with Facebook saved template. But when I send only text message to recipient then API response become success with message Id but message not yet deliver to recipient.

My curl code sample given bellow

curl --location --request POST 'https://graph.facebook.com/v13.0/106433498743301/messages' \ --header 'Authorization: Bearer EAAOw8oNtvXkBAKk89CqJtyusjxk7c7qGSNS0quxqeZBRtjE5MYwZCK0USeGGLV4n56qNAuaRoRWZA2oCIS8zcz6U5UZAtQCOb6YQnjuXZBfLnyZAwsOZBpASpnNOvvz29T0Jn0aXgZAdo9VKmBv0CkNYuOeb1I7X0GZCEwLHPZBFpfOCj4K3S9CMPjBfYR5Jog06LC95P7UgCr5Fy2nqbRM5Ys' \ --header 'Content-Type: application/json' \ --data-raw '{ "messaging_product": "whatsapp", "preview_url": false, "recipient_type": "individual", "to": "xxxxxxx150", "type": "text", "text": { "body": "Test message" } }' 

I'm trying to upload an image as profile picture using WhatsApp Cloud API *.

After creating an application using WhatsApp Cloud API I'm not allowed to access neither using the regular application nor using Business Application. It says something like "try again in one hour". So I have to implement everything using the API.

After reading the docs and importing Postman Endpoints I found the one called Business Profiles > Update Business Profile

https://graph.facebook.com/{{Version}}/{{Phone-Number-ID}}/whatsapp_business_profile

It has a field "profile_picture_url"and I have tried POSTing media https://graph.facebook.com/{{Version}}/{{Phone-Number-ID}}/media and then with the given ID y used https://graph.facebook.com/{{Version}}/{{Media-ID}} to get the URL but it didn't work. The rest of the information is updated successfully

{     "messaging_product": "whatsapp",     "address": "",     "description": "Simple Bot",     "email": "...@gmail.com",     "websites": [         "https://..."     ],     "profile_picture_url": "https://lookaside.fbsbx.com/..." } 

However if I try to send someone using the ID and the endpoint https://graph.facebook.com/{{Version}}/{{Phone-Number-ID}}/messages it works fine. And if I use Download Media Content with the URL in Postman it works fine too.

I don't know if I have misunderstood something or if it can't be done using the API.

Iam trying to use gupshup whatsapp business api through template.

My template expects a link url for the attachment therefore iam building an url through buffer in nodejs and having given response type for the link url as this.

       statusCode: 200,        headers: {            "content-type": "application/pdf",            'content-disposition': 'inline; filename=suresign.pdf',            'Accept-Ranges': 'bytes',            'Content-Length': buffer.length,        },        body: buffer.toString('base64'),        isBase64Encoded: true    }``` Iam able to generate message id ```{"messageId":"8427c6aa-8140-4d79-a835-ba8f44f6c867","status":"submitted"}``` but in gupshup callback response im getting error as this ```{    "app": "SureCredsLIVE",    "timestamp": 1654016941604,    "version": 2,    "type": "message-event",    "payload": {        "id": "8427c6aa-8140-4d79-a835-ba8f44f6c867",        "type": "failed",        "destination": "918553220750",        "payload": {            "code": 1011,            "reason": "Invalid Media Size"        }    } }```