I'm trying to use Strava events, so i have to register a webhook. All fine.
1) I make a post request to initiate the process of registering the webhook.
curl -X POST https://api.strava.com/api/v3/push_subscriptions \
-F client_id=MY_APP_ID \
-F client_secret=MY_CLIENT_SECRET \
-F 'callback_url=MY_DOMAIN/webhook/strava' \
-F 'verify_token=MY_VERIFY_TOKEN'
2) I have my route setup
Route::match(['get', 'post'], '/webhook/strava', 'StravaController@webhook');
3) My controller returns valid json response with code 200 and all the data needed
public function webhook(Request $request)
{
Log::info($request->input('hub.challenge'));
return response()->json([
'hub.challenge' => $request->input('hub.challenge')
], 200);
}
But when i make the post it returns:
{"message":"Bad Request","errors":[{"resource":"PushSubscription","field":"challenge response","code":"challenge response malformed"}]}
Details:
I noticed that the log statement is not fired. So maybe it's saying malformed becouse it's returning {"hub.challenge": null}
. But i think in that case, the error message would be different.
Thank you guys!
use underscore. like this