Link does not exist or invalid, Facebook ADS API / creating Javascript ad

Asked

Viewed 263 times

0

I’m creating the creative ad like this:

FB.api(act_xxxxxxx  + '/adcreatives', 'POST', {
        name: vlName,
        title: vlTitle,
        body: vlBody,
        image_url: vlImage_url,            
        object_id: vlObject_id

    }, function (response) {
        if (response && !response.error) {
            var x = response.id;
            document.getElementById("txtIdRetornoAdsCreative").value = x;
            console.log(response);
        } else {
            document.getElementById("txtIdRetornoAdsCreative").value = "ERROR!";
            console.log(response);
        }
    }); 

Then I try to create the ADS, which I understand to be the final announcement, so:

 FB.api(act_xxxxxxx + '/ads', 'POST', {
            creative: { creative_id: document.getElementById("txtIdRetornoAdsCreative").value },
            name: 'TESTEFixo',
            status: 'PAUSED',
            adset_id: document.getElementById("idConjuntoAd").value

        }, function (response) {

            if (response && !response.error) {
                var x = response.id;
                document.getElementById("txtIdRetornoAdsCreative").value = x;
                console.log(response);
            } else {
                document.getElementById("txtIdRetornoAdsCreative").value = "ERROR2!";
                console.log(response);
            }

        });

I get the following error:

{
  "error": {
    "message": "Invalid parameter",
    "type": "OAuthException",
    "code": 100,
    "error_subcode": 1815520,
    "is_transient": false,
    "error_user_title": "Ad Creative Does Not Use Valid Link",
    "error_user_msg": "The link in this ad is either missing or invalid 

for Link Click Ads Optimization. This could be because this ad needs to link External content (e.g., an Advertiser’s website), but this ad does not (e.g., it links to a Facebook page). Fix this error by making the link Valid.", "fbtrace_id": "Acx1uappdfe" } }

1 answer

0

I found the problem, in the Creative parameter was missing one more value, so:

FB.api(act_xxxx '/ads', 'POST', {
            name: 'TESTEFixo',
            status: 'PAUSED',
            adset_id: xxxxx,
            creative: {
                object_story_spec: {
                    page_id: xxxxxx,
                    link_data: {

                        link: 'https://link.com.br', 

                    }
                }
            },
        }

Browser other questions tagged

You are not signed in. Login or sign up in order to post.