使用FB api创建Facebook广告时,找不到给定广告组的创意规范

时间:2017-08-21 10:40:53

标签: javascript json facebook-graph-api facebook-apps facebook-marketing-api

我有一个Facebook广告系列,adSet和我使用Facebook API创建的adcreative。但是,当我尝试使用这三个端点(:I think they are called endpoints)创建广告时,会出现错误No creative spec found for given adgroup.以下是我创建广告的代码,其中包含先前创建的图片,广告和广告系列:

FB.api('act_xxxxxxxx/adcreatives', 'POST', {
name: 'My Testworthy Ad Creative',
title: 'Facebook Marketing Partners',
body: 'Get exactly the things you need from your marketing.',
image_url: 'img url',
object_url: 'https://www.facebookmarketingpartners.com',
access_token:'app access token for selected permissions'

        },function(adcreativeresponse){
          console.log(adcreativeresponse.id);
          FB.api('/act_xxxxxxxx/ads','POST',  {
          creative:["{\"creative_id\" : \"adcreativeresponse.id /*or a static creative_id*/\"}"],
          name:"tryncatch",
          adset_id:"adsetId",
          status:"PAUSED",
          access_token:"app access token with the required permissions selected"},
          function(response) {
                                console.log("response for ad");
                                                 console.log(response);// 
                                                 Insert your code here
                             }
                                            );

                                        } );

如代码所示,我创建了一个adcreative,它返回了adcreative创建的节点ID,我在response函数中使用它来创建ad使用之前收集的所有参数,但它会在记录"response for ad"后提供的图像中显示错误。 enter image description here

我在这里缺少什么。

1 个答案:

答案 0 :(得分:1)

param对象中的键creative的值应为:

"creative": {"creative_id":<CREATIVE_ID>} // without the array
正如它在creating ads的官方Facebook文档中所述:

  

广告素材(AdCreative):

     

此字段是创建所必需的。此广告要使用的广告素材的ID。您可以在此处详细了解广告素材。您应该在对象中提供ID,如下所示:

     

{"creative_id": <CREATIVE_ID>}

相关问题