Facebook sends empty POST to a webhook

Viewed 2474

I am trying to install a webhook for leadgen event for my page via a facebook app. So I have:

  1. Facebook Page where leads come from
  2. Facebook App
  3. Webserver where I want to save leads

App and webserver are connected well I believe. Webhook is shown at app page etc. But when I am trying to create a test lead with this tool https://developers.facebook.com/tools/lead-ads-testing I am getting a POST request with no data in it.

I was suspecting permissions problems, but I am able to check a lead from page (via leadgen_id) directly with PHP SDK and the POST request is sent from Facebook just by URL, so they don't know about tokens yet.

UPD Plain POST request to the same url (curl -d "param=value" https://..url..) works as expected.

4 Answers

In case you are using the django framework, you should request.body, as post data will remain empty.

def webhook_response(request):
   # it will print the contents from facebook webhook response
   print(request.body)

   # something like the following object will print up if you are using leadgen
   {"object": "page", "entry": [{"id": "0", "time": 111111111, "changes": [{"field": "leadgen", "value": {"ad_id": "444444444", "form_id": "444444444444", "leadgen_id": "444444444444", "created_time": 11111111, "page_id": "444444444444", "adgroup_id": "44444444444"}}]}]}
Related