Facebook营销API中的参数无效

时间:2017-06-28 10:46:21

标签: facebook authorization facebook-marketing-api

$video_data = new AdCreativeVideoData();
$video_data->setData(array(

  AdCreativeVideoDataFields::VIDEO_ID => $videoId,
  AdCreativeVideoDataFields::CALL_TO_ACTION => array(
    'value' => array(
      'page' => '209938349531555',
    ),
  ),
));


$object_story_spec = new AdCreativeObjectStorySpec();
$object_story_spec->setData(array(
  AdCreativeObjectStorySpecFields::PAGE_ID => '209938349531555',
  AdCreativeObjectStorySpecFields::VIDEO_DATA => $getId,
));

$creative = new AdCreative(null, 'act_101365637166818');


$creative->setData(array(
  AdCreativeFields::NAME => 'Sample Creative',
  AdCreativeFields::OBJECT_STORY_SPEC => $object_story_spec,
));

$crtv=$creative->create();

这是我用于视频广告的代码。但是我收到此错误: “未捕获的异常'FacebookAds \ Http \ Exception \ AuthorizationException',消息'参数无效'”

1 个答案:

答案 0 :(得分:0)

  1. 您是否初始化了API?

    Api::init( '<app_id>', '<app_secret>', '<facebook_access_token>' );

  2. 在AdCreativeObjectStorySpec中设置数据,您有错误
  3. AdCreativeObjectStorySpecFields::VIDEO_DATA => $getId

    更改为:

    AdCreativeObjectStorySpecFields::VIDEO_DATA => $video_data

    1. 您是否已将Facebook应用与Facebook网站相关联?
    2. Page Subscribed Apps

      1. 您没有号召性用语类型
      2. 'type' => AdCreativeCallToActionTypeValues::LIKE_PAGE,

        1. 阅读文档Ad Creative Video Data