gpt4 book ai didi

php - 在 facebook api 上创建广告得到 error_subcode 1885833

转载 作者:塔克拉玛干 更新时间:2023-11-03 05:34:20 25 4
gpt4 key购买 nike

尝试使用 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 页面帖子上找到了这个解决方案

=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'

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

关于php - 在 facebook api 上创建广告得到 error_subcode 1885833,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52273304/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com