feat: Region-aware webhook system for enterprise course completion #89
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.
This pull request introduces a robust, region-aware webhook system for enterprise course completion and enrollment events. It adds new models to store webhook configurations and transmission queues, implements event handlers to queue webhooks for enterprise learners, and includes logic to determine user region from SSO metadata. The changes focus on reliable delivery, security (including SSRF protections), and deduplication of webhook transmissions.
Webhook models and database schema:
EnterpriseWebhookConfigurationandWebhookTransmissionQueuemodels to support region-specific webhook URLs, transmission queuing, deduplication, retries, and status tracking. Includes constraints and indexes for efficient lookups and uniqueness. (channel_integrations/integrated_channel/models.py,channel_integrations/integrated_channel/migrations/0006_add_webhook_models.py) [1] [2]Event handling and queuing:
handle_grade_change_for_webhooks,handle_enrollment_for_webhooks) that process OpenEdX grade and enrollment events, prepare payloads, and queue webhook transmissions for enterprise learners based on configuration and region. (channel_integrations/integrated_channel/handlers.py)User region detection:
channel_integrations/integrated_channel/services/region_service.py)Security improvements:
channel_integrations/integrated_channel/models.py)Dependency and import updates:
ipaddress, URL parsing, and Django validators. (channel_integrations/integrated_channel/models.py)Merge checklist:
Check off if complete or not applicable: