{"id":21247474,"url":"https://github.com/audrow/fitbit-goal-setter","last_synced_at":"2026-05-18T08:34:06.605Z","repository":{"id":45120334,"uuid":"419377835","full_name":"audrow/fitbit-goal-setter","owner":"audrow","description":"Set active steps goals for multiple Fitbit devices.","archived":false,"fork":false,"pushed_at":"2022-01-07T00:38:56.000Z","size":1629,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-30T16:53:17.116Z","etag":null,"topics":["deno","fitbit","health","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/audrow.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-20T15:02:49.000Z","updated_at":"2022-02-11T07:32:29.000Z","dependencies_parsed_at":"2022-09-02T22:33:35.730Z","dependency_job_id":null,"html_url":"https://github.com/audrow/fitbit-goal-setter","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/audrow/fitbit-goal-setter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/audrow%2Ffitbit-goal-setter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/audrow%2Ffitbit-goal-setter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/audrow%2Ffitbit-goal-setter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/audrow%2Ffitbit-goal-setter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/audrow","download_url":"https://codeload.github.com/audrow/fitbit-goal-setter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/audrow%2Ffitbit-goal-setter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33170876,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-18T05:43:36.989Z","status":"ssl_error","status_checked_at":"2026-05-18T05:43:19.133Z","response_time":71,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deno","fitbit","health","typescript"],"created_at":"2024-11-21T02:35:25.524Z","updated_at":"2026-05-18T08:34:06.585Z","avatar_url":"https://github.com/audrow.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# README\n\nThe code in this repository helps with setting walking goals using a Fitbit\ndevice. Data obtained from the Fitbit API is downloaded to a folder called\n`data`; once downloaded, the data is used to count how many active steps the\nuser has done each day and to set daily and weekly active step goals.\n\nThis project uses [Deno](https://deno.land/) and\n[TypeScript](https://www.typescriptlang.org/).\n\n## Setup\n\nNote that you'll need your Fitbit access tokens in this setup. You can see\n[this page](./docs/getting-fitbit-access-tokens.md) for instructions on how to\nget your access token.\n\n1. Open a terminal (Windows PowerShell on Windows).\n1. Install [Deno](https://deno.land/). You can find install instructions on\n   Deno's website or try the commands below.\n   ```bash\n   # For ubuntu/mac\n   curl -fsSL https://deno.land/install.sh | sh\n   ```\n   ```bash\n   # For windows (using PowerShell)\n   iwr https://deno.land/install.ps1 -useb | iex\n   ```\n1. Next let's make an executable for the program on your computer (you also use\n   this command to update this program to a newer version).\n   ```bash\n   deno install --allow-read --allow-write --allow-net --reload https://raw.githubusercontent.com/audrow/fitbit-goal-setter/deploy/build/fitbit-goal-setter.js\n   ```\n   Now you have my program!\n\n   Note that you can uninstall the program by running the following command:\n   ```bash\n   # For ubuntu/mac\n   deno uninstall fitbit-goal-setter\n   ```\n   ```bash\n   # For windows\n   deno uninstall fitbit-goal-setter.cmd\n   ```\n\n   You can test that the program works by running\n   ```bash\n   # For ubuntu/mac\n   fitbit-goal-setter --help\n   ```\n   ```bash\n   # For windows\n   fitbit-goal-setter.cmd --help\n   ```\n   which will output something like the following:\n   ```\n   deno run \u003ccommand\u003e\n\n   Commands:\n     deno run list-devices                  List all devices\n     deno run test-api-keys                 Test API keys\n     deno run goal-status                   Get goal status\n     deno run pull-data                     Pull data from the Fitbit API\n     deno run call-fitbit-api \u003crequest\u003e     Make your own call to the fitbit API fo\n                                           r all devices\n     deno run make-config-file [--minimal]  Make a config file. This doesn't overwr\n                                           ite existing config files, so if you wa\n                                           nt to make another config file, delete\n                                           or rename the existing one.\n\n   Options:\n     -h, --help     Show help                                             [boolean]\n     -v, --version  Show version number                                   [boolean]\n   ```\n   Note that each command begins with `deno run \u003ccommand\u003e`, this is a quirk of\n   the library that I'm using for the command line interface. It should say\n   `fitbit-goal-setter.cmd \u003ccommand\u003e` on Windows and\n   `fitbit-goal-setter \u003ccommand\u003e` on Linux/macOS.\n\n   Also, note that we haven't set up our config file, so you won't be able to\n   run most of the commands yet.\n\n1. Create a directory where you want, and go into it. The directory can be\n   called whatever you want. In the following commands, we create a directory\n   called `fitbit`, but you could use anything else.\n   ```bash\n   mkdir fitbit\n   cd fitbit\n   ```\n   Note that this is the directory where your data will be downloaded to and\n   where you should commands from in the future.\n\n1. Now let's create a configuration file. This is how you'll set various aspects\n   of the system up, such as how you define active steps, the Fitbit API\n   credentials, the study and intervention dates, etc.\n   ```bash\n   # For ubuntu/mac\n   fitbit-goal-setter make-config-file\n   ```\n   ```bash\n   # For windows\n   fitbit-goal-setter.cmd make-config-file\n   ```\n   You should see the following output:\n   ```bash\n   Created config file: config.yaml\n   ```\n1. Now we need to edit the configuration file. You can open the file in any text\n   editor, for example on Windows you can use Notepad. Note that the config file\n   will look better in a code editor, like\n   [Visual Studio Code](https://code.visualstudio.com/).\n   ```bash\n   # For windows\n   notepad.exe .\\config.yaml\n   ```\n   The config file has several comments in it, which are lines that start with\n   #. The comments are intended to help you understand how to use the config\n   file. If you don't like the comments, you can delete the config file and then\n   run the command again with the `--minimal` option.\n   ```bash\n   # For ubuntu/mac\n   # rm ./config.yaml # remove the config file\n   fitbit-goal-setter make-config-file --minimal\n   ```\n   ```bash\n   # For windows\n   # rm .\\config.yaml # remove the config file\n   fitbit-goal-setter.cmd make-config-file --minimal\n   ```\n\n   The main thing is that you must have at least one Fitbit device setup. This\n   requires you to define study and intervention start dates, as well as to get\n   an access token for each Fitbit device that you plan to use. For instructions\n   on getting an access token from Fitbit, see\n   [here](./docs/getting-fitbit-access-tokens.md).\n\n1. Once you have the configuration file setup, you can check the API keys to see\n   if they are correct before proceeding. This command will check if you're able\n   to connect to the Fitbit API at all and if you have access to the intraday\n   steps. Both of these checks are necessary before you can run the rest of the\n   commands.\n   ```bash\n   # For ubuntu/mac\n   fitbit-goal-setter test-api-keys\n   ```\n   ```bash\n   # For windows\n   fitbit-goal-setter.cmd test-api-keys\n   ```\n   If this was not successful, make sure that you're using the right access\n   token and that you have the right permissions to access the Fitbit intra\n   process data. Make sure you've done everything correct in\n   [this page](./docs/getting-fitbit-access-token.md).\n\nNow you're setup! The main command that you'll be using is `goal-status`, which\nprints information on the status of all devices in the configuration file.\n\n```bash\n# For ubuntu/mac\nfitbit-goal-setter goal-status\n```\n\n```bash\n# For windows\nfitbit-goal-setter.cmd goal-status\n```\n\nAll of the data generated from the Fitbit API as well as a summary of each days\nresults is stored in a folder called `data` that will be created for you when\nyou run `goal-status` or `pull-data` (`pull-data` is run automatically when you\nrun `goal-status`). To see the generated data folder, run the command `ls`.\n\nThe files in the `data` folder are CSV files (Comma Separated Values), which\nseparate data by commas. You can open this data file in Excel or any other\nspreadsheet program, like Google Sheets. For each device, there is a summary\npage and then a folder with all of the downloaded intraday steps data.\n\n## Commands\n\n### make-config-file\n\nMakes a dummy configuration file for you. You can then modify the dummy\nconfiguration file to your own liking and add your own Fitbit devices. You can\nuse the `--minimal` option to make a minimal config file, which doesn't have any\nof the comments or whitespace.\n\n### goal-status\n\nThis gets the status of all devices in the configuration file. It will also list\ninformation about each device and its current state in the study.\n\nThis command also pulls data from the Fitbit API and stores it in a folder\ncalled `data`.\n\n### pull-data\n\nThis command is implicitly run when you run `goal-status`. It pulls data from\nthe Fitbit API and stores it in a folder called `data`. It will also create a\nsummary of the data in a file called `summary.csv`.\n\n### list-devices\n\nThis commands lists the devices in the config file. For more detail, see the\nconfig file.\n\n### test-api-keys\n\nThis command performs two checks:\n\n1. It checks if it can communicate with the Fitbit API at all.\n2. It checks if it can access the intraday steps data.\n\nBoth of these are necessary for this program to work. If the first check fails,\nyou likely haven't obtained your Fitbit API key correctly. If the second check\nfails, you likely didn't create the application on Fitbit's site with the\ncorrect permissions. You can either select the application as a personal\napplication, or get explicit permission from Fitbit to access the intraday data.\n\n### call-fitbit-api\n\nThis command lets you run an arbitrary request to the Fitbit API. It will run\nthe command and print the output to the console. For example, you can use this\ncommand to get the last sync information with the Fitbit request URL:\n`https://api.fitbit.com/1/user/-/devices.json` and you will get something like\nthe following:\n\n```\nDevice: My Fitbit Device\n[\n  {\n    battery: \"Medium\",\n    batteryLevel: 60,\n    deviceVersion: \"Alta HR\",\n    features: [],\n    id: \"554003533\",\n    lastSyncTime: \"2021-11-06T08:53:36.000\",\n    mac: \"AA3A580A09C9\",\n    type: \"TRACKER\"\n  }\n]\n```\n\n## FAQ\n\n### How do I upgrade to a newer version of this program?\n\nRun the following command (same command as getting this program for the first\ntime):\n\n```bash\ndeno install --allow-read --allow-write --allow-net --reload https://raw.githubusercontent.com/audrow/fitbit-goal-setter/deploy/build/fitbit-goal-setter.js\n```\n\n### Why can I not connect to the Fitbit API?\n\nMake sure you have gotten the API keys correctly. You may want to retry the\nsteps in [getting the Fitbit access token](./getting-fitbit-access-tokens.md).\n\n### I'm not able to access intraday steps?\n\nMake sure that your Fitbit application is setup correctly. Double check that in\ncreating your application on Fitbit that you have the correct permissions for\nintraday steps data. This can be through selecting a \"personal\" application type\nor from getting explicit permission from Fitbit to use your app with intraday\nsteps data. See\n[getting the Fitbit access token](./getting-fitbit-access-tokens.md) for more\ninformation.\n\n### It seems to be hanging when I run `goal-status`. What's going on?\n\nI'm not sure. I found that this occurred occasionally when I tested on Windows.\nIf it does, just hit Ctrl-C and try again and probably it will finish up and\ngive you the correct output.\n\n### It can't find my config file, what's going on?\n\nMake sure that you are in the same directory that you created the config file\nin. You can do a `ls` to see what files and folders are in your current\ndirectory, and use `cd` to move into the correct directory.\n\n### I'm getting a YAML error, how do I fix it?\n\nYAML is a format for storing data. One of the way data is structured in YAML is\nthrough the spacing. Often you'll get an error where the error mentions how to\nfix it. For example:\n\n```bash\nCheck that your config file 'config.yaml' is valid YAML format\n YAMLError: bad indentation of a mapping entry at line 18, column 2:\n     daily:\n     ^\n    at generateError (https://deno.land/std@0.113.0/encoding/_yaml/loader/loader.ts:161:10)\n    at throwError (https://deno.land/std@0.113.0/encoding/_yaml/loader/loader.ts:174:9)\n    at readBlockMapping (https://deno.land/std@0.113.0/encoding/_yaml/loader/loader.ts:1227:14)\n    at composeNode (https://deno.land/std@0.113.0/encoding/_yaml/loader/loader.ts:1502:13)\n    at readDocument (https://deno.land/std@0.113.0/encoding/_yaml/loader/loader.ts:1688:3)\n    at loadDocuments (https://deno.land/std@0.113.0/encoding/_yaml/loader/loader.ts:1750:5)\n    at load (https://deno.land/std@0.113.0/encoding/_yaml/loader/loader.ts:1780:21)\n    at parse (https://deno.land/std@0.113.0/encoding/_yaml/parse.ts:18:10)\n    at load (file:///Users/audrow/Code/fitbit-script/src/config/index.ts:5:25)\n    at async loadConfig (file:///Users/audrow/Code/fitbit-script/src/index.ts:20:12)\n```\n\nIn this case, you know the line number and that something to do with the\nindentation is wrong. If you go and have a look, you can probably tell what is\nwrong.\n\nOther cases may not be that straight forward. If the error is very confusing, I\nrecommend just regenerating the config file and copying your settings into it.\nYou can do this piece by piece and rerun a command, like `test-api-keys` to see\nwhat you are doing wrong.\n\n### The program was working and now has stopped working, what happened?\n\nIt's likely that you have exceeded Fitbit's call request limit. They let\npersonal applications have up to 150 requests in an hour. If you have exceeded\nthis limit, you will need to wait until the next hour to make another request.\nIf this is the case, here is an example of the error you'll be seeing in\nconsole.\n\n```\nResponse {\n  body: ReadableStream { locked: false },\n  bodyUsed: false,\n  headers: Headers {\n  \"cf-cache-status\": \"DYNAMIC\",\n  \"cf-ray\": \"6a7e4a5c1fb92530-SJC\",\n  connection: \"keep-alive\",\n  \"content-length\": \"99\",\n  \"content-type\": \"application/json\",\n  date: \"Tue, 02 Nov 2021 15:10:34 GMT\",\n  \"expect-ct\": 'max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"',\n  \"fitbit-rate-limit-limit\": \"150\",\n  \"fitbit-rate-limit-remaining\": \"0\",\n  \"fitbit-rate-limit-reset\": \"2966\",\n  \"retry-after\": \"2966\",\n  server: \"cloudflare\",\n  via: \"1.1 google\",\n  \"x-frame-options\": \"SAMEORIGIN\",\n  \"x-gateway-error\": \"ABOVE_RATE_LIMIT\"\n},\n  ok: false,\n  redirected: false,\n  status: 429,\n  statusText: \"Too Many Requests\",\n  url: \"https://api.fitbit.com/1/user/-/activities/steps/date/2021-11-02/1d.json\"\n}\nerror: Uncaught (in promise) Error: Trouble connecting to Fitbit - make sure your credentials are correct: status 429\n    throw new Error(\n          ^\n    at fitbitRequest (file:///Users/audrow/Code/fitbit-script/src/fitbit-api/index.ts:77:11)\n    at async getIntradaySteps (file:///Users/audrow/Code/fitbit-script/src/fitbit-api/index.ts:19:16)\n    at async getStatus (file:///Users/audrow/Code/fitbit-script/src/caching/index.ts:417:29)\n    at async file:///Users/audrow/Code/fitbit-script/src/caching/index.ts:439:13\n```\n\nThe most important part of the error to look for is\n`statusText: \"Too Many Requests\"`, which tells you that you've exceeded the\nnumber of requests you can make in an hour.\n\nIt is also possible that a token you were using expired, although not likely if\nyou followed the instructions in\n[getting the Fitbit access token](./getting-fitbit-access-tokens.md), since we\nset the token to expire after one year. In this case, follow the instructions\nagain to get a new token.\n\n### Can you add a feature?\n\nProbably, just make an issue or send me an email, and we can discuss it.\n\n### I found a bug. How do I report it?\n\nYou can email me, or better yet, create an issue on\n[GitHub](https://github.com/audrow/fitbit-goal-setter/issues/new) (my\npreference). In either case, be sure to tell me what is going on and try to tell\nme how to reproduce it.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faudrow%2Ffitbit-goal-setter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faudrow%2Ffitbit-goal-setter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faudrow%2Ffitbit-goal-setter/lists"}