在 Facebook 上创建广告 api 获得 error_subcode 1885833

Creating adcreative on facebook api getting error_subcode 1885833

当尝试使用 api 3.1 在 Facebook 上创建广告时,我遇到了这个错误:

[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',
)  

在 Facebook 页面上找到此解决方案 post

=Breaking Change: Event Ads, Link Ads not Associated with Valid Page=

We recently announced an initiative to make the Facebook Advertising platform more transparent to Facebook users. Read more about this in

To support this initiative, we're deprecating Event Ads and Link Ads that are not connected to a valid page from the Marketing API.

This breaking change impacts all supported API versions, including the upcoming Marketing API version v2.11, and v2.10 and v2.9, which are available, but will be deprecated. This breaking change will take effect the week of Nov. 6, 2017.

As a result of this breaking change, you will no longer be able to create or edit Event Ads and Link Ads that are not connected to a valid page. Requests to do so will return the error: 'ErrorCode::ADPRO2__AD_MUST_HAVE_PAGE (1885833)'.

失败选项

The following ad options used together will fail: ===Event Ads=== - Objective: 'EVENT_RESPONSES' - Creative fields: 'body, object_id' === Link Ads === - Objective: 'LINK_CLICKS' - Creative fields: 'title', 'body', 'object_url' containing 'image_file' or 'image_hash'

You can still create Event Ads and Link Ads if you provide a valid 'actor_id' in the ad creative's 'object_story_id' or 'object_story_spec' fields.

有效选项

These options used together are valid: === Event Ads === - Objective: 'EVENT_RESPONSES' - Creative fields: 'object_story_id' or 'object_story_spec' === Link Ads === - Objective: 'LINK_CLICKS' - Creative fields: 'object_story_id' or 'object_story_spec'

Link 来自: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,
    ]);

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

$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,
    ]);