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 ad, like this:
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" } }