Python WebHooks Callback Validation Please help

Hello all and thanks in advance - I am trying to create a small flask app with a webhook from Strava and I am facing some challenges with the Callback Validation. I have attached the link to my github lines 17 -19 and the (python/flask) app.py folder within the project.
after doing some research I think this is the method and the file that the method should go into for my
Callback Validation

@app.route('inspect/http', methods=['GET'])
def respond():
  return Response({ "hub.challenge":"7b601dcaee0c1371" }), 200

but I am not sure if even goes into this file or the node files. I am stumped on this one. Thanks to anyone who has time to look at this. this is in response to Strava’s directions which is listed below.

Callback Validation

Your callback address must respond within two seconds to the GET request from Strava’s subscription service. The response should indicate status code 200 and should echo the hub.challenge field in the response body as application/json content type: { “hub.challenge”:”15f7d1a91c1f40f8a748fd134752feb3” }

Once you have successfully created a webhook events subscription by responding to the callback validation, you will receive a response to your original subscription creation POST request. This response will include the id of the newly created subscription. If creation of a new subscription fails, this response will instead include error information. The most common cause of subscription creation failure is a failure to respond in a timely manner to the validation GET request, or failure to correctly echo the hub.challenge field.

1 Like

I don’t have experience with the Strava API (or Flask), but based on the docs, it looks like the hub.challenge value will be provided via a query parameter in the request. E.g.,:

$ GET https://mycallbackurl.com?hub.verify_token=STRAVA&hub.challenge=15f7d1a91c1f40f8a748fd134752feb3&hub.mode=subscribe

If you obtain hub.challenge from the query parameter instead of hard-coding the value into your endpoint, the rest looks consistent with my quick read of the docs. Good luck!

1 Like