The Fitbit API offers a window into the rich data from Fitbit devices and user profiles, allowing you to access metrics such as step count, sleep quality, heart rate, and more. With these insights, you can create personalized health dashboards, automate fitness challenges, synchronize health data with other apps, or even build custom notifications for user activity milestones.
import { axios } from "@pipedream/platform"
export default defineComponent({
props: {
fitbit: {
type: "app",
app: "fitbit",
}
},
async run({steps, $}) {
return await axios($, {
url: `https://api.fitbit.com/1/user/-/profile.json`,
headers: {
Authorization: `Bearer ${this.fitbit.$auth.oauth_access_token}`,
},
})
},
})
Sync Fitbit Data to Google Sheets: Automatically update a Google Sheets spreadsheet with your daily activity stats. By leveraging Pipedream's ability to connect with Google Sheets, you can regularly import your step count, sleep data, and other fitness metrics into a sheet for analysis and record-keeping.
Custom Email or SMS Reminders Based on Activity: Set up a workflow that sends you an email or SMS when you haven't reached a certain activity threshold by a specific time of the day. By integrating with SendGrid for email or Twilio for SMS services on Pipedream, you can encourage users to stay active and hit their daily goals.
Automated Social Media Updates for Achievements: Share your fitness achievements automatically on social media platforms like Twitter or Facebook when you reach milestones like 10,000 steps. By hooking into Fitbit's API to monitor achievements and using Pipedream's integration with social media services, you can celebrate your successes and motivate others.
Fitbit uses OAuth authentication. When you connect your Fitbit account, Pipedream will open a popup window where you can sign into Fitbit and grant Pipedream permission to connect to your account. Pipedream securely stores and automatically refreshes the OAuth tokens so you can easily authenticate any Fitbit API.
Pipedream requests the following authorization scopes when you connect your account:
activity
heartrate
location
nutrition
profile
settings
sleep
social
weight
temperature
oxygen_saturation
respiratory_rate
electrocardiogram
cardio_fitness
irregular_rhythm_notifications
GET
https://www.fitbit.com/oauth2/authorize
?
client_id={{oauth.client_id}}
&
redirect_uri={{oauth.redirect_uri}}
&
state={{oauth.state}}
&
response_type=code
&
scope={{oauth.space_separated_scopes}}
POST
https://api.fitbit.com/oauth2/token
content-type: application/x-www-form-urlencoded
accept: application/json
client_id={{oauth.client_id}}
&
client_secret={{oauth.client_secret}}
&
redirect_uri={{oauth.redirect_uri}}
&
grant_type=authorization_code
&
code={{oauth.code}}
&
token_type=Bearer
POST
https://api.fitbit.com/oauth2/token
content-type: application/x-www-form-urlencoded
accept: application/json
client_id={{oauth.client_id}}
&
client_secret={{oauth.client_secret}}
&
grant_type=refresh_token
&
refresh_token={{oauth.refresh_token}}