通过 API 创建连接到现有表单的线索广告

Create Lead Ad connected to existing Form through API

我想要达到的目标:

我想通过 API 创建一个 Facebook 线索广告并将其连接到现有的线索广告表单,该表单也是通过 API 手动创建的。

因此,表单已创建,文档显示:

You only need to provide formID and form_url for the object_story_spec for the ad creative. Source: https://developers.facebook.com/docs/marketing-api/guides/lead-ads/create/v2.8#create-forms

我已经用问题推送了我的表单。拥有表单 ID,因此根据文档,下一步是推送广告,在 OBJECT_STORY_SPEC 内设置 formID 或 form_id,但是当我尝试这样做时,出现以下错误留言:

InvalidArgumentException in FieldValidation.php line 44: form_id is not a field of FacebookAds\Object\ObjectStorySpec

有没有办法通过 API 创建线索广告?如果是这样,我很想为该对象获取一个示例。

对潜在客户表单的引用存储在 post 的 号召性用语 结构中。

出于广告目的,您通常希望创建内联 post,方法是将其所有参数传递给 POST act_<accountId>/adcreatives,通过单个请求创建广告素材和 post。 object_story_spec 在这里指定post。

object_story_spec = {
    "page_id":"888899994444555",
    "link_data": {
        "call_to_action":{
            "type":"SIGN_UP",
            "value": {
                "lead_gen_form_id":"1112223334445566",
                "link_title":"Title"
            }
        },
        "message":"Cool text",
        "link":"www.google.com"
    }
}

这是关于内联创建的文档 https://developers.facebook.com/docs/marketing-api/reference/ad-creative-link-data/

这是 call_to_action/value 的文档,包括您需要填写的 lead_gen_form_id 字段 https://developers.facebook.com/docs/marketing-api/reference/ad-creative-link-data-call-to-action-value/