2.3.1 • Published 1 month ago

hubot-fitbit-leaders v2.3.1

Weekly downloads
2
License
MIT
Repository
github
Last release
1 month ago

Hubot Fitbit Leaders

npm version Node CI

This script is designed to be used with a Hubot to compare the Fitbit activity of your friends.

Adding to Your Hubot

See full instructions here.

  1. npm install hubot-fitbit-leaders --save (updates your package.json file)
  2. Open the external-scripts.json file in the root directory (you may need to create this file) and add an entry to the array (e.g. [ 'hubot-fitbit-leaders' ]).

Commands

  • hubot fitbit setup - Run through the setup process for the bot (for admins)
  • hubot fitbit leaders - Show table of leaders
  • hubot fitbit register - Show how to friend the bot
  • hubot fitbit approve - Approve all pending requests

Upgrading from 1.0.x?

You will need to update your FITBIT_CLIENT_ID and generate a new FITBIT_OAUTH_TOKEN using the steps below. You no longer need the FITBIT_OAUTH_TOKEN_SECRET configuration variable. Note that you will have to go through this process at least once a year (the Implicit grant type token is time-limited.)

Configuration

Environment VariableDescription
FITBIT_CLIENT_IDObtained from the app registration.
FITBIT_CLIENT_SECRETObtained from the app registration.
FITBIT_REDIRECT_URLRedirect URL, must mach app registration.
FITBIT_OAUTH_TOKENFound in the callback response, lasts one year.

Register the three values as environment variables when starting your bot (as usual with Hubot scripts) using export or heroku config:set or whatever applies to your Hubot hosting environment.

Suggested Setup

  • Decide whether you want to use a user account or create a "robot" account to use with Fitbit
  • Go to the Fitbit Developer App Registration Page and register an application
  • The "Callback URL" field can be any running public web server. I prefer to use a RunScope bucket.
  • The "OAuth 2.0 Application Type: is "Client"
  • The application will need "Read & Write" access (for friend requests)
  • Note the Client ID and Client Secret. Go ahead and add those to your configuration file and restart Hubot.
  • Run the Fitbit setup command, e.g. hubot fitbit setup
  • A URL will be displayed that contains your configured Client ID, but is missing the registered callback URL. Plug that in, then go through the authorization steps.
  • Upon a successful authorization, the URL will appear in your browser containing your access token. It's very long, so make sure you grab everything between the = and the next &. Place these values into your configuration and restart Hubot.
  • If all went well, type hubot register and see if you receive a response.

Troubleshooting

  • Remember that the token expires after a year, so be prepared to go through these steps at least that often (replacing the Access Token).
  • Double check your saved configuration to make sure it matches the values displayed in the Fitbit application.
  • The callback step is a bit tricky. The few times I've run it, I ended up with a server error, but was still able to retrieve the Access Token from the URL.
2.3.1

1 month ago

2.3.0

5 months ago

2.2.18

5 months ago

2.2.17

11 months ago

2.2.15

2 years ago

2.2.16

1 year ago

2.2.13

2 years ago

2.2.14

2 years ago

2.2.11

2 years ago

2.2.12

2 years ago

2.2.10

2 years ago

2.2.9

2 years ago

2.2.8

3 years ago

2.2.7

3 years ago

2.2.6

3 years ago

2.2.5

4 years ago

2.2.4

4 years ago

2.2.3

4 years ago

2.2.2

4 years ago

2.2.1

4 years ago

2.2.0

4 years ago

2.1.7

5 years ago

2.1.6

5 years ago

2.1.5

6 years ago

2.1.4

6 years ago

2.1.3

6 years ago

2.1.2

6 years ago

2.1.1

6 years ago

2.1.0

6 years ago

2.0.3

8 years ago

2.0.2

8 years ago

2.0.1

8 years ago

2.0.0

8 years ago

1.1.0

9 years ago

1.0.4

9 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.0

10 years ago