参数无效-AdCreative(facebook-marketing-api)

时间:2019-05-23 09:58:43

标签: facebook facebook-graph-api facebook-marketing-api

在Facebook营销api中创建AdCreative(使用PHP sdk)期间,出现“ 无效参数”错误。根据graph-api(请参阅下文),发生错误是因为我正在尝试使用处于开发模式的应用创建AdCreative。

由于我正在制作概念证明,因此我怀疑我的应用是否将获得 ads_management 许可(创建AdCreative需要此许可)。

是否可以通过我的应用程序(在开发模式下)使用facebook-marketing-api创建AdCreative(因此也可以创建广告)?

如果不是,是否还有其他方式


当我将应用程序置于“公共”模式时,出现以下错误:

{"error":{"message":"(#294) Managing advertisements requires an access token with the extended permission for ads_management","type":"OAuthException","code":294,"fbtrace_id":"AHZ4vUXzCv+"}}

我正在使用facebook的官方广告指南来创建AdCreative:https://developers.facebook.com/docs/marketing-api/buying-api

我目前正在使用以下代码创建AdCreative

// campaign creation (objective -> reach)
// adset creation
// adimage creation

$creativeFields = [];

$creativeParams = [
    'name' => $validatedRequest['creative_name'],
    'object_story_spec' => [
        'page_id' => $page_id,
        'link_data' => [
            'image_hash' => $image->{AdImageFields::HASH},
            'link' => "https://facebook.com/{$page_id}",
            'message' => 'THIS IS THE DEFAULT MESSAGE FOR AD CREATIVES - [[THIS IS VERSION 2]]',
        ],
    ],
];

$creativeId = (new AdAccount($id))->createAdCreative($creativeFields, $creativeParams)
                                  ->exportAllData();

当我尝试使用graph-api(使用curl)创建AdCreative时,收到以下JSON响应:

{"error":{"message":"Invalid Parameter", "type":"OAuthException", "code":100, "error_subcode":1885183, "is_transient":false, "error_user_title":"Ads creative post was created by an app that is in development mode", "error_user_msg":"Ads creative post was created by an app that is in development mode. It must be in public to create this ad.", "fbtrace_id":"GzpSaGkDlNa"}}

0 个答案:

没有答案