UNPKG

@vonage/messages

Version:

Multi-channel messaging that integrates WhatsApp, Facebook, Viber, SMS, and MMS

65 lines 1.9 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.WhatsAppSticker = void 0; const AbstractMessage_1 = require("../AbstractMessage"); /** * Represents a sticker message for WhatsApp. * * @group WhatsApp */ class WhatsAppSticker extends AbstractMessage_1.AbstractMessage { channel; messageType; sticker; context; /** * Send a sticker message to a WhatsApp user. * * @param {WhatsAppStickerParams} params - The parameters for creating a WhatsApp sticker message. * @example * Send a sticker message with a sticker ID: * ```ts * import { WhatsAppSticker } from '@vonage/messages'; * * const { messageUUID } = await messagesClient.send(new WhatsAppSticker({ * to: TO_NUMBER, * from: FROM_NUMBER, * sticker: { * id: '0-0', * }, * clientRef: 'my-personal-reference', * })); * * console.log(`Message sent successfully with UUID ${messageUUID}`); * ``` * * @example * Send a sticker message with a sticker URL: * ```ts * import { WhatsAppSticker } from '@vonage/messages'; * * const { messageUUID } = await messagesClient.send(new WhatsAppSticker({ * to: TO_NUMBER, * from: FROM_NUMBER, * sticker: { * url: 'https://example.com/sticker.png', * }, * clientRef: 'my-personal-reference', * })); * * console.log(`Message sent successfully with UUID ${messageUUID}`); * ``` */ constructor(params) { super(params); this.sticker = params.sticker; this.channel = 'whatsapp'; this.messageType = 'sticker'; /* istanbul ignore next */ if (params.context) { this.context = params.context; } } } exports.WhatsAppSticker = WhatsAppSticker; //# sourceMappingURL=WhatsAppSticker.js.map