twenty-four: strava service
The Strava service processes activities automatically. Adds emojis, tags commutes, mutes short walks, assigns gear, and syncs to Intervals.icu.
The Problem
Every Strava activity needs housekeeping:
- Add emoji to activity name (🏃 Run, 🚴 Ride, 💪 Strength, etc.)
- Tag commutes (home ↔ work, home ↔ dojo)
- Assign the correct gear (roadie, gravel, trainer, running shoes)
- Mute short walks from the feed (< 2km)
- Hide activities that shouldn’t be public
This is tedious when you upload 15+ activities a week.
The Solution
Automated processing via Strava API:
|
|
Runs via CronJob every 15 minutes. Processes new activities, ignores already-processed ones.
Emoji Injection
Activity names get emoji prefixes based on type:
|
|
Special cases:
Metabolic conditioning classes (from gym) get ❤️🔥:
|
|
This matches the gym service emoji mapping, so activities created manually vs. synced from ICU look consistent.
Commute Detection
Strava has commute tagging, but it’s manual. Automate it based on start/end location.
Coordinates:
|
|
Commute logic:
|
|
Works great for bike rides. Doesn’t work for runs (I don’t run commute routes). Could add more route detection but haven’t needed it yet.
Gear Assignment
Strava tracks gear (bikes, shoes) but you have to manually assign it to each activity.
Gear IDs (fetched once from Strava API):
|
|
Assignment logic:
|
|
Walk Muting
Short walks (< 2km) clutter the feed. Mute them:
|
|
This hides the activity from followers’ feeds but keeps it in my activity list. Lots of 1:1s.
API Rate Limits
Strava API has rate limits:
- 100 requests per 15 minutes
- 1000 requests per day
With 15+ activities per week and processing every 15 minutes, this is tight.
Optimization:
Only process activities modified in the last 30 days:
|
|
Batch updates where possible (though Strava API doesn’t support true batching).
Use cache to skip already-processed activities.
Haven’t hit the rate limit yet, but it’s close during high-volume weeks.
Endpoints
|
|
The CronJob hits /sync every 15 minutes. Can also trigger manually after uploading a new activity.
What Worked
Emoji automation: Scanning my Strava feed is way easier when activities have visual prefixes.
Commute detection: Tagging commutes automatically keeps my fans from getting bored.
Gear assignment: Forgot what this was like before. Now I just upload activities and the right gear gets assigned. Still need to do shoes…
Walk muting: Lots of short walks.
See also: Part 0: The Platform | Part 1: Building with Claude | Part 2: Calendar Service | Part 3: Gym Service | Part 5: Workout Generator | Part 6: AI Recommendations | Part 7: Service Consolidation | Part 8: What’s Next
🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com