In development mode, I have used the Facebook app control panel to set up a webhook to track when a user uploads a picture by setting the webhook fields "photos, pic, picture." Then I created a php file on my server with the following code:
<?
if (isset( $_REQUEST['hub_challenge']) && isset($_REQUEST['hub_verify_token'])) {
$challenge = $_REQUEST['hub_challenge'];
$verify_token = $_REQUEST['hub_verify_token'];
if ($verify_token === 'VERIFY_TOKEN') {
echo $challenge;
}
}
$values = $HTTP_RAW_POST_DATA;
$filename = 'my_data.txt';
$handle = fopen($filename, 'w');
fwrite($handle, $values);
fclose($handle);
?>
This passes the verification stage and writes any post data to a file for testing purposes and the server uses HTTPS. I've successfully simulated a webhook POST request
curl -i -X POST -H 'Content-Type: application/json' -d '{"object":"page","entry":[{"id":43674671559,"time":1460620433256,"messaging":[{"sender":{"id":123456789},"recipient":{"id":987654321},"timestamp":1460620433123,"message":{"mid":"mid.1460620432888:f8e3412003d2d1cd93","seq":12604,"text":"Testing Chat Bot .."}}]}]}' https://URL.php
I have logged in as the Admin account and the went to Facebook and uploaded a picture, but I checked the logs and no post request was made from facebook. There was also no data.txt being written. I tried this several times with no luck. I even tested the about_me, quotes, etc fields.
处于开发模式的应用将不会收到实时 Webhooks 通知。当应用处于开发模式时,系统仅会发送通过应用面板发出的测试通知。
请注意,针对 Messenger Webhooks 事件,开发模式行为会有不同。请参阅 Messenger Webhooks 文档了解更多信息。