Overview

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.

WEBHOOKS SCENARIO

A typical Webhooks scenario might look like this:

Set Up and Verify a Subscription:

  1. Developer creates a callback URL (see CREATING THE CALLBACK URL for more information)
  2. Developer provides callback_url (and optionally a verify_token) to Nike+.
  3. 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).
  4. 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).
  5. When Nike+ receives the response, the subscription is verified and subscribed apps are ready to receive Notifications.

Receive Notifications:

  1. 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).
  2. 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).
  3. 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).

TRANSPORT LAYER SECURITY (TLS) REQUIRED

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.