facebook赞助的消息广告创意| java sdk

fae0ux8s  于 2021-07-06  发布在  Java
关注(0)|答案(0)|浏览(226)

我目前正在尝试使用facebook javasdk来创建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时,似乎没有问题。然而,当我用它在这个广告创意,它不是。
我需要帮助理解为什么会这样,如果我的信息结构合理的话。。。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题