-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Expand file tree
/
Copy pathsendMessage.dto.ts
More file actions
194 lines (171 loc) · 4.06 KB
/
Copy pathsendMessage.dto.ts
File metadata and controls
194 lines (171 loc) · 4.06 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
import { proto, WAPresence } from 'baileys';
export class Quoted {
key: proto.IMessageKey;
message: proto.IMessage;
}
export class Options {
delay?: number;
presence?: WAPresence;
quoted?: Quoted;
linkPreview?: boolean;
encoding?: boolean;
mentionsEveryOne?: boolean;
mentioned?: string[];
webhookUrl?: string;
}
export class MediaMessage {
mediatype: MediaType;
mimetype?: string;
caption?: string;
// for document
fileName?: string;
// url or base64
media: string;
}
export class StatusMessage {
type: string;
content: string;
statusJidList?: string[];
allContacts?: boolean;
caption?: string;
backgroundColor?: string;
font?: number;
}
export class Metadata {
number: string;
delay?: number;
quoted?: Quoted;
linkPreview?: boolean;
mentionsEveryOne?: boolean;
mentioned?: string[];
encoding?: boolean;
notConvertSticker?: boolean;
}
export class SendTextDto extends Metadata {
text: string;
}
export class SendPresence extends Metadata {
text: string;
}
export class SendStatusDto extends Metadata {
type: string;
content: string;
statusJidList?: string[];
allContacts?: boolean;
caption?: string;
backgroundColor?: string;
font?: number;
}
export class SendPollDto extends Metadata {
name: string;
selectableCount: number;
values: string[];
messageSecret?: Uint8Array;
}
export type MediaType = 'image' | 'document' | 'video' | 'audio' | 'ptv';
export class SendMediaDto extends Metadata {
mediatype: MediaType;
mimetype?: string;
caption?: string;
// for document
fileName?: string;
// url or base64
media: string;
}
export class SendPtvDto extends Metadata {
video: string;
}
export class SendStickerDto extends Metadata {
sticker: string;
}
export class SendAudioDto extends Metadata {
audio: string;
}
export type TypeButton = 'reply' | 'copy' | 'url' | 'call' | 'pix';
export type KeyType = 'phone' | 'email' | 'cpf' | 'cnpj' | 'random';
export class Button {
type: TypeButton;
displayText?: string;
id?: string;
url?: string;
copyCode?: string;
phoneNumber?: string;
currency?: string;
name?: string;
keyType?: KeyType;
key?: string;
}
export class SendButtonsDto extends Metadata {
thumbnailUrl?: string;
title: string;
description?: string;
footer?: string;
buttons: Button[];
}
export class SendLocationDto extends Metadata {
latitude: number;
longitude: number;
name?: string;
address?: string;
}
class Row {
title: string;
description: string;
rowId: string;
}
class Section {
title: string;
rows: Row[];
}
export class SendListDto extends Metadata {
title: string;
description?: string;
footerText?: string;
buttonText: string;
sections: Section[];
}
export class ContactMessage {
fullName: string;
wuid: string;
phoneNumber: string;
organization?: string;
email?: string;
url?: string;
}
export class SendTemplateDto extends Metadata {
name: string;
language: string;
components: any;
webhookUrl?: string;
}
export class SendContactDto extends Metadata {
contact: ContactMessage[];
}
export class SendReactionDto {
key: proto.IMessageKey;
reaction: string;
}
export class SendProductDto extends Metadata {
/** WhatsApp internal product id (from /business/getCatalog `id`) */
productId: string;
/** Business owner JID — `<phone>@s.whatsapp.net` of the catalog owner */
businessOwnerJid: string;
/** Product image — URL or base64 */
productImage: string;
/** Merchant-side retailer id (e.g. `BD3`). Optional. */
retailerId?: string;
/** Product title shown to recipients as a fallback. */
title?: string;
/** Product description shown as a fallback. */
description?: string;
/** ISO 4217 currency code (e.g. `ILS`, `USD`). Defaults to `USD`. */
currencyCode?: string;
/** Price × 1000 (e.g. 5500 ILS → `5500000`). */
priceAmount1000?: number;
/** Product landing URL. Optional. */
url?: string;
/** How many images the product has in the catalog. Defaults to 1. */
productImageCount?: number;
/** Optional caption sent alongside the product card. */
caption?: string;
}