Posts under category Meta & Facebook

curl -G \   -d "fields=campaign_name,adset_id,adset_name,impressions,clicks,cpc,spend,date_start,date_stop" \   -d "time_range={'since':'2023-07-01','until':'2023-09-30'}" \   -d "access_token=${FACEBOOK_ACCESS_TOKEN}" \   https://graph.facebook.com/v21.0/act_"$FACEBOOK_ACCOUNT_ID"/insights 

Returns

{   "data": [     {       "impressions": "*******",       "clicks": "*****",       "cpc": "*****",       "spend": "**********",       "date_start": "2023-09-25",       "date_stop": "2023-09-30"     }   ],   "paging": {     "cursors": {       "before": "****",       "after": "****"     }   } } 

Why is it not returning the other fields like campaign_name, adset_id etc?? I'm getting the field names from here: https://github.com/facebook/facebook-php-business-sdk/blob/7ec7292c1ce3c78e2005d730da0092e28458af95/src/FacebookAds/Object/Fields/AdsInsightsFields.php#L46

If I make this call to get campaign data from the Graph API:

const url = `https://graph.facebook.com/v19.0/${account}/insights?time_increment=30&time_range={since:'2024-01-01',until:'2024-01-30'}&level=campaign&fields=campaign_id,campaign_name,frequency,spend,reach,impressions,objective,optimization_goal,clicks,actions&action_breakdowns=action_type&access_token=${token}`;  

I get 219,189 as the total reach. However, if I make the same call, changing only time_increment=7

const url = `https://graph.facebook.com/v19.0/${account}/insights?time_increment=7&time_range={since:'2024-01-01',until:'2024-01-30'}&level=campaign&fields=campaign_id,campaign_name,frequency,spend,reach,impressions,objective,optimization_goal,clicks,actions&action_breakdowns=action_type&access_token=${token}`; 

I get 287,141 as the total reach. If, finally, I change time_increment=1

const url = `https://graph.facebook.com/v19.0/${account}/insights?time_increment=1&time_range={since:'2024-01-01',until:'2024-01-30'}&level=campaign&fields=campaign_id,campaign_name,frequency,spend,reach,impressions,objective,optimization_goal,clicks,actions&action_breakdowns=action_type&access_token=${token}`;      

I get 391,900 as total reach. As we can see, these are very inconsistent figures. What could be the cause of this Thanks in advance!

Technical detail: I'm calling the data via the GET REST API method >> const data = await fetch(url). I'm not using an SDK.

I expect to recieve the same reach figure, independently of the time_increment parameter.

I want to create a catalog programmatically, without using commerce manager. I am using this end point but I keep getting this error message": "Unsupported post request. Object with ID does not exist, cannot be loaded due to missing permissionss.. These are my permissions: catalog_management, ads_management, business_management, whatsapp_business_management, commerce_account_read_settings, commerce_account_manage_orders, commerce_account_read_orders, whatsapp_business_messaging and I can see my owned catalogs by using this same business id but cannot create one. Am I missing something here?

I am using the Instagram API with Facebook Login. Apparently, it happens on any account, but i attach an example of a certain account.
On the account attached below, we have the necessary permissions and subscribed webhook events. Account: https://www.instagram.com/iammetridavid/
When I publish a story from the Instagram plaftorm, works properly. However, when i publish a story vía API, the webhook does not respond after 24 hours of being published.
I attach a story id published vía API on this account: 18043511027052706
What could be happening?
Regards, David.

I am integrating the WhatsApp Business API into my website, and everything works fine during the creation of a template. However, I am encountering an issue when updating a carousel template that contains media (image) in the header.

**Here’s the data I provide during template creation, and it works perfectly: **

{     "category": "MARKETING",     "components": [         {             "type": "BODY",             "text": "Enter the text for your message in the language that you've selected."         },         {             "type": "HEADER",             "format": "IMAGE",             "example": {                 "header_handle": [                     "https://scontent.whatsapp.net/v/t61.29466-34/455307745_840177258275973_4917068164528515056_n.jpg?ccb=1-7&_nc_sid=8b1bef&_nc_ohc=JhgXpTB6hb8Q7kNvgGo4C8z&_nc_ht=scontent.whatsapp.net&edm=AH51TzQEAAAA&_nc_gid=AYrC8T5SS1pa7iuvimhJfWi&oh=01_Q5AaIDQYeMKQIW57cK89ejtgUrwADCGDyq30TZQusIPOCDmo&oe=672C6BF5"                 ]             }         }     ] } 

However, when I try to update a carousel template with similar image data, I receive the following error:

This carousel template contains a card (index=0) with an invalid media sample.

Here’s the data I send during the update, which throws the error:

{     "category": "MARKETING",     "components": [         {             "type": "BODY",             "text": "12324"         },         {             "type": "CAROUSEL",             "cards": [                 {                     "components": [                         {                             "type": "HEADER",                             "format": "IMAGE",                             "example": {                                 "header_handle": [                                     "https://scontent.whatsapp.net/v/t61.29466-34/421261359_838328285127784_2325180770850864310_n.jpg?ccb=1-7&_nc_sid=a80384&_nc_ohc=CvDs5MWLqggQ7kNvgEuowZS&_nc_ht=scontent.whatsapp.net&edm=AH51TzQEAAAA&_nc_gid=AThnla93YjSTDzg4e3-2eDa&oh=01_Q5AaID-Ozb7JEZ-dNOAYQlxmks79b0nfTElne8ZqRD14ZtFV&oe=672C57BB"                                 ]                             }                         },                         {                             "type": "BODY",                             "text": "234525"                         },                         {                             "type": "BUTTONS",                             "buttons": [                                 {                                     "type": "QUICK_REPLY",                                     "text": "2452"                                 }                             ]                         }                     ]                 }             ]         }     ] } 

What I've Tried:

  • The image URL is valid and works fine for non-carousel templates.
  • The URL is provided by Meta after uploading the media.
  • I suspect the issue might be related to how the API validates media for carousel components.

Question:

Why does the same image URL work for a regular template but result in an "invalid media sample" error for a carousel template? Does the WhatsApp API require a media ID for carousel updates, even if the URL is valid? How should I handle image media in carousel templates to avoid this error?

Any insights or suggestions are appreciated. Thanks in advance!