Am working on a facebook chat bot using Nexmos facebook message API with PHP. I succeeded in sending a message in sandbox to facebook. However, get a reply when through the inbound webhook call back is a hard nut now.
NEXMO documentation is not that well detailed to help me get done with the TASK. Any Help on how i can the reply message when a user on facebook replies to the page's chat?
function inbound() {
$this->load_model("Api_model")->save_inbound_prod_message($_POST);
}
In that above code, i expected to have some data sent to me through $_POST however, the variable is empty.
THank you for your help
I had not mastered the art of PHP wit JSON data. So this was solved by these simple lines of code
$input = file_get_contents('php://input');
//error_log($input);
$input = json_decode($input);
$psid = $input->from->id;
as you can see in the question, i expected the reply to be in $_POST variable which wasn't the case.