-
Notifications
You must be signed in to change notification settings - Fork 180
/
MessengerText.ts
47 lines (44 loc) · 1.18 KB
/
MessengerText.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 { MessengerTextParams, MessengerType } from '../../types';
/**
* Represents a text message for the Messenger channel.
*
* @group Messenger
*/
export class MessengerText
extends AbstractTextMessage
implements MessengerTextParams
{
/**
* The channel for this message (always 'messenger').
*/
public channel: 'messenger';
/**
* The messenger information for this message.
*/
public messenger: MessengerType;
/**
* Sends a text message to the Facebook Messenger channel.
*
* @param {MessengerTextParams} params - The parameters for creating a Messenger text message.
*
* @example
* ```ts
* import { MessengerText } from '@vonage/messages';
*
* const { messageUUID } = await messagesClient.send(new MessengerText({
* to: TO_NUMBER,
* from: FROM_NUMBER,
* text: 'Hello world',
* clientRef: 'my-personal-reference',
* }));
*
* console.log(`Message sent successfully with UUID ${messageUUID}`);
* ```
*/
public constructor(params: MessengerTextParams) {
super(params);
this.messenger = params.messenger;
this.channel = 'messenger';
}
}