$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',消息'参数无效'”
答案 0 :(得分:0)
您是否初始化了API?
Api::init(
'<app_id>',
'<app_secret>',
'<facebook_access_token>'
);
AdCreativeObjectStorySpecFields::VIDEO_DATA => $getId
更改为:
AdCreativeObjectStorySpecFields::VIDEO_DATA => $video_data
'type' => AdCreativeCallToActionTypeValues::LIKE_PAGE,