java - Facebook 赞助信息广告创意 | Java SDK
问题描述
我目前正在尝试使用 Facebook Java SDK 来创建 Facebook 广告/广告创意。到目前为止,这是我的代码:
AdCreative adCreative = new AdAccount(id, context).createAdCreative()
.setActorId("15726030300")
.setObjectId("15726030300")
.setName("Temp")
.setMessengerSponsoredMessage("{\"message\":{\"attachment\":{\"type\":\"template\",\"payload\":{\"template_type\":\"generic\",\"elements\":[{\"title\":\"Title\",\"image_url\":\"https://image.ibb.co/bz5t6Q/placeholder.png\",\"subtitle\":\"Subtitle\",\"buttons\":[{\"type\":\"web_url\",\"url\":\"https://www.google.com/\",\"title\":\"View Website\"}]}]}}}}")
.execute();
new AdAccount(id, context).createAd()
.setName("Hunter Test Ad")
.setAdsetId("6229867441719")
.setCreative(adCreative)
.setStatus(Ad.EnumStatus.VALUE_PAUSED)
.execute();
在.setMessengerSponsoredMessage
中,我包含了一些直接从 FB 示例复制的消息 JSON。这是格式化的 JSON:
{
"message": {
"attachment": {
"type": "template",
"payload": {
"template_type": "generic",
"elements": [
{
"title": "Title",
"image_url": "https://image.ibb.co/bz5t6Q/placeholder.png",
"subtitle": "Subtitle",
"buttons": [
{
"type": "web_url",
"url": "https://www.google.com/",
"title": "View Website"
}
]
}
]
}
}
}
}
我目前被抛出此错误:
{
"error": {
"message": "Invalid parameter",
"type": "OAuthException",
"code": 100,
"error_subcode": 1815790,
"is_transient": false,
"error_user_title": "Invalid Attachment For Sponsored Message",
"error_user_msg": "The message object for sponsored messages is invalid",
"fbtrace_id": "AIjSPu5k0Z6Q_9VjvDv2mHx"
}
}
当我尝试在他们的原生 AD 工具中使用 JSON 时,它似乎没有问题。但是,当我在此广告素材中使用它时,它不是。
如果我的信息可能结构正确,我需要帮助理解为什么会这样……
解决方案
推荐阅读
- kotlin - 如何将我的 graphql 对象扩展到我的 Kotlin 对象中?
- python - How to efficiently unroll a matrix by value with numpy?
- asp.net - 带有 Linux Docker 的 ASP.NET 自动生成“服务'未能构建:复制失败:stat /var/lib/docker/tmp/docker-builder”
- wordpress - REST API woocommerce - 未在 GET/customers 上显示所有客户
- java - 来自 Kafka 主题的 JSON 中没有发生结构化流-流连接
- amazon-web-services - 为什么 AccessKeyId 包含在 s3 预签名 URL 中?
- c# - 是否可以找到将我的类用作泛型类型的 .NET 类?
- java - 使用扫描仪时如何验证输入?
- rdf - Unicode 转义序列的 dotNetRdf 问题/Jena Fuseki 无法在 URI 中加载撇号
- python - Scrapinghub 导出多个项目