Facebook sends empty POST to a webhook

前端 未结 4 750
执念已碎
执念已碎 2021-01-18 11:58

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. <
4条回答
  •  天涯浪人
    2021-01-18 12:22

    Facebook sends webhook data as Content-Type: application/json, not as …: application/x-www-form-urlencoded (as a normal form with method=post would.)

    Therefor, PHP does not populate $_POST – you need to read the raw input stream instead. That can be done using file_get_contents('php://input') – and then just apply json_decode on that data, and you’ll have a proper data structure to work with.

提交回复
热议问题