Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.velahq.xyz/docs/llms.txt

Use this file to discover all available pages before exploring further.

Rules watch for events matching a name and optional conditions, then deliver alerts to configured destinations (Slack, Discord, or email).
Destinations are configured in the Vela dashboard. The SDK references them by ID.

List rules

const rules = await appRes.notificationRules.list();

Create a rule

const rule = await appRes.notificationRules.create({
  name: 'Alert on large payment failure',
  eventName: 'payment.failed',
  enabled: true, // optional, defaults to true
  conditions: [
    {
      id: 'cond-1',
      field: 'amountCents',
      operator: 'greater_than',
      value: 10000,
    },
  ],
  actions: [
    {
      id: 'action-1',
      destinationId: 'dest-uuid-here',
      channel: 'slack',
      enabled: true,
    },
  ],
});
Pass an empty conditions array to trigger on every matching event regardless of payload.

Update a rule

// Pause a rule
await appRes.notificationRules.update(rule.id, { enabled: false });

// Update conditions
await appRes.notificationRules.update(rule.id, {
  conditions: [
    { id: 'cond-1', field: 'amountCents', operator: 'greater_than', value: 50000 },
  ],
});

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 value as substring
starts_withString field starts with value