Skip to content

Instantly share code, notes, and snippets.

@varunon9
Created July 18, 2024 14:13
Show Gist options
  • Save varunon9/6398706fb58b45a198cfc7479b9e6e77 to your computer and use it in GitHub Desktop.
Save varunon9/6398706fb58b45a198cfc7479b9e6e77 to your computer and use it in GitHub Desktop.
Get all leads of an instant form using Meta marketing API. We at https://groweasy.ai use this approach to download all leads for our clients

Get all leads belonging to an instant form-

curl --location 'https://graph.facebook.com/v18.0/<FORM_ID>/leads?limit=500&access_token=<LONG_LIVED_ACESS_TOKEN>'
  1. Replace <FORM_ID> with form id, e.g. 1260551454918979
  2. Replace <LONG_LIVED_ACESS_TOKEN> with your access token

Sample Response

{
    "data": [
        {
            "created_time": "2024-07-18T13:42:25+0000",
            "id": "1298429028153341",
            "field_data": [
                {
                    "name": "question4",
                    "values": [
                        "Path plus"
                    ]
                },
                {
                    "name": "question5",
                    "values": [
                        "Nothing"
                    ]
                },
                {
                    "name": "question1",
                    "values": [
                        "Nikhil Bhardwaj"
                    ]
                },
                {
                    "name": "question2",
                    "values": [
                        "[email protected]"
                    ]
                },
                {
                    "name": "question3",
                    "values": [
                        "+9180592XXXXX"
                    ]
                }
            ]
        }
    ],
    "paging": {}
}

Docs: https://developers.facebook.com/docs/marketing-api/guides/lead-ads/retrieving/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment