Webhooks provides an HTTP-based interface for subscriptions and notifications. It offers a way for apps to subscribe to notifications about changes to Activities in a user’s Nike+ account. When an Activity is created, updated, or deleted, Nike+ sends a notification to a service associated with subscribed apps. This eliminates the need for apps to poll Nike+ to determine if there have been any changes to a user’s Activities.
Note: The notifications only indicate that a particular Activity has changed and do not include the values of any Activity fields. The notification POST from Nike+ provides a URL (object_uri) and ID (object_id) that subscribed apps can use to retrieve the details of an Activity (see NOTIFICATIONS for more information).
To begin receiving notifications, apps must first subscribe to the Webhooks service (see SUBSCRIPTIONS for more information). Once the subscription is verified, apps can begin receiving notifications from the Webhooks service.
A typical Webhooks scenario might look like this:
Set Up and Verify a Subscription:
- Developer creates a callback URL (see CREATING THE CALLBACK URL for more information)
- Developer provides callback_url (and optionally a verify_token) to Nike+.
- Nike+ will make a GET request to the callback_url with the hub_challenge (and a hub_verify_token if developer provided a verify_token) (see VERIFYING A SUBSCRIPTION for more information).
- The server of the callback URL sends a 200 OK response with the hub_challenge value returned in the body (see VERIFYING A SUBSCRIPTION for more information).
- When Nike+ receives the response, the subscription is verified and subscribed apps are ready to receive Notifications.
- The Webhooks service sends notifications to subscribed apps (via the callback_url) whenever the user’s Activities are created, updated, or deleted by Nike+ (see NOTIFICATIONS for more information).
- Notifications from the Webhooks service for a specific user of a subscribed app will continue until the user of that subscribed app chooses to disconnect the app from Nike+ either through the user’s Nike+ “Connected Apps” page or the app itself. (Note: If the user disconnects through the app, the app must call the Disconnect (/me/app) endpoint (see DISCONNECT API for more information).
- An app can then get details of the Activity by calling the Activity Detail endpoint with the provided URL (object_uri) (see SAMPLE GET FOR ACTIVITY DETAIL for more information).
Webhooks is available over TLS 1.2, falling back to TLS 1.1 for clients that do not yet support TLS 1.2. TLS 1.1 support will be removed in a future update.