Skip to content

Commit d70dc0d

Browse files
committed
feat: added WhatsApp category
1 parent 7fb016a commit d70dc0d

File tree

10 files changed

+96
-12
lines changed

10 files changed

+96
-12
lines changed

packages/messages/lib/classes/WhatsApp/WhatsAppAudio.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ export class WhatsAppAudio
1616
public channel: Channels.WHATSAPP = Channels.WHATSAPP;
1717

1818
public context?: WhatsAppContext;
19+
20+
/**
21+
* Send via MM Lite API only this is valid for marketing template messages
22+
* only, and for Alpha release only
23+
*/
24+
public category?: string;
25+
1926
/**
2027
* Sends an audio message to a WhatsApp user.
2128
*
@@ -43,5 +50,6 @@ export class WhatsAppAudio
4350
if (params.context) {
4451
this.context = params.context;
4552
}
53+
this.category = params.category;
4654
}
4755
}

packages/messages/lib/classes/WhatsApp/WhatsAppCustom.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ export class WhatsAppCustom
2828

2929
public context?: WhatsAppContext;
3030

31+
/**
32+
* Send via MM Lite API only this is valid for marketing template messages
33+
* only, and for Alpha release only
34+
*/
35+
public category?: string;
36+
3137
/**
3238
* Sends a custom message to a WhatsApp user.
3339
*
@@ -59,5 +65,7 @@ export class WhatsAppCustom
5965
if (params.context) {
6066
this.context = params.context;
6167
}
68+
69+
this.category = params.category;
6270
}
6371
}

packages/messages/lib/classes/WhatsApp/WhatsAppFile.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ export class WhatsAppFile
1717

1818
public context?: WhatsAppContext;
1919

20+
/**
21+
* Send via MM Lite API only this is valid for marketing template messages
22+
* only, and for Alpha release only
23+
*/
24+
public category?: string;
25+
2026
/**
2127
* Send a WhatsApp file message.
2228
*
@@ -39,6 +45,7 @@ export class WhatsAppFile
3945
*/
4046
public constructor(params: Omit<WhatsAppFileParams, 'channel' | 'messageType'>) {
4147
super(params);
48+
this.category = params.category;
4249
/* istanbul ignore next */
4350
if (params.context) {
4451
this.context = params.context;

packages/messages/lib/classes/WhatsApp/WhatsAppImage.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ export class WhatsAppImage
1616
public channel: Channels.WHATSAPP = Channels.WHATSAPP;
1717

1818
public context?: WhatsAppContext;
19+
20+
/**
21+
* Send via MM Lite API only this is valid for marketing template messages
22+
* only, and for Alpha release only
23+
*/
24+
public category?: string;
25+
1926
/**
2027
* Sends an image message to a WhatsApp user.
2128
*
@@ -43,5 +50,7 @@ export class WhatsAppImage
4350
if (params.context) {
4451
this.context = params.context;
4552
}
53+
54+
this.category = params.category;
4655
}
4756
}

packages/messages/lib/classes/WhatsApp/WhatsAppReaction.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ export class WhatsAppReaction
3434
*/
3535
public context?: WhatsAppContext;
3636

37+
/**
38+
* Send via MM Lite API only this is valid for marketing template messages
39+
* only, and for Alpha release only
40+
*/
41+
public category?: string;
42+
3743
/**
3844
* Sends a reaction message to a WhatsApp user.
3945
*
@@ -76,6 +82,8 @@ export class WhatsAppReaction
7682
public constructor(params: Omit<WhatsAppReactionParams, 'channel' | 'messageType'>) {
7783
super(params);
7884
this.reaction = params.reaction;
85+
this.category = params.category;
86+
7987
if (params.context) {
8088
this.context = params.context;
8189
}

packages/messages/lib/classes/WhatsApp/WhatsAppSticker.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ export class WhatsAppSticker
2929

3030
public context?: WhatsAppContext;
3131

32+
/**
33+
* Send via MM Lite API only this is valid for marketing template messages
34+
* only, and for Alpha release only
35+
*/
36+
public category?: string;
37+
3238
/**
3339
* Send a sticker message to a WhatsApp user.
3440
*
@@ -74,5 +80,7 @@ export class WhatsAppSticker
7480
if (params.context) {
7581
this.context = params.context;
7682
}
83+
84+
this.category = params.category;
7785
}
7886
}

packages/messages/lib/classes/WhatsApp/WhatsAppTemplate.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { AbstractMessage } from '../AbstractMessage.js';
1+
import { AbstractMessage } from '../AbstractMessage';
22
import {
33
WhatsAppTemplateParams,
44
WhatsAppPolicyType,
55
WhatsAppTemplateType,
66
WhatsAppContext,
7-
} from '../../types/index.js';
8-
import { Channels, MessageTypes } from '../../enums/index.js';
7+
} from '../../types/';
8+
import { Channels, MessageTypes } from '../../enums/';
99

1010
/**
1111
* Represents a template message for WhatsApp.
@@ -31,6 +31,12 @@ export class WhatsAppTemplate
3131

3232
public context?: WhatsAppContext;
3333

34+
/**
35+
* Send via MM Lite API only this is valid for marketing template messages
36+
* only, and for Alpha release only
37+
*/
38+
public category?: string;
39+
3440
/**
3541
* Send a template message to a WhatsApp user.
3642
*

packages/messages/lib/classes/WhatsApp/WhatsAppText.ts

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { AbstractTextMessage } from '../AbstractTextMessage.js';
2-
import { WhatsAppTextParams, WhatsAppContext } from '../../types/index.js';
3-
import { Channels } from '../../enums/index.js';
1+
import { AbstractTextMessage } from '../AbstractTextMessage';
2+
import { WhatsAppTextParams, WhatsAppContext } from '../../types/';
3+
import { Channels } from '../../enums/';
44

55
/**
66
* Represents a text message for WhatsApp.
@@ -15,7 +15,21 @@ export class WhatsAppText
1515
*/
1616
public channel: Channels.WHATSAPP = Channels.WHATSAPP;
1717

18+
/**
19+
* A context used for quoting/replying/reacting to a specific message in a
20+
* conversation. When used for quoting or replying, the WhatsApp UI will
21+
* display the new message along with a contextual bubble that displays the
22+
* quoted/replied to message's content. When used for reacting the WhatsApp
23+
* UI will display the reaction emoji below the reacted to message.
24+
*/
1825
public context?: WhatsAppContext;
26+
27+
/**
28+
* Send via MM Lite API only this is valid for marketing template messages
29+
* only, and for Alpha release only
30+
*/
31+
public category?: string;
32+
1933
/**
2034
* Send a WhatsApp text message.
2135
*
@@ -39,5 +53,6 @@ export class WhatsAppText
3953
if (params.context) {
4054
this.context = params.context;
4155
}
56+
this.category = params.category;
4257
}
4358
}

packages/messages/lib/classes/WhatsApp/WhatsAppVideo.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ export class WhatsAppVideo
1616
public channel: Channels.WHATSAPP = Channels.WHATSAPP;
1717

1818
public context?: WhatsAppContext;
19+
20+
/**
21+
* Send via MM Lite API only this is valid for marketing template messages
22+
* only, and for Alpha release only
23+
*/
24+
public category?: string;
25+
1926
/**
2027
* Sends a video message to a WhatsApp user.
2128
*
@@ -44,5 +51,6 @@ export class WhatsAppVideo
4451
if (params.context) {
4552
this.context = params.context;
4653
}
54+
this.category = params.category;
4755
}
4856
}
Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Channels } from '../../..//enums/index.js';
2-
import { MessageParams } from '../../MessageParams.js';
1+
import { Channels } from '../../..//enums/';
2+
import { MessageParams } from '../../MessageParams';
33

44
export type WhatsAppContext = {
55
/**
@@ -12,10 +12,17 @@ export type WhatsAppParams = {
1212
channel: Channels.WHATSAPP | string;
1313

1414
/**
15-
* An optional context used for quoting/replying to a specific meesage in a
16-
* conversation. When used, the WhatsApp UI will display the new message
17-
* along with a contextual bubble that displays the quoted/replied to
18-
* message's content
15+
* A context used for quoting/replying/reacting to a specific message in a
16+
* conversation. When used for quoting or replying, the WhatsApp UI will
17+
* display the new message along with a contextual bubble that displays the
18+
* quoted/replied to message's content. When used for reacting the WhatsApp
19+
* UI will display the reaction emoji below the reacted to message.
1920
*/
2021
context?: WhatsAppContext;
22+
23+
/**
24+
* Send via MM Lite API only this is valid for marketing template messages
25+
* only, and for Alpha release only
26+
*/
27+
category?: string;
2128
} & MessageParams;

0 commit comments

Comments
 (0)