0

I am trying to setup a webhook for the Facebook Messenger Bot Platform and i am receiving this error:

The URL couldn't be validated. Response does not match challenge, expected value = '892694233', received='892694233<link rel...'

I am using a heroku host for testing and a callback URL with SSL, the project is on Laravel 5.2 and this is the code that processs the webhook setup

if ($request->get('hub_verify_token') == config('services.bot.verification_token')) {
        return (new Response())->setContent($request->get('hub_challenge'));
    }

return (new Response())->setContent('Error: token mismatch');
Antonio
  • 69
  • 7

3 Answers3

1

Sorry for the late answer to my post, the problem was the APP_DEBUG (in .env file) in my Laravel applications is set to TRUE and the request get the code from a debug bar

Antonio
  • 69
  • 7
0

I'm not familiarized with Lavarel, but looks like the way you are extracting the value of the parameter hub.challenge is giving you a wrong value: '892694233

If you return just the number in the response ('892694233') it should work. Maybe you can clean up the result of calling $request->get('hub_challenge') in order to remove the text at the end?

slondono
  • 26
  • 1
  • 2
-1

You have to do like this

    if (Request::input('hub_verify_token') === $hubVerifyToken) {
  echo Request::input('hub_challenge');
  exit;
}