UNPKG

@vulog/aima-notifier

Version:

Email notification sending.

65 lines (46 loc) 1.21 kB
# @vulog/aima-notifier Email notification sending. ## Installation ```sh npm install @vulog/aima-notifier @vulog/aima-client @vulog/aima-core ``` ## Usage ```ts import { getClient } from '@vulog/aima-client'; import { sendEmail } from '@vulog/aima-notifier'; const client = getClient({ /* client options */ }); await sendEmail(client, { to: ['user@example.com'], type: 'trip_confirmation', lang: 'en', bodyData: { userName: 'Jane Doe', tripId: 'trip-uuid', }, }); ``` ## API Reference ### sendEmail ```ts sendEmail(client: Client, data: SendEmailParam): Promise<void> ``` Sends an email using a notifier service template. Recipient addresses in `to[]` are validated as valid email addresses. **Params:** `client` — Authenticated AIMA client; `data` — email payload **Returns:** `Promise<void>` > The `type` field is a free-form string. Available template names depend on the notifier service configuration, not on this SDK. ## Types ### SendEmailParam ```ts interface SendEmailParam { bodyData: SendEmailData; lang: string; to: string[]; type: string; } ``` ### SendEmailData ```ts interface SendEmailData { [key: string]: any; } ```