Testing and Troubleshooting

Use this API to create and delete test leads.

Using the Testing Tool

You can use this tool to create and delete test leads for your forms; however, you cannot use the tool in developer mode.

You can create one test lead per form. You'll need to delete an existing lead in order to create a new one.

Debug Real Time Update Integration

Use this tool to test if your integration with Facebook's Webhooks is sucessful. Here are the steps to use this tool to debug your integration.

Please note that the leads created using this tool are organic leads which are not associated with any ad. Only one lead can be created per form. Therefore to re-create a lead for the same form, click the Delete Lead button to first delete then lead and then create it once again.

  • The drop down will list all the pages you have advertiser access to. Select a page from the dropdown.
  • In the Form dropdown, select a form to use for creating a lead.
  • Click Create Lead button to create a lead. By default, the lead that gets created has dummy data within it.
  • To customize the data being sent, click on Preview Form
  • Enter the desired data on the form level to create a lead with custom content.
  • Once the lead is created you will see a Track Status button appear.
  • Click Track Status, to see the status of the leads. It takes a few seconds for the RTU to be fired to your endpoint. Until then you see the RTU in pending status. Click Track Status again until you will see the status change.
  • Once the lead is pushed to your endpoint, you will see that the status field will changes. If the RTU was fired successfully, the status will change to success
  • For the success cases, you will also see the payload in the table. The payload shown here is a copy of what Facebook sends to your endpoint, so you should see the content and handle the JSON.
  • If there was an issue during sending the RTU, then the status will change to failed. In such cases, the error_code column will give details about the reason for the failure.

Video tutorial

Check out the Real Time Updates Debug Tool video for demo of this tool.

Sending a Stubbed Sample

You can make the following call to test the realtime update ping:

curl \
-F "object_id=<PAGE_ID>" \
-F "object=page" \
-F "field=leadgen" \
-F "access_token=<ACCESS_TOKEN>" \
-F 'custom_fields={"page_id": <PAGE_ID>}' \

This will deploy a stubbed payload similar to the one that the realtime updates uses.

Creating Test Leads

You can create a test lead by making a POST request to /{FORM_ID}/test_leads.

For this request to succeed, the following requirements must be met:

  • You should not have existing test leads for the specified Lead Ad form..
  • You must have a page role of Advertiser or above on the page under which the form was created.
curl \
-F "access_token=<ACCESS_TOKEN>" \

You can customize the test lead content by passing the following parameters:

  • field_data: A vector parameter with name and values pairs.
  • custom_disclaimer_responses: A vector parameter with checkbox_key and is_checked pairs.
curl \
-F "field_data=[{'name': 'favorite_color?', 'values': ['yellow']}, {'name': 'email', 'values': ['test@test.com']}]" \
-F "custom_disclaimer_responses=[{'checkbox_key': 'my_checkbox', 'is_checked': true}]" \
-F "access_token=<ACCESS_TOKEN>" \

The leads created from the above calls are fake leads and are therefore not associated with any ads.

Reading Test Leads

You can read the test leads associated with a Lead Ads form by making a GET call to the {FORM_ID}/test_leads endpoint.

curl \
-d "access_token=<ACCESS_TOKEN>" \

Deleting Test Leads

If you are testing your integration, and you wish to delete a lead so that you can re-submit, this can be achived by making the following API call:

curl -X DELETE \
-d "access_token=<ACCESS_TOKEN>" \

Note that only the owner of the lead can delete the lead.