我有一个 Facebook 事件、广告集和一个使用 Facebook API 创建的广告。然而,当我尝试使用这三个端点(:我认为它们被称为端点)
创建广告时,它给出了一个错误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”
后提供的图像所示。
我在这里遗漏了什么吗?
最佳答案
键的值 creative
在你的参数对象中应该是:
"creative": {"creative_id":<CREATIVE_ID>} // without the array
正如 Facebook 官方文档中所述 creating ads :
creative (AdCreative):
This field is required for create. The ID of the ad creative to be used by this ad. You can read more about creatives here. You should supply the ID within an object as follows:
{"creative_id": <CREATIVE_ID>}
关于javascript - 使用 FB api 创建 Facebook 广告时未找到给定广告组的创意规范,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45795047/