@vonage/messages
Version:
Multi-channel messaging that integrates WhatsApp, Facebook, Viber, SMS, and MMS
65 lines • 2.14 kB
TypeScript
import { AbstractTextMessage } from '../AbstractTextMessage';
import { SMSExtraParams, SMSParams } from '../../types';
import { Channels } from '../../enums';
/**
* Send a text message using the SMS channel.
*
* @group SMS
*/
export declare class SMS extends AbstractTextMessage implements SMSParams {
/**
* The channel for this message (always 'sms').
*/
channel: Channels.SMS;
sms?: SMSExtraParams;
/**
* The duration in seconds the delivery of an SMS will be attempted. By
* default Vonage attempts delivery for 72 hours, however the maximum
* effective value depends on the operator and is typically 24 - 48 hours. We
* recommend this value should be kept at its default or at least 30 minutes.
*/
ttl?: number;
/**
* Send an SMS message
*
* @param {MessageParamsText | string} params - The message parameters or text message.
* @param {string} to - The recipient's phone number.
* @param {string} from - The sender's phone number.
* @param {string} clientRef - The client reference for the message.
*
* @example
* ```ts
* import { SMS } from '@vonage/messages';
*
* const { messageUUID } = await messagesClient.send(new SMS({
* to: TO_NUMBER,
* from: FROM_NUMBER,
* text: 'Hello world',
* clientRef: 'my-personal-reference',
* }));
*
* console.log(`Message sent successfully with UUID ${messageUUID}`);
* ```
*
* @example
* Send SMS with entity ID and content ID
* ```ts
* import { SMS } from '@vonage/messages';
*
* const { messageUUID } = await messagesClient.send(new SMS({
* to: TO_NUMBER,
* from: FROM_NUMBER,
* text: 'Hello world',
* clientRef: 'my-personal-reference',
* sms: {
* entityId: 'MyEntityID',
* contentId: 'MyContentID'
* }
* }));
*
* console.log(`Message sent successfully with UUID ${messageUUID}`);
* ```
*/
constructor(params: SMSParams | string, to?: string, from?: string, clientRef?: string);
}
//# sourceMappingURL=SMS.d.ts.map