This is a simple implementation of the Strava Webhook API for a local cycling community.
Comes with the following query parameters:
- hub.mode = subscribe
- hub.verify_token = a secret used for subscription
- hub.challenge = a random string to send back
The response is a JSON string with the same hub.challenge.
Comes as a JSON string with the following keys:
- subscription_id = the webhook's unique id
- aspect_type = type of change, either create or update (delete is being ignored)
- updates = what has been changed
- type = the only update supported is the type switch to Ride
- authorized = false when the athlete unsubscribes
- object_type = athlete or activity
- owner_id = the athlete's unique number
- object_id = either activity's unique number or the athlete's if they unsubscribes
In case all the requirements are met the whole request goes to a Google Pub/Sub service queue and triggers another cloud function to pick it up on the other side.
WARNING. If the hook doesn't manage to finish in 2 sec. (when cold started) Strava gonna repeat the request in 2 min. Next attempt has more chances to succeed due to a warm cloud function state.