在转盘广告素材上使用Facebook Adset创建失败了

时间:2017-06-23 12:40:44

标签: facebook facebook-marketing-api

我通过发布到adsets端点(Marketing API)来创建广告集。 它返回给我以下错误:

{
  "error": {
    "message": "An unknown error occurred",
    "type": "OAuthException",
    "code": 1,
    "error_subcode": 1815652,
    "is_transient": false,
    "error_user_title": "Missing Messenger Destination in Child Item",
    "error_user_msg": "To use Messenger as destination, all children     items in the carousel ads should have messenger destination.",
    "fbtrace_id": "AdulKVKescc"
  }
}

广告素材是 carousel 。 旋转木马的每个孩子(卡片)都有call_to_action'{type:"LEARN_MORE",value:{app_destination:"MESSENGER"}}'

我尝试了各种组合,即放置link而不是将link放在子元素中。我也试过放一个m.me链接,但是在创建广告时会引发不同的错误。

我使用adcreatives端点来制作我的广告素材......

关于什么应该是链接值的任何指导原则? Facebook文档称它被忽略了。如果忽略,为什么会出错?

2 个答案:

答案 0 :(得分:2)

该错误有点误导,因为child_attachments都包含call_to_action,但您还必须将相同的call_to_action添加到link_data或video_data中的广告素材中(具体取决于广告素材的类型)。

答案 1 :(得分:0)

将call_to_action添加到link_data。 Credit Chris Simmons

# use picture or image_hash
fb_dummy_image = 'https://i.ytimg.com/vi/eGKWS6_187s/maxresdefault.jpg'
image_hash = "164d943385c130d64e702664c9ab1798"

data = {
    "access_token": SELLIO_AD_SERVER_TOKEN,
    "name": "Sample Creative",
    "object_story_spec": {
        "link_data": {
        "call_to_action": {"type": "LEARN_MORE", "value": {"app_destination": "MESSENGER"}},
            "child_attachments": [
                {
                    "description": "$800.99",
                    "image_hash": image_hash,
                    "link": "https://www.example.com",
                    "name": "A1",
                    "call_to_action": {
                        "type": "LEARN_MORE",
                        "value": {
                            "app_destination": "MESSENGER",
                        }
                    },
                },
                {
                    "description": "$400.99",
                    "image_hash": image_hash,
                    "link": "https://www.example.com",
                    "name": "A2",
                    "call_to_action": {
                        "type": "LEARN_MORE",
                        "value": {
                            "app_destination": "MESSENGER",
                        }
                    },
                },
                {
                    "description": "$300.99",
                    "picture": fb_dummy_image,
                    "link": "https://www.messenger.com/t/xxxxxxxxxxxx",
                    "name": "A3",
                    "call_to_action": {
                        "type": "LEARN_MORE",
                        "value": {
                            "app_destination": "MESSENGER",
                        }
                    }
                }
            ],
            "link": "https://www.messenger.com/t/xxxxxxxxxx",
            "page_welcome_message": '{"user_edit": true, "message": {"attachment": {"type": "template", "payload": {"template_type": "generic", "elements": [{"buttons": [{"url": "http://www.example.com/", "type": "web_url", "title": "View Website"}, {"type": "postback", "payload": "USER_DEFINED_PAYLOAD", "title": "Start Chatting"}], "subtitle": "Optional: Enter a subtitle to provide more information", "image_url": "https://image.ibb.co/bz5t6Q/placeholder.png", "title": "Enter a title to accompany your image"}, {"buttons": [{"url": "http://www.example.com/", "type": "web_url", "title": "View Website"}, {"type": "postback", "payload": "USER_DEFINED_PAYLOAD", "title": "Start Chatting"}], "subtitle": "2nd product", "image_url": "https://image.ibb.co/bz5t6Q/placeholder.png", "title": "a2"}, {"buttons": [{"url": "http://www.example.com/", "type": "web_url", "title": "View Website"}, {"type": "postback", "payload": "USER_DEFINED_PAYLOAD", "title": "Start Chatting"}], "subtitle": "3rd product", "image_url": "https://image.ibb.co/bz5t6Q/placeholder.png", "title": "a3"}]}}}}'
        },
        "page_id": "xxxxxxxxxxx"
    }
}

然后还制作以 MESSAGES 为目标的广告系列

def create_campaign(ad_account_id, campaign_name):
my_account = AdAccount(ad_account_id)
campaign = Campaign(parent_id=my_account.get_id_assured())

campaign.update({
    Campaign.Field.name: campaign_name,
    Campaign.Field.objective: 'MESSAGES'
})

campaign.remote_create(params={
    'status': Campaign.Status.paused,
})
logging.debug(campaign)
return campaign.get_id()