facebook / facebook-java-business-sdk

Java SDK for Meta Marketing APIs
https://developers.facebook.com/docs/business-sdk
Other
402 stars 332 forks source link

AdCreative with `asset_feed_spec` is not creating the Ad with Website destination #452

Closed nicolasgoldman07 closed 9 months ago

nicolasgoldman07 commented 9 months ago

Which SDK version are you using?

v18

What's the issue?

I'm trying to create an AdCreative (for an Awareness Campaign) with a website destination and different images for each placement with the asset_feed_spec and I'm not able to do it.

This is the AdCreative I'm trying to create:

{
    "asset_feed_spec": {
        "ad_formats": [
            "SINGLE_IMAGE"
        ],
        "asset_customization_rules": [
            {
                "customization_spec": {
                    "audience_network_positions": [
                        "classic"
                    ],
                    "facebook_positions": [
                        "facebook_reels",
                        "story"
                    ],
                    "instagram_positions": [
                        "story",
                        "reels"
                    ],
                    "publisher_platforms": [
                        "facebook",
                        "instagram",
                        "audience_network"
                    ]
                },
                "image_label": {
                    "name": "IMG_STORY"
                }
            },
            {
                "customization_spec": {
                    "audience_network_positions": [
                        "classic",
                        "instream_video"
                    ],
                    "facebook_positions": [
                        "feed",
                        "instant_article",
                        "instream_video",
                        "marketplace",
                        "right_hand_column",
                        "search",
                        "suggested_video",
                        "video_feeds",
                        "facebook_reels_overlay",
                        "profile_feed"
                    ],
                    "instagram_positions": [
                        "stream",
                        "explore",
                        "explore_home",
                        "profile_feed",
                        "ig_search"
                    ],
                    "publisher_platforms": [
                        "facebook",
                        "instagram",
                        "audience_network"
                    ]
                },
                "image_label": {
                    "name": "GENERAL_IMAGE"
                }
            }
        ],
        "images": [
            {
                "adlabels": [
                    {
                        "name": "IMG_STORY"
                    }
                ],
                "url": "https://s3.amazonaws.com/<file1_url>.jpg"
            },
            {
                "adlabels": [
                    {
                        "name": "GENERAL_IMAGE"
                    }
                ],
                "url": https://s3.amazonaws.com/<file2_url>.jpg"
            }
        ],
        "link_urls": [
            {
                "website_url": "http://www.tangocode.com"
            }
        ]
    },
    "degrees_of_freedom_spec": {
        "creative_features_spec": {
            "standard_enhancements": {
                "enroll_status": "OPT_OUT"
            }
        }
    },
    "link_url": "http://www.tangocode.com",
    "object_story_spec": {
        "instagram_actor_id": "1284059018340746",
        "page_id": "312871095901417"
    }
}

When I go the the Facebook Ad Creator, I see that the Ad Destination is unchecked.

If I remove the asset_feed_spec and I add the object_story_spec it works ok:

{
    "degrees_of_freedom_spec": {
        "creative_features_spec": {
            "standard_enhancements": {
                "enroll_status": "OPT_OUT"
            }
        }
    },
    "link_url": "http://www.tangocode.com",
    "object_story_spec": {
        "instagram_actor_id": "1284059018340746",
        "link_data": {
            "call_to_action": {
                "type": "SUBSCRIBE",
                "value": {
                    "link": "http://www.tangocode.com"
                }
            },
            "caption": "http://www.tangocode.com",
            "description": "Test Description",
            "link": "http://www.tangocode.com",
            "message": "This is a test message",
            "name": "Test",
            "picture": "https://s3.amazonaws.com/<file_url>.jpg"
        },
        "page_id": "312871095901417"
    }
}

Steps/Sample code to reproduce the issue

Use the ad creatives above and you will get the results also above.

Observed Results:

Expected Results:

alexandre-sev commented 9 months ago

Hello @nicolasgoldman07,

I have a similar issue. Were you able to solve it? Sorry if it is inappropriate to comment here. It is my first time using Github.