Backend: Implement Strava webhook registration and event processing#100
Merged
Backend: Implement Strava webhook registration and event processing#100
Conversation
Co-authored-by: apdarr <3004606+apdarr@users.noreply.github.com>
Co-authored-by: apdarr <3004606+apdarr@users.noreply.github.com>
Co-authored-by: apdarr <3004606+apdarr@users.noreply.github.com>
Co-authored-by: apdarr <3004606+apdarr@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add Strava webhook registration and configuration
Backend: Implement Strava webhook registration and event processing
Oct 20, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Implements the backend infrastructure for Strava webhook integration, enabling real-time activity synchronization as outlined in issue #59. This replaces the need for manual bulk imports by automatically processing activity create, update, and delete events from Strava.
What's New
Database Schema
Added webhook tracking fields to support subscription management:
users.strava_webhook_subscription_id- Stores Strava's subscription IDusers.webhook_verify_token- Token for webhook verificationplans.webhook_enabled- Boolean flag to enable/disable webhooks per planWebhook Endpoints
Verification Endpoint (
GET /webhooks/strava)Event Endpoint (
POST /webhooks/strava)Core Components
StravaWebhookService (
app/services/strava_webhook_service.rb)Manages webhook subscription lifecycle through Strava's Push Subscriptions API:
ProcessStravaWebhookJob (
app/jobs/process_strava_webhook_job.rb)Processes webhook events asynchronously:
createeventsupdateeventsdeleteeventsWebhooks::StravaController (
app/controllers/webhooks/strava_controller.rb)Implementation Details
Strava API Constraints
Strava allows only one webhook subscription per application (not per user). The implementation handles this by:
owner_idin webhook payloadstrava_idto route events to the correct accountSecurity
Testing
Comprehensive test coverage with VCR cassettes for all HTTP interactions:
Documentation
Added complete setup and usage guide in
docs/STRAVA_WEBHOOKS.mdcovering:Future Work
This PR provides the backend foundation. Future PRs will add:
Closes #60 (Backend portion of #59)
Original prompt
Fixes #97
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.