Ich erhalte einen Fehler, wenn ich versuche, eine Anzeige auf Facebook über die PHP-API zu erstellen.Facebook Ads API - Eltern-ID erforderlich
Exception in AbstractCrudObject.php line 113: A parent ID is required.
Die Sache ist, ich den Code aus https://developers.facebook.com/docs/marketing-api/guides/lead-ads/create/v2.8 kopiert und es nur geändert zu entsprechen, was ich brauche. Ich bin verwirrt, was fehlt, da ich bis jetzt in der Dokumentation nichts dazu finden kann. Hat noch jemand das gleiche Problem oder findet es heraus, wie es zu beheben ist?
Hier ist mein Code:
$link_data = new AdCreativeLinkData();
$link_data->setData([
AdCreativeLinkDataFields::LINK => $creativeInfo->link,
AdCreativeLinkDataFields::MESSAGE => $creativeInfo->message,
AdCreativeLinkDataFields::IMAGE_HASH => $image->{AdImageFields::HASH}.PHP_EOL,
AdCreativeLinkDataFields::CAPTION => $creativeInfo->caption,
AdCreativeLinkDataFields::DESCRIPTION => $creativeInfo->description,
AdCreativeLinkDataFields::CALL_TO_ACTION => [
'type' => $creativeInfo->cta,
'value' => [
'lead_gen_form_id' => $creativeInfo->leadform,
],
],
]);
$story = new AdCreativeObjectStorySpec();
$story->setData([
AdCreativeObjectStorySpecFields::PAGE_ID => $creativeInfo->page_id,
AdCreativeObjectStorySpecFields::LINK_DATA => $link_data,
]);
$creative = new AdCreative();
$creative->setData([
AdCreativeFields::OBJECT_STORY_SPEC => $story,
]);
$creative->create();