UNPKG

@vonage/messages

Version:

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

71 lines 2.13 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.WhatsAppSticker = void 0; const AbstractMessage_1 = require("../AbstractMessage"); const MessageTypes_1 = require("../../enums/MessageTypes"); const enums_1 = require("../../enums"); /** * Represents a sticker message for WhatsApp. * * @group WhatsApp */ class WhatsAppSticker extends AbstractMessage_1.AbstractMessage { /** * The channel for this message (always 'whatsapp'). */ channel = enums_1.Channels.WHATSAPP; /** * The type of message (always 'sticker'). */ messageType = MessageTypes_1.MessageTypes.STICKER; 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; /* istanbul ignore next */ if (params.context) { this.context = params.context; } } } exports.WhatsAppSticker = WhatsAppSticker; //# sourceMappingURL=WhatsAppSticker.js.map