Skip to main content

List rules

rules = app_res.notification_rules.list()

Create a rule

rule = app_res.notification_rules.create({
    "name": "Alert on large payment failure",
    "event_name": "payment.failed",
    "enabled": True,
    "conditions": [
        {
            "id": "cond-1",
            "field": "amountCents",
            "operator": "greater_than",
            "value": 10000,
        },
    ],
    "actions": [
        {
            "id": "action-1",
            "destination_id": "dest-uuid-here",
            "channel": "slack",
            "enabled": True,
        },
    ],
})
Pass an empty conditions list to trigger on every matching event.

Update a rule

# Pause a rule
app_res.notification_rules.update(rule.id, {"enabled": False})

Condition operators

OperatorDescription
equalsField strictly equals value
not_equalsField does not equal value
greater_thanNumeric field is greater than value
less_thanNumeric field is less than value
containsString field contains substring
starts_withString field starts with value