Posts under category Facebook WhatsApp Business API

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.

I have read the document regarding payments and also raised the customer support ticket in Meta for Developers(Developer Support) and find the relevant question but I didn't get the proper solution on how to add Indian Payment Method.

Does anyone know anything about adding payment method in India? Any help would be appreciated.

I'm trying to send a POST request to edit a template message of WhatsApp:

POST /{whatsapp_template_id}    {   "name": "my_template",   "language": "en_US",   "category": "transactional",   "components": [     {       "type": "BODY",       "text": "whatsapp buddy?"     }   ] } 

Receiving (#3) Application does not have the capability to make this API call.

I am planning to use whatsapp cloud API but I see each country has different rate cards: https://developers.facebook.com/docs/whatsapp/pricing/ If I have application in which registered user can be in USA or UK or India etc and can send messages to users belonging to different countries in that case how to handle pricing implementation on backend?

Is it ok if I calculate the cost based on analytics endpoint: https://developers.facebook.com/docs/whatsapp/business-management-api/analytics this endpoint includes cost as well for each registered phone number. In that case I can easily calculate monthly cost occurring with start and end date in query params. Is there any other solution or can this be improved?