Notifications
Use @stendar/notifications to route high-signal events to external channels.
Available notifiers
Section titled “Available notifiers”TelegramNotifier(botToken,chatId)DiscordNotifier(webhookUrl)WebhookNotifier(url, optionalheaders, optional HMACsecret)
All notifiers support:
events: list ofRuntimeEventsto subscribe tominSeverity:info|warn|error
Wiring a notifier
Section titled “Wiring a notifier”import { TypedEmitter, type RuntimeEvents } from '@stendar/core';import { TelegramNotifier } from '@stendar/notifications';
const events = new TypedEmitter<RuntimeEvents>();
const telegram = new TelegramNotifier({ botToken: process.env.TELEGRAM_BOT_TOKEN!, chatId: process.env.TELEGRAM_CHAT_ID!, minSeverity: 'warn', events: ['runtime:error', 'strategy:approval_required', 'strategy:circuit_breaker'],});
telegram.subscribe(events);Add TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID to your .env file (see Installation).
Forward runtime events into notifier bus
Section titled “Forward runtime events into notifier bus”DeFiRuntime exposes runtime.on(...); bridge those callbacks into your shared emitter:
runtime.on('runtime:error', (error) => events.emit('runtime:error', error));runtime.on('policy:decision', (decision, intent) => events.emit('policy:decision', decision, intent),);runtime.on('tx:confirmed', (confirmation) => events.emit('tx:confirmed', confirmation),);Webhook signing
Section titled “Webhook signing”When using WebhookNotifier with secret, payloads include:
X-Stendar-Signature: sha256=<hex-digest>
Use this for signature verification in your receiving service.
Pair this with Security model for production operations.