Reputation: 308
first of all I expose you my use case: I have a Facebook application bound with a Facebook page. I created via Facebook's PowerEditor a Campaign, an AdSet and an Ad all binded to my facebook page(LeadAD).
I sent a LeadAd test campaign and now I would to retrieve the users that completed the form via CURL or maybe PhpSdk. I can't figure out how to do this, probably I didn't figured out the logic behind Facebook's methods.
I know you can't paste all the code to do this, but if you can, just explain me how the Facebook logic works. All comments are appreciated.
Thanks in advance.
Upvotes: 0
Views: 1076
Reputation: 308
I figured out that Facebook has some undocumented rest calls.
In this case I was looking for the rest edge "leadgen_forms" callable on page or ad account ids.
https://graph.facebook.com/v2.6/<AD_ACCOUNT_ID>/leadgen_forms?access_token=<ACCESS_TOKEN>
or
https://graph.facebook.com/v2.6/<PAGE_ID>/leadgen_forms?access_token=<ACCESS_TOKEN>
This call allowed me to access the form resource id, and calling its own edge I found a lot of useful fields like leadgen_export_csv_url, try it with:
https://graph.facebook.com/v2.6/<FORM_ID>?access_token=<ACCESS_TOKEN>
The awesome thing (That was what I was really looking for) was another edge that you can try with this that returns all the leads generated:
https://graph.facebook.com/v2.6/<FORM_ID>/leads?access_token=<ACCESS_TOKEN>
Hope this will help somebody else.
Andrea.
Upvotes: 2