Skip to content

Webhook Conditional Routing #834

Description

@DokaIzk

Title: feat: add conditional routing for webhooks based on event properties

Labels: enhancement feature
Complexity: medium
Branch: feat/webhook-conditional-routing


Problem Context

Subscribers want to filter webhook deliveries by event properties (e.g., "only send if amount > 1000 XLM"). Without this, they receive all events and must filter client-side, wasting bandwidth and latency.


Scope

Included:

  • Condition DSL: JSON-based rules for event filtering
  • Operators: eq, gt, gte, lt, lte, in, contains, regex
  • Nested conditions: AND/OR/NOT logic
  • UI for building conditions
  • Dry-run: test condition against sample events

Not included:

  • Complex CEP (event stream processing)

Implementation Guidelines

Model updates:

class WebhookSubscription(models.Model):
    # ... existing fields ...
    filter_condition = models.JSONField(blank=True, null=True)

Condition DSL example:

{
  "op": "and",
  "conditions": [
    { "field": "decodedPayload.amount", "op": "gte", "value": 1000 },
    { "field": "event_type", "op": "eq", "value": "transfer" }
  ]
}

Constraints:

  • Condition evaluation must be <1ms per event
  • Conditions stored as JSON, not in code

Acceptance Criteria

  • Condition DSL supports all operators
  • Nested AND/OR/NOT conditions work
  • Webhook dispatch only sends if condition passes
  • Dry-run tests condition
  • Admin UI builds conditions visually


Metadata

Metadata

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions