I am sending subscription request as follows
<form action="https://www.strava.com/api/v3/push_subscriptions" method="post" id="myform">
<input type="hidden" name="client_id" value="XXX"/>
<input type="hidden" name="client_secret" value="XXXX"/>
<input type="hidden" name="callback_url" value="XXXX"/>
<input type="hidden" name="verify_token" value="STRAVA"/>
<input type="submit" value="Connect Webhook"/>
</form>
And then I am trying to validate the callback using PHP:
$hubMode = $_GET['hub_mode'];
$hubVerifyToken = $_GET['hub_verify_token'];
$hubChal = $_GET['hub_challenge'];
$submitChallenge = array("hub.challenge"=>$hubChal);
header('Content-Type: application/json;');
http_response_code(200);
echo json_encode($submitChallenge);
I keep getting error as {"message":"Bad Request","errors":[{"resource":"PushSubscription","field":"callback url","code":"not verifiable"}]}
Please help on what I am doing wrong.
The callback URL must be publicly available (not localhost). You can use Ngrok to redirect from an outside facing URL to your localhost URL.
Check this article from Strava about webhooks: https://developers.strava.com/docs/webhookexample/