Skip to content

Conversation

@irfanuddinahmad
Copy link

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:

  • Added EnterpriseWebhookConfiguration and WebhookTransmissionQueue models 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:

  • Implemented event handlers (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:

  • Added a service to determine user region from SSO metadata, country codes, or enterprise customer info, with fallback logic and mapping for GDPR/EU, UK, US, and other regions. (channel_integrations/integrated_channel/services/region_service.py)

Security improvements:

  • Enforced SSRF protections in webhook configuration validation: requires HTTPS, blocks localhost, private/reserved IPs, and reserved hostnames. (channel_integrations/integrated_channel/models.py)

Dependency and import updates:

  • Added necessary imports for new functionality, including ipaddress, URL parsing, and Django validators. (channel_integrations/integrated_channel/models.py)

Merge checklist:
Check off if complete or not applicable:

  • Version bumped
  • Changelog record added
  • Documentation updated (not only docstrings)
  • Fixup commits are squashed away
  • Unit tests added/updated
  • Manual testing instructions provided
  • Noted any: Concerns, dependencies, migration issues, deadlines, tickets

@irfanuddinahmad irfanuddinahmad changed the title Iahmad/webhook completion feat: Region-aware webhook system for enterprise course completion Jan 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants