Skip to content
Aurabase Logo
aurabase

JavaScript SDK: notifications reference

Every method for sending and administering notifications, with its signature.

Reference6 min readLevel reference

NotificationsService#

PropertyDescription
readonly admin: NotificationsAdminServiceAdministration subclient: statistics, queue, scrap (DLQ), supplier logs, events, rules and settings.
MethodDescription
send(options: SendNotificationOptions): Promise<AuraResponse<Notification>>
send(channel: NotificationChannel, recipient: string, body: string, options?: { subject?: string; templateId?: string; variables?: Record<string, unknown>; metadata?: Record<string, unknown>; idempotencyKey?: string; }): Promise<AuraResponse<Notification>>
Queues a notification to be sent (Modern Object API).
sendBatch(items: Array<SendNotificationRequest | SendNotificationItem>): Promise<AuraResponse<BatchSendResponse>>Sends a batch of notifications (POST /send/batch).
sendEmail(options: SendEmailPayload): Promise<AuraResponse<Notification>>
sendEmail(recipient: string, subject: string, body: string, options?: SendEmailOptions): Promise<AuraResponse<Notification>>
Sends a transactional email (channel: 'email').
sendSms(options: SendSmsPayload): Promise<AuraResponse<Notification>>
sendSms(recipient: string, body: string, options?: SendSmsOptions): Promise<AuraResponse<Notification>>
Sends a transactional SMS (channel: 'sms').
sendPush(options: SendPushPayload): Promise<AuraResponse<Notification>>
sendPush(recipient: string, title: string, body: string, options?: SendPushOptions): Promise<AuraResponse<Notification>>
Sends a mobile push notification (channel: 'push', FCM or APNs).
sendWebhook(targetUrl: string, event: string, payload: string | Record<string, unknown>, options?: SendWebhookOptions): Promise<AuraResponse<Notification>>Issues an outgoing HTTP POST webhook (channel: 'webhook').
retry(id: string): Promise<AuraResponse<Notification>>Retry a failed notification (status: 'failed' or 'dead_lettered').
list(options?: { channel?: NotificationChannel; status?: NotificationStatus; search?: string; sort?: 'created_at' | 'updated_at' | 'status'; order?: 'asc' | 'desc'; limit?: number; offset?: number; }): Promise<AuraResponse<Notification[]>>Lists the project's notification history, filterable by channel, status and search, sorted by created_at, updated_at or status, with limit / offset pagination.
get(id: string): Promise<AuraResponse<Notification>>Reads a notification by its identifier.
listTemplates(): Promise<AuraResponse<NotificationTemplate[]>>Lists the project message templates.
getTemplate(id: string): Promise<AuraResponse<NotificationTemplate>>Reads a message template by its identifier.
createTemplate(template: Omit<NotificationTemplate, 'id' | 'project_id' | 'created_at' | 'updated_at'>): Promise<AuraResponse<NotificationTemplate>>Creates a template — name, channel, subject, body, and nothing else.
updateTemplate(id: string, updates: Partial<Pick<NotificationTemplate, 'name' | 'subject' | 'body'>>): Promise<AuraResponse<NotificationTemplate>>Updates a template: name, subject and/or body.
deleteTemplate(id: string): Promise<AuraResponse<null>>Deletes a message template.

NotificationsAdminService#

MethodDescription
getSettings(): Promise<AuraResponse<NotificationSettingsPublic>>Retrieves the project's public supplier and quota settings (GET /settings).
updateSettings(settings: NotificationSettingsPatch | Partial<NotificationSettings>): Promise<AuraResponse<NotificationSettingsPublic>>Updates the project's supplier or quota settings (PATCH /settings).
getStats(options?: { window?: NotificationStatsWindow; channel?: NotificationChannel; }): Promise<AuraResponse<NotificationStats>>Aggregated sending statistics (GET /stats).
getQueue(): Promise<AuraResponse<NotificationQueueStats>>Reads the status of the sending queue: depth and distribution of pending notifications.
listAttempts(notificationId: string): Promise<AuraResponse<NotificationAttempt[]>>Lists attempts to send a notification, with the provider's response to each.
listDeadLetters(options?: { channel?: NotificationChannel; search?: string; limit?: number; offset?: number; }): Promise<AuraResponse<NotificationDeadLetter[]>>Lists notifications placed in the garbage queue (DLQ), filterable by channel and search.
retryDeadLetter(id: string): Promise<AuraResponse<Notification>>Resends a specific notification from the scrap queue (DLQ).
listEvents(options?: { status?: 'received' | 'matched' | 'ignored' | 'failed' | 'enqueued'; limit?: number; offset?: number; }): Promise<AuraResponse<NotificationEvent[]>>Lists events received by the rules engine, filterable by status.
listProviderLogs(options?: { channel?: NotificationChannel; status?: NotificationAttemptStatus; limit?: number; offset?: number; }): Promise<AuraResponse<NotificationProviderLog[]>>Third-party vendor execution logs (GET /providers/logs).
previewTemplate(id: string, variables: Record<string, unknown>): Promise<AuraResponse<NotificationTemplatePreview>>Renders a model with the given variables for preview, without sending a message.
listRules(): Promise<AuraResponse<NotificationRule[]>>Lists the project notification rules (automatic triggering of a sending).
createRule(rule: CreateNotificationRuleRequest): Promise<AuraResponse<NotificationRule>>Creates a notification rule: for each event of type trigger_type which checks condition, a message is sent on channel to the recipient given by recipient_expr, with an optional delay.
getRule(id: string): Promise<AuraResponse<NotificationRule>>Reads a notification rule by its identifier.
updateRule(id: string, updates: UpdateNotificationRuleRequest): Promise<AuraResponse<NotificationRule>>Updates a notification rule: only the provided fields change (for example enabled).
deleteRule(id: string): Promise<AuraResponse<null>>Deletes a notification rule.
Generated page

This page is generated from the type declarations and comments of the SDK, so it cannot drift from the published code. For worked examples, read the guides.

@aurabase/aurabase-js@0.7.5 · aura@0.3.4↗ Report a problem