Getting started guide to CjFit

The CjFit app needs integration with Fitbit API. To integrate Fitbit, you need to create an app on Fitbit site and enter the API keys in CjFit options.

Setup Fitbit App

  1. Go to https://dev.fitbit.com/apps
  2. Create a new app with the details mentioned in your CjFit dashboard page
  3. While creating your app, please create a subscriber as well.
  4. You can find your API client id and client secret keys on your app page
  5. Fill the Client ID, Client Secret and Verification Code in CjFit Options
  6. Once you fill in the options, go to your Fitbit app page and click on verify link on the subscriber row
  7. Your subscription verification is completed now and you are ready to use the app on your site.

Creating Cronjob

  1. Get the cronjob url from the CjFit dashboard page
  2. Create a cronjob to execute every hour and trigger the cron url available in your CjFit administrator dashboard page.

Related Links: http://wiki.corejoomla.com/Setup_cronjob_to_trigger_emails_automatically

Create Menu Items

  1. Go to Menus -> Main Menu
  2. Create CjFit dashboard menu item

When you access the menu item from front-end, it will show the logged in user’s dashboard if the user is already connected to Fitbit. If the user is not connected to the Fitbit, a button will be shown to proceed to authorize Fitbit with your site. User dashboard will be visible to other users only when he authorized your site to connect to Fitbit.

How it works

  1. When the user account is connected to Fitbit by authorizing with his Fitbit account, CjFit stores OAuth token of the user shared by Fitbit.
  2. CjFit will create a user subscription with Fitbit so that Fitbit can send updates about the user workouts.
  3. Fitbit will notify, your site in the background, user data whenever there is an update available.
  4. The cronjob, which you setup, will get these updates every hour and fetch user data using Fitbit API.