Since Facebook updated to version 18 I'm having troubles with adding lead ad forms using the API.
Reference: https://developers.facebook.com/docs/marketing-api/guides/lead-ads/create/
When creating campaigns using the objective LEAD_GENERATION it gives the following error:
"Objective LEAD_GENERATION is invalid. Use one of: OUTCOME_LEADS, OUTCOME_SALES, OUTCOME_ENGAGEMENT, OUTCOME_AWARENESS, OUTCOME_TRAFFIC, OUTCOME_APP_PROMOTION."
However changing the objective to OUTCOME_LEADS give the following error when creating the ad:
"Creative with lead form can only be used for Lead Generation objective. Please create a new one."
I had the same issue ,and the docs are not very clear. Try adding the "destination_type": "ON_AD" to the ad set params when creating seemed to solve the issue,
Example:
{
"name": "Adgroup Name",
"billing_event": "IMPRESSIONS",
"optimization_goal": "LEAD_GENERATION",
"campaign_id": 00000000000000,
"bid_strategy": "LOWEST_COST_WITH_BID_CAP",
"daily_budget": 2000,
"targeting": {
"custom_audiences": [
111111111111
],
"geo_locations": {
"custom_locations": [
{
"latitude": "41.81",
"longitude": "-88.07",
"radius": 50
}
]
},
"publisher_platforms": [
"facebook"
]
},
"promoted_object": {
"page_id": 222222222222222,
"product_set_id": 333333333333333333
},
"bid_amount": 125,
"destination_type": "ON_AD",
"attribution_spec": [
{
"event_type": "CLICK_THROUGH",
"window_days": 1
}
]
}