Receive a Facebook message

First make sure your webhook server is running. It should correctly handle both inbound message callbacks and message status callbacks returning at least a 200 to acknowledge each callback. You will need to have this in place so you can obtain the PSID of the Facebook User sending the inbound message. Once you have this you will be able to reply.

When a Facebook message is sent by a Facebook User to your Facebook Page a callback will be sent to your Inbound Message Webhook URL. An example callback is shown here:

      "text":"Hello from Facebook Messenger!"

You need to extract the value here as this is the ID that you need to send a reply.

Sending a Facebook Messenger message

The Messages API provides the ability to send messages to various channels, including Facebook Messenger, SMS, WhatsApp and Viber. This task looks at using the Messages API to send a Facebook Messenger message.