By your code I decided that you can't setup your webhook, so from documentation
At your webhook URL, add code for verification. Your code should
expect the Verify Token you previously defined, and respond with the
challenge sent back in the verification request. Click the "Verify and
Save" button in the New Page Subscription to call your webhook with a
GET request.
So, for PHP to make a success with webhook setup you must return hub_challenge parameter.
Define $verify_token with your token and add something like:
if (!empty($_REQUEST['hub_mode']) && $_REQUEST['hub_mode'] == 'subscribe' && $_REQUEST['hub_verify_token'] == $verify_token) {
// Webhook setup request
echo $_REQUEST['hub_challenge']; exit;
}
After success setup, you can delete this code from your script.
Or, if your webhook already hooked:
You should skip any read and delivery messages, like this:
if (!empty($input['entry'][0]['messaging'])) {
foreach ($input['entry'][0]['messaging'] as $message) {
// Skipping delivery messages
if (!empty($message['delivery'])) {
continue;
}
// Skipping read messages
if (!empty($message['read'])) {
continue;
}
}
}
Or, you can deselect message_reads & message_deliveries checkboxes in Page Subscription section of your Facebook Page Settings/Webhooks.