Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Domas's avatar
Level 1

Facebook webhook 405 method not allowed

Hello,

I am trying to create Facebook messenger bot in my Laravel app. Of course, I ran into problem :D

I set Facebook webhook and configured everything in facebook developers dashboard.

The problem is with webhook route. In facebook Webhook Errors i get error: The requested URL returned error: 405 Method Not Allowed.

I now that sometimes it happens with POST method but here I am using GET.

My controller:

public function verifyToken(Request $request) { $local_verify_token = env('BOT_VERIFY_TOKEN'); $hub_verify_token = $request->input('hub_verify_token');

    if($local_verify_token == $hub_verify_token) {
      return $request->input('hub_challenge');
    }

    return response("Invalid token!", 400);
}

My route:

Route::get('/webhook', 'BotController@verifyToken');

0 likes
3 replies
Sinnbeck's avatar

Are you certain that facebook does not use POST instead of GET? That would make alot more sense.

Route::post('/webhook', 'BotController@verifyToken');
Sinnbeck's avatar

Does it work if you just open that url in the browser? /webhook

Oh and never use env() outside of config files. That will lead to issues down the line (when using caching env() always return null)

Please or to participate in this conversation.