Posts under category Meta & Facebook

I am testing the Single Product Message API endpoint in Whatsapp-Business Cloud.

It is working for some of the products in the catalogue, but for some other products in the same catalogue giving error as 'product not found for product_retailer_id, XX, in catalog_id, XXXXXXXXX'

I can't see any Issue / Policy violations for those products.

This is the Sample Request Payload

{     "messaging_product": "whatsapp",     "recipient_type": "individual",     "to": "XXXX",     "type": "interactive",     "interactive": {         "type": "product",         "body": {             "text": "Hello 111111"         },         "footer": {             "text": "Hello1 1111111"         },         "action": {             "catalog_id": "XXXX",             "product_retailer_id": "XX"         }     }  } 

can you please help me to resolve this issue

I am attempting to use the Meta WhatsApp business API found here: https://developers.facebook.com/docs/whatsapp/cloud-api/overview

Everything has been setup correctly as far as I can tell as I am able to send template messages with my ACCESS_TOKEN and my FROM_PHONE_NUMBER_ID to my mobile using the below:

curl -i -X POST \   https://graph.facebook.com/v14.0/FROM_PHONE_NUMBER_ID/messages \   -H 'Authorization: Bearer ACCESS_TOKEN' \   -H 'Content-Type: application/json' \   -d '{ "messaging_product": "whatsapp", "to": "MY_MOBILE", "type": "template", "template": { "name": "hello_world", "language": { "code": "en_US" } } }' 

I would now like to send a free form text message by using the example given on the above link. The example is:

curl -X POST \   'https://graph.facebook.com/v14.0/FROM_PHONE_NUMBER_ID/messages' \   -H "Authorization: ACCESS_TOKEN" \   -d '{     "messaging_product": "whatsapp",     "to": "1650XXXXXXX",     "text": {"body" : "hi"}    }' 

I use:

curl -X POST \   'https://graph.facebook.com/v14.0/MY_FROM_PHONE_NUMBER_ID/messages' \   -H "Authorization: ACCESS_TOKEN" \   -d '{     "messaging_product": "whatsapp",     "to": "MY_MOBILE",     "text": {"body" : "hi"}    }' 

This returns a valid message id with no errors however the message is never received.

Some confusing points to note: Why is there no 'Bearer' directive in the ACCESS_TOKEN, it is required for the template call. ( I have tried with and without )? Why does the example show 1650XXXXXX as the mobile number, surely it's just an example but why put the 1650 there in the first place!!! ?

To download an image received from the webhook, first, I retrieve the URL with the call to the media endpoint, I execute a curl call to

https://graph.facebook.com/v14.0/xxxxxxxxxxxxxx 

where xxxxxxxxxxxxxx is the media id.

The code I use to do that is:

$token = 'sdfsfsdfd'; $curl = curl_init(); curl_setopt_array($curl, array(   CURLOPT_URL => 'https://graph.facebook.com/v14.0/xxxxx',   CURLOPT_RETURNTRANSFER => true,   CURLOPT_ENCODING => '',   CURLOPT_MAXREDIRS => 10,   CURLOPT_TIMEOUT => 0,   CURLOPT_FOLLOWLOCATION => true,   CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,   CURLOPT_CUSTOMREQUEST => 'GET',   CURLOPT_HTTPHEADER => array(     'Authorization: Bearer '.$token,     'Content-Type: application/json'   ), ));   $response = curl_exec($curl); curl_close($curl); echo $response."<hr>"; $dati = json_decode($response); 

and the $response is:

(     [url] => https://lookaside.fbsbx.com/whatsapp_business/attachments/?mid=790316572396xxx&ext=1659596318&hash=ATuHn61BbJOBYzugyRcP6O6UnyY2NSVh3Bb8v12OS3OCzQ     [mime_type] => image/jpeg     [sha256] => 1cf4a54f0d86c6603d10ad2e9836bc5a98edfabab4b5b8120822be59cbdcxxx0     [file_size] => 253685     [id] => xxxxx     [messaging_product] => whatsapp ) 

After this, I make a new curl call to the obtained URL

$curl = curl_init(); curl_setopt_array($curl, array(   CURLOPT_URL => $dati->url,   CURLOPT_RETURNTRANSFER => true,   CURLOPT_ENCODING => '',   CURLOPT_MAXREDIRS => 10,   CURLOPT_TIMEOUT => 0,   CURLOPT_FOLLOWLOCATION => true,   CURLOPT_USERAGENT => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36',   CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,   CURLOPT_CUSTOMREQUEST => 'GET',   CURLOPT_HTTPHEADER => array(     'Authorization: Bearer '.$token        ), )); $response = curl_exec($curl); if(curl_errno($curl)){     throw new Exception(curl_error($curl)); } $getstatusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); if($getstatusCode == 200){          echo 'Downloaded!<hr>';              echo $response;      } else{          echo "Status Code: " . $getstatusCode;      } 

But the $response obtained is the "something went wrong".

I would have expected a binary blob instead.

Where did I go wrong?

Please note, this issue is in Whatsapp Cloud API not the business API.