Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need a functional callback on my website from whatsapp cloud API but am not getting it right and i need help. On whtasapp cloud, i added https://abc.com/whatsapp and verify token as 123 for example. On my whatsapp folder, i have index.php with the below php code, this is not showing anything. How do i verify whatsapp POST to my endpoint url with php? Do i need to add https://abc.com/whatsapp/webhook to callback url like this? All is not just working. Help

What I have tried:

<?php
if($_SERVER['REQUEST_METHOD']=="GET"){
    echo $_GET['hub_challenge']; //respond back hub_callenge key
    http_response_code(200);
}else{
    $data = json_decode(file_get_contents('php://input'), true);
    error_log(json_encode($data)); //print inbound message     
}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900