This guide follows up a previous post, Strava API and Next.js. We will be adding webhooks to enable our Next.js app to subscribe to events that occur within Strava
Create a subscription
Creating a new webhook subscription is a two-step process:
- Request subscription creation by making a POST request to the subscriptions endpoint. This request includes the application’s client_id and client_secret. It defines the callback address where events will be sent and also defines a verification token used in validating the callback address.
- Validate the callback address. The Strava webhook system, upon receiving an subscription creation request, will issue a GET request to the newly defined callback address to validate that it is available. The server serving the callback address must respond to this GET in a timely and correct manner for the subscription to be validated and enabled.
Create a subscription via a curl request.