Based on Log Strava Activity in Notion
- Node.js
- A Strava Developer account
- A Notion account
- Log in to your Strava account.
- Go to Strava API.
- Click on Create An App
- Fill in the required details and click Create.
- Copy the Client ID and Client Secret.
- Log in to your Notion account.
- Go to Notion Integrations.
- Click on New Integration.
- Fill in the required details and click Submit.
- Copy the generated Internal Integration Token.
- Create a new database in Notion with the following properties:
- ID (Title)
- Name (Title)
- Distance (Number)
- Pace (Text)
- Duration (Text)
- Elevation Gain (Number)
- Type (Text)
- Date (Date)
- Share the database with your integration:
- Click on the three dots in the top-right corner of the page.
- Under Connections, click on Connect to and search for your integration and invite it.
cp .env-example .env
And set all the variables:
NOTION_TOKEN=
NOTION_DATABASE_ID=
STRAVA_CLIENT_ID=
STRAVA_CLIENT_SECRET=
STRAVA_ACCESS_TOKEN=
STRAVA_REFRESH_TOKEN=
Warning
Please note that you will have to update your .env
file with your STRAVA_ACCESS_TOKEN
and STRAVA_REFRESH_TOKEN
after completing Strava’s OAuth flow.
npm install
npm run build
- Start the OAuth Server:
node run server
- Open your browser and navigate to http://localhost:3000:
- You should see a page with a link to authorize with Strava.
- Click the link to authorize with Strava:
- This will redirect you to Strava's authorization page.
- Authorize the application:
- Strava will redirect you to a page with an authorization code.
- The server will exchange the authorization code for an access token and refresh token:
- The tokens will be displayed on the page.
- Copy the refresh token and update your
.env
file with it.
npm start
npm run format