-
Notifications
You must be signed in to change notification settings - Fork 180
/
WhatsAppVideo.ts
45 lines (43 loc) · 1.14 KB
/
WhatsAppVideo.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
import { AbstractVideoMessage } from '../AbstractVideoMessage';
import { WhatsAppVideoParams, WhatsAppContext } from '../../types';
/**
* Represents a video message for WhatsApp.
*
* @group WhatsApp
*/
export class WhatsAppVideo
extends AbstractVideoMessage
implements WhatsAppVideoParams
{
public channel: 'whatsapp';
public context?: WhatsAppContext;
/**
* Sends a video message to a WhatsApp user.
*
* @param {WhatsAppVideoParams} params - The parameters for creating a WhatsApp video message.
*
* @example
* ```ts
* import { WhatsAppVideo } from '@vonage/messages';
*
* const { messageUUID } = await messagesClient.send(new WhatsAppVideo({
* to: TO_NUMBER,
* from: FROM_NUMBER,
* video: {
* url: 'https://example.com/video.mp4',
* caption: 'This is a video message',
* },
* clientRef: 'my-personal-reference',
* }));
*
* console.log(`Message sent successfully with UUID ${messageUUID}`);
* ```
*/
public constructor(params: WhatsAppVideoParams) {
super(params);
this.channel = 'whatsapp';
if (params.context) {
this.context = params.context;
}
}
}