1. Webhooks
  2. Data Flow

Historical Data Flow

When a user first connects a device to Vital, Vital backend pulls historical data. Historical data is all data that exists on a user’s account, prior to them linking their wearable account with Vital. This can take several minutes for all the data to be retrieved and to be readily accessible.

When data is available, the backend triggers a historical.data.<resource_type>.created webhook event. The resource_type is determined by the provider - more information on which resources a provider can support can be found here.

We send a webhook event for each resource a provider supports. In certain cases, where a user has large amounts of historical data, we send webhook events for each ordered-chunk (most-recent first). The is_final flag is used to indicate that the data collection is complete.

Webhook Event

When you receive the historical backfill event, you should make an API call for the specific resource you received the webhook event for. As an example, if you receive the event historical.data.workouts.created you should make a call to GET workout data from the API. Historical data can be quite big, so we don’t send the full payload in a webhook.

Daily Data Flow

After a user has connected and historical data is backfilled, any new data is sent in the payload of the daily.data.<resource_type>.created webhook. Each payload has an id associated with it, and we recommend storing this value. This is to support cases where data may be updated. If an instance of previously sent data is changed by the user, we issue a daily.data.<resource_type>.updated event. For example, the title of a workout can be edited, or the amount of calories a user has burnt can change throughout the day.

Examples of each payload are provided in the webhooks dashboard. You can send test events which contain the different payloads you may receive throughout the integrations lifecyle.

Webhook Event

Connection Created

Once a connection between a provider and a user is established, we will send a webhook confirming it.

Webhook Event

Deep Dive into Vital Webhooks

Webhook Events

All our webhook events have the following structure. Each event consists of an event_type followed by a payload under the data key. The event_type specifies the type of data that is sent. You can see examples in the dashboard under Svix. You can also send example data via the Svix dashboard, under example events.

Webhook Event