-
Notifications
You must be signed in to change notification settings - Fork 181
/
ViberImage.ts
48 lines (46 loc) · 1.24 KB
/
ViberImage.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
48
import { AbstractImageMessage } from '../AbstractImageMessage';
import { ViberImageParams } from '../../types';
import { ViberActionParams } from '../../types';
/**
* Represents an image message for the Viber Service channel.
*
* @group Viber
*/
export class ViberImage
extends AbstractImageMessage
implements ViberImageParams
{
public channel: 'viber_service';
public viberService: ViberActionParams;
/**
* Send an image message using the Viber Service channel.
*
* @param {ViberImageParams} params - The parameters for the ViberImage message.
* @example
* ```ts
* import { ViberImage } from '@vonage/messages';
*
* const { messageUUID } = await messagesClient.send(new ViberImage({
* to: TO_NUMBER,
* from: FROM_NUMBER,
* image: {
* url: 'https://my-host.com/my-image.jpg',
* },
* 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: ViberImageParams) {
super(params);
this.viberService = params.viberService;
this.channel = 'viber_service';
}
}