Skip to main content

Prerequisites

  • A Vela account with an app created in the dashboard
  • Your client secret (vela_cs_...) and API key (vela_live_...)

Step 1: Install an SDK

npm install @vela/sdk

Step 2: Register an event schema

Before ingesting events, you need to define their shape. This tells Vela what fields to expect and validate.
import { VelaManagementClient } from '@vela/sdk';

const client = new VelaManagementClient(process.env.VELA_CLIENT_SECRET);
const appRes = client.forApp('my-app');

await appRes.schemas.create({
  eventName: 'order.placed',
  description: 'Emitted when a checkout completes',
  fields: [
    { id: 'fld-order-id', name: 'orderId', type: 'string', required: true },
    { id: 'fld-amount', name: 'amountCents', type: 'number', required: true },
  ],
});

Step 3: Send an event

import { VelaIngestClient } from '@vela/sdk';

const ingest = new VelaIngestClient(process.env.VELA_API_KEY);

const result = await ingest.ingest({
  event: 'order.placed',
  data: { orderId: 'ord_abc123', amountCents: 4999 },
  level: 'info',
});

console.log(result.accepted); // 1

Step 4: Set up a notification rule (optional)

Get alerted when specific events occur:
await appRes.notificationRules.create({
  name: 'Alert on payment failure',
  eventName: 'payment.failed',
  conditions: [],
  actions: [
    {
      id: 'action-1',
      destinationId: 'dest-uuid-from-dashboard',
      channel: 'slack',
      enabled: true,
    },
  ],
});

Next steps

TypeScript SDK

Full TypeScript SDK reference.

Python SDK

Full Python SDK reference.

CLI

Manage schemas as code with the Vela CLI.

Schemas

Learn about field types and validation.