@davidbolaji/termii-node
Version:
Node.js SDK for Termii API – send SMS, voice, OTP, and manage messaging with ease.
32 lines (31 loc) • 904 B
JavaScript
export class MessageService {
constructor(http) {
this.http = http;
}
/**
* Send a single SMS or WhatsApp message
*
* @param payload - Request payload containing recipient, sender ID, and message details
* @returns Expanded `SendMessageResponse` with message details
*/
async sendMessage(payload) {
return this.http.request("/sms/send", {
method: "POST",
data: payload,
authLocation: "body"
});
}
/**
* Send bulk messages (up to 10,000 recipients)
*
* @param payload - Bulk message request payload
* @returns Expanded `SendBulkMessageResponse` with bulk message status
*/
async sendBulkMessage(payload) {
return this.http.request("/sms/send/bulk", {
method: "POST",
data: payload,
authLocation: "body"
});
}
}