Google Fit (Developer App) provides a robust API for accessing and storing a user's health and wellness data collected from various devices and apps. With it, you can read and write different types of fitness data, such as steps, calories burned, and heart rate, enabling the development of personalized health dashboards, proactive fitness reminders, and integrative health reports. Using Pipedream, this data can be ingested and combined with other services to automate health tracking, set goals, and even inform healthcare providers or coaching systems of a user's progress.
import { axios } from "@pipedream/platform"
export default defineComponent({
props: {
google_fit_developer_app: {
type: "app",
app: "google_fit_developer_app",
}
},
async run({steps, $}) {
return await axios($, {
url: `https://www.googleapis.com/oauth2/v1/userinfo`,
headers: {
Authorization: `Bearer ${this.google_fit_developer_app.$auth.oauth_access_token}`,
},
})
},
})
Daily Health Summary Email: Combine Google Fit data with Pipedream's email service to send a daily summary of a user's fitness activity. A workflow could fetch the previous day's data, including steps taken, calories burned, and sleep analysis, then format this information and send it via an automated email to encourage consistent fitness tracking and goal setting.
Smart Home Integration for Fitness Reminders: Integrate Google Fit data with smart home devices using Pipedream. If a user's activity level is lower than a set threshold by a certain time of day, the workflow could trigger a smart home device, like a smart speaker, to remind the user to take a walk or perform their workout routine.
Health Dashboard Sync: Sync Google Fit data with a custom health dashboard app. Data can be pulled at regular intervals to update the dashboard, allowing users or health coaches to view trends and insights over time. This could be extended by connecting it to a data visualization tool like Google Data Studio for enhanced reporting capabilities.
The Google Fit Developer App in Pipedream can integrate with either a personal Gmail account or a Google workspace email account. Either option involves creating a custom Google App in the Google Cloud Console. This process does not involve any code or special approval by Google. The steps are outlined below:
In order to connect your personal or workspace Google Fit account to Pipedream, you'll need to create a custom OAuth app in Google Cloud.
Select an existing project or create a new one in the Google Cloud Console
Select "Enable APIs & Services to open a menu to enable the Google Fitness API for Pipedream to connect to
Search for and select the Google Fitness API
Click "OAuth consent screen" in the left navigation menu
Select "External" in the OAuth Consent Screen
pipedream.comFitness API select whichever scopes you intend to use and then click "Update". For more information about available Google Fit scopes, please see this overview.Now you've created an unlisted Google Fit app that you can integrate with Pipedream.
You will need to generate a set of OAuth credentials to connect your new Google Fit app to Pipedream properly.
Navigate to the Credentials section on the left side.
Open the Credentials menu in the left hand nav bar
Click Create Credentials at the top and select "*OAuth client ID
Click create credentials to start the process
Select the OAuth Client ID option
Web application is the type of OAuth credential we're generating
https://api.pipedream.com/connect/oauth/oa_gA6iex/callbackAdd the Pipedream URL to the Callback Redirect URL option
Store the Client ID and Client Secret keys
At this point, you should have a Google Fit App under your Google Project, and a set of OAuth keys.
Now when prompted in Pipedream after trying to connect a Google Fit Developer App, copy and paste your OAuth credentials.
Add the scopes that you chose when setting up the app in a space-separate list.
Then click Connect
If you did not publish your Google Fit App in the Google Cloud Console, just click Continue to ignore the warning.
Click continue if presented with a warning about an unpublished app
Check all of the necessary scopes you'll need for your workflows
Check all scopes to include grant your integration permission
Click the final Connect and your custom Google Fit app should be integrated into Pipedream!
Google has a 7 day expiration window on refresh tokens for applications with a publishing status of "Testing", so you will need to Publish your application in order to maintain your account connection.
Publish your application
Confirmation of changes
Application disconnects after 7 days
If your developer application disconnects after 7 days, you need to follow the steps above to Publish your Google Fit app in order to keep your account connected.
Google Fit uses OAuth authentication. When you connect your Google Fit account, Pipedream will open a popup window where you can sign into Google Fit and grant Pipedream permission to connect to your account. Pipedream securely stores and automatically refreshes the OAuth tokens so you can easily authenticate any Google Fit API.
Pipedream requests the following authorization scopes when you connect your account:
GEThttps://accounts.google.com/o/oauth2/auth?client_id={{custom_fields.client_id}}&redirect_uri={{oauth.redirect_uri}}&state={{oauth.state}}&response_type=code&scope=email profile {{custom_fields.space_separated_scopes}}&access_type=offline&prompt=consentPOSThttps://oauth2.googleapis.com/tokencontent-type: application/x-www-form-urlencodedaccept: application/jsonclient_id={{custom_fields.client_id}}&client_secret={{custom_fields.client_secret}}&redirect_uri={{oauth.redirect_uri}}&grant_type=authorization_code&code={{oauth.code}}POSThttps://oauth2.googleapis.com/tokencontent-type: application/x-www-form-urlencodedaccept: application/jsonclient_id={{custom_fields.client_id}}&client_secret={{custom_fields.client_secret}}&grant_type=refresh_token&refresh_token={{oauth.refresh_token}}