Integrating with Fitbit
Learn how to create a Fitbit app and integrate with Point.
Creating a Fitbit app
The first thing you need to do is create a Fitbit account and enter the Developer Fitbit page.
Being logged into your account you can access the menu Manage -> Register An App
and register your app. Here is a guide to help you fill the form:
Application Name: `Put the name of your application`
Description: `Put the description of your application`
Application Website URL: `Put the home page of your application, where the users can go and download it`
Organization: `Put the name of your Organization`
Organization Website URL: `The Website of your Organization`
Terms of Service URL: `Terms of Service URL of your application`
Privacy Policy URL: `Privacy Policy URL of your application`
OAuth 2.0 Application Type: `Here you should put **Server**`
Redirect URL: `Here you can put any URL you like, we're going to change after the app is created`
Default Access Type: `Here you should put **Read Only**`
Now that the app is created you have your OAuth 2.0 Client ID and your Client Secret. Be sure to copy this informations, you will need them! (the Client Secret shouldn’t be shared with anyone. It's a secret information!)
Editing you Redirect URL
With your OAuth 2.0 Client ID copied click the Edit Application Settings
and you will be redirected to the edit application details page.
In the edit form, go to the Redirect URL
parameter and insert this URL (for here on now, every time that :clientId
appears it means the OAuth 2.0 Client ID generated and copied before!):
https://${env}.sdk.areyoupoint.com/organizations/integrations/fitbit/:clientId/token
For example, if your OAuth 2.0 Client ID is 238C9M
the URL should be:
https://${env}.sdk.areyoupoint.com/organizations/integrations/fitbit/238C9M/token
Creating a Subscriber
After filling the Redirect URL
parameter go down the page and click in Add a subscriber
.
Mark default
as true and in the Endpoint URL
part you should enter:
https://${env}.sdk.areyoupoint.com/organizations/integrations/fitbit/:clientId/subscription
Now if you go down the page you can see the Subscribers endpoint stats
part. This is the subscriber that we just created. With this subscriber we're going to be able to retrieve the information from your clients Fitbit activities.
Save the Verification code
that appears in the bottom right part and the Subscriber ID
(the SubscriberId
is the number that appears in the top left corner of the URL) as well!
Gathering all the important information
Now a small recap. We've just created a new Fitbit application and we have a lot of important data! These are the data that you should need from now on:
> OAuth 2.0 Client ID
> Client Secret
> Verification Code
> Subscriber Id
Creating the App Integration in our Dashboard
Now with this information copied and secured you can log into our Dashboard and add a Fitbit Integration.
There you will have to enter these data and also a callback URL. This callback URL is the final redirect that we will send your clients after they authenticate in the Fitbit workflow.
Verifying your Subscriber
After creating the integration in our Dashboard you can go back to the Dev Fitbit Screen and to the Subscribers endpoint stats
section.
Now you can click in the Verify
button. Your subscriber should be now verified and your integration completed!
Requesting Intraday data with Fitbit
Fitbit has the possibility of retrieving intraday data for the metrics but for that you need to fill a form in the Fitbit website. You can read more about that here.
Next Steps
We need to get the user's permission to retrieve their Fitbit data. The Point SDK provides an easy way to do it, or you can do it directly using our Endpoints.