-
Notifications
You must be signed in to change notification settings - Fork 181
/
ViberText.ts
47 lines (45 loc) · 1.19 KB
/
ViberText.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 { ViberActionParams } from '../../types';
import { ViberTextParams } from '../../types';
/**
* Represents a text message for the Viber Service channel.
*
* @group Viber
*/
export class ViberText
extends AbstractTextMessage
implements ViberTextParams
{
public channel: 'viber_service';
public viberService: ViberActionParams;
/**
* Send a text message using the Viber Service channel.
*
* @param {ViberTextParams} params - The parameters for the ViberText message.
*
* @example
* ```ts
* import { ViberText } from '@vonage/messages';
*
* const { messageUUID } = await messagesClient.send(new ViberText({
* to: TO_NUMBER,
* from: FROM_NUMBER,
* text: 'Hello world',
* viberService: {
* action: {
* url: 'https://my-host.com/my-path',
* text: 'My button text',
* },
* },
* clientRef: 'my-personal-reference',
* }));
*
* console.log(`Message sent successfully with UUID ${messageUUID}`);
* ```
*/
constructor(params: ViberTextParams) {
super(params);
this.viberService = params.viberService;
this.channel = 'viber_service';
}
}