0

I'm trying to integrate webhook into my project, I have verified the webhook successfully, but when I send sample data to the server, my server does not receive anything, my project developed on Codeigniter.

I tried using postman to post Json data to the webhook url that was authenticated, my server received

Postman: [POST] https://xxxxxx.xxx/api/webhook

[RAW]

{
  "field": "conversations",
  "value": {
    "page_id": 4444444,
    "thread_id": "t_mid.14833205540:9182a4e489"
  }
}

Code:

public function webhook(){

    if (isset($_GET['hub_mode']) && isset($_GET['hub_challenge']) && isset($_GET['hub_verify_token'])) {
        if ($_GET['hub_verify_token'] == 'EcyUykjnmredclnuYFLShBKHfutRFfDRdfdfb'){
            echo $_GET['hub_challenge'];
        }
    }

    $data = file_get_contents("php://input",true);
    $myfile = fopen("./my-assets/uploads/text.txt", "w");
    fwrite($myfile, $data);
    fclose($myfile);

    http_response_code(200);
}
Andronicus
  • 25,419
  • 17
  • 47
  • 88
colinmorgan
  • 55
  • 1
  • 6
  • Sending test data from Facebook does not work, or your own attempt using Postman? Do you see incoming POST requests in the access log? What does the error log say? – misorude Aug 16 '19 at 06:34
  • hi, I tried, my server doesn't show logs when sending test data from facebook, only log of the get method verify – colinmorgan Aug 16 '19 at 07:19
  • @colinmorgan Did you get the response. I m having same issue. – Maneesh Rao Jan 20 '20 at 06:07

0 Answers0