-1

I'm using Facebook Ads API to create unpublished page posts. I have a problem when I try to publish those page posts which are videos with call-to-action button. I create unpublished page posts successfully and then I publish the unpublished posts from power editor, but it shows this message when I try to publish unpublished page posts I created: Sorry, something went wrong. Please try again.

I tried to remove call_to_action from the code, posts get published without any problem. I'm using Marketing API integrated with my app and use user access token with those permissions: manage_pages, publish_pages, ads_management, business_management, public_profile.

I need help to be able to publish unpublished posts (videos) with CTA button.

Here's the code I use:

$video_data = new AdCreativeVideoData();
$video_data->setData(array(
AdCreativeVideoDataFields::DESCRIPTION => '<DESCRIPTION>',
AdCreativeVideoDataFields::IMAGE_URL => '<IMAGE_URL>',
AdCreativeVideoDataFields::VIDEO_ID => '<VIDEO_ID>',
AdCreativeVideoDataFields::CALL_TO_ACTION => array(
    'type' => AdCreativeCallToActionTypeValues::LEARN_MORE,
    'value' => array( 
    'link' => '<URL>',
    'link_title' => '<LINK TITLE>',
    'link_caption' => '<LINK CAPTION>',
    'link_format' => 'VIDEO_LPP',
    ),
    ),
));
$object_story_spec = new AdCreativeObjectStorySpec();
$object_story_spec->setData(array(
  AdCreativeObjectStorySpecFields::PAGE_ID => '<PAGE_ID>',
  AdCreativeObjectStorySpecFields::VIDEO_DATA => $video_data,
));
$creative = new AdCreative(null, 'act_<Ad_ACCOUNT_ID>');
$creative->setData(array(
  AdCreativeFields::NAME => 'Sample Creative',
  AdCreativeFields::OBJECT_STORY_SPEC => $object_story_spec,
));
$creative->create();

Hope to get help, Thanks!

Moh90
  • 1
  • 1
  • Yes, it's PHP. I edited it now. – Moh90 Mar 29 '17 at 19:47
  • "it shows this message when I try to publish unpublished page posts I created: Sorry, something went wrong. Please try again." What does? Your framework? Or is this error message output by the Facebook SDK? Typically, a failed Facebook Ads SDK call causes a specific exception with useful error codes. – ceejayoz Mar 29 '17 at 19:49
  • @ceejayoz I get this error message in Power Editor when I try to publish the posts I created successfully through this code. This code doesn't show any errors. I'm wondering if I can use Ads API to publish unpublished Page posts that I already created? – Moh90 Mar 29 '17 at 20:23
  • I'm voting to close this question as off-topic because it's asking about behaviour not related to code, but about how FB's power editor functions. – Paul Bain May 17 '17 at 12:17

1 Answers1

0

To publish unpublished post through API, you can make a POST call like /?is_published=true.

For the error from PowerEditor, it is lack of information for me to share any insights. It would be preferable to file a bug to Facebook for this type of issues. You are safe to share more details in the bug tool and Facebook can also pull information from their logs for troubleshooting.

In case you do not know the link to Facebook Bug Tool. https://developers.facebook.com/bugs/

Gu Xu
  • 51
  • 1