botman / driver-facebook

BotMan Facebook Messenger Driver
MIT License
71 stars 73 forks source link

verifyRequest gets everything, but response is empty (when setting up webhook) #69

Closed chrisgia closed 6 years ago

chrisgia commented 6 years ago

I can't seem to get the webhook between Messenger and Botman working. I tried it on localhost with ngrok USING THE EXACT SAME SCRIPT and it works, but I need it on my webserver.

I logged the hub_verify_token, hub_mode, and hub_challenge in the verifyRequest method and it gets the right token, hub_mode and hub_challenge, but I always get the "Response does not match challenge, expected value="468366090", received="" " error.

webhook_error errorlog

I'm using it without BotMan Studio.

christophrumpel commented 6 years ago

Hey @Chrisgia , this is a bit difficult to debug. Also as it works locally it means it must be something with your server or .env settings there.

It seems this is false right ?https://github.com/botman/driver-facebook/blob/master/src/FacebookDriver.php#L109

I would check that and see why.

sakibulalam commented 6 years ago

@Chrisgia, I have faced this issue as well. After debugging I found out that $this->config->get('verification') was returning null and thus FacebookDriver@verifyRequest didn't return a response.

The culprit in my case was this [5.0] Environment variables sometimes return null #8191 and you can find details in this answer. This is still a issue in Lavel 5.6.

You can try and setting the app environment to production and caching the configuration with php artisan config:cache. This solved the problem for me. This would not be a problem in production but is a hassle in development.

christophrumpel commented 6 years ago

I am closing this now due to inactivity. @Chrisgia you can still comment if you found a solution.