Fitbit

Let users log in with their Fitbit accounts, fetch their workout data, and update their subscription status.

This is the short-form, technical reference for the Fitbit plugin. For a more in-depth explanation of the plugin and how it works, see our User Manual article below:

Article: The Fitbit plugin

Signup/login with a social network

This workflow action allows you to integrate the Fitbit authentication event when registering a new user, or logging in an existing user.

OAuth provider

Allows the Fitbit editor to verify the correct social platform to login/signup the user.

Invite Fitbit friend

Send a friend request to another Fitbit user.

InvitedUserEmail

The email address of a user’s Fitbit account that the current user would like to send an invite to.

Accept Fitbit friend invitation

Accept a friend request from another Fitbit user.

FromUserID

When choosing to accept a friend request, this is the ID of a Fitbit user's account that will be added to the current user’s friend list.

Add Fitbit subscription

Start a Fitbit subscription.

SubscriptionID

The unique characters to reference a user's Fitbit subscription.

Delete Fitbit subscription

Remove a Fitbit subscription.

CollectionPath

Collection of data to retrieve notifications. If the collection is not provided, the list will include all subscriptions for the user.

Current user’s Fitbit profile

When adding dynamic data, this expression allows you to fetch and display the profile information from a user’s connected Fitbit account.

ID

The unique ID of a user’s Fitbit account.

Avatar

The profile photo from a user’s Fitbit account.

FullName

The full name from a user’s connected Fitbit account.

Nickname

The alternative name added to a user’s connected Fitbit account.

AboutMe

The profile description from a user’s connected Fitbit account.

Age

The age of a user saved within their Fitbit account.

Height

The height of a user saved within their Fitbit account.

Weight

The weight of a user saved within their Fitbit account.

DateOfBirth

The birth date of a user saved within their Fitbit account.

MemberSince

The date that a user initially created their Fitbit account.

Current user’s Fitbit daily activities

Allows you to fetch the user’s workout data from a specific date.

Activities

A list of all the recorded activities from a user’s account.

Goals_caloriesOut

Calorie burn goal represents either dynamic daily target from the premium trainer plan or manual calorie burn goal.

Goals_distance

The target distance traveled within a user’s Fitbit account for a specified date.

Goals_floors

The target amount of floors climbed within a user’s Fitbit account for a specified date.

Goals_steps

The target number of steps within a user’s Fitbit account for a specified date.

Current user’s Fitbit food log

Allows you to fetch the user’s log food intake data from a specified date.

Foods

The recorded foods a user consumed on a specified date.

Summary_calories

A summary of the total calories consumed by a user on a specified date.

Summary_carbs

A summary of the total carbs consumed by a user on a specified date.

Summary_fat

A summary of the total fat consumed by a user on a specified date.

Summary_fiber

A summary of the total fiber consumed by a user on a specified date.

Summary_protein

A summary of the total protein consumed by a user on a specified date.

Summary_sodium

A summary of the total sodium consumed by a user on a specified date.

Summary_water

A summary of the total water consumed by a user on a specified date.

Current user’s Fitbit sleep log

Allows you to fetch the user’s logged sleep data from a specific date.

TotalMinutesAsleep

A summary of the total minutes a user slept on a specified date.

TotalSleepRecords

The total number of sleep records stored within a user’s Fitbit account.

TotalTimeInBed

A summary of the total minutes a user spent in bed - both awake and asleep.

Current user’s Fitbit heart rate log

Allows you to fetch the user’s heart rate data logged from a specific date.

CaloriesOut

The total number of calories a user burnt on a specified date

Max

The max heart rate recorded on a specified date.

Min

The minimum heart rate recorded on a specified date.

Minutes

The duration of each session where a heart rate was elevated.

Name

The name given to a workout session where the user’s heart rate was elevated.

Current user’s Fitbit lifetime activities

The total activity statistics from a user’s Fitbit account. This is an overview of all their historical key data points, as well as achievement values.

Lifetime_total_caloriesOut

The total number of calories a user has burnt since the creation of their account.

Lifetime_total_distance

The total distance traveled by a user since the creation of their account.

Lifetime_total_floors

The total number of floors a user has climbed since the creation of their account.

Lifetime_total_activeScore

The average active score given to a user’s account based on their lifetime activity.

Current user’s Fitbit device

The Fitbit device model linked to the user’s account.

ID

The device ID on a user’s linked Fitbit device.

Battery

The current battery level of a user’s linked Fitbit device.

DeviceVersion

The device model of a user’s linked Fitbit device.

Type

The type of device linked to a user’s account e.g. fitness tracker, scales.

LastSyncTime

The last recorded time that a user’s device was synced to their account.

Current user’s Fitbit friends

A list of all the friends connected to a user’s Fitbit account.

ID

The unique ID of a friend’s Fitbit account.

Avatar

The profile photo of a friend’s Fitbit account.

FullName

The full name listed on a friend’s Fitbit account.

Nickname

The alternative name added to a friend’s Fitbit account.

AboutMe

The profile description from a friend’s Fitbit account.

Age

The age saved on a friend’s Fitbit account.

Height

The height saved on a friend’s Fitbit account.

Weight

The weight saved on a friend’s Fitbit account.

DateOfBirth

The date of birth saved on a friend’s Fitbit account.

MemberSince

The date that a user’s friend registered initially created their Fitbit account.

Current user’s Fitbit friends invitations

A list of the current friend requests to a user’s Fitbit account.

DateTime

The date and time that a friend request was sent.

User

The user who has sent the current user a Fitbit friend invite.

Current user’s Fitbit subscription

Allows you to fetch the user’s heart rate data logged from a specific date.

CollectionType

The type of Fitbit subscription e.g. activities, body, sleep, etc

OwnerID

The ID of the user who owns the subscription.

OwnerType

The type of entity who owns the current subscription e.g. user

SubscriberID

The ID of the subscriber that will receive the subscription notifications.

SubscriptionID

This is the unique ID of the subscription created by the API client application.

Setup

Configuring your API

Once you’ve installed the Fitbit plugin, you’ll need to first create a developer account to secure access to an OAuth key.

After registering a developer account, you’ll then need to register a new app within the Fitbit developer portal.

Once the details of your app have been added, you’ll be provided with a client ID and secret key for your OAuth 2.0 integration.

Now, you’ll need to copy both the client ID and client secret keys into their relevant fields within your plugin settings.

Note: It’s also possible to enable a generic redirect URL within the Bubble plugin settings itself.

Logging a user in through Fitbit

After configuring your OAuth credentials, you can now use the ‘signup/login with social network’ step within a workflow. From the event dropdown menu, you’ll see an option to select the Fitbit OAuth provider. This event can be added to an element like a login button.

After a user clicks this button, they’ll be redirected to a Fitbit portal where they can verify their account, then be redirected back to the destination URL of your application.

Now, you can choose to display information from a user's Fitbit account by using the ‘current user’s Fitbit’ operator.

Accepting a friend invitation

To display a list of a user’s Fitbit friend invitations, start by adding a repeating group element to the page. The type of content for this repeating group will need to be configured as ‘Fitbit Friend Invitation’.

Now, you’ll also need to update the data source to display the ‘current user’s Fitbit friends invitations’.

Now, within the repeating group cell, you can display information from a user’s Fitbit profile who has sent a friend invitation.

From here, when the accept button is clicked, you can create a workflow and choose from the ‘accept Fitbit friend invitation’ event.

When configuring this workflow event, you’ll need to set the FromUserID to be the ‘current cell’s Fitbit friend’s invitation’s User ID’.

Inviting a Fitbit friend

In order to allow the current user to send a Fitbit friend invitation, select the ‘invite Fitbit friend’ workflow event.

Within this workflow event, you’ll need to configure an email value associated with a user’s Fitbit account. This can be attained through an input form.

Adding a Fitbit subscription

When adding a new Fitbit subscription, select the ‘add a Fitbit subscription’ event within your workflow editor.

When adding a new subscriber, you’ll need to associate a SubscriptionID to the current user. This unique ID will be shared with Fitbit. As Fitbit states within their API docs, this ID has a character limit of 50 characters.

Within a Bubble input, it’s possible to use the formula operator to generate a random character string.

Now, when configuring your subscription workflow event, it’s possible to use the value of this input field as the SubscriptionID.

We’d also recommend storing this SubscriptionID as a field under your user data type. This will allow you to reference this unique ID if the user chooses to delete their subscription at a later date.

Deleting a Fitbit subscription

When deleting a user’s Fitbit subscription, select from the ‘delete a Fitbit subscription’ workflow event.

When configuring this workflow step, you’ll need to provide the subscription type that the user will be canceling.

Note: If the CollectionPath is not provided, subscriptions will be deleted from all collections.

Next, you’ll need to verify what subscription ID you’ll be deleting. If you’ve stored the current user’s subscription ID within your database, you can reference this here.

FAQ

(Have a suggested FAQ to help other Bubblers? Please visit our Support center to get in touch with a member of our Support team!)

Last updated