@wats/graph 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/endpoints/businessManagement.d.ts +144 -0
- package/dist/endpoints/businessManagement.js +273 -1
- package/dist/endpoints/messages/builders-basic.d.ts +11 -0
- package/dist/endpoints/messages/builders-basic.js +272 -0
- package/dist/endpoints/messages/builders-interactive.d.ts +11 -0
- package/dist/endpoints/messages/builders-interactive.js +156 -0
- package/dist/endpoints/messages/builders-template.d.ts +3 -0
- package/dist/endpoints/messages/builders-template.js +121 -0
- package/dist/endpoints/messages/callables.d.ts +31 -0
- package/dist/endpoints/messages/callables.js +57 -0
- package/dist/endpoints/messages/index.d.ts +6 -0
- package/dist/endpoints/messages/index.js +56 -0
- package/dist/endpoints/messages/types.d.ts +363 -0
- package/dist/endpoints/messages/types.js +0 -0
- package/dist/endpoints/messages/validation.d.ts +43 -0
- package/dist/endpoints/messages/validation.js +277 -0
- package/dist/endpoints/messages.d.ts +1 -375
- package/dist/endpoints/messages.js +1 -675
- package/dist/endpoints/templates/builders.js +23 -0
- package/dist/endpoints/templates/callables.d.ts +1 -0
- package/dist/endpoints/templates/callables.js +4 -2
- package/dist/endpoints/templates/groups.d.ts +126 -0
- package/dist/endpoints/templates/groups.js +156 -0
- package/dist/endpoints/templates/index.d.ts +3 -1
- package/dist/endpoints/templates/index.js +8 -0
- package/dist/endpoints/templates/types.d.ts +14 -1
- package/dist/endpoints/templates.d.ts +2 -2
- package/dist/endpoints/templates.js +6 -0
- package/dist/endpoints/waba/phoneNumbers.d.ts +2 -0
- package/dist/endpoints/wabaEndpoints.d.ts +2 -2
- package/dist/endpoints/wabaEndpoints.js +6 -0
- package/dist/errorSubclasses.d.ts +28 -0
- package/dist/errorSubclasses.js +63 -0
- package/dist/subclients/phoneNumberClient.d.ts +18 -2
- package/dist/subclients/phoneNumberClient.js +72 -1
- package/dist/subclients/wabaClient.d.ts +15 -1
- package/dist/subclients/wabaClient.js +33 -0
- package/package.json +10 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from "./types.js";
|
|
2
|
+
export { GRAPH_MESSAGES_TEXT_BODY_MAX_LENGTH, GRAPH_MESSAGES_RECIPIENT_MAX_DIGITS, GRAPH_MESSAGES_REPLY_TO_MESSAGE_ID_MAX_LENGTH, GRAPH_MESSAGES_MEDIA_ID_MAX_LENGTH, GRAPH_MESSAGES_MEDIA_LINK_MAX_LENGTH, GRAPH_MESSAGES_MEDIA_CAPTION_MAX_LENGTH, GRAPH_MESSAGES_DOCUMENT_FILENAME_MAX_LENGTH, GRAPH_MESSAGES_GENERAL_TEXT_MAX_LENGTH, GRAPH_MESSAGES_SHORT_LABEL_MAX_LENGTH, GRAPH_MESSAGES_BUTTON_TITLE_MAX_LENGTH, GRAPH_MESSAGES_BUTTON_ID_MAX_LENGTH, GRAPH_MESSAGES_SECTION_TITLE_MAX_LENGTH, GRAPH_MESSAGES_ROW_TITLE_MAX_LENGTH, GRAPH_MESSAGES_ROW_DESCRIPTION_MAX_LENGTH, GRAPH_MESSAGES_MAX_REPLY_BUTTONS, GRAPH_MESSAGES_MAX_LIST_SECTIONS, GRAPH_MESSAGES_MAX_LIST_ROWS, GRAPH_MESSAGES_MAX_CONTACTS, GRAPH_MESSAGES_MAX_PRODUCT_ITEMS } from "./validation.js";
|
|
3
|
+
export { buildSendTextPayload, buildSendImagePayload, buildSendVideoPayload, buildSendAudioPayload, buildSendDocumentPayload, buildSendStickerPayload, buildSendLocationPayload, buildSendContactsPayload, buildSendReactionPayload, buildRemoveReactionPayload } from "./builders-basic.js";
|
|
4
|
+
export { buildSendButtonsPayload, buildSendListPayload, buildSendCtaUrlPayload, buildSendCallPermissionRequestPayload, buildSendProductPayload, buildSendProductsPayload, buildSendCatalogPayload, buildRequestLocationPayload, buildMarkMessageAsReadPayload, buildTypingIndicatorPayload } from "./builders-interactive.js";
|
|
5
|
+
export { buildSendTemplatePayload, buildSendMarketingTemplatePayload } from "./builders-template.js";
|
|
6
|
+
export { buildSendMessagePayload, sendMarketingTemplate, sendMessage, GraphMessagesEndpoint } from "./callables.js";
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export * from "./types.js";
|
|
2
|
+
export {
|
|
3
|
+
GRAPH_MESSAGES_TEXT_BODY_MAX_LENGTH,
|
|
4
|
+
GRAPH_MESSAGES_RECIPIENT_MAX_DIGITS,
|
|
5
|
+
GRAPH_MESSAGES_REPLY_TO_MESSAGE_ID_MAX_LENGTH,
|
|
6
|
+
GRAPH_MESSAGES_MEDIA_ID_MAX_LENGTH,
|
|
7
|
+
GRAPH_MESSAGES_MEDIA_LINK_MAX_LENGTH,
|
|
8
|
+
GRAPH_MESSAGES_MEDIA_CAPTION_MAX_LENGTH,
|
|
9
|
+
GRAPH_MESSAGES_DOCUMENT_FILENAME_MAX_LENGTH,
|
|
10
|
+
GRAPH_MESSAGES_GENERAL_TEXT_MAX_LENGTH,
|
|
11
|
+
GRAPH_MESSAGES_SHORT_LABEL_MAX_LENGTH,
|
|
12
|
+
GRAPH_MESSAGES_BUTTON_TITLE_MAX_LENGTH,
|
|
13
|
+
GRAPH_MESSAGES_BUTTON_ID_MAX_LENGTH,
|
|
14
|
+
GRAPH_MESSAGES_SECTION_TITLE_MAX_LENGTH,
|
|
15
|
+
GRAPH_MESSAGES_ROW_TITLE_MAX_LENGTH,
|
|
16
|
+
GRAPH_MESSAGES_ROW_DESCRIPTION_MAX_LENGTH,
|
|
17
|
+
GRAPH_MESSAGES_MAX_REPLY_BUTTONS,
|
|
18
|
+
GRAPH_MESSAGES_MAX_LIST_SECTIONS,
|
|
19
|
+
GRAPH_MESSAGES_MAX_LIST_ROWS,
|
|
20
|
+
GRAPH_MESSAGES_MAX_CONTACTS,
|
|
21
|
+
GRAPH_MESSAGES_MAX_PRODUCT_ITEMS
|
|
22
|
+
} from "./validation.js";
|
|
23
|
+
export {
|
|
24
|
+
buildSendTextPayload,
|
|
25
|
+
buildSendImagePayload,
|
|
26
|
+
buildSendVideoPayload,
|
|
27
|
+
buildSendAudioPayload,
|
|
28
|
+
buildSendDocumentPayload,
|
|
29
|
+
buildSendStickerPayload,
|
|
30
|
+
buildSendLocationPayload,
|
|
31
|
+
buildSendContactsPayload,
|
|
32
|
+
buildSendReactionPayload,
|
|
33
|
+
buildRemoveReactionPayload
|
|
34
|
+
} from "./builders-basic.js";
|
|
35
|
+
export {
|
|
36
|
+
buildSendButtonsPayload,
|
|
37
|
+
buildSendListPayload,
|
|
38
|
+
buildSendCtaUrlPayload,
|
|
39
|
+
buildSendCallPermissionRequestPayload,
|
|
40
|
+
buildSendProductPayload,
|
|
41
|
+
buildSendProductsPayload,
|
|
42
|
+
buildSendCatalogPayload,
|
|
43
|
+
buildRequestLocationPayload,
|
|
44
|
+
buildMarkMessageAsReadPayload,
|
|
45
|
+
buildTypingIndicatorPayload
|
|
46
|
+
} from "./builders-interactive.js";
|
|
47
|
+
export {
|
|
48
|
+
buildSendTemplatePayload,
|
|
49
|
+
buildSendMarketingTemplatePayload
|
|
50
|
+
} from "./builders-template.js";
|
|
51
|
+
export {
|
|
52
|
+
buildSendMessagePayload,
|
|
53
|
+
sendMarketingTemplate,
|
|
54
|
+
sendMessage,
|
|
55
|
+
GraphMessagesEndpoint
|
|
56
|
+
} from "./callables.js";
|
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
export interface GraphMessagesSendMessageInput {
|
|
2
|
+
phoneNumberId: string;
|
|
3
|
+
to: string;
|
|
4
|
+
text: string;
|
|
5
|
+
previewUrl?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface GraphMessagesSendTextInput {
|
|
8
|
+
readonly to: string;
|
|
9
|
+
readonly text: string;
|
|
10
|
+
readonly previewUrl?: boolean;
|
|
11
|
+
readonly replyToMessageId?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface GraphMessagesSendMediaInput {
|
|
14
|
+
readonly to: string;
|
|
15
|
+
readonly mediaId?: string;
|
|
16
|
+
readonly link?: string;
|
|
17
|
+
readonly replyToMessageId?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface GraphMessagesSendCaptionedMediaInput extends GraphMessagesSendMediaInput {
|
|
20
|
+
readonly caption?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface GraphMessagesSendDocumentInput extends GraphMessagesSendCaptionedMediaInput {
|
|
23
|
+
readonly filename?: string;
|
|
24
|
+
}
|
|
25
|
+
export type GraphMessagesSendImageInput = GraphMessagesSendCaptionedMediaInput;
|
|
26
|
+
export type GraphMessagesSendVideoInput = GraphMessagesSendCaptionedMediaInput;
|
|
27
|
+
export interface GraphMessagesSendAudioInput extends GraphMessagesSendMediaInput {
|
|
28
|
+
/** Graph v24+ voice-message designation for audio sends. Defaults to omitted/false. */
|
|
29
|
+
readonly voice?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export type GraphMessagesSendStickerInput = GraphMessagesSendMediaInput;
|
|
32
|
+
export interface GraphMessagesSendLocationInput {
|
|
33
|
+
readonly to: string;
|
|
34
|
+
readonly latitude: number;
|
|
35
|
+
readonly longitude: number;
|
|
36
|
+
readonly name?: string;
|
|
37
|
+
readonly address?: string;
|
|
38
|
+
readonly replyToMessageId?: string;
|
|
39
|
+
}
|
|
40
|
+
export interface GraphMessagesContactNameInput {
|
|
41
|
+
readonly formattedName?: string;
|
|
42
|
+
readonly firstName?: string;
|
|
43
|
+
readonly lastName?: string;
|
|
44
|
+
readonly middleName?: string;
|
|
45
|
+
readonly suffix?: string;
|
|
46
|
+
readonly prefix?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface GraphMessagesContactPhoneInput {
|
|
49
|
+
readonly phone?: string;
|
|
50
|
+
readonly type?: string;
|
|
51
|
+
readonly waId?: string;
|
|
52
|
+
}
|
|
53
|
+
export interface GraphMessagesContactEmailInput {
|
|
54
|
+
readonly email: string;
|
|
55
|
+
readonly type?: string;
|
|
56
|
+
}
|
|
57
|
+
export interface GraphMessagesContactUrlInput {
|
|
58
|
+
readonly url: string;
|
|
59
|
+
readonly type?: string;
|
|
60
|
+
}
|
|
61
|
+
export interface GraphMessagesContactAddressInput {
|
|
62
|
+
readonly street?: string;
|
|
63
|
+
readonly city?: string;
|
|
64
|
+
readonly state?: string;
|
|
65
|
+
readonly zip?: string;
|
|
66
|
+
readonly country?: string;
|
|
67
|
+
readonly countryCode?: string;
|
|
68
|
+
readonly type?: string;
|
|
69
|
+
}
|
|
70
|
+
export interface GraphMessagesContactOrgInput {
|
|
71
|
+
readonly company?: string;
|
|
72
|
+
readonly department?: string;
|
|
73
|
+
readonly title?: string;
|
|
74
|
+
}
|
|
75
|
+
export interface GraphMessagesContactInput {
|
|
76
|
+
readonly name: GraphMessagesContactNameInput;
|
|
77
|
+
readonly phones?: readonly GraphMessagesContactPhoneInput[];
|
|
78
|
+
readonly emails?: readonly GraphMessagesContactEmailInput[];
|
|
79
|
+
readonly urls?: readonly GraphMessagesContactUrlInput[];
|
|
80
|
+
readonly addresses?: readonly GraphMessagesContactAddressInput[];
|
|
81
|
+
readonly org?: GraphMessagesContactOrgInput;
|
|
82
|
+
readonly birthday?: string;
|
|
83
|
+
}
|
|
84
|
+
export interface GraphMessagesSendContactsInput {
|
|
85
|
+
readonly to: string;
|
|
86
|
+
readonly contacts: readonly GraphMessagesContactInput[];
|
|
87
|
+
readonly replyToMessageId?: string;
|
|
88
|
+
}
|
|
89
|
+
export interface GraphMessagesSendReactionInput {
|
|
90
|
+
readonly to: string;
|
|
91
|
+
readonly messageId: string;
|
|
92
|
+
readonly emoji: string;
|
|
93
|
+
}
|
|
94
|
+
export interface GraphMessagesRemoveReactionInput {
|
|
95
|
+
readonly to: string;
|
|
96
|
+
readonly messageId: string;
|
|
97
|
+
}
|
|
98
|
+
export interface GraphMessagesSendButtonsInput {
|
|
99
|
+
readonly to: string;
|
|
100
|
+
readonly bodyText: string;
|
|
101
|
+
readonly buttons: readonly {
|
|
102
|
+
readonly id: string;
|
|
103
|
+
readonly title: string;
|
|
104
|
+
}[];
|
|
105
|
+
readonly headerText?: string;
|
|
106
|
+
readonly footerText?: string;
|
|
107
|
+
readonly replyToMessageId?: string;
|
|
108
|
+
}
|
|
109
|
+
export interface GraphMessagesSendListInput {
|
|
110
|
+
readonly to: string;
|
|
111
|
+
readonly bodyText: string;
|
|
112
|
+
readonly buttonText: string;
|
|
113
|
+
readonly sections: readonly {
|
|
114
|
+
readonly title?: string;
|
|
115
|
+
readonly rows: readonly {
|
|
116
|
+
readonly id: string;
|
|
117
|
+
readonly title: string;
|
|
118
|
+
readonly description?: string;
|
|
119
|
+
}[];
|
|
120
|
+
}[];
|
|
121
|
+
readonly headerText?: string;
|
|
122
|
+
readonly footerText?: string;
|
|
123
|
+
readonly replyToMessageId?: string;
|
|
124
|
+
}
|
|
125
|
+
export interface GraphMessagesSendCtaUrlInput {
|
|
126
|
+
readonly to: string;
|
|
127
|
+
readonly bodyText: string;
|
|
128
|
+
readonly displayText: string;
|
|
129
|
+
readonly url: string;
|
|
130
|
+
readonly footerText?: string;
|
|
131
|
+
readonly replyToMessageId?: string;
|
|
132
|
+
}
|
|
133
|
+
export interface GraphMessagesSendCallPermissionRequestInput {
|
|
134
|
+
readonly to: string;
|
|
135
|
+
readonly bodyText: string;
|
|
136
|
+
readonly footerText?: string;
|
|
137
|
+
readonly replyToMessageId?: string;
|
|
138
|
+
}
|
|
139
|
+
export interface GraphMessagesSendProductInput {
|
|
140
|
+
readonly to: string;
|
|
141
|
+
readonly catalogId: string;
|
|
142
|
+
readonly productRetailerId: string;
|
|
143
|
+
readonly bodyText?: string;
|
|
144
|
+
readonly footerText?: string;
|
|
145
|
+
readonly replyToMessageId?: string;
|
|
146
|
+
}
|
|
147
|
+
export interface GraphMessagesSendProductsInput {
|
|
148
|
+
readonly to: string;
|
|
149
|
+
readonly catalogId: string;
|
|
150
|
+
readonly headerText: string;
|
|
151
|
+
readonly bodyText: string;
|
|
152
|
+
readonly sections: readonly {
|
|
153
|
+
readonly title: string;
|
|
154
|
+
readonly productItems: readonly {
|
|
155
|
+
readonly productRetailerId: string;
|
|
156
|
+
}[];
|
|
157
|
+
}[];
|
|
158
|
+
readonly footerText?: string;
|
|
159
|
+
readonly replyToMessageId?: string;
|
|
160
|
+
}
|
|
161
|
+
export interface GraphMessagesSendCatalogInput {
|
|
162
|
+
readonly to: string;
|
|
163
|
+
readonly bodyText: string;
|
|
164
|
+
readonly footerText?: string;
|
|
165
|
+
readonly thumbnailProductRetailerId?: string;
|
|
166
|
+
readonly replyToMessageId?: string;
|
|
167
|
+
}
|
|
168
|
+
export interface GraphMessagesRequestLocationInput {
|
|
169
|
+
readonly to: string;
|
|
170
|
+
readonly bodyText: string;
|
|
171
|
+
readonly replyToMessageId?: string;
|
|
172
|
+
}
|
|
173
|
+
export interface GraphMessagesMarkMessageAsReadInput {
|
|
174
|
+
readonly messageId: string;
|
|
175
|
+
}
|
|
176
|
+
export type GraphMessagesTypingIndicatorInput = GraphMessagesMarkMessageAsReadInput;
|
|
177
|
+
export interface GraphMessagesTemplateComponentInput {
|
|
178
|
+
readonly type: string;
|
|
179
|
+
readonly parameters?: readonly Record<string, unknown>[];
|
|
180
|
+
readonly subType?: string;
|
|
181
|
+
readonly index?: string;
|
|
182
|
+
}
|
|
183
|
+
export interface GraphMessagesSendTemplateInput {
|
|
184
|
+
readonly to: string;
|
|
185
|
+
readonly name: string;
|
|
186
|
+
readonly languageCode: string;
|
|
187
|
+
readonly components?: readonly GraphMessagesTemplateComponentInput[];
|
|
188
|
+
readonly replyToMessageId?: string;
|
|
189
|
+
}
|
|
190
|
+
export type GraphMessagesMarketingProductPolicy = "CLOUD_API_FALLBACK" | "STRICT";
|
|
191
|
+
export type GraphMessagesMarketingMessageStatus = "accepted" | "held_for_quality_assessment" | "paused" | string;
|
|
192
|
+
export interface GraphMessagesSendMarketingTemplateInput {
|
|
193
|
+
readonly to?: string;
|
|
194
|
+
readonly recipient?: string;
|
|
195
|
+
readonly name: string;
|
|
196
|
+
readonly languageCode: string;
|
|
197
|
+
readonly components?: readonly GraphMessagesTemplateComponentInput[];
|
|
198
|
+
readonly productPolicy?: GraphMessagesMarketingProductPolicy;
|
|
199
|
+
readonly messageActivitySharing?: boolean;
|
|
200
|
+
}
|
|
201
|
+
export interface GraphMessagesSendResponse {
|
|
202
|
+
messaging_product?: string;
|
|
203
|
+
contacts?: Array<{
|
|
204
|
+
input?: string;
|
|
205
|
+
wa_id?: string;
|
|
206
|
+
}>;
|
|
207
|
+
messages?: Array<{
|
|
208
|
+
id: string;
|
|
209
|
+
}>;
|
|
210
|
+
}
|
|
211
|
+
export interface GraphMessagesMarketingTemplateResponse {
|
|
212
|
+
messaging_product?: string;
|
|
213
|
+
contacts?: Array<{
|
|
214
|
+
input?: string;
|
|
215
|
+
wa_id?: string;
|
|
216
|
+
/** WATS-98 BSUID response field returned for Business-Scoped User ID sends. */
|
|
217
|
+
user_id?: string;
|
|
218
|
+
}>;
|
|
219
|
+
messages?: Array<{
|
|
220
|
+
id: string;
|
|
221
|
+
/** WATS-98 /marketing_messages status: accepted, held_for_quality_assessment, or paused. */
|
|
222
|
+
message_status?: GraphMessagesMarketingMessageStatus;
|
|
223
|
+
}>;
|
|
224
|
+
}
|
|
225
|
+
export interface GraphMessagesMarketingTemplatePayload {
|
|
226
|
+
messaging_product: "whatsapp";
|
|
227
|
+
recipient_type: "individual";
|
|
228
|
+
to?: string;
|
|
229
|
+
recipient?: string;
|
|
230
|
+
type: "template";
|
|
231
|
+
template: Record<string, unknown>;
|
|
232
|
+
product_policy?: GraphMessagesMarketingProductPolicy;
|
|
233
|
+
message_activity_sharing?: boolean;
|
|
234
|
+
}
|
|
235
|
+
export interface GraphMessagesTextPayload {
|
|
236
|
+
messaging_product: "whatsapp";
|
|
237
|
+
to: string;
|
|
238
|
+
type: "text";
|
|
239
|
+
text: {
|
|
240
|
+
body: string;
|
|
241
|
+
preview_url?: boolean;
|
|
242
|
+
};
|
|
243
|
+
context?: {
|
|
244
|
+
message_id: string;
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
export type GraphMessagesMediaType = "image" | "video" | "audio" | "document" | "sticker";
|
|
248
|
+
interface GraphMessagesMediaReferencePayload {
|
|
249
|
+
id?: string;
|
|
250
|
+
link?: string;
|
|
251
|
+
caption?: string;
|
|
252
|
+
filename?: string;
|
|
253
|
+
}
|
|
254
|
+
interface GraphMessagesAudioReferencePayload extends GraphMessagesMediaReferencePayload {
|
|
255
|
+
voice?: boolean;
|
|
256
|
+
}
|
|
257
|
+
export type GraphMessagesImagePayload = {
|
|
258
|
+
messaging_product: "whatsapp";
|
|
259
|
+
to: string;
|
|
260
|
+
type: "image";
|
|
261
|
+
image: GraphMessagesMediaReferencePayload;
|
|
262
|
+
context?: {
|
|
263
|
+
message_id: string;
|
|
264
|
+
};
|
|
265
|
+
};
|
|
266
|
+
export type GraphMessagesVideoPayload = {
|
|
267
|
+
messaging_product: "whatsapp";
|
|
268
|
+
to: string;
|
|
269
|
+
type: "video";
|
|
270
|
+
video: GraphMessagesMediaReferencePayload;
|
|
271
|
+
context?: {
|
|
272
|
+
message_id: string;
|
|
273
|
+
};
|
|
274
|
+
};
|
|
275
|
+
export type GraphMessagesAudioPayload = {
|
|
276
|
+
messaging_product: "whatsapp";
|
|
277
|
+
to: string;
|
|
278
|
+
type: "audio";
|
|
279
|
+
audio: GraphMessagesAudioReferencePayload;
|
|
280
|
+
context?: {
|
|
281
|
+
message_id: string;
|
|
282
|
+
};
|
|
283
|
+
};
|
|
284
|
+
export type GraphMessagesDocumentPayload = {
|
|
285
|
+
messaging_product: "whatsapp";
|
|
286
|
+
to: string;
|
|
287
|
+
type: "document";
|
|
288
|
+
document: GraphMessagesMediaReferencePayload;
|
|
289
|
+
context?: {
|
|
290
|
+
message_id: string;
|
|
291
|
+
};
|
|
292
|
+
};
|
|
293
|
+
export type GraphMessagesStickerPayload = {
|
|
294
|
+
messaging_product: "whatsapp";
|
|
295
|
+
to: string;
|
|
296
|
+
type: "sticker";
|
|
297
|
+
sticker: GraphMessagesMediaReferencePayload;
|
|
298
|
+
context?: {
|
|
299
|
+
message_id: string;
|
|
300
|
+
};
|
|
301
|
+
};
|
|
302
|
+
export type GraphMessagesMediaPayload = GraphMessagesImagePayload | GraphMessagesVideoPayload | GraphMessagesAudioPayload | GraphMessagesDocumentPayload | GraphMessagesStickerPayload;
|
|
303
|
+
export type GraphMessagesLocationPayload = {
|
|
304
|
+
messaging_product: "whatsapp";
|
|
305
|
+
to: string;
|
|
306
|
+
type: "location";
|
|
307
|
+
location: {
|
|
308
|
+
latitude: number;
|
|
309
|
+
longitude: number;
|
|
310
|
+
name?: string;
|
|
311
|
+
address?: string;
|
|
312
|
+
};
|
|
313
|
+
context?: {
|
|
314
|
+
message_id: string;
|
|
315
|
+
};
|
|
316
|
+
};
|
|
317
|
+
export type GraphMessagesContactsPayload = {
|
|
318
|
+
messaging_product: "whatsapp";
|
|
319
|
+
to: string;
|
|
320
|
+
type: "contacts";
|
|
321
|
+
contacts: readonly Record<string, unknown>[];
|
|
322
|
+
context?: {
|
|
323
|
+
message_id: string;
|
|
324
|
+
};
|
|
325
|
+
};
|
|
326
|
+
export type GraphMessagesReactionPayload = {
|
|
327
|
+
messaging_product: "whatsapp";
|
|
328
|
+
to: string;
|
|
329
|
+
type: "reaction";
|
|
330
|
+
reaction: {
|
|
331
|
+
message_id: string;
|
|
332
|
+
emoji: string;
|
|
333
|
+
};
|
|
334
|
+
};
|
|
335
|
+
export type GraphMessagesInteractivePayload = {
|
|
336
|
+
messaging_product: "whatsapp";
|
|
337
|
+
to: string;
|
|
338
|
+
type: "interactive";
|
|
339
|
+
interactive: Record<string, unknown>;
|
|
340
|
+
context?: {
|
|
341
|
+
message_id: string;
|
|
342
|
+
};
|
|
343
|
+
};
|
|
344
|
+
export type GraphMessagesTemplatePayload = {
|
|
345
|
+
messaging_product: "whatsapp";
|
|
346
|
+
to: string;
|
|
347
|
+
type: "template";
|
|
348
|
+
template: Record<string, unknown>;
|
|
349
|
+
context?: {
|
|
350
|
+
message_id: string;
|
|
351
|
+
};
|
|
352
|
+
};
|
|
353
|
+
export type GraphMessagesStatusPayload = {
|
|
354
|
+
messaging_product: "whatsapp";
|
|
355
|
+
status: "read";
|
|
356
|
+
message_id: string;
|
|
357
|
+
typing_indicator?: {
|
|
358
|
+
type: "text";
|
|
359
|
+
};
|
|
360
|
+
};
|
|
361
|
+
export type GraphMessagesRemainingPayload = GraphMessagesLocationPayload | GraphMessagesContactsPayload | GraphMessagesReactionPayload | GraphMessagesInteractivePayload | GraphMessagesTemplatePayload | GraphMessagesStatusPayload;
|
|
362
|
+
export type GraphMessagesSendBody = GraphMessagesTextPayload | GraphMessagesMediaPayload | GraphMessagesRemainingPayload;
|
|
363
|
+
export {};
|
|
File without changes
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export declare const GRAPH_MESSAGES_TEXT_BODY_MAX_LENGTH = 4096;
|
|
2
|
+
export declare const GRAPH_MESSAGES_RECIPIENT_MAX_DIGITS = 15;
|
|
3
|
+
export declare const GRAPH_MESSAGES_REPLY_TO_MESSAGE_ID_MAX_LENGTH = 256;
|
|
4
|
+
export declare const GRAPH_MESSAGES_MEDIA_ID_MAX_LENGTH = 2048;
|
|
5
|
+
export declare const GRAPH_MESSAGES_MEDIA_LINK_MAX_LENGTH = 2048;
|
|
6
|
+
export declare const GRAPH_MESSAGES_MEDIA_CAPTION_MAX_LENGTH = 1024;
|
|
7
|
+
export declare const GRAPH_MESSAGES_DOCUMENT_FILENAME_MAX_LENGTH = 256;
|
|
8
|
+
export declare const GRAPH_MESSAGES_GENERAL_TEXT_MAX_LENGTH = 1024;
|
|
9
|
+
export declare const GRAPH_MESSAGES_SHORT_LABEL_MAX_LENGTH = 60;
|
|
10
|
+
export declare const GRAPH_MESSAGES_BUTTON_TITLE_MAX_LENGTH = 20;
|
|
11
|
+
export declare const GRAPH_MESSAGES_BUTTON_ID_MAX_LENGTH = 256;
|
|
12
|
+
export declare const GRAPH_MESSAGES_SECTION_TITLE_MAX_LENGTH = 24;
|
|
13
|
+
export declare const GRAPH_MESSAGES_ROW_TITLE_MAX_LENGTH = 24;
|
|
14
|
+
export declare const GRAPH_MESSAGES_ROW_DESCRIPTION_MAX_LENGTH = 72;
|
|
15
|
+
export declare const GRAPH_MESSAGES_MAX_REPLY_BUTTONS = 3;
|
|
16
|
+
export declare const GRAPH_MESSAGES_MAX_LIST_SECTIONS = 10;
|
|
17
|
+
export declare const GRAPH_MESSAGES_MAX_LIST_ROWS = 10;
|
|
18
|
+
export declare const GRAPH_MESSAGES_MAX_CONTACTS = 257;
|
|
19
|
+
export declare const GRAPH_MESSAGES_MAX_PRODUCT_ITEMS = 30;
|
|
20
|
+
export declare function isPlainOptionsObject(value: unknown): value is Record<string, unknown>;
|
|
21
|
+
export declare function hasControlChar(value: string): boolean;
|
|
22
|
+
export declare function assertValidRecipient(to: unknown, helperName?: string): string;
|
|
23
|
+
export declare function assertValidText(text: unknown): string;
|
|
24
|
+
export declare function assertValidReplyToMessageId(value: unknown): string;
|
|
25
|
+
export declare function assertNonEmptyControlFreeString(value: unknown, fieldName: string, maxLength: number, helperName: string): string;
|
|
26
|
+
export declare function assertNoUnsupportedMediaFields(input: Record<string, unknown>, helperName: string, options: {
|
|
27
|
+
readonly caption: boolean;
|
|
28
|
+
readonly filename: boolean;
|
|
29
|
+
}): void;
|
|
30
|
+
export declare function assertValidMediaLink(value: unknown, helperName: string): string;
|
|
31
|
+
export declare function assertValidNumberInRange(value: unknown, fieldName: string, min: number, max: number, helperName: string): number;
|
|
32
|
+
export declare function maybeText(value: unknown, fieldName: string, maxLength: number, helperName: string): string | undefined;
|
|
33
|
+
export declare function withReplyContext<T extends object>(payload: T, input: Record<string, unknown>): T & {
|
|
34
|
+
context?: {
|
|
35
|
+
message_id: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
export declare function asRecordInput(input: unknown, helperName: string): Record<string, unknown>;
|
|
39
|
+
export declare function assertBoundedArray(value: unknown, fieldName: string, min: number, max: number, helperName: string): readonly unknown[];
|
|
40
|
+
export declare function mapValidatedArray<T>(values: readonly unknown[], mapper: (value: unknown, index: number) => T): T[];
|
|
41
|
+
export declare function assertOnlyKnownKeys(record: Record<string, unknown>, allowed: readonly string[], helperName: string): void;
|
|
42
|
+
export declare function inspectTemplateValue<T>(helperName: string, path: string, inspector: () => T): T;
|
|
43
|
+
export declare function sanitizeTemplateParameter(value: unknown, helperName: string, path: string, seen: WeakSet<object>, depth?: number): unknown;
|