在facebook api上创建adcreative获取error_subcode 1885833

Mar*_*cus 5 php facebook facebook-graph-api laravel

当尝试使用api 3.1在facebook上创建adcreative时,我收到此错误:

[2018-09-10 10:45:47] local.INFO: array (
  'message' => 'Invalid parameter',
  'type' => 'OAuthException',
  'code' => 100,
  'error_subcode' => 1885833,
  'is_transient' => false,
  'error_user_title' => 'Ad Must Be Associated With a Facebook Page',
  'error_user_msg' => 'Ads and ad creatives must be associated with a Facebook Page. Try connecting your ad or ad creative to a Page and resubmit your ad.',
  'fbtrace_id' => 'FUMJg2Q2z1e',
)  
Run Code Online (Sandbox Code Playgroud)

Mar*_*cus 5

在Facebook专页上找到了这个解决方案

=重大变化:事件广告,链接广告未与有效页面相关联=

我们最近宣布了一项举措,旨在使Facebook Advertising平台对Facebook用户更加透明。阅读更多关于此

为了支持该计划,我们将淘汰那些未通过Marketing API连接到有效页面的事件广告和链接广告。

这一重大变化会影响所有受支持的API版本,包括即将推出的Marketing API版本v2.11,v2.10和v2.9,这些版本可用,但将不建议使用。这项重大更改将于2017年11月6日这一周生效。

由于这项重大更改,您将无法再创建或编辑未连接到有效页面的事件广告和链接广告。这样做的请求将返回错误:“ ErrorCode :: ADPRO2__AD_MUST_HAVE_PAGE(1885833)”。

失败的选择

以下广告选项一起使用将失败:===事件广告===-目标:“ EVENT_RESPONSES”-广告素材字段:“ body,object_id” ===链接广告===-目标:“ LINK_CLICKS”-广告素材字段: 'title','body','object_url'包含'image_file'或'image_hash'

如果您在广告素材的“ object_story_id”或“ object_story_spec”字段中提供了有效的“ actor_id”,则仍可以创建事件广告和链接广告。

有效选项

这些选项一起使用是有效的:===事件广告===-目标:“ EVENT_RESPONSES”-广告素材字段:“ object_story_id”或“ object_story_spec” ===链接广告===-目标:“ LINK_CLICKS”-广告素材字段: 'object_story_id'或'object_story_spec'

链接来自:https : //www.facebook.com/marketingdevelopers/posts/=breaking-change : -event-ads- link/ 1469189583195436/

编辑 - -

最终我使它工作了,这是问题的综合。主要的问题是,广告素材的设置方式不允许,facebook文档与您允许的操作不匹配。所以这是我在php中的工作广告

$data = file_get_contents($imageUrl);

$data = [
    'bytes'        => base64_encode($data),
    'access_token' => $this->accessToken,
];

$response = $this->client->request('POST',
    "act_{$accountId}/adimages", [
        'form_params' => $data,
    ]);

$response = $this->readStream($response)->images->bytes;

$link = (object)[
    'link' => $linkUrl,
];

$signUp = (object)[
    'type'  => "SIGN_UP",
    'value' => $link,
];

$linkData = (object)[
    'call_to_action' => $signUp,
    'link'           => $objectUrl,
    'image_hash'     => $response->hash,
    'message'        => $body,
];

$objectStory = (object)[
    'link_data' => $linkData,
    'page_id'   => $pageId,
];

$data = (object)[
    'name'              => 'system-generated-' . $accountId,
    'title'             => $title,
    'object_story_spec' => $objectStory,
    'access_token'      => $this->accessToken,
];

$response = $this->client->request('POST',
    "act_{$accountId}/adcreatives", [
        'form_params' => $data,
    ]);
Run Code Online (Sandbox Code Playgroud)

这就是我制作实际广告的方式

$creative = (object)[
    'creative_id' => $creativeId,
];

$data = (object)[
    'name'         => $name,
    'creative'     => $creative,
    'adset_id'     => $adSetId,
    'status'       => "PAUSED",
    'access_token' => $this->accessToken,
];

$response = $this->client->request('POST',
    "act_{$accountId}/ads", [
        'form_params' => $data,
    ]);
Run Code Online (Sandbox Code Playgroud)

  • 非常感谢你做的这些!整天呆在这里,文档无处不在。当您在宣传链接时,务必制作出这些“ AdCreativeLinkData”内容,然后将其打包到“ AdCreativeObjectStorySpec”中。 (2认同)