Skip to main content
zerotal

Documentation


Documentation / @zerotal/notifications / SmsChannel

Class: SmsChannel

Defined in: notifications/src/SmsChannel.ts:59

SMS notification channel — sends via Twilio or Vonage REST APIs.

No npm dependencies — uses the global fetch API.

Configure in config/notifications.ts: sms: { driver: 'twilio', twilio: { accountSid: Bun.env['TWILIO_ACCOUNT_SID'] ?? '', authToken: Bun.env['TWILIO_AUTH_TOKEN'] ?? '', from: Bun.env['TWILIO_FROM'] ?? '', }, }

Usage in a Notification: channels() { return ['sms']; } toSms(_notifiable: Notifiable): SmsMessage { return { body: 'Your code is 1234' }; // delivered to notifiable.phone }

Constructors

Constructor

new SmsChannel(config): SmsChannel

Defined in: notifications/src/SmsChannel.ts:60

Parameters

config

SmsConfigShape

Returns

SmsChannel

Methods

send()

send(notifiable, notification): Promise<void>

Defined in: notifications/src/SmsChannel.ts:62

Parameters

notifiable

Notifiable

notification

Notification

Returns

Promise<void>