How to update the title and body of a facebook ad via the API?

Digital Marketing Facebook Marketing API 2 years ago

0 1 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating
_x000D_ _x000D_ I want to use the facebook API v2.5 to update the title and body of an existing facebook ad. I am using the PHP sdk (and the facebook API explorer). What is the correct way to do this? This what I have tried so far. After fetching the ad, I read the related ad_creative: $ad = new Ad(); $ad_creatives = $ad->getAdCreatives(); $creative = new AdCreative($ad_creatives[0]->id); // fetch from API $fields = $creative->getFields(); $creative->read($fields); Changing a value and calling update has no effect: $creative->{AdCreativeFields::BODY} = 'When life gives you lemons'; $creative->update(); Another possible way is to create a new creative and clone the data from the existing one: $data = $creative->getData(); $new_creative = new AdCreative(null, ); $new_creative->setData($data); $new_creative->create(); But it seems I will need to do some tinkering to get it right, because the api is returning errors. Btw, the app has the following permissions: ads_management, manage_pages, publish_pages.

Posted on 16 Aug 2022, this text provides information on Facebook Marketing API related to Digital Marketing. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (1)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago
_x000D_ Creative content is immutable. In order to update the tittle or body you will need to create a new creative (and then update your ad to use the new creative instead of the old one).

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.