@vonage/messages
Version:
Multi-channel messaging that integrates WhatsApp, Facebook, Viber, SMS, and MMS
51 lines • 1.45 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.WhatsAppCustom = void 0;
const AbstractMessage_1 = require("../AbstractMessage");
/**
* Represents a custom message for WhatsApp.
*
* @group WhatsApp
*/
class WhatsAppCustom extends AbstractMessage_1.AbstractMessage {
channel;
messageType;
custom;
context;
/**
* Sends a custom message to a WhatsApp user.
*
* @param {WhatsAppCustomParams} params - The parameters for creating a WhatsApp custom message.
* @example
* ```ts
* import { WhatsAppCustom } from '@vonage/messages';
*
* const { messageUUID } = await messagesClient.send(new WhatsAppCustom({
* to: TO_NUMBER,
* from: FROM_NUMBER,
* custom: {
* type: 'template',
* template: {
* namespace: 'your-namespace',
* name: 'your-template-name',
* },
* }
* clientRef: 'my-personal-reference',
* }));
*
* console.log(`Message sent successfully with UUID ${messageUUID}`);
* ```
*/
constructor(params) {
super(params);
this.custom = params.custom;
this.channel = 'whatsapp';
this.messageType = 'custom';
/* istanbul ignore next */
if (params.context) {
this.context = params.context;
}
}
}
exports.WhatsAppCustom = WhatsAppCustom;
//# sourceMappingURL=WhatsAppCustom.js.map