-
Notifications
You must be signed in to change notification settings - Fork 180
/
RCSText.ts
47 lines (44 loc) · 1.34 KB
/
RCSText.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import { AbstractTextMessage } from '../AbstractTextMessage';
import { RCSTextParams } from '../../types';
import { Channels } from '../../enums';
/**
* Represents a text message for the RCS channel.
*
* @group RCS
*/
export class RCSText extends AbstractTextMessage implements RCSTextParams {
/**
* The channel for this message (always 'rcs').
*/
public channel: Channels.RCS = Channels.RCS;
/**
* The duration in seconds the delivery of a message 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.
*/
public ttl?: number;
/**
* Sends a text message through the RCS channel.
*
* @param {RCSTextParams} params - The parameters for creating a RCS text message.
*
* @example
* ```ts
* import { RCSText } from '@vonage/messages';
*
* const { messageUUID } = await messagesClient.send(new RCSText({
* to: TO_NUMBER,
* from: FROM_NUMBER,
* text: 'Hello world',
* clientRef: 'my-personal-reference',
* }));
*
* console.log(`Message sent successfully with UUID ${messageUUID}`);
* ```
*/
public constructor(params: RCSTextParams) {
super(params);
this.ttl = params.ttl;
}
}