Skip to content

A utility that runs on AWS Lambda to rename and tag commute rides on Strava

License

Notifications You must be signed in to change notification settings

dcarley/strava-commute

Repository files navigation

CircleCI

strava-commute

A utility that runs on AWS Lambda to rename and tag commute rides on Strava.

It is inspired by Alex Muller's lambda-strava-commute-namer. I started from scratch because I wanted to try out:

Usage

Prerequisites

  1. Install Terraform.

  2. Export your AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.

  3. Create an S3 bucket to store state and initialise Terraform:

     make init BUCKET_SUFFIX=<your_suffix>
    
  4. Create an API application from your settings on Strava with a callback domain of localhost:8080.

  5. Create an API token that has write and view_private scopes for your account using dcarley/oauth2-cli:

     oauth2-cli \
       -scope write,view_private \
       -id <your_client_id> \
       -secret <your_client_secret> \
       -auth https://www.strava.com/oauth/authorize \
       -token https://www.strava.com/oauth/token
    
  6. Email developers@strava.com to ask them to enable webhook push subscriptions for your application. Include your application client ID and a brief description of what your application does.

Config

Write a config file to dist/config.json in the following format:

{
  "gear_id": "b12345",
  "locations": {
    "London": {
      "min": [-0.510375, 51.286758],
      "max": [0.334015, 51.691875]
    },
    "Sheffield": {
      "min": [-1.801472, 53.304512],
      "max": [-1.324669, 53.503128]
    }
  }
}

Notes about the format:

  • The name of each location will be append to activities that have a matching start and/or end location. You can use a bounding box utility to generate the longitude and latitude co-ordinates.
  • The gear_id is optional. If present all activities with matching locations will be tagged with it. You can get the ID from the URL when looking at your bike/shoes on Strava, but you need to prefix it with b for bikes and g for shoes.

Deployment

  1. Export your Strava API token as STRAVA_API_TOKEN.

  2. Build, package, and deploy:

     make
    
  3. Create a push subscription if you're deploying for the first time or the URL has changed:

     make register \
       STRAVA_CLIENT_ID=<your_client_id> \
       STRAVA_CLIENT_SECRET=<your_client_secret>
    

About

A utility that runs on AWS Lambda to rename and tag commute rides on Strava

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages