Posts tagged with cloud

Can we create Media template with using Resumable Upload API of Meta, if we have the https url of the media

We wanted the create media template using meta cloud api without using resumable upload api.

eg payload : { "category": "MARKETING", "name": "flig_confim", "language": "en", "allow_category_change": true, "components": [ { "type": "BODY", "text": "This is your flight confirmation for {{1}}-{{2}} on {{3}}", "example": { "body_text": [ [ "Delhi", "Banglore", "20th Monday" ] ] } }, { "type": "FOOTER", "text": "To manage the reservation signin to travel portal" }, { "type": "HEADER", "format": "IMAGE", "example": { "header_handle":"4::YX..." } } ] }

Below is the example to create media template with header_handle info got during resumable api. But we wanted to create media tempate without using resumable api, where user will provide the https url of the image/document and we need to create template using that link instead of header_handle

Currently, I am using WhatsApp Business api cloud on one of my web project, I would like to register a customer's phone number but via api instead through meta, developer platform like following:

"Here is the image to register customer's number in the meta developer platform"

I want do this: (managing the phone numbers)

but via api, and later of that send the verification code via api as well. If someone can help me , telling me if that is possible and sharing documentation or the endpoint I would appreciate it very much, I've been looking at the documentation and postman's examples for 2 days without any success.

I'm sorry I didn't share the pictures directly, it is my first question on Stackoverflow

Thanks in advance, Greetings!

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'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.

I'm writing a code to load data from Google Ads api to BigQuery table by using Cloud Functions, the process query a table called ad_group_ad but i'm struggling when trying to validate if there's duplicated rows at my destination.

By reading the docs I was expecting to find some attribute used to identifier a column or a group of columns that represents the table key. May this question seem obviously but i ain't having progress when trying to google this.

Is there a way to identifies if there's is duplicated rows? I'm not using any group by instruction when collecting, just a simple select like the example below:

SELECT     segments.ad_network_type,     campaign.name,     ad_group.name,     ad_group.id,     so     on,     and,     so,     forth FROM ad_group_ad WHERE segments.date = ?