meta-cloud-api 1.1.3 → 1.1.5
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/base.d.ts +19 -0
- package/dist/base.d.ts.map +1 -0
- package/dist/chunk-PECeCxCb.js +15 -0
- package/dist/config.d.ts +80 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/enums.d.ts +668 -0
- package/dist/enums.d.ts.map +1 -0
- package/dist/enums.js +681 -0
- package/dist/enums.js.map +1 -0
- package/dist/httpsClient.d.ts +21 -0
- package/dist/httpsClient.d.ts.map +1 -0
- package/dist/index.d.ts +4386 -27
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3436 -1
- package/dist/index.js.map +1 -1
- package/dist/logger.d.ts +11 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/request.d.ts +52 -0
- package/dist/request.d.ts.map +1 -0
- package/package.json +11 -118
- package/dist/BusinessProfileApi-C_sEOrWM.d.ts +0 -353
- package/dist/EncryptionApi-CcCfeK2b.d.ts +0 -22
- package/dist/FlowApi-DDHrFT_Q.d.ts +0 -136
- package/dist/MediaApi-CY9RVo7u.d.ts +0 -90
- package/dist/MessageApi-CX_jN8da.d.ts +0 -171
- package/dist/PhoneNumberApi-B-hY7g1M.d.ts +0 -142
- package/dist/QrCodeApi-DRICKN04.d.ts +0 -98
- package/dist/RegistrationApi-CFPzU1Vw.d.ts +0 -47
- package/dist/TemplateApi-fCIlzBtK.d.ts +0 -161
- package/dist/TwoStepVerificationApi-C0jpAKfu.d.ts +0 -33
- package/dist/WabaApi-x5PhsLT3.d.ts +0 -175
- package/dist/WebhookProcessor-DEIZ2PRU.d.ts +0 -707
- package/dist/WhatsApp-BFsBgjJO.d.ts +0 -82
- package/dist/api/encryption/index.d.ts +0 -10
- package/dist/api/encryption/index.js +0 -2
- package/dist/api/encryption/index.js.map +0 -1
- package/dist/api/flow/index.d.ts +0 -11
- package/dist/api/flow/index.js +0 -2
- package/dist/api/flow/index.js.map +0 -1
- package/dist/api/index.d.ts +0 -18
- package/dist/api/index.js +0 -2
- package/dist/api/index.js.map +0 -1
- package/dist/api/media/index.d.ts +0 -10
- package/dist/api/media/index.js +0 -2
- package/dist/api/media/index.js.map +0 -1
- package/dist/api/messages/builders/index.d.ts +0 -536
- package/dist/api/messages/builders/index.js +0 -4
- package/dist/api/messages/builders/index.js.map +0 -1
- package/dist/api/messages/index.d.ts +0 -10
- package/dist/api/messages/index.js +0 -2
- package/dist/api/messages/index.js.map +0 -1
- package/dist/api/phone/index.d.ts +0 -10
- package/dist/api/phone/index.js +0 -2
- package/dist/api/phone/index.js.map +0 -1
- package/dist/api/profile/index.d.ts +0 -10
- package/dist/api/profile/index.js +0 -2
- package/dist/api/profile/index.js.map +0 -1
- package/dist/api/qrCode/index.d.ts +0 -10
- package/dist/api/qrCode/index.js +0 -2
- package/dist/api/qrCode/index.js.map +0 -1
- package/dist/api/registration/index.d.ts +0 -10
- package/dist/api/registration/index.js +0 -2
- package/dist/api/registration/index.js.map +0 -1
- package/dist/api/template/index.d.ts +0 -21
- package/dist/api/template/index.js +0 -2
- package/dist/api/template/index.js.map +0 -1
- package/dist/api/twoStepVerification/index.d.ts +0 -10
- package/dist/api/twoStepVerification/index.js +0 -2
- package/dist/api/twoStepVerification/index.js.map +0 -1
- package/dist/api/waba/index.d.ts +0 -10
- package/dist/api/waba/index.js +0 -2
- package/dist/api/waba/index.js.map +0 -1
- package/dist/base-BV6DyzGS.d.ts +0 -18
- package/dist/chunk-5577QQ7V.js +0 -2
- package/dist/chunk-5577QQ7V.js.map +0 -1
- package/dist/chunk-6DFC5L3X.js +0 -2
- package/dist/chunk-6DFC5L3X.js.map +0 -1
- package/dist/chunk-7QBIZCJ4.js +0 -2
- package/dist/chunk-7QBIZCJ4.js.map +0 -1
- package/dist/chunk-AMHQGG6Z.js +0 -2
- package/dist/chunk-AMHQGG6Z.js.map +0 -1
- package/dist/chunk-BAOZ4U74.js +0 -10
- package/dist/chunk-BAOZ4U74.js.map +0 -1
- package/dist/chunk-CRZ7EUYR.js +0 -2
- package/dist/chunk-CRZ7EUYR.js.map +0 -1
- package/dist/chunk-FKXSL2JK.js +0 -3
- package/dist/chunk-FKXSL2JK.js.map +0 -1
- package/dist/chunk-FSKBLPGE.js +0 -2
- package/dist/chunk-FSKBLPGE.js.map +0 -1
- package/dist/chunk-GM63NGNV.js +0 -2
- package/dist/chunk-GM63NGNV.js.map +0 -1
- package/dist/chunk-IYSR44P6.js +0 -2
- package/dist/chunk-IYSR44P6.js.map +0 -1
- package/dist/chunk-J2JPTKU6.js +0 -2
- package/dist/chunk-J2JPTKU6.js.map +0 -1
- package/dist/chunk-JC6YMVID.js +0 -2
- package/dist/chunk-JC6YMVID.js.map +0 -1
- package/dist/chunk-JPAV644F.js +0 -2
- package/dist/chunk-JPAV644F.js.map +0 -1
- package/dist/chunk-JXCLRKQ7.js +0 -2
- package/dist/chunk-JXCLRKQ7.js.map +0 -1
- package/dist/chunk-KMAH6636.js +0 -2
- package/dist/chunk-KMAH6636.js.map +0 -1
- package/dist/chunk-L4ESAO2S.js +0 -2
- package/dist/chunk-L4ESAO2S.js.map +0 -1
- package/dist/chunk-LV3TULSI.js +0 -2
- package/dist/chunk-LV3TULSI.js.map +0 -1
- package/dist/chunk-MJEG3K4V.js +0 -2
- package/dist/chunk-MJEG3K4V.js.map +0 -1
- package/dist/chunk-PHPQ5HP3.js +0 -2
- package/dist/chunk-PHPQ5HP3.js.map +0 -1
- package/dist/chunk-RIL6QABY.js +0 -2
- package/dist/chunk-RIL6QABY.js.map +0 -1
- package/dist/chunk-RWCVPWRC.js +0 -2
- package/dist/chunk-RWCVPWRC.js.map +0 -1
- package/dist/chunk-SNNRWNGZ.js +0 -2
- package/dist/chunk-SNNRWNGZ.js.map +0 -1
- package/dist/chunk-U5FBZ6UB.js +0 -3
- package/dist/chunk-U5FBZ6UB.js.map +0 -1
- package/dist/chunk-VHAODWCN.js +0 -2
- package/dist/chunk-VHAODWCN.js.map +0 -1
- package/dist/chunk-ZMNXRMWK.js +0 -2
- package/dist/chunk-ZMNXRMWK.js.map +0 -1
- package/dist/common-B8kp4RdL.d.ts +0 -403
- package/dist/common-CGbls9Y8.d.ts +0 -425
- package/dist/core/webhook/frameworks/express.d.ts +0 -53
- package/dist/core/webhook/frameworks/express.js +0 -2
- package/dist/core/webhook/frameworks/express.js.map +0 -1
- package/dist/core/webhook/frameworks/nextjs-app.d.ts +0 -48
- package/dist/core/webhook/frameworks/nextjs-app.js +0 -2
- package/dist/core/webhook/frameworks/nextjs-app.js.map +0 -1
- package/dist/core/webhook/frameworks/nextjs.d.ts +0 -49
- package/dist/core/webhook/frameworks/nextjs.js +0 -2
- package/dist/core/webhook/frameworks/nextjs.js.map +0 -1
- package/dist/core/webhook/index.d.ts +0 -29
- package/dist/core/webhook/index.js +0 -2
- package/dist/core/webhook/index.js.map +0 -1
- package/dist/core/whatsapp/index.d.ts +0 -42
- package/dist/core/whatsapp/index.js +0 -2
- package/dist/core/whatsapp/index.js.map +0 -1
- package/dist/enums-DIimUG6s.d.ts +0 -707
- package/dist/factory-kNha6WaY.d.ts +0 -200
- package/dist/handler-DbySwF0E.d.ts +0 -20
- package/dist/httpsClient-Cbd2Y6mg.d.ts +0 -19
- package/dist/isMetaError-CQLXyEL4.d.ts +0 -63
- package/dist/logger-BdE0Vyim.d.ts +0 -9
- package/dist/request-CUjrMn8R.d.ts +0 -50
- package/dist/types/config.d.ts +0 -78
- package/dist/types/config.js +0 -2
- package/dist/types/config.js.map +0 -1
- package/dist/types/enums.d.ts +0 -1
- package/dist/types/enums.js +0 -2
- package/dist/types/enums.js.map +0 -1
- package/dist/types/index.d.ts +0 -6
- package/dist/types/index.js +0 -2
- package/dist/types/index.js.map +0 -1
- package/dist/utils/index.d.ts +0 -40
- package/dist/utils/index.js +0 -2
- package/dist/utils/index.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,27 +1,4386 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
1
|
+
import { Agent } from "https";
|
|
2
|
+
import { IncomingHttpHeaders, IncomingMessage } from "http";
|
|
3
|
+
|
|
4
|
+
//#region src/types/enums.d.ts
|
|
5
|
+
declare namespace enums_d_exports {
|
|
6
|
+
export { AudioMediaTypesEnum, BusinessVerticalEnum, ButtonPositionEnum, CategoryEnum, ComponentTypesEnum, ConversationTypesEnum, CurrencyCodesEnum, DataLocalizationRegionEnum, DocumentMediaTypesEnum, HttpMethodsEnum, ImageMediaTypesEnum, InteractiveTypesEnum, LanguagesEnum, MessageTypesEnum, ParametersTypesEnum, ReferralSourceTypesEnum, RequestCodeMethodsEnum, StatusEnum, StickerMediaTypesEnum, SubTypeEnum, SystemChangeTypesEnum, TemplateStatusEnum, VideoMediaTypesEnum, WabaConfigEnum, WebhookTypesEnum };
|
|
7
|
+
}
|
|
8
|
+
declare enum CategoryEnum {
|
|
9
|
+
Authentication = "AUTHENTICATION",
|
|
10
|
+
Marketing = "MARKETING",
|
|
11
|
+
Utility = "UTILITY",
|
|
12
|
+
}
|
|
13
|
+
declare enum TemplateStatusEnum {
|
|
14
|
+
Approved = "APPROVED",
|
|
15
|
+
Pending = "PENDING",
|
|
16
|
+
Rejected = "REJECTED",
|
|
17
|
+
}
|
|
18
|
+
declare enum HttpMethodsEnum {
|
|
19
|
+
Get = "GET",
|
|
20
|
+
Post = "POST",
|
|
21
|
+
Put = "PUT",
|
|
22
|
+
Delete = "DELETE",
|
|
23
|
+
}
|
|
24
|
+
declare enum MessageTypesEnum {
|
|
25
|
+
Audio = "audio",
|
|
26
|
+
Contacts = "contacts",
|
|
27
|
+
Document = "document",
|
|
28
|
+
Image = "image",
|
|
29
|
+
Interactive = "interactive",
|
|
30
|
+
Location = "location",
|
|
31
|
+
Reaction = "reaction",
|
|
32
|
+
Sticker = "sticker",
|
|
33
|
+
Template = "template",
|
|
34
|
+
Text = "text",
|
|
35
|
+
Video = "video",
|
|
36
|
+
Button = "button",
|
|
37
|
+
Order = "order",
|
|
38
|
+
System = "system",
|
|
39
|
+
Unknown = "unknown",
|
|
40
|
+
Statuses = "statuses",
|
|
41
|
+
'*' = "*",
|
|
42
|
+
}
|
|
43
|
+
declare enum ParametersTypesEnum {
|
|
44
|
+
Action = "ACTION",
|
|
45
|
+
CouponCode = "COUPON_CODE",
|
|
46
|
+
Currency = "CURRENCY",
|
|
47
|
+
DateTime = "DATE_TIME",
|
|
48
|
+
Document = "DOCUMENT",
|
|
49
|
+
ExpirationTimeMs = "EXPIRATION_TIME_MS",
|
|
50
|
+
Image = "IMAGE",
|
|
51
|
+
LimitedTimeOffer = "LIMITED_TIME_OFFER",
|
|
52
|
+
Location = "LOCATION",
|
|
53
|
+
OrderStatus = "ORDER_STATUS",
|
|
54
|
+
Payload = "PAYLOAD",
|
|
55
|
+
Product = "PRODUCT",
|
|
56
|
+
Text = "TEXT",
|
|
57
|
+
TtlMinutes = "TTL_MINUTES",
|
|
58
|
+
Video = "VIDEO",
|
|
59
|
+
WebviewInteraction = "WEBVIEW_INTERACTION",
|
|
60
|
+
WebviewPresentation = "WEBVIEW_PRESENTATION",
|
|
61
|
+
}
|
|
62
|
+
declare enum InteractiveTypesEnum {
|
|
63
|
+
Button = "button",
|
|
64
|
+
List = "list",
|
|
65
|
+
Product = "product",
|
|
66
|
+
ProductList = "product_list",
|
|
67
|
+
CtaUrl = "cta_url",
|
|
68
|
+
LocationRequest = "location_request_message",
|
|
69
|
+
AddressMessage = "address_message",
|
|
70
|
+
Flow = "flow",
|
|
71
|
+
}
|
|
72
|
+
declare enum ButtonPositionEnum {
|
|
73
|
+
First = 1,
|
|
74
|
+
Second = 2,
|
|
75
|
+
Third = 3,
|
|
76
|
+
Fourth = 4,
|
|
77
|
+
Fifth = 5,
|
|
78
|
+
}
|
|
79
|
+
declare enum SubTypeEnum {
|
|
80
|
+
Catalog = "CATALOG",
|
|
81
|
+
CopyCode = "COPY_CODE",
|
|
82
|
+
Flow = "FLOW",
|
|
83
|
+
Mpm = "MPM",
|
|
84
|
+
OrderDetails = "ORDER_DETAILS",
|
|
85
|
+
QuickReply = "QUICK_REPLY",
|
|
86
|
+
Reminder = "REMINDER",
|
|
87
|
+
Url = "URL",
|
|
88
|
+
VoiceCall = "VOICE_CALL",
|
|
89
|
+
}
|
|
90
|
+
declare enum ComponentTypesEnum {
|
|
91
|
+
Header = "HEADER",
|
|
92
|
+
Body = "BODY",
|
|
93
|
+
Button = "BUTTON",
|
|
94
|
+
Footer = "FOOTER",
|
|
95
|
+
}
|
|
96
|
+
declare enum WabaConfigEnum {
|
|
97
|
+
AppId = "M4D_APP_ID",
|
|
98
|
+
Port = "WA_PORT",
|
|
99
|
+
AppSecret = "M4D_APP_SECRET",
|
|
100
|
+
PhoneNumberId = "WA_PHONE_NUMBER_ID",
|
|
101
|
+
BusinessAcctId = "WA_BUSINESS_ACCOUNT_ID",
|
|
102
|
+
APIVersion = "CLOUD_API_VERSION",
|
|
103
|
+
AccessToken = "CLOUD_API_ACCESS_TOKEN",
|
|
104
|
+
WebhookEndpoint = "WEBHOOK_ENDPOINT",
|
|
105
|
+
WebhookVerificationToken = "WEBHOOK_VERIFICATION_TOKEN",
|
|
106
|
+
ListenerPort = "LISTENER_PORT",
|
|
107
|
+
MaxRetriesAfterWait = "MAX_RETRIES_AFTER_WAIT",
|
|
108
|
+
RequestTimeout = "REQUEST_TIMEOUT",
|
|
109
|
+
Debug = "DEBUG",
|
|
110
|
+
PrivatePem = "FLOW_API_PRIVATE_PEM",
|
|
111
|
+
Passphrase = "FLOW_API_PASSPHRASE",
|
|
112
|
+
}
|
|
113
|
+
declare enum ConversationTypesEnum {
|
|
114
|
+
BusinessInitiated = "business_initiated",
|
|
115
|
+
CustomerInitiated = "customer_initiated",
|
|
116
|
+
ReferralConversion = "referral_conversion",
|
|
117
|
+
}
|
|
118
|
+
declare enum StatusEnum {
|
|
119
|
+
Delivered = "delivered",
|
|
120
|
+
Read = "read",
|
|
121
|
+
Sent = "sent",
|
|
122
|
+
}
|
|
123
|
+
declare enum VideoMediaTypesEnum {
|
|
124
|
+
Mp4 = "video/mp4",
|
|
125
|
+
Threegp = "video/3gp",
|
|
126
|
+
}
|
|
127
|
+
declare enum StickerMediaTypesEnum {
|
|
128
|
+
Webp = "image/webp",
|
|
129
|
+
}
|
|
130
|
+
declare enum ImageMediaTypesEnum {
|
|
131
|
+
Jpeg = "image/jpeg",
|
|
132
|
+
Png = "image/png",
|
|
133
|
+
}
|
|
134
|
+
declare enum DocumentMediaTypesEnum {
|
|
135
|
+
Text = "text/plain",
|
|
136
|
+
Pdf = "application/pdf",
|
|
137
|
+
Ppt = "application/vnd.ms-powerpoint",
|
|
138
|
+
Word = "application/msword",
|
|
139
|
+
Excel = "application/vnd.ms-excel",
|
|
140
|
+
OpenDoc = "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
141
|
+
OpenPres = "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
142
|
+
OpenSheet = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
143
|
+
}
|
|
144
|
+
declare enum AudioMediaTypesEnum {
|
|
145
|
+
Aac = "audio/aac",
|
|
146
|
+
Mp4 = "audio/mp4",
|
|
147
|
+
Mpeg = "audio/mpeg",
|
|
148
|
+
Amr = "audio/amr",
|
|
149
|
+
Ogg = "audio/ogg",
|
|
150
|
+
}
|
|
151
|
+
declare enum WebhookTypesEnum {
|
|
152
|
+
Audio = "audio",
|
|
153
|
+
Button = "button",
|
|
154
|
+
Document = "document",
|
|
155
|
+
Text = "text",
|
|
156
|
+
Image = "image",
|
|
157
|
+
Interactive = "interactive",
|
|
158
|
+
Order = "order",
|
|
159
|
+
Sticker = "sticker",
|
|
160
|
+
System = "system",
|
|
161
|
+
Unknown = "unknown",
|
|
162
|
+
Video = "video",
|
|
163
|
+
}
|
|
164
|
+
declare enum SystemChangeTypesEnum {
|
|
165
|
+
CustomerChangedNumber = "customer_changed_number",
|
|
166
|
+
CustomerIdentityChanged = "customer_identity_changed",
|
|
167
|
+
}
|
|
168
|
+
declare enum ReferralSourceTypesEnum {
|
|
169
|
+
Ad = "ad",
|
|
170
|
+
Post = "post",
|
|
171
|
+
}
|
|
172
|
+
declare enum RequestCodeMethodsEnum {
|
|
173
|
+
Sms = "SMS",
|
|
174
|
+
Voice = "VOICE",
|
|
175
|
+
}
|
|
176
|
+
declare enum LanguagesEnum {
|
|
177
|
+
Afrikaans = "af",
|
|
178
|
+
Albanian = "sq",
|
|
179
|
+
Arabic = "ar",
|
|
180
|
+
Azerbaijani = "az",
|
|
181
|
+
Bengali = "bn",
|
|
182
|
+
Bulgarian = "bg",
|
|
183
|
+
Catalan = "ca",
|
|
184
|
+
Chinese_CHN = "zh_CN",
|
|
185
|
+
Chinese_HKG = "zh_HK",
|
|
186
|
+
Chinese_TAI = "zh_TW",
|
|
187
|
+
Croatian = "hr",
|
|
188
|
+
Czech = "cs",
|
|
189
|
+
Danish = "da",
|
|
190
|
+
Dutch = "nl",
|
|
191
|
+
English = "en",
|
|
192
|
+
English_UK = "en_GB",
|
|
193
|
+
English_US = "en_US",
|
|
194
|
+
Estonian = "et",
|
|
195
|
+
Filipino = "fil",
|
|
196
|
+
Finnish = "fi",
|
|
197
|
+
French = "fr",
|
|
198
|
+
Georgian = "ka",
|
|
199
|
+
German = "de",
|
|
200
|
+
Greek = "el",
|
|
201
|
+
Gujarati = "gu",
|
|
202
|
+
Hausa = "ha",
|
|
203
|
+
Hebrew = "he",
|
|
204
|
+
Hindi = "hi",
|
|
205
|
+
Hungarian = "hu",
|
|
206
|
+
Indonesian = "id",
|
|
207
|
+
Irish = "ga",
|
|
208
|
+
Italian = "it",
|
|
209
|
+
Japanese = "ja",
|
|
210
|
+
Kannada = "kn",
|
|
211
|
+
Kazakh = "kk",
|
|
212
|
+
Kinyarwanda = "rw_RW",
|
|
213
|
+
Korean = "ko",
|
|
214
|
+
Kyrgyz_Kyrgyzstan = "ky_KG",
|
|
215
|
+
Lao = "lo",
|
|
216
|
+
Latvian = "lv",
|
|
217
|
+
Lithuanian = "lt",
|
|
218
|
+
Macedonian = "mk",
|
|
219
|
+
Malay = "ms",
|
|
220
|
+
Malayalam = "ml",
|
|
221
|
+
Marathi = "mr",
|
|
222
|
+
Norwegian = "nb",
|
|
223
|
+
Persian = "fa",
|
|
224
|
+
Polish = "pl",
|
|
225
|
+
Portuguese_BR = "pt_BR",
|
|
226
|
+
Portuguese_POR = "pt_PT",
|
|
227
|
+
Punjabi = "pa",
|
|
228
|
+
Romanian = "ro",
|
|
229
|
+
Russian = "ru",
|
|
230
|
+
Serbian = "sr",
|
|
231
|
+
Slovak = "sk",
|
|
232
|
+
Slovenian = "sl",
|
|
233
|
+
Spanish = "es",
|
|
234
|
+
Spanish_ARG = "es_AR",
|
|
235
|
+
Spanish_SPA = "es_ES",
|
|
236
|
+
Spanish_MEX = "es_MX",
|
|
237
|
+
Swahili = "sw",
|
|
238
|
+
Swedish = "sv",
|
|
239
|
+
Tamil = "ta",
|
|
240
|
+
Telugu = "te",
|
|
241
|
+
Thai = "th",
|
|
242
|
+
Turkish = "tr",
|
|
243
|
+
Ukrainian = "uk",
|
|
244
|
+
Urdu = "ur",
|
|
245
|
+
Uzbek = "uz",
|
|
246
|
+
Vietnamese = "vi",
|
|
247
|
+
Zulu = "zu",
|
|
248
|
+
}
|
|
249
|
+
declare enum CurrencyCodesEnum {
|
|
250
|
+
AFN = "AFN",
|
|
251
|
+
EUR = "EUR",
|
|
252
|
+
ALL = "ALL",
|
|
253
|
+
DZD = "DZD",
|
|
254
|
+
USD = "USD",
|
|
255
|
+
AOA = "AOA",
|
|
256
|
+
XCD = "XCD",
|
|
257
|
+
ARS = "ARS",
|
|
258
|
+
AMD = "AMD",
|
|
259
|
+
AWG = "AWG",
|
|
260
|
+
AUD = "AUD",
|
|
261
|
+
AZN = "AZN",
|
|
262
|
+
BSD = "BSD",
|
|
263
|
+
BHD = "BHD",
|
|
264
|
+
BDT = "BDT",
|
|
265
|
+
BBD = "BBD",
|
|
266
|
+
BYN = "BYN",
|
|
267
|
+
BZD = "BZD",
|
|
268
|
+
XOF = "XOF",
|
|
269
|
+
BMD = "BMD",
|
|
270
|
+
INR = "INR",
|
|
271
|
+
BTN = "BTN",
|
|
272
|
+
BOB = "BOB",
|
|
273
|
+
BOV = "BOV",
|
|
274
|
+
BAM = "BAM",
|
|
275
|
+
BWP = "BWP",
|
|
276
|
+
NOK = "NOK",
|
|
277
|
+
BRL = "BRL",
|
|
278
|
+
BND = "BND",
|
|
279
|
+
BGN = "BGN",
|
|
280
|
+
BIF = "BIF",
|
|
281
|
+
CVE = "CVE",
|
|
282
|
+
KHR = "KHR",
|
|
283
|
+
XAF = "XAF",
|
|
284
|
+
CAD = "CAD",
|
|
285
|
+
KYD = "KYD",
|
|
286
|
+
CLP = "CLP",
|
|
287
|
+
CLF = "CLF",
|
|
288
|
+
CNY = "CNY",
|
|
289
|
+
COP = "COP",
|
|
290
|
+
COU = "COU",
|
|
291
|
+
KMF = "KMF",
|
|
292
|
+
CDF = "CDF",
|
|
293
|
+
NZD = "NZD",
|
|
294
|
+
CRC = "CRC",
|
|
295
|
+
HRK = "HRK",
|
|
296
|
+
CUP = "CUP",
|
|
297
|
+
CUC = "CUC",
|
|
298
|
+
ANG = "ANG",
|
|
299
|
+
CZK = "CZK",
|
|
300
|
+
DKK = "DKK",
|
|
301
|
+
DJF = "DJF",
|
|
302
|
+
DOP = "DOP",
|
|
303
|
+
EGP = "EGP",
|
|
304
|
+
SVC = "SVC",
|
|
305
|
+
ERN = "ERN",
|
|
306
|
+
SZL = "SZL",
|
|
307
|
+
ETB = "ETB",
|
|
308
|
+
FKP = "FKP",
|
|
309
|
+
FJD = "FJD",
|
|
310
|
+
XPF = "XPF",
|
|
311
|
+
GMD = "GMD",
|
|
312
|
+
GEL = "GEL",
|
|
313
|
+
GHS = "GHS",
|
|
314
|
+
GIP = "GIP",
|
|
315
|
+
GTQ = "GTQ",
|
|
316
|
+
GBP = "GBP",
|
|
317
|
+
GNF = "GNF",
|
|
318
|
+
GYD = "GYD",
|
|
319
|
+
HTG = "HTG",
|
|
320
|
+
HNL = "HNL",
|
|
321
|
+
HKD = "HKD",
|
|
322
|
+
HUF = "HUF",
|
|
323
|
+
ISK = "ISK",
|
|
324
|
+
IDR = "IDR",
|
|
325
|
+
XDR = "XDR",
|
|
326
|
+
IRR = "IRR",
|
|
327
|
+
IQD = "IQD",
|
|
328
|
+
ILS = "ILS",
|
|
329
|
+
JMD = "JMD",
|
|
330
|
+
JPY = "JPY",
|
|
331
|
+
JOD = "JOD",
|
|
332
|
+
KZT = "KZT",
|
|
333
|
+
KES = "KES",
|
|
334
|
+
KPW = "KPW",
|
|
335
|
+
KRW = "KRW",
|
|
336
|
+
KWD = "KWD",
|
|
337
|
+
KGS = "KGS",
|
|
338
|
+
LAK = "LAK",
|
|
339
|
+
LBP = "LBP",
|
|
340
|
+
LSL = "LSL",
|
|
341
|
+
ZAR = "ZAR",
|
|
342
|
+
LRD = "LRD",
|
|
343
|
+
LYD = "LYD",
|
|
344
|
+
CHF = "CHF",
|
|
345
|
+
MOP = "MOP",
|
|
346
|
+
MKD = "MKD",
|
|
347
|
+
MGA = "MGA",
|
|
348
|
+
MWK = "MWK",
|
|
349
|
+
MYR = "MYR",
|
|
350
|
+
MVR = "MVR",
|
|
351
|
+
MRU = "MRU",
|
|
352
|
+
MUR = "MUR",
|
|
353
|
+
XUA = "XUA",
|
|
354
|
+
MXN = "MXN",
|
|
355
|
+
MXV = "MXV",
|
|
356
|
+
MDL = "MDL",
|
|
357
|
+
MNT = "MNT",
|
|
358
|
+
MAD = "MAD",
|
|
359
|
+
MZN = "MZN",
|
|
360
|
+
MMK = "MMK",
|
|
361
|
+
NAD = "NAD",
|
|
362
|
+
NPR = "NPR",
|
|
363
|
+
NIO = "NIO",
|
|
364
|
+
NGN = "NGN",
|
|
365
|
+
OMR = "OMR",
|
|
366
|
+
PKR = "PKR",
|
|
367
|
+
PAB = "PAB",
|
|
368
|
+
PGK = "PGK",
|
|
369
|
+
PYG = "PYG",
|
|
370
|
+
PEN = "PEN",
|
|
371
|
+
PHP = "PHP",
|
|
372
|
+
PLN = "PLN",
|
|
373
|
+
QAR = "QAR",
|
|
374
|
+
RON = "RON",
|
|
375
|
+
RUB = "RUB",
|
|
376
|
+
RWF = "RWF",
|
|
377
|
+
SHP = "SHP",
|
|
378
|
+
WST = "WST",
|
|
379
|
+
STN = "STN",
|
|
380
|
+
SAR = "SAR",
|
|
381
|
+
RSD = "RSD",
|
|
382
|
+
SCR = "SCR",
|
|
383
|
+
SLL = "SLL",
|
|
384
|
+
SGD = "SGD",
|
|
385
|
+
XSU = "XSU",
|
|
386
|
+
SBD = "SBD",
|
|
387
|
+
SOS = "SOS",
|
|
388
|
+
SSP = "SSP",
|
|
389
|
+
LKR = "LKR",
|
|
390
|
+
SDG = "SDG",
|
|
391
|
+
SRD = "SRD",
|
|
392
|
+
SEK = "SEK",
|
|
393
|
+
CHE = "CHE",
|
|
394
|
+
CHW = "CHW",
|
|
395
|
+
SYP = "SYP",
|
|
396
|
+
TWD = "TWD",
|
|
397
|
+
TJS = "TJS",
|
|
398
|
+
TZS = "TZS",
|
|
399
|
+
THB = "THB",
|
|
400
|
+
TOP = "TOP",
|
|
401
|
+
TTD = "TTD",
|
|
402
|
+
TND = "TND",
|
|
403
|
+
TRY = "TRY",
|
|
404
|
+
TMT = "TMT",
|
|
405
|
+
UGX = "UGX",
|
|
406
|
+
UAH = "UAH",
|
|
407
|
+
AED = "AED",
|
|
408
|
+
USN = "USN",
|
|
409
|
+
UYU = "UYU",
|
|
410
|
+
UYI = "UYI",
|
|
411
|
+
UYW = "UYW",
|
|
412
|
+
UZS = "UZS",
|
|
413
|
+
VUV = "VUV",
|
|
414
|
+
VES = "VES",
|
|
415
|
+
VND = "VND",
|
|
416
|
+
YER = "YER",
|
|
417
|
+
ZMW = "ZMW",
|
|
418
|
+
ZWL = "ZWL",
|
|
419
|
+
XBA = "XBA",
|
|
420
|
+
XBB = "XBB",
|
|
421
|
+
XBC = "XBC",
|
|
422
|
+
XBD = "XBD",
|
|
423
|
+
XTS = "XTS",
|
|
424
|
+
XXX = "XXX",
|
|
425
|
+
XAU = "XAU",
|
|
426
|
+
XPD = "XPD",
|
|
427
|
+
XPT = "XPT",
|
|
428
|
+
XAG = "XAG",
|
|
429
|
+
AFA = "AFA",
|
|
430
|
+
FIM = "FIM",
|
|
431
|
+
ALK = "ALK",
|
|
432
|
+
ADP = "ADP",
|
|
433
|
+
ESP = "ESP",
|
|
434
|
+
FRF = "FRF",
|
|
435
|
+
AOK = "AOK",
|
|
436
|
+
AON = "AON",
|
|
437
|
+
AOR = "AOR",
|
|
438
|
+
ARA = "ARA",
|
|
439
|
+
ARP = "ARP",
|
|
440
|
+
ARY = "ARY",
|
|
441
|
+
RUR = "RUR",
|
|
442
|
+
ATS = "ATS",
|
|
443
|
+
AYM = "AYM",
|
|
444
|
+
AZM = "AZM",
|
|
445
|
+
BYB = "BYB",
|
|
446
|
+
BYR = "BYR",
|
|
447
|
+
BEC = "BEC",
|
|
448
|
+
BEF = "BEF",
|
|
449
|
+
BEL = "BEL",
|
|
450
|
+
BOP = "BOP",
|
|
451
|
+
BAD = "BAD",
|
|
452
|
+
BRB = "BRB",
|
|
453
|
+
BRC = "BRC",
|
|
454
|
+
BRE = "BRE",
|
|
455
|
+
BRN = "BRN",
|
|
456
|
+
BRR = "BRR",
|
|
457
|
+
BGJ = "BGJ",
|
|
458
|
+
BGK = "BGK",
|
|
459
|
+
BGL = "BGL",
|
|
460
|
+
BUK = "BUK",
|
|
461
|
+
HRD = "HRD",
|
|
462
|
+
CYP = "CYP",
|
|
463
|
+
CSJ = "CSJ",
|
|
464
|
+
CSK = "CSK",
|
|
465
|
+
ECS = "ECS",
|
|
466
|
+
ECV = "ECV",
|
|
467
|
+
GQE = "GQE",
|
|
468
|
+
EEK = "EEK",
|
|
469
|
+
XEU = "XEU",
|
|
470
|
+
GEK = "GEK",
|
|
471
|
+
DDM = "DDM",
|
|
472
|
+
DEM = "DEM",
|
|
473
|
+
GHC = "GHC",
|
|
474
|
+
GHP = "GHP",
|
|
475
|
+
GRD = "GRD",
|
|
476
|
+
GNE = "GNE",
|
|
477
|
+
GNS = "GNS",
|
|
478
|
+
GWE = "GWE",
|
|
479
|
+
GWP = "GWP",
|
|
480
|
+
ITL = "ITL",
|
|
481
|
+
ISJ = "ISJ",
|
|
482
|
+
IEP = "IEP",
|
|
483
|
+
ILP = "ILP",
|
|
484
|
+
ILR = "ILR",
|
|
485
|
+
LAJ = "LAJ",
|
|
486
|
+
LVL = "LVL",
|
|
487
|
+
LVR = "LVR",
|
|
488
|
+
LSM = "LSM",
|
|
489
|
+
ZAL = "ZAL",
|
|
490
|
+
LTL = "LTL",
|
|
491
|
+
LTT = "LTT",
|
|
492
|
+
LUC = "LUC",
|
|
493
|
+
LUF = "LUF",
|
|
494
|
+
LUL = "LUL",
|
|
495
|
+
MGF = "MGF",
|
|
496
|
+
MVQ = "MVQ",
|
|
497
|
+
MLF = "MLF",
|
|
498
|
+
MTL = "MTL",
|
|
499
|
+
MTP = "MTP",
|
|
500
|
+
MRO = "MRO",
|
|
501
|
+
MXP = "MXP",
|
|
502
|
+
MZE = "MZE",
|
|
503
|
+
MZM = "MZM",
|
|
504
|
+
NLG = "NLG",
|
|
505
|
+
NIC = "NIC",
|
|
506
|
+
PEH = "PEH",
|
|
507
|
+
PEI = "PEI",
|
|
508
|
+
PES = "PES",
|
|
509
|
+
PLZ = "PLZ",
|
|
510
|
+
PTE = "PTE",
|
|
511
|
+
ROK = "ROK",
|
|
512
|
+
ROL = "ROL",
|
|
513
|
+
STD = "STD",
|
|
514
|
+
CSD = "CSD",
|
|
515
|
+
SKK = "SKK",
|
|
516
|
+
SIT = "SIT",
|
|
517
|
+
RHD = "RHD",
|
|
518
|
+
ESA = "ESA",
|
|
519
|
+
ESB = "ESB",
|
|
520
|
+
SDD = "SDD",
|
|
521
|
+
SDP = "SDP",
|
|
522
|
+
SRG = "SRG",
|
|
523
|
+
CHC = "CHC",
|
|
524
|
+
TJR = "TJR",
|
|
525
|
+
TPE = "TPE",
|
|
526
|
+
TRL = "TRL",
|
|
527
|
+
TMM = "TMM",
|
|
528
|
+
UGS = "UGS",
|
|
529
|
+
UGW = "UGW",
|
|
530
|
+
UAK = "UAK",
|
|
531
|
+
SUR = "SUR",
|
|
532
|
+
USS = "USS",
|
|
533
|
+
UYN = "UYN",
|
|
534
|
+
UYP = "UYP",
|
|
535
|
+
VEB = "VEB",
|
|
536
|
+
VEF = "VEF",
|
|
537
|
+
VNC = "VNC",
|
|
538
|
+
YDD = "YDD",
|
|
539
|
+
YUD = "YUD",
|
|
540
|
+
YUM = "YUM",
|
|
541
|
+
YUN = "YUN",
|
|
542
|
+
ZRN = "ZRN",
|
|
543
|
+
ZRZ = "ZRZ",
|
|
544
|
+
ZMK = "ZMK",
|
|
545
|
+
ZWC = "ZWC",
|
|
546
|
+
ZWD = "ZWD",
|
|
547
|
+
ZWN = "ZWN",
|
|
548
|
+
ZWR = "ZWR",
|
|
549
|
+
XFO = "XFO",
|
|
550
|
+
XRE = "XRE",
|
|
551
|
+
XFU = "XFU",
|
|
552
|
+
}
|
|
553
|
+
declare enum DataLocalizationRegionEnum {
|
|
554
|
+
AU = "AU",
|
|
555
|
+
// Australia
|
|
556
|
+
ID = "ID",
|
|
557
|
+
// Indonesia
|
|
558
|
+
IN = "IN",
|
|
559
|
+
// India
|
|
560
|
+
JP = "JP",
|
|
561
|
+
// Japan
|
|
562
|
+
SG = "SG",
|
|
563
|
+
// Singapore
|
|
564
|
+
KR = "KR",
|
|
565
|
+
// South Korea
|
|
566
|
+
DE = "DE",
|
|
567
|
+
// EU (Germany)
|
|
568
|
+
CH = "CH",
|
|
569
|
+
// Switzerland
|
|
570
|
+
GB = "GB",
|
|
571
|
+
// United Kingdom
|
|
572
|
+
BR = "BR",
|
|
573
|
+
// Brazil
|
|
574
|
+
BH = "BH",
|
|
575
|
+
// Bahrain
|
|
576
|
+
ZA = "ZA",
|
|
577
|
+
// South Africa
|
|
578
|
+
AE = "AE",
|
|
579
|
+
// United Arab Emirates
|
|
580
|
+
CA = "CA",
|
|
581
|
+
}
|
|
582
|
+
/**
|
|
583
|
+
* Business category values for WhatsApp Business Profile.
|
|
584
|
+
* These values map to specific strings displayed in the WhatsApp client.
|
|
585
|
+
*/
|
|
586
|
+
declare enum BusinessVerticalEnum {
|
|
587
|
+
/**
|
|
588
|
+
* Alcoholic Beverages
|
|
589
|
+
*/
|
|
590
|
+
ALCOHOL = "ALCOHOL",
|
|
591
|
+
/**
|
|
592
|
+
* Clothing and Apparel
|
|
593
|
+
*/
|
|
594
|
+
APPAREL = "APPAREL",
|
|
595
|
+
/**
|
|
596
|
+
* Automotive
|
|
597
|
+
*/
|
|
598
|
+
AUTO = "AUTO",
|
|
599
|
+
/**
|
|
600
|
+
* Beauty, Spa and Salon
|
|
601
|
+
*/
|
|
602
|
+
BEAUTY = "BEAUTY",
|
|
603
|
+
/**
|
|
604
|
+
* Education
|
|
605
|
+
*/
|
|
606
|
+
EDU = "EDU",
|
|
607
|
+
/**
|
|
608
|
+
* Entertainment
|
|
609
|
+
*/
|
|
610
|
+
ENTERTAIN = "ENTERTAIN",
|
|
611
|
+
/**
|
|
612
|
+
* Event Planning and Service
|
|
613
|
+
*/
|
|
614
|
+
EVENT_PLAN = "EVENT_PLAN",
|
|
615
|
+
/**
|
|
616
|
+
* Finance and Banking
|
|
617
|
+
*/
|
|
618
|
+
FINANCE = "FINANCE",
|
|
619
|
+
/**
|
|
620
|
+
* Public Service
|
|
621
|
+
*/
|
|
622
|
+
GOVT = "GOVT",
|
|
623
|
+
/**
|
|
624
|
+
* Food and Grocery
|
|
625
|
+
*/
|
|
626
|
+
GROCERY = "GROCERY",
|
|
627
|
+
/**
|
|
628
|
+
* Medical and Health
|
|
629
|
+
*/
|
|
630
|
+
HEALTH = "HEALTH",
|
|
631
|
+
/**
|
|
632
|
+
* Hotel and Lodging
|
|
633
|
+
*/
|
|
634
|
+
HOTEL = "HOTEL",
|
|
635
|
+
/**
|
|
636
|
+
* Non-profit
|
|
637
|
+
*/
|
|
638
|
+
NONPROFIT = "NONPROFIT",
|
|
639
|
+
/**
|
|
640
|
+
* Online Gambling & Gaming
|
|
641
|
+
*/
|
|
642
|
+
ONLINE_GAMBLING = "ONLINE_GAMBLING",
|
|
643
|
+
/**
|
|
644
|
+
* Over-the-Counter Drugs
|
|
645
|
+
*/
|
|
646
|
+
OTC_DRUGS = "OTC_DRUGS",
|
|
647
|
+
/**
|
|
648
|
+
* Other
|
|
649
|
+
*/
|
|
650
|
+
OTHER = "OTHER",
|
|
651
|
+
/**
|
|
652
|
+
* Non-Online Gambling & Gaming (E.g. Brick and mortar)
|
|
653
|
+
*/
|
|
654
|
+
PHYSICAL_GAMBLING = "PHYSICAL_GAMBLING",
|
|
655
|
+
/**
|
|
656
|
+
* Professional Services
|
|
657
|
+
*/
|
|
658
|
+
PROF_SERVICES = "PROF_SERVICES",
|
|
659
|
+
/**
|
|
660
|
+
* Restaurant
|
|
661
|
+
*/
|
|
662
|
+
RESTAURANT = "RESTAURANT",
|
|
663
|
+
/**
|
|
664
|
+
* Shopping and Retail
|
|
665
|
+
*/
|
|
666
|
+
RETAIL = "RETAIL",
|
|
667
|
+
/**
|
|
668
|
+
* Travel and Transportation
|
|
669
|
+
*/
|
|
670
|
+
TRAVEL = "TRAVEL",
|
|
671
|
+
}
|
|
672
|
+
//#endregion
|
|
673
|
+
//#region src/types/config.d.ts
|
|
674
|
+
type WhatsAppConfig = {
|
|
675
|
+
accessToken: string;
|
|
676
|
+
appId?: string;
|
|
677
|
+
appSecret?: string;
|
|
678
|
+
phoneNumberId?: number;
|
|
679
|
+
businessAcctId?: string;
|
|
680
|
+
apiVersion?: string;
|
|
681
|
+
webhookEndpoint?: string;
|
|
682
|
+
webhookVerificationToken?: string;
|
|
683
|
+
listenerPort?: number;
|
|
684
|
+
debug?: boolean;
|
|
685
|
+
maxRetriesAfterWait?: number;
|
|
686
|
+
requestTimeout?: number;
|
|
687
|
+
privatePem?: string;
|
|
688
|
+
passphrase?: string;
|
|
689
|
+
};
|
|
690
|
+
type WabaConfigType = {
|
|
691
|
+
/**
|
|
692
|
+
* The Meta for Developers business application Id for this registered application.
|
|
693
|
+
*/
|
|
694
|
+
[WabaConfigEnum.AppId]: string;
|
|
695
|
+
/**
|
|
696
|
+
* The Meta for Developers business application secret for this registered application.
|
|
697
|
+
*/
|
|
698
|
+
[WabaConfigEnum.AppSecret]: string;
|
|
699
|
+
/**
|
|
700
|
+
* The Meta for Developers phone number id used by the registered business.
|
|
701
|
+
*/
|
|
702
|
+
[WabaConfigEnum.PhoneNumberId]: number;
|
|
703
|
+
/**
|
|
704
|
+
* The Meta for Developers business id for the registered business.
|
|
705
|
+
*/
|
|
706
|
+
[WabaConfigEnum.BusinessAcctId]: string;
|
|
707
|
+
/**
|
|
708
|
+
* The version of the Cloud API being used. Starts with a "v" and follows the major number.
|
|
709
|
+
*/
|
|
710
|
+
[WabaConfigEnum.APIVersion]: string;
|
|
711
|
+
/**
|
|
712
|
+
* The access token to make calls on behalf of the signed in Meta for Developers account or business.
|
|
713
|
+
*/
|
|
714
|
+
[WabaConfigEnum.AccessToken]: string;
|
|
715
|
+
/**
|
|
716
|
+
* The endpoint path (e.g. if the value here is webhook, the webhook URL would look like http/https://{host}/webhook).
|
|
717
|
+
*/
|
|
718
|
+
[WabaConfigEnum.WebhookEndpoint]: string;
|
|
719
|
+
/**
|
|
720
|
+
* The verification token that needs to match what is sent by the Cloud API webhook in order to subscribe.
|
|
721
|
+
*/
|
|
722
|
+
[WabaConfigEnum.WebhookVerificationToken]: string;
|
|
723
|
+
/**
|
|
724
|
+
* The listener port for the webhook web server.
|
|
725
|
+
*/
|
|
726
|
+
[WabaConfigEnum.ListenerPort]: number;
|
|
727
|
+
/**
|
|
728
|
+
* To turn on global debugging of the logger to print verbose output across the APIs.
|
|
729
|
+
*/
|
|
730
|
+
[WabaConfigEnum.Debug]: boolean;
|
|
731
|
+
/**
|
|
732
|
+
* The total number of times a request should be retried after the wait period if it fails.
|
|
733
|
+
*/
|
|
734
|
+
[WabaConfigEnum.MaxRetriesAfterWait]: number;
|
|
735
|
+
/**
|
|
736
|
+
* The timeout period for a request to quit and destroy the attempt in ms.
|
|
737
|
+
*/
|
|
738
|
+
[WabaConfigEnum.RequestTimeout]: number;
|
|
739
|
+
/**
|
|
740
|
+
* The private key for the Meta for Developers business.
|
|
741
|
+
*/
|
|
742
|
+
[WabaConfigEnum.PrivatePem]: string;
|
|
743
|
+
/**
|
|
744
|
+
* The passphrase for the Meta for Developers business.
|
|
745
|
+
*/
|
|
746
|
+
[WabaConfigEnum.Passphrase]: string;
|
|
747
|
+
};
|
|
748
|
+
//#endregion
|
|
749
|
+
//#region src/types/logger.d.ts
|
|
750
|
+
interface LoggerInterface {
|
|
751
|
+
log(...data: any[]): void;
|
|
752
|
+
error(...data: any[]): void;
|
|
753
|
+
warn(...data: any[]): void;
|
|
754
|
+
info(...data: any[]): void;
|
|
755
|
+
debug(...data: any[]): void;
|
|
756
|
+
}
|
|
757
|
+
//#endregion
|
|
758
|
+
//#region src/types/request.d.ts
|
|
759
|
+
type GeneralRequestBody = Record<string, unknown>;
|
|
760
|
+
interface GeneralHeaderInterface {
|
|
761
|
+
/**
|
|
762
|
+
* Authorization token. This is required for all HTTP requests made to the graph API.
|
|
763
|
+
* @default 'Bearer '
|
|
764
|
+
*/
|
|
765
|
+
Authorization: string;
|
|
766
|
+
/**
|
|
767
|
+
* Content type of the message being sent. This is required for all HTTP requests made to the graph API.
|
|
768
|
+
* @default 'application/json'
|
|
769
|
+
*/
|
|
770
|
+
'Content-Type': string;
|
|
771
|
+
/**
|
|
772
|
+
* User agent field sent in all requests. This is used to gather SDK usage metrics and help
|
|
773
|
+
* better triage support requests.
|
|
774
|
+
* @default `WA_SDK/${ SDK_version } (Node.js ${ process.version })`
|
|
775
|
+
*/
|
|
776
|
+
'User-Agent': string;
|
|
777
|
+
}
|
|
778
|
+
interface RequesterResponseInterface<T> {
|
|
779
|
+
json: () => Promise<T>;
|
|
780
|
+
}
|
|
781
|
+
interface ResponseSuccess {
|
|
782
|
+
success: boolean;
|
|
783
|
+
}
|
|
784
|
+
interface ResponseData<T> {
|
|
785
|
+
data: T;
|
|
786
|
+
}
|
|
787
|
+
interface ResponsePagination<T> {
|
|
788
|
+
data: T[];
|
|
789
|
+
paging: Paging;
|
|
790
|
+
}
|
|
791
|
+
interface Paging {
|
|
792
|
+
cursors: {
|
|
793
|
+
before: string;
|
|
794
|
+
after: string;
|
|
795
|
+
};
|
|
796
|
+
next: string;
|
|
797
|
+
}
|
|
798
|
+
declare class RequesterClass {
|
|
799
|
+
constructor(apiVersion: string, phoneNumberId: number, accessToken: string, businessAcctId: string, userAgent: string);
|
|
800
|
+
sendRequest: (method: HttpMethodsEnum, path: string, timeout: number, body?: GeneralRequestBody, contentType?: string, additionalHeaders?: Record<string, string>) => Promise<RequesterResponseInterface<unknown>>;
|
|
801
|
+
getJson<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: GeneralRequestBody, additionalHeaders?: Record<string, string>): Promise<T>;
|
|
802
|
+
sendFormData<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: FormData, additionalHeaders?: Record<string, string>): Promise<T>;
|
|
803
|
+
sendUrlEncodedForm<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: Record<string, string>, additionalHeaders?: Record<string, string>): Promise<T>;
|
|
804
|
+
}
|
|
805
|
+
//#endregion
|
|
806
|
+
//#region src/types/httpsClient.d.ts
|
|
807
|
+
type ResponseHeaderValue = string | string[] | undefined;
|
|
808
|
+
type ResponseHeaders = Record<string, ResponseHeaderValue>;
|
|
809
|
+
type ResponseJSONBody = Record<string, unknown>;
|
|
810
|
+
declare class HttpsClientResponseClass {
|
|
811
|
+
constructor(resp: Response);
|
|
812
|
+
statusCode: () => number;
|
|
813
|
+
headers: () => ResponseHeaders;
|
|
814
|
+
rawResponse: () => Response;
|
|
815
|
+
json: () => Promise<ResponseJSONBody>;
|
|
816
|
+
}
|
|
817
|
+
declare class HttpsClientClass {
|
|
818
|
+
constructor();
|
|
819
|
+
clearSockets: () => boolean;
|
|
820
|
+
sendRequest: (host: string, path: string, method: HttpMethodsEnum, headers: HeadersInit, timeout: number, body?: BodyInit | null) => Promise<HttpsClientResponseClass>;
|
|
821
|
+
}
|
|
822
|
+
//#endregion
|
|
823
|
+
//#region src/types/base.d.ts
|
|
824
|
+
declare class BaseClass {
|
|
825
|
+
constructor(config: WabaConfigType);
|
|
826
|
+
}
|
|
827
|
+
declare class BaseAPI implements BaseClass {
|
|
828
|
+
protected config: WabaConfigType;
|
|
829
|
+
protected client: RequesterClass;
|
|
830
|
+
constructor(config: WabaConfigType, client: RequesterClass);
|
|
831
|
+
protected sendJson<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any): Promise<T>;
|
|
832
|
+
protected sendFormData<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any): Promise<T>;
|
|
833
|
+
protected sendUrlEncodedForm<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any): Promise<T>;
|
|
834
|
+
}
|
|
835
|
+
//#endregion
|
|
836
|
+
//#region src/utils/http/httpsClient.d.ts
|
|
837
|
+
declare class HttpsClient implements HttpsClientClass {
|
|
838
|
+
agent: Agent;
|
|
839
|
+
constructor();
|
|
840
|
+
clearSockets(): boolean;
|
|
841
|
+
sendRequest(hostname: string, path: string, method: HttpMethodsEnum, headers: HeadersInit, timeout: number, body?: BodyInit | null): Promise<HttpsClientResponseClass>;
|
|
842
|
+
}
|
|
843
|
+
declare class HttpsClientResponse implements HttpsClientResponseClass {
|
|
844
|
+
res: Response;
|
|
845
|
+
respStatusCode: number;
|
|
846
|
+
respHeaders: ResponseHeaders;
|
|
847
|
+
constructor(resp: Response);
|
|
848
|
+
statusCode(): number;
|
|
849
|
+
headers(): ResponseHeaders;
|
|
850
|
+
rawResponse(): Response;
|
|
851
|
+
json(): Promise<ResponseJSONBody>;
|
|
852
|
+
}
|
|
853
|
+
//#endregion
|
|
854
|
+
//#region src/utils/http/request.d.ts
|
|
855
|
+
declare class Requester implements RequesterClass {
|
|
856
|
+
client: Readonly<HttpsClient>;
|
|
857
|
+
accessToken: Readonly<string>;
|
|
858
|
+
phoneNumberId: Readonly<number>;
|
|
859
|
+
businessAcctId: Readonly<string>;
|
|
860
|
+
apiVersion: Readonly<string>;
|
|
861
|
+
userAgent: Readonly<string>;
|
|
862
|
+
host: Readonly<string>;
|
|
863
|
+
protocol: Readonly<string>;
|
|
864
|
+
constructor(apiVersion: string, phoneNumberId: number, accessToken: string, businessAcctId: string, userAgent: string);
|
|
865
|
+
buildHeader(contentType: string, additionalHeaders?: Record<string, string>): HeadersInit;
|
|
866
|
+
buildCAPIPath(endpoint: string): string;
|
|
867
|
+
sendRequest(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any, contentType?: string, additionalHeaders?: Record<string, string>): Promise<HttpsClientResponseClass>;
|
|
868
|
+
getJson<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any, additionalHeaders?: Record<string, string>): Promise<T>;
|
|
869
|
+
sendFormData<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: FormData, additionalHeaders?: Record<string, string>): Promise<T>;
|
|
870
|
+
sendUrlEncodedForm<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: Record<string, string>, additionalHeaders?: Record<string, string>): Promise<T>;
|
|
871
|
+
}
|
|
872
|
+
//#endregion
|
|
873
|
+
//#region src/api/encryption/types/publicKey.d.ts
|
|
874
|
+
type EncryptionPublicKeyResponse = ResponseData<{
|
|
875
|
+
business_public_key: string;
|
|
876
|
+
business_public_key_signature_status: 'VALID' | 'MISMATCH';
|
|
877
|
+
}>;
|
|
878
|
+
//#endregion
|
|
879
|
+
//#region src/api/encryption/types/common.d.ts
|
|
880
|
+
interface EncryptionClass {
|
|
881
|
+
getEncryptionPublicKey(): Promise<EncryptionPublicKeyResponse>;
|
|
882
|
+
setEncryptionPublicKey(businessPublicKey: string): Promise<ResponseSuccess>;
|
|
883
|
+
}
|
|
884
|
+
//#endregion
|
|
885
|
+
//#region src/api/encryption/EncryptionApi.d.ts
|
|
886
|
+
declare class EncryptionApi extends BaseAPI implements EncryptionClass {
|
|
887
|
+
private readonly endpoint;
|
|
888
|
+
constructor(config: WabaConfigType, client: RequesterClass);
|
|
889
|
+
getEncryptionPublicKey(): Promise<EncryptionPublicKeyResponse>;
|
|
890
|
+
setEncryptionPublicKey(businessPublicKey: string): Promise<ResponseSuccess>;
|
|
891
|
+
}
|
|
892
|
+
//#endregion
|
|
893
|
+
//#region src/api/flow/types/common.d.ts
|
|
894
|
+
/**
|
|
895
|
+
* Enum for Flow Status
|
|
896
|
+
*/
|
|
897
|
+
declare enum FlowStatusEnum {
|
|
898
|
+
Draft = "DRAFT",
|
|
899
|
+
Published = "PUBLISHED",
|
|
900
|
+
Throttled = "THROTTLED",
|
|
901
|
+
Blocked = "BLOCKED",
|
|
902
|
+
Deprecated = "DEPRECATED",
|
|
903
|
+
}
|
|
904
|
+
/**
|
|
905
|
+
* Enum for Flow Categories
|
|
906
|
+
*/
|
|
907
|
+
declare enum FlowCategoryEnum {
|
|
908
|
+
SignUp = "SIGN_UP",
|
|
909
|
+
SignIn = "SIGN_IN",
|
|
910
|
+
AppointmentBooking = "APPOINTMENT_BOOKING",
|
|
911
|
+
LeadGeneration = "LEAD_GENERATION",
|
|
912
|
+
ContactUs = "CONTACT_US",
|
|
913
|
+
CustomerSupport = "CUSTOMER_SUPPORT",
|
|
914
|
+
Survey = "SURVEY",
|
|
915
|
+
Other = "OTHER",
|
|
916
|
+
}
|
|
917
|
+
declare enum FlowActionEnum {
|
|
918
|
+
INIT = "INIT",
|
|
919
|
+
BACK = "BACK",
|
|
920
|
+
DATA_EXCHANGE = "data_exchange",
|
|
921
|
+
}
|
|
922
|
+
/**
|
|
923
|
+
* Enum for Flow Types in webhook handlers
|
|
924
|
+
* Used to register handlers for specific flow events
|
|
925
|
+
*/
|
|
926
|
+
declare enum FlowTypeEnum {
|
|
927
|
+
/** Health check/ping requests */
|
|
928
|
+
Ping = "ping",
|
|
929
|
+
/** Data exchange requests */
|
|
930
|
+
Change = "data_exchange",
|
|
931
|
+
/** Error notification requests */
|
|
932
|
+
Error = "error",
|
|
933
|
+
/** Match all flow action types */
|
|
934
|
+
All = "*",
|
|
935
|
+
}
|
|
936
|
+
type FlowType = (typeof FlowTypeEnum)[keyof typeof FlowTypeEnum];
|
|
937
|
+
/**
|
|
938
|
+
* Flow Validation Error Pointer
|
|
939
|
+
*/
|
|
940
|
+
interface FlowValidationErrorPointer {
|
|
941
|
+
line_start: number;
|
|
942
|
+
line_end: number;
|
|
943
|
+
column_start: number;
|
|
944
|
+
column_end: number;
|
|
945
|
+
path: string;
|
|
946
|
+
}
|
|
947
|
+
/**
|
|
948
|
+
* Flow Validation Error
|
|
949
|
+
*/
|
|
950
|
+
interface FlowValidationError {
|
|
951
|
+
error: string;
|
|
952
|
+
error_type: string;
|
|
953
|
+
message: string;
|
|
954
|
+
line_start: number;
|
|
955
|
+
line_end: number;
|
|
956
|
+
column_start: number;
|
|
957
|
+
column_end: number;
|
|
958
|
+
pointers: FlowValidationErrorPointer[];
|
|
959
|
+
}
|
|
960
|
+
/**
|
|
961
|
+
* Flow Item
|
|
962
|
+
*/
|
|
963
|
+
interface Flow {
|
|
964
|
+
id: string;
|
|
965
|
+
name: string;
|
|
966
|
+
status: FlowStatusEnum;
|
|
967
|
+
categories: FlowCategoryEnum[];
|
|
968
|
+
validation_errors: FlowValidationError[];
|
|
969
|
+
}
|
|
970
|
+
/**
|
|
971
|
+
* Pagination Cursors
|
|
972
|
+
*/
|
|
973
|
+
interface PaginationCursors {
|
|
974
|
+
before: string;
|
|
975
|
+
after: string;
|
|
976
|
+
}
|
|
977
|
+
/**
|
|
978
|
+
* Pagination Object
|
|
979
|
+
*/
|
|
980
|
+
interface Pagination {
|
|
981
|
+
cursors: PaginationCursors;
|
|
982
|
+
}
|
|
983
|
+
/**
|
|
984
|
+
* Flows List Response
|
|
985
|
+
*/
|
|
986
|
+
interface FlowsListResponse {
|
|
987
|
+
data: Flow[];
|
|
988
|
+
paging: Pagination;
|
|
989
|
+
}
|
|
990
|
+
/**
|
|
991
|
+
* Flow Asset
|
|
992
|
+
*/
|
|
993
|
+
interface FlowAsset {
|
|
994
|
+
name: string;
|
|
995
|
+
asset_type: string;
|
|
996
|
+
download_url: string;
|
|
997
|
+
}
|
|
998
|
+
/**
|
|
999
|
+
* Flow Assets Response
|
|
1000
|
+
*/
|
|
1001
|
+
interface FlowAssetsResponse {
|
|
1002
|
+
data: FlowAsset[];
|
|
1003
|
+
paging: Pagination;
|
|
1004
|
+
}
|
|
1005
|
+
/**
|
|
1006
|
+
* Flow Preview
|
|
1007
|
+
*/
|
|
1008
|
+
interface FlowPreview {
|
|
1009
|
+
preview_url: string;
|
|
1010
|
+
expires_at: string;
|
|
1011
|
+
}
|
|
1012
|
+
/**
|
|
1013
|
+
* Flow Preview Response
|
|
1014
|
+
*/
|
|
1015
|
+
interface FlowPreviewResponse {
|
|
1016
|
+
preview: FlowPreview;
|
|
1017
|
+
id: string;
|
|
1018
|
+
}
|
|
1019
|
+
/**
|
|
1020
|
+
* Flow Migration Result
|
|
1021
|
+
*/
|
|
1022
|
+
interface FlowMigrationResult {
|
|
1023
|
+
source_name: string;
|
|
1024
|
+
source_id: string;
|
|
1025
|
+
migrated_id: string;
|
|
1026
|
+
}
|
|
1027
|
+
/**
|
|
1028
|
+
* Flow Migration Failure
|
|
1029
|
+
*/
|
|
1030
|
+
interface FlowMigrationFailure {
|
|
1031
|
+
source_name: string;
|
|
1032
|
+
error_code: string;
|
|
1033
|
+
error_message: string;
|
|
1034
|
+
}
|
|
1035
|
+
/**
|
|
1036
|
+
* Create Flow Response
|
|
1037
|
+
*/
|
|
1038
|
+
interface CreateFlowResponse {
|
|
1039
|
+
id: string;
|
|
1040
|
+
success: boolean;
|
|
1041
|
+
validation_errors?: FlowValidationError[];
|
|
1042
|
+
}
|
|
1043
|
+
/**
|
|
1044
|
+
* Update Flow Response
|
|
1045
|
+
*/
|
|
1046
|
+
interface UpdateFlowResponse {
|
|
1047
|
+
success: boolean;
|
|
1048
|
+
validation_errors?: FlowValidationError[];
|
|
1049
|
+
}
|
|
1050
|
+
/**
|
|
1051
|
+
* Flow Migration Response
|
|
1052
|
+
*/
|
|
1053
|
+
interface FlowMigrationResponse {
|
|
1054
|
+
migrated_flows: FlowMigrationResult[];
|
|
1055
|
+
failed_flows: FlowMigrationFailure[];
|
|
1056
|
+
}
|
|
1057
|
+
/**
|
|
1058
|
+
* Validate Flow JSON Response
|
|
1059
|
+
*/
|
|
1060
|
+
interface ValidateFlowJsonResponse {
|
|
1061
|
+
valid: boolean;
|
|
1062
|
+
success: boolean;
|
|
1063
|
+
validation_errors?: FlowValidationError[];
|
|
1064
|
+
}
|
|
1065
|
+
/**
|
|
1066
|
+
* WhatsApp Flow Endpoint - Encrypted Request Payload
|
|
1067
|
+
* Represents the raw encrypted data received from WhatsApp
|
|
1068
|
+
*/
|
|
1069
|
+
interface FlowEncryptedRequestPayload {
|
|
1070
|
+
encrypted_aes_key: string;
|
|
1071
|
+
encrypted_flow_data: string;
|
|
1072
|
+
initial_vector: string;
|
|
1073
|
+
}
|
|
1074
|
+
/**
|
|
1075
|
+
* WhatsApp Flow Endpoint - Decrypted Request Response
|
|
1076
|
+
* Represents the successfully decrypted data and encryption keys
|
|
1077
|
+
*/
|
|
1078
|
+
interface FlowDecryptedRequestResponse {
|
|
1079
|
+
decryptedBody: any;
|
|
1080
|
+
aesKeyBuffer: Buffer;
|
|
1081
|
+
initialVectorBuffer: Buffer;
|
|
1082
|
+
}
|
|
1083
|
+
/**
|
|
1084
|
+
* WhatsApp Flow Endpoint - HTTP Request with Body
|
|
1085
|
+
* Represents an HTTP request with the encrypted payload
|
|
1086
|
+
*/
|
|
1087
|
+
interface FlowHttpRequest extends IncomingMessage {
|
|
1088
|
+
body: FlowEncryptedRequestPayload;
|
|
1089
|
+
headers: IncomingHttpHeaders;
|
|
1090
|
+
}
|
|
1091
|
+
/**
|
|
1092
|
+
* WhatsApp Flow Endpoint - Health Check Request
|
|
1093
|
+
* Represents the structure of a health check request
|
|
1094
|
+
*/
|
|
1095
|
+
interface FlowHealthCheckRequest {
|
|
1096
|
+
action: 'ping';
|
|
1097
|
+
version: '3.0';
|
|
1098
|
+
}
|
|
1099
|
+
/**
|
|
1100
|
+
* WhatsApp Flow Endpoint - Health Check Response
|
|
1101
|
+
* The expected response structure for health check requests
|
|
1102
|
+
*/
|
|
1103
|
+
interface FlowHealthCheckResponse {
|
|
1104
|
+
data: {
|
|
1105
|
+
status: 'active';
|
|
1106
|
+
};
|
|
1107
|
+
}
|
|
1108
|
+
/**
|
|
1109
|
+
* WhatsApp Flow Endpoint - Data Exchange Request
|
|
1110
|
+
* Represents the structure of a data exchange request
|
|
1111
|
+
*/
|
|
1112
|
+
interface FlowDataExchangeRequest {
|
|
1113
|
+
version: '3.0';
|
|
1114
|
+
action: FlowActionEnum;
|
|
1115
|
+
screen: string;
|
|
1116
|
+
flow_token: string;
|
|
1117
|
+
data?: Record<string, any> & {
|
|
1118
|
+
error_message?: string;
|
|
1119
|
+
};
|
|
1120
|
+
}
|
|
1121
|
+
/**
|
|
1122
|
+
* WhatsApp Flow Endpoint - Data Exchange Response
|
|
1123
|
+
* The expected response structure for data exchange requests
|
|
1124
|
+
*/
|
|
1125
|
+
interface FlowDataExchangeResponse {
|
|
1126
|
+
screen?: string;
|
|
1127
|
+
data?: Record<string, any | {
|
|
1128
|
+
error_message?: string;
|
|
1129
|
+
}>;
|
|
1130
|
+
}
|
|
1131
|
+
/**
|
|
1132
|
+
* WhatsApp Flow Endpoint - Success Screen Response
|
|
1133
|
+
* The expected response structure for success screen requests
|
|
1134
|
+
*/
|
|
1135
|
+
interface FlowSuccessScreenResponse {
|
|
1136
|
+
screen: 'SUCCESS';
|
|
1137
|
+
data: {
|
|
1138
|
+
extension_message_response?: {
|
|
1139
|
+
params?: {
|
|
1140
|
+
flow_token: string;
|
|
1141
|
+
[key: string]: string;
|
|
1142
|
+
};
|
|
1143
|
+
};
|
|
1144
|
+
};
|
|
1145
|
+
}
|
|
1146
|
+
/**
|
|
1147
|
+
* WhatsApp Flow Endpoint - Error Notification Request
|
|
1148
|
+
* Represents the structure of an error notification request
|
|
1149
|
+
*/
|
|
1150
|
+
interface FlowErrorNotificationRequest {
|
|
1151
|
+
version: '3.0';
|
|
1152
|
+
action: Exclude<FlowActionEnum, FlowActionEnum.BACK>;
|
|
1153
|
+
screen: string;
|
|
1154
|
+
flow_token: string;
|
|
1155
|
+
data: {
|
|
1156
|
+
error: string;
|
|
1157
|
+
error_message: string;
|
|
1158
|
+
};
|
|
1159
|
+
}
|
|
1160
|
+
/**
|
|
1161
|
+
* WhatsApp Flow Endpoint - Error Notification Response
|
|
1162
|
+
* The expected response structure for error notification requests
|
|
1163
|
+
*/
|
|
1164
|
+
interface FlowErrorNotificationResponse {
|
|
1165
|
+
acknowledged: boolean;
|
|
1166
|
+
}
|
|
1167
|
+
/**
|
|
1168
|
+
* WhatsApp Flow Endpoint - Comprehensive Request Object
|
|
1169
|
+
* A combined type that includes all possible fields from different request types
|
|
1170
|
+
* with all fields being optional for flexibility
|
|
1171
|
+
*/
|
|
1172
|
+
interface FlowEndpointRequest {
|
|
1173
|
+
version?: '3.0';
|
|
1174
|
+
action?: 'ping' | FlowActionEnum;
|
|
1175
|
+
screen?: string;
|
|
1176
|
+
flow_token?: string;
|
|
1177
|
+
data?: Record<string, any> & {
|
|
1178
|
+
error_key?: string;
|
|
1179
|
+
error_message?: string;
|
|
1180
|
+
};
|
|
1181
|
+
}
|
|
1182
|
+
/**
|
|
1183
|
+
* WhatsApp Flow Endpoint - Response
|
|
1184
|
+
* Union type for all possible response types from a Flow endpoint
|
|
1185
|
+
*/
|
|
1186
|
+
type FlowEndpointResponse = FlowHealthCheckResponse | FlowDataExchangeResponse | FlowErrorNotificationResponse | FlowSuccessScreenResponse;
|
|
1187
|
+
interface FlowClass {
|
|
1188
|
+
/**
|
|
1189
|
+
* List Flows
|
|
1190
|
+
*
|
|
1191
|
+
* @param wabaId - The WABA ID
|
|
1192
|
+
* @returns Promise with the list of flows
|
|
1193
|
+
*/
|
|
1194
|
+
listFlows(wabaId: string): Promise<FlowsListResponse>;
|
|
1195
|
+
/**
|
|
1196
|
+
* Create Flow
|
|
1197
|
+
*
|
|
1198
|
+
* @param wabaId - The WABA ID
|
|
1199
|
+
* @param data - The flow data including name, categories, endpoint_uri, and optional clone_flow_id
|
|
1200
|
+
* @returns Promise with the created flow ID
|
|
1201
|
+
*/
|
|
1202
|
+
createFlow(wabaId: string, data: {
|
|
1203
|
+
name: string;
|
|
1204
|
+
categories?: FlowCategoryEnum[];
|
|
1205
|
+
endpoint_uri?: string;
|
|
1206
|
+
clone_flow_id?: string;
|
|
1207
|
+
flow_json?: string;
|
|
1208
|
+
publish?: boolean;
|
|
1209
|
+
}): Promise<CreateFlowResponse>;
|
|
1210
|
+
/**
|
|
1211
|
+
* Get Flow
|
|
1212
|
+
*
|
|
1213
|
+
* @param flowId - The flow ID
|
|
1214
|
+
* @param fields - Optional fields to return
|
|
1215
|
+
* @param dateFormat - Optional date format
|
|
1216
|
+
* @returns Promise with the flow details
|
|
1217
|
+
*/
|
|
1218
|
+
getFlow(flowId: string, fields?: string, dateFormat?: string): Promise<Flow | FlowPreviewResponse>;
|
|
1219
|
+
/**
|
|
1220
|
+
* Update Flow Metadata
|
|
1221
|
+
*
|
|
1222
|
+
* @param flowId - The flow ID
|
|
1223
|
+
* @param data - The flow metadata to update
|
|
1224
|
+
* @returns Promise with the success status
|
|
1225
|
+
*/
|
|
1226
|
+
updateFlowMetadata(flowId: string, data: {
|
|
1227
|
+
name?: string;
|
|
1228
|
+
categories?: FlowCategoryEnum[];
|
|
1229
|
+
endpoint_uri?: string;
|
|
1230
|
+
application_id?: string;
|
|
1231
|
+
}): Promise<ResponseSuccess>;
|
|
1232
|
+
/**
|
|
1233
|
+
* Delete Flow
|
|
1234
|
+
*
|
|
1235
|
+
* @param flowId - The flow ID
|
|
1236
|
+
* @returns Promise with the success status
|
|
1237
|
+
*/
|
|
1238
|
+
deleteFlow(flowId: string): Promise<ResponseSuccess>;
|
|
1239
|
+
/**
|
|
1240
|
+
* List Assets (Get Flow JSON URL)
|
|
1241
|
+
*
|
|
1242
|
+
* @param flowId - The flow ID
|
|
1243
|
+
* @returns Promise with the list of assets
|
|
1244
|
+
*/
|
|
1245
|
+
listAssets(flowId: string): Promise<FlowAssetsResponse>;
|
|
1246
|
+
/**
|
|
1247
|
+
* Update Flow JSON
|
|
1248
|
+
*
|
|
1249
|
+
* @param flowId - The flow ID
|
|
1250
|
+
* @param data - The asset data including asset_type, file, and name
|
|
1251
|
+
* @returns Promise with the success status and validation errors
|
|
1252
|
+
*/
|
|
1253
|
+
updateFlowJson(flowId: string, data: {
|
|
1254
|
+
file: Blob | Buffer | object;
|
|
1255
|
+
name?: string;
|
|
1256
|
+
}): Promise<UpdateFlowResponse>;
|
|
1257
|
+
/**
|
|
1258
|
+
* Validate Flow JSON by attempting an update without publishing.
|
|
1259
|
+
* This is a convenience method; the API doesn't have a dedicated validation endpoint.
|
|
1260
|
+
*
|
|
1261
|
+
* @param flowId - The ID of the Flow (must exist, can be in DRAFT status).
|
|
1262
|
+
* @param flowJsonData - The Flow JSON content as a Buffer, JSON object, or Blob.
|
|
1263
|
+
* @returns Promise indicating if the JSON is valid and includes validation errors if any.
|
|
1264
|
+
*/
|
|
1265
|
+
validateFlowJson(flowId: string, flowJsonData: Blob | Buffer | object): Promise<ValidateFlowJsonResponse>;
|
|
1266
|
+
/**
|
|
1267
|
+
* Publish Flow
|
|
1268
|
+
*
|
|
1269
|
+
* @param flowId - The flow ID
|
|
1270
|
+
* @returns Promise with the success status
|
|
1271
|
+
*/
|
|
1272
|
+
publishFlow(flowId: string): Promise<ResponseSuccess>;
|
|
1273
|
+
/**
|
|
1274
|
+
* Deprecate Flow
|
|
1275
|
+
*
|
|
1276
|
+
* @param flowId - The flow ID
|
|
1277
|
+
* @returns Promise with the success status
|
|
1278
|
+
*/
|
|
1279
|
+
deprecateFlow(flowId: string): Promise<ResponseSuccess>;
|
|
1280
|
+
/**
|
|
1281
|
+
* Migrate Flows
|
|
1282
|
+
*
|
|
1283
|
+
* @param wabaId - The destination WABA ID
|
|
1284
|
+
* @param data - The migration data including source_waba_id and optional source_flow_names
|
|
1285
|
+
* @returns Promise with migration results
|
|
1286
|
+
*/
|
|
1287
|
+
migrateFlows(wabaId: string, data: {
|
|
1288
|
+
source_waba_id: string;
|
|
1289
|
+
source_flow_names?: string[];
|
|
1290
|
+
}): Promise<FlowMigrationResponse>;
|
|
1291
|
+
}
|
|
1292
|
+
//#endregion
|
|
1293
|
+
//#region src/api/flow/FlowApi.d.ts
|
|
1294
|
+
/**
|
|
1295
|
+
* API for managing WhatsApp Flows.
|
|
1296
|
+
*
|
|
1297
|
+
* This API allows you to:
|
|
1298
|
+
* - List flows
|
|
1299
|
+
* - Create flows
|
|
1300
|
+
* - Get flow details and previews
|
|
1301
|
+
* - Update flow metadata and JSON
|
|
1302
|
+
* - Delete flows
|
|
1303
|
+
* - Publish and deprecate flows
|
|
1304
|
+
* - Migrate flows between WABAs
|
|
1305
|
+
* - Validate flow JSON
|
|
1306
|
+
*/
|
|
1307
|
+
declare class FlowApi extends BaseAPI implements FlowClass {
|
|
1308
|
+
constructor(config: WabaConfigType, client: RequesterClass);
|
|
1309
|
+
/**
|
|
1310
|
+
* List Flows
|
|
1311
|
+
*
|
|
1312
|
+
* @param wabaId - The WABA ID
|
|
1313
|
+
* @returns Promise with the list of flows
|
|
1314
|
+
*/
|
|
1315
|
+
listFlows(wabaId: string): Promise<FlowsListResponse>;
|
|
1316
|
+
/**
|
|
1317
|
+
* Create Flow
|
|
1318
|
+
*
|
|
1319
|
+
* @param wabaId - The WABA ID
|
|
1320
|
+
* @param data - The flow data including name, categories, endpoint_uri, and optional clone_flow_id
|
|
1321
|
+
* @returns Promise with the created flow ID and validation errors if any
|
|
1322
|
+
*/
|
|
1323
|
+
createFlow(wabaId: string, data: {
|
|
1324
|
+
name: string;
|
|
1325
|
+
categories?: FlowCategoryEnum[];
|
|
1326
|
+
endpoint_uri?: string;
|
|
1327
|
+
clone_flow_id?: string;
|
|
1328
|
+
flow_json?: string;
|
|
1329
|
+
publish?: boolean;
|
|
1330
|
+
}): Promise<CreateFlowResponse>;
|
|
1331
|
+
/**
|
|
1332
|
+
* Get Flow details
|
|
1333
|
+
*
|
|
1334
|
+
* @param flowId - The flow ID
|
|
1335
|
+
* @param fields - Optional fields to return (e.g., 'name,status,preview.invalidate(false)')
|
|
1336
|
+
* @param dateFormat - Optional date format
|
|
1337
|
+
* @returns Promise with the flow details or preview response
|
|
1338
|
+
*/
|
|
1339
|
+
getFlow(flowId: string, fields?: string, dateFormat?: string): Promise<Flow | FlowPreviewResponse>;
|
|
1340
|
+
/**
|
|
1341
|
+
* Get Flow Preview URL
|
|
1342
|
+
*
|
|
1343
|
+
* @param flowId - The flow ID
|
|
1344
|
+
* @param invalidate - Optional. If true, invalidates existing preview and generates a new one. Defaults to false.
|
|
1345
|
+
* @returns Promise with the flow preview details
|
|
1346
|
+
*/
|
|
1347
|
+
getFlowPreview(flowId: string, invalidate?: boolean): Promise<FlowPreviewResponse>;
|
|
1348
|
+
/**
|
|
1349
|
+
* Update Flow Metadata
|
|
1350
|
+
*
|
|
1351
|
+
* @param flowId - The flow ID
|
|
1352
|
+
* @param data - The flow metadata to update (name, categories, endpoint_uri, application_id)
|
|
1353
|
+
* @returns Promise with the success status
|
|
1354
|
+
*/
|
|
1355
|
+
updateFlowMetadata(flowId: string, data: {
|
|
1356
|
+
name?: string;
|
|
1357
|
+
categories?: FlowCategoryEnum[];
|
|
1358
|
+
endpoint_uri?: string;
|
|
1359
|
+
application_id?: string;
|
|
1360
|
+
}): Promise<ResponseSuccess>;
|
|
1361
|
+
/**
|
|
1362
|
+
* Delete Flow (only works if the Flow is in DRAFT status)
|
|
1363
|
+
*
|
|
1364
|
+
* @param flowId - The flow ID
|
|
1365
|
+
* @returns Promise with the success status
|
|
1366
|
+
*/
|
|
1367
|
+
deleteFlow(flowId: string): Promise<ResponseSuccess>;
|
|
1368
|
+
/**
|
|
1369
|
+
* List Assets (e.g., get Flow JSON download URL)
|
|
1370
|
+
*
|
|
1371
|
+
* @param flowId - The flow ID
|
|
1372
|
+
* @returns Promise with the list of assets
|
|
1373
|
+
*/
|
|
1374
|
+
listAssets(flowId: string): Promise<FlowAssetsResponse>;
|
|
1375
|
+
/**
|
|
1376
|
+
* Update Flow JSON by uploading a file, buffer, JSON object, or Blob.
|
|
1377
|
+
*
|
|
1378
|
+
* @param flowId - The flow ID
|
|
1379
|
+
* @param data - Object containing the file data and optional name.
|
|
1380
|
+
* @param data.file - The Flow JSON content as a Buffer, JSON object, or Blob.
|
|
1381
|
+
* @param data.name - Optional name for the asset, defaults to 'flow.json'.
|
|
1382
|
+
* @returns Promise with the success status and validation errors, if any.
|
|
1383
|
+
*/
|
|
1384
|
+
updateFlowJson(flowId: string, data: {
|
|
1385
|
+
file: Blob | Buffer | object;
|
|
1386
|
+
name?: string;
|
|
1387
|
+
}): Promise<UpdateFlowResponse>;
|
|
1388
|
+
/**
|
|
1389
|
+
* Validate Flow JSON by attempting an update without publishing.
|
|
1390
|
+
* This is a convenience method; the API doesn't have a dedicated validation endpoint.
|
|
1391
|
+
*
|
|
1392
|
+
* @param flowId - The ID of the Flow (must exist, can be in DRAFT status).
|
|
1393
|
+
* @param flowJsonData - The Flow JSON content as a file path (string), Buffer, JSON object, or Blob.
|
|
1394
|
+
* @returns Promise indicating if the JSON is valid and includes validation errors if any.
|
|
1395
|
+
*/
|
|
1396
|
+
validateFlowJson(flowId: string, flowJsonData: Blob | Buffer | object): Promise<ValidateFlowJsonResponse>;
|
|
1397
|
+
/**
|
|
1398
|
+
* Publish Flow
|
|
1399
|
+
*
|
|
1400
|
+
* @param flowId - The flow ID
|
|
1401
|
+
* @returns Promise with the success status
|
|
1402
|
+
*/
|
|
1403
|
+
publishFlow(flowId: string): Promise<ResponseSuccess>;
|
|
1404
|
+
/**
|
|
1405
|
+
* Deprecate Flow
|
|
1406
|
+
*
|
|
1407
|
+
* @param flowId - The flow ID
|
|
1408
|
+
* @returns Promise with the success status
|
|
1409
|
+
*/
|
|
1410
|
+
deprecateFlow(flowId: string): Promise<ResponseSuccess>;
|
|
1411
|
+
/**
|
|
1412
|
+
* Migrate Flows between WABAs
|
|
1413
|
+
*
|
|
1414
|
+
* @param destinationWabaId - The destination WABA ID
|
|
1415
|
+
* @param data - The migration data including source_waba_id and optional source_flow_names
|
|
1416
|
+
* @returns Promise with migration results (successes and failures)
|
|
1417
|
+
*/
|
|
1418
|
+
migrateFlows(destinationWabaId: string, data: {
|
|
1419
|
+
source_waba_id: string;
|
|
1420
|
+
source_flow_names?: string[];
|
|
1421
|
+
}): Promise<FlowMigrationResponse>;
|
|
1422
|
+
}
|
|
1423
|
+
//#endregion
|
|
1424
|
+
//#region src/api/media/types/common.d.ts
|
|
1425
|
+
type MediaResponse = {
|
|
1426
|
+
id: string;
|
|
1427
|
+
url: string;
|
|
1428
|
+
mime_type: string;
|
|
1429
|
+
sha256: string;
|
|
1430
|
+
file_size: number;
|
|
1431
|
+
messaging_product: 'whatsapp';
|
|
1432
|
+
};
|
|
1433
|
+
type MediasResponse = {
|
|
1434
|
+
data: MediaResponse[];
|
|
1435
|
+
paging: {
|
|
1436
|
+
cursors: {
|
|
1437
|
+
before: string;
|
|
1438
|
+
after: string;
|
|
1439
|
+
};
|
|
1440
|
+
};
|
|
1441
|
+
};
|
|
1442
|
+
type UploadMediaResponse = {
|
|
1443
|
+
id: string;
|
|
1444
|
+
};
|
|
1445
|
+
interface MediaClass {
|
|
1446
|
+
getMediaById(mediaId: string, phone_number_id?: string): Promise<MediaResponse>;
|
|
1447
|
+
uploadMedia(file: File, messagingProduct?: string): Promise<UploadMediaResponse>;
|
|
1448
|
+
deleteMedia(mediaId: string, phone_number_id?: string): Promise<ResponseSuccess>;
|
|
1449
|
+
downloadMedia(mediaUrl: string): Promise<Blob>;
|
|
1450
|
+
}
|
|
1451
|
+
//#endregion
|
|
1452
|
+
//#region src/api/media/MediaApi.d.ts
|
|
1453
|
+
/**
|
|
1454
|
+
* API for managing WhatsApp Media.
|
|
1455
|
+
*
|
|
1456
|
+
* This API allows you to:
|
|
1457
|
+
* - Get media information by ID
|
|
1458
|
+
* - Upload media files
|
|
1459
|
+
* - Delete media files
|
|
1460
|
+
* - Download media files from URLs
|
|
1461
|
+
*/
|
|
1462
|
+
declare class MediaApi extends BaseAPI implements MediaClass {
|
|
1463
|
+
private readonly endpoint;
|
|
1464
|
+
constructor(config: WabaConfigType, client: RequesterClass);
|
|
1465
|
+
/**
|
|
1466
|
+
* Retrieve media information by media ID.
|
|
1467
|
+
*
|
|
1468
|
+
* @param mediaId The media ID to retrieve information for
|
|
1469
|
+
* @param phone_number_id Optional phone number ID (defaults to configured one)
|
|
1470
|
+
* @returns Media information including URL, mime type, file size, etc.
|
|
1471
|
+
*
|
|
1472
|
+
* @example
|
|
1473
|
+
* const mediaInfo = await whatsappClient.media.getMediaById('media_id_123');
|
|
1474
|
+
*/
|
|
1475
|
+
getMediaById(mediaId: string, phone_number_id?: string): Promise<MediaResponse>;
|
|
1476
|
+
/**
|
|
1477
|
+
* Upload a media file to WhatsApp.
|
|
1478
|
+
*
|
|
1479
|
+
* @param file The file to upload
|
|
1480
|
+
* @param messagingProduct The messaging product (default: 'whatsapp')
|
|
1481
|
+
* @returns Upload response containing the media ID
|
|
1482
|
+
*
|
|
1483
|
+
* @example
|
|
1484
|
+
* const file = new File([buffer], 'image.jpg', { type: 'image/jpeg' });
|
|
1485
|
+
* const result = await whatsappClient.media.uploadMedia(file);
|
|
1486
|
+
*/
|
|
1487
|
+
uploadMedia(file: File, messagingProduct?: string): Promise<UploadMediaResponse>;
|
|
1488
|
+
/**
|
|
1489
|
+
* Delete a media file.
|
|
1490
|
+
*
|
|
1491
|
+
* @param mediaId The media ID to delete
|
|
1492
|
+
* @param phone_number_id Optional phone number ID (defaults to configured one)
|
|
1493
|
+
* @returns Response indicating success or failure
|
|
1494
|
+
*
|
|
1495
|
+
* @example
|
|
1496
|
+
* await whatsappClient.media.deleteMedia('media_id_123');
|
|
1497
|
+
*/
|
|
1498
|
+
deleteMedia(mediaId: string, phone_number_id?: string): Promise<ResponseSuccess>;
|
|
1499
|
+
/**
|
|
1500
|
+
* Download media from a URL.
|
|
1501
|
+
*
|
|
1502
|
+
* @param mediaUrl The URL to download media from
|
|
1503
|
+
* @returns Blob containing the media data
|
|
1504
|
+
*
|
|
1505
|
+
* @example
|
|
1506
|
+
* const blob = await whatsappClient.media.downloadMedia('https://...');
|
|
1507
|
+
*/
|
|
1508
|
+
downloadMedia(mediaUrl: string): Promise<Blob>;
|
|
1509
|
+
}
|
|
1510
|
+
//#endregion
|
|
1511
|
+
//#region src/api/messages/types/text.d.ts
|
|
1512
|
+
type TextObject = {
|
|
1513
|
+
body: string;
|
|
1514
|
+
preview_url?: boolean;
|
|
1515
|
+
};
|
|
1516
|
+
type TextMessageRequestBody = MessageRequestBody<MessageTypesEnum.Text> & {
|
|
1517
|
+
[MessageTypesEnum.Text]: [TextObject];
|
|
1518
|
+
};
|
|
1519
|
+
interface TextMessageParams extends MessageRequestParams<TextObject | string> {
|
|
1520
|
+
previewUrl?: boolean;
|
|
1521
|
+
}
|
|
1522
|
+
//#endregion
|
|
1523
|
+
//#region src/api/messages/types/template.d.ts
|
|
1524
|
+
type LanguageObject = {
|
|
1525
|
+
policy: 'deterministic';
|
|
1526
|
+
code: LanguagesEnum;
|
|
1527
|
+
};
|
|
1528
|
+
type ParametersObject<T extends ParametersTypesEnum> = {
|
|
1529
|
+
type: T;
|
|
1530
|
+
};
|
|
1531
|
+
type SimpleTextObject$1 = {
|
|
1532
|
+
text: string;
|
|
1533
|
+
};
|
|
1534
|
+
type TextParametersObject = ParametersObject<ParametersTypesEnum.Text> & SimpleTextObject$1;
|
|
1535
|
+
type CouponCodeParametersObject = ParametersObject<ParametersTypesEnum.CouponCode> & {
|
|
1536
|
+
coupon_code: string;
|
|
1537
|
+
};
|
|
1538
|
+
type CurrencyObject = {
|
|
1539
|
+
fallback_value: string;
|
|
1540
|
+
code: CurrencyCodesEnum;
|
|
1541
|
+
amount_1000: number;
|
|
1542
|
+
};
|
|
1543
|
+
type CurrencyParametersObject = ParametersObject<ParametersTypesEnum.Currency> & {
|
|
1544
|
+
currency: CurrencyObject;
|
|
1545
|
+
};
|
|
1546
|
+
type DateTimeObject = {
|
|
1547
|
+
fallback_value: string;
|
|
1548
|
+
};
|
|
1549
|
+
type DateTimeParametersObject = ParametersObject<ParametersTypesEnum.Currency> & {
|
|
1550
|
+
date_time: DateTimeObject;
|
|
1551
|
+
};
|
|
1552
|
+
type DocumentMediaObject$2 = {
|
|
1553
|
+
id?: string;
|
|
1554
|
+
link?: string;
|
|
1555
|
+
caption?: string;
|
|
1556
|
+
filename?: string;
|
|
1557
|
+
};
|
|
1558
|
+
type ImageMediaObject$2 = {
|
|
1559
|
+
id?: string;
|
|
1560
|
+
link?: string;
|
|
1561
|
+
caption?: string;
|
|
1562
|
+
};
|
|
1563
|
+
type VideoMediaObject$2 = {
|
|
1564
|
+
id?: string;
|
|
1565
|
+
link?: string;
|
|
1566
|
+
caption?: string;
|
|
1567
|
+
};
|
|
1568
|
+
type DocumentParametersObject = ParametersObject<ParametersTypesEnum.Document> & DocumentMediaObject$2;
|
|
1569
|
+
type ImageParametersObject = ParametersObject<ParametersTypesEnum.Image> & ImageMediaObject$2;
|
|
1570
|
+
type VideoParametersObject = ParametersObject<ParametersTypesEnum.Video> & VideoMediaObject$2;
|
|
1571
|
+
type ComponentObject<T extends ComponentTypesEnum> = {
|
|
1572
|
+
type: T;
|
|
1573
|
+
parameters: (CurrencyParametersObject | DateTimeParametersObject | DocumentParametersObject | ImageParametersObject | TextParametersObject | VideoParametersObject | CouponCodeParametersObject)[];
|
|
1574
|
+
};
|
|
1575
|
+
type ButtonComponentObject = ComponentObject<ComponentTypesEnum.Button> & {
|
|
1576
|
+
parameters?: (TextParametersObject | PayloadParametersObject)[];
|
|
1577
|
+
sub_type: SubTypeEnum;
|
|
1578
|
+
index: ButtonPositionEnum;
|
|
1579
|
+
};
|
|
1580
|
+
type PayloadParametersObject = ParametersObject<ParametersTypesEnum.Payload> & {
|
|
1581
|
+
payload: string;
|
|
1582
|
+
};
|
|
1583
|
+
type MessageTemplateObject<T extends ComponentTypesEnum> = {
|
|
1584
|
+
name: string;
|
|
1585
|
+
language: LanguageObject;
|
|
1586
|
+
components?: (ComponentObject<T> | ButtonComponentObject)[];
|
|
1587
|
+
};
|
|
1588
|
+
type MessageTemplateRequestBody<T extends ComponentTypesEnum> = MessageRequestBody<MessageTypesEnum.Template> & MessageTemplateObject<T>;
|
|
1589
|
+
//#endregion
|
|
1590
|
+
//#region src/api/messages/types/media.d.ts
|
|
1591
|
+
type MetaMediaObject = {
|
|
1592
|
+
id: string;
|
|
1593
|
+
link?: never;
|
|
1594
|
+
};
|
|
1595
|
+
type HostedMediaObject = {
|
|
1596
|
+
id?: never;
|
|
1597
|
+
link: string;
|
|
1598
|
+
};
|
|
1599
|
+
type AudioMediaObject = MetaMediaObject | HostedMediaObject;
|
|
1600
|
+
type AudioMessageRequestBody = MessageRequestBody<MessageTypesEnum.Audio> & {
|
|
1601
|
+
[MessageTypesEnum.Audio]: [AudioMediaObject];
|
|
1602
|
+
};
|
|
1603
|
+
type MetaDocumentMediaObject = MetaMediaObject & {
|
|
1604
|
+
caption?: string;
|
|
1605
|
+
filename?: string;
|
|
1606
|
+
};
|
|
1607
|
+
type HostedDocumentMediaObject = HostedMediaObject & {
|
|
1608
|
+
caption?: string;
|
|
1609
|
+
filename?: string;
|
|
1610
|
+
};
|
|
1611
|
+
type DocumentMediaObject = MetaDocumentMediaObject | HostedDocumentMediaObject;
|
|
1612
|
+
type DocumentMessageRequestBody = MessageRequestBody<MessageTypesEnum.Document> & {
|
|
1613
|
+
[MessageTypesEnum.Document]: [DocumentMediaObject];
|
|
1614
|
+
};
|
|
1615
|
+
type MetaImageMediaObject = MetaMediaObject & {
|
|
1616
|
+
caption?: string;
|
|
1617
|
+
};
|
|
1618
|
+
type HostedImageMediaObject = HostedMediaObject & {
|
|
1619
|
+
caption?: string;
|
|
1620
|
+
};
|
|
1621
|
+
type ImageMediaObject = MetaImageMediaObject | HostedImageMediaObject;
|
|
1622
|
+
type ImageMessageRequestBody = MessageRequestBody<MessageTypesEnum.Image> & {
|
|
1623
|
+
[MessageTypesEnum.Image]: [ImageMediaObject];
|
|
1624
|
+
};
|
|
1625
|
+
type MetaVideoMediaObject = MetaMediaObject & {
|
|
1626
|
+
caption?: string;
|
|
1627
|
+
};
|
|
1628
|
+
type HostedVideoMediaObject = HostedMediaObject & {
|
|
1629
|
+
caption?: string;
|
|
1630
|
+
};
|
|
1631
|
+
type VideoMediaObject = MetaVideoMediaObject | HostedVideoMediaObject;
|
|
1632
|
+
type VideoMessageRequestBody = MessageRequestBody<MessageTypesEnum.Video> & {
|
|
1633
|
+
[MessageTypesEnum.Video]: [VideoMediaObject];
|
|
1634
|
+
};
|
|
1635
|
+
type StickerMediaObject = MetaMediaObject | HostedMediaObject;
|
|
1636
|
+
type StickerMessageRequestBody = MessageRequestBody<MessageTypesEnum.Sticker> & {
|
|
1637
|
+
[MessageTypesEnum.Sticker]: [StickerMediaObject];
|
|
1638
|
+
};
|
|
1639
|
+
//#endregion
|
|
1640
|
+
//#region src/api/messages/types/contact.d.ts
|
|
1641
|
+
type AddressesObject = {
|
|
1642
|
+
street?: string;
|
|
1643
|
+
city?: string;
|
|
1644
|
+
state?: string;
|
|
1645
|
+
zip?: string;
|
|
1646
|
+
country?: string;
|
|
1647
|
+
country_code?: string;
|
|
1648
|
+
type?: 'HOME' | 'WORK' | string;
|
|
1649
|
+
};
|
|
1650
|
+
type EmailObject = {
|
|
1651
|
+
email?: string;
|
|
1652
|
+
type?: 'HOME' | 'WORK' | string;
|
|
1653
|
+
};
|
|
1654
|
+
type NameObject = {
|
|
1655
|
+
formatted_name: string;
|
|
1656
|
+
first_name?: string;
|
|
1657
|
+
last_name?: string;
|
|
1658
|
+
middle_name?: string;
|
|
1659
|
+
suffix?: string;
|
|
1660
|
+
prefix?: string;
|
|
1661
|
+
};
|
|
1662
|
+
type OrgObject = {
|
|
1663
|
+
company?: string;
|
|
1664
|
+
department?: string;
|
|
1665
|
+
title?: string;
|
|
1666
|
+
};
|
|
1667
|
+
type PhoneObject = {
|
|
1668
|
+
phone?: 'PHONE_NUMBER';
|
|
1669
|
+
type?: 'CELL' | 'MAIN' | 'IPHONE' | 'HOME' | 'WORK' | string;
|
|
1670
|
+
wa_id?: string;
|
|
1671
|
+
};
|
|
1672
|
+
type URLObject = {
|
|
1673
|
+
url?: string;
|
|
1674
|
+
type?: 'HOME' | 'WORK' | string;
|
|
1675
|
+
};
|
|
1676
|
+
type ContactObject = {
|
|
1677
|
+
addresses?: AddressesObject[];
|
|
1678
|
+
birthday?: `${number}${number}${number}${number}-${number}${number}-${number}${number}`;
|
|
1679
|
+
emails?: EmailObject[];
|
|
1680
|
+
name: NameObject;
|
|
1681
|
+
org?: OrgObject;
|
|
1682
|
+
phones?: PhoneObject[];
|
|
1683
|
+
urls?: URLObject[];
|
|
1684
|
+
};
|
|
1685
|
+
type ContactsMessageRequestBody = MessageRequestBody<MessageTypesEnum.Contacts> & {
|
|
1686
|
+
[MessageTypesEnum.Contacts]: [ContactObject];
|
|
1687
|
+
};
|
|
1688
|
+
//#endregion
|
|
1689
|
+
//#region src/api/messages/types/location.d.ts
|
|
1690
|
+
type LocationObject = {
|
|
1691
|
+
longitude: number;
|
|
1692
|
+
latitude: number;
|
|
1693
|
+
name?: string;
|
|
1694
|
+
address?: string;
|
|
1695
|
+
};
|
|
1696
|
+
type LocationMessageRequestBody = MessageRequestBody<MessageTypesEnum.Location> & {
|
|
1697
|
+
[MessageTypesEnum.Location]: [LocationObject];
|
|
1698
|
+
};
|
|
1699
|
+
//#endregion
|
|
1700
|
+
//#region src/api/messages/types/interactive.d.ts
|
|
1701
|
+
type DocumentMediaObject$1 = {
|
|
1702
|
+
id?: string;
|
|
1703
|
+
link?: string;
|
|
1704
|
+
caption?: string;
|
|
1705
|
+
filename?: string;
|
|
1706
|
+
};
|
|
1707
|
+
type ImageMediaObject$1 = {
|
|
1708
|
+
id?: string;
|
|
1709
|
+
link?: string;
|
|
1710
|
+
caption?: string;
|
|
1711
|
+
};
|
|
1712
|
+
type VideoMediaObject$1 = {
|
|
1713
|
+
id?: string;
|
|
1714
|
+
link?: string;
|
|
1715
|
+
caption?: string;
|
|
1716
|
+
};
|
|
1717
|
+
type ProductObject = {
|
|
1718
|
+
product_retailer_id: string;
|
|
1719
|
+
};
|
|
1720
|
+
type SimpleTextObject = {
|
|
1721
|
+
text: string;
|
|
1722
|
+
};
|
|
1723
|
+
type RowObject = {
|
|
1724
|
+
id: string;
|
|
1725
|
+
title: string;
|
|
1726
|
+
description?: string;
|
|
1727
|
+
};
|
|
1728
|
+
type MultiProductSectionObject = {
|
|
1729
|
+
product_items: ProductObject[];
|
|
1730
|
+
rows?: never;
|
|
1731
|
+
title?: string;
|
|
1732
|
+
};
|
|
1733
|
+
type ListSectionObject = {
|
|
1734
|
+
product_items?: never;
|
|
1735
|
+
rows: RowObject[];
|
|
1736
|
+
title?: string;
|
|
1737
|
+
};
|
|
1738
|
+
type SectionObject = MultiProductSectionObject | ListSectionObject;
|
|
1739
|
+
type ButtonObject = {
|
|
1740
|
+
title: string;
|
|
1741
|
+
id: string;
|
|
1742
|
+
};
|
|
1743
|
+
type ReplyButtonObject = {
|
|
1744
|
+
type: 'reply';
|
|
1745
|
+
reply: ButtonObject;
|
|
1746
|
+
};
|
|
1747
|
+
type ActionObject = {
|
|
1748
|
+
buttons?: ReplyButtonObject[];
|
|
1749
|
+
catalog_id?: string;
|
|
1750
|
+
product_retailer_id?: string;
|
|
1751
|
+
sections?: SectionObject[];
|
|
1752
|
+
};
|
|
1753
|
+
type HeaderObject = {
|
|
1754
|
+
type: 'document' | 'image' | 'text' | 'video';
|
|
1755
|
+
document?: DocumentMediaObject$1;
|
|
1756
|
+
image?: ImageMediaObject$1;
|
|
1757
|
+
text?: string;
|
|
1758
|
+
video?: VideoMediaObject$1;
|
|
1759
|
+
};
|
|
1760
|
+
type ButtonInteractiveObject = {
|
|
1761
|
+
type: InteractiveTypesEnum.Button;
|
|
1762
|
+
body: SimpleTextObject;
|
|
1763
|
+
footer?: SimpleTextObject;
|
|
1764
|
+
header?: HeaderObject;
|
|
1765
|
+
action: ActionObject;
|
|
1766
|
+
};
|
|
1767
|
+
type ListInteractiveObject = {
|
|
1768
|
+
type: InteractiveTypesEnum.List;
|
|
1769
|
+
body: SimpleTextObject;
|
|
1770
|
+
footer?: SimpleTextObject;
|
|
1771
|
+
header?: HeaderObject;
|
|
1772
|
+
action: ActionObject;
|
|
1773
|
+
};
|
|
1774
|
+
type ProductInteractiveObject = {
|
|
1775
|
+
type: InteractiveTypesEnum.Product;
|
|
1776
|
+
body?: SimpleTextObject;
|
|
1777
|
+
footer?: SimpleTextObject;
|
|
1778
|
+
header?: HeaderObject;
|
|
1779
|
+
action: ActionObject;
|
|
1780
|
+
};
|
|
1781
|
+
type ProductListInteractiveObject = {
|
|
1782
|
+
type: InteractiveTypesEnum.ProductList;
|
|
1783
|
+
body: SimpleTextObject;
|
|
1784
|
+
footer?: SimpleTextObject;
|
|
1785
|
+
header: HeaderObject;
|
|
1786
|
+
action: ActionObject;
|
|
1787
|
+
};
|
|
1788
|
+
type CtaUrlParameters = {
|
|
1789
|
+
display_text: string;
|
|
1790
|
+
url: string;
|
|
1791
|
+
};
|
|
1792
|
+
type CtaUrlActionObject = {
|
|
1793
|
+
name: 'cta_url';
|
|
1794
|
+
parameters: CtaUrlParameters;
|
|
1795
|
+
};
|
|
1796
|
+
type CtaUrlInteractiveObject = {
|
|
1797
|
+
type: InteractiveTypesEnum.CtaUrl;
|
|
1798
|
+
body?: SimpleTextObject;
|
|
1799
|
+
footer?: SimpleTextObject;
|
|
1800
|
+
header?: HeaderObject;
|
|
1801
|
+
action: CtaUrlActionObject;
|
|
1802
|
+
};
|
|
1803
|
+
type LocationRequestActionObject = {
|
|
1804
|
+
name: 'send_location';
|
|
1805
|
+
};
|
|
1806
|
+
type LocationRequestInteractiveObject = {
|
|
1807
|
+
type: InteractiveTypesEnum.LocationRequest;
|
|
1808
|
+
body: SimpleTextObject;
|
|
1809
|
+
footer?: SimpleTextObject;
|
|
1810
|
+
header?: HeaderObject;
|
|
1811
|
+
action: LocationRequestActionObject;
|
|
1812
|
+
};
|
|
1813
|
+
type AddressValues = {
|
|
1814
|
+
name?: string;
|
|
1815
|
+
phone_number?: string;
|
|
1816
|
+
in_pin_code?: string;
|
|
1817
|
+
house_number?: string;
|
|
1818
|
+
floor_number?: string;
|
|
1819
|
+
tower_number?: string;
|
|
1820
|
+
building_name?: string;
|
|
1821
|
+
address?: string;
|
|
1822
|
+
landmark_area?: string;
|
|
1823
|
+
city?: string;
|
|
1824
|
+
state?: string;
|
|
1825
|
+
};
|
|
1826
|
+
type SavedAddress = {
|
|
1827
|
+
id: string;
|
|
1828
|
+
value: AddressValues;
|
|
1829
|
+
};
|
|
1830
|
+
type ValidationErrors = { [key in keyof AddressValues]?: string };
|
|
1831
|
+
type AddressMessageParameters = {
|
|
1832
|
+
country: string;
|
|
1833
|
+
values?: AddressValues;
|
|
1834
|
+
saved_addresses?: SavedAddress[];
|
|
1835
|
+
validation_errors?: ValidationErrors;
|
|
1836
|
+
};
|
|
1837
|
+
type AddressMessageActionObject = {
|
|
1838
|
+
name: 'address_message';
|
|
1839
|
+
parameters: AddressMessageParameters;
|
|
1840
|
+
};
|
|
1841
|
+
type AddressMessageInteractiveObject = {
|
|
1842
|
+
type: InteractiveTypesEnum.AddressMessage;
|
|
1843
|
+
body: SimpleTextObject;
|
|
1844
|
+
footer?: SimpleTextObject;
|
|
1845
|
+
header?: HeaderObject;
|
|
1846
|
+
action: AddressMessageActionObject;
|
|
1847
|
+
};
|
|
1848
|
+
type FlowParameters = {
|
|
1849
|
+
flow_message_version: string;
|
|
1850
|
+
flow_id?: string;
|
|
1851
|
+
flow_name?: string;
|
|
1852
|
+
flow_cta: string;
|
|
1853
|
+
mode?: 'draft' | 'published';
|
|
1854
|
+
flow_token: string;
|
|
1855
|
+
flow_action: 'navigate' | 'data_exchange';
|
|
1856
|
+
flow_action_payload?: {
|
|
1857
|
+
screen?: string;
|
|
1858
|
+
data?: Record<string, string>;
|
|
1859
|
+
};
|
|
1860
|
+
};
|
|
1861
|
+
type FlowActionObject = {
|
|
1862
|
+
name: 'flow';
|
|
1863
|
+
parameters: FlowParameters;
|
|
1864
|
+
};
|
|
1865
|
+
type FlowInteractiveObject = {
|
|
1866
|
+
type: InteractiveTypesEnum.Flow;
|
|
1867
|
+
body: SimpleTextObject;
|
|
1868
|
+
footer?: SimpleTextObject;
|
|
1869
|
+
header?: HeaderObject;
|
|
1870
|
+
action: FlowActionObject;
|
|
1871
|
+
};
|
|
1872
|
+
type InteractiveObject = ButtonInteractiveObject | ListInteractiveObject | ProductInteractiveObject | ProductListInteractiveObject | CtaUrlInteractiveObject | LocationRequestInteractiveObject | AddressMessageInteractiveObject | FlowInteractiveObject;
|
|
1873
|
+
type InteractiveMessageRequestBody = MessageRequestBody<MessageTypesEnum.Interactive> & {
|
|
1874
|
+
[MessageTypesEnum.Interactive]: InteractiveObject;
|
|
1875
|
+
};
|
|
1876
|
+
//#endregion
|
|
1877
|
+
//#region src/api/messages/types/reaction.d.ts
|
|
1878
|
+
type ReActionObject = {
|
|
1879
|
+
message_id: string;
|
|
1880
|
+
emoji: string;
|
|
1881
|
+
};
|
|
1882
|
+
type ReactionMessageRequestBody = MessageRequestBody<MessageTypesEnum.Reaction> & ReActionObject;
|
|
1883
|
+
interface ReactionParams {
|
|
1884
|
+
messageId: string;
|
|
1885
|
+
emoji: string;
|
|
1886
|
+
to: string;
|
|
1887
|
+
}
|
|
1888
|
+
//#endregion
|
|
1889
|
+
//#region src/api/messages/types/common.d.ts
|
|
1890
|
+
type GeneralMessageBody = GeneralRequestBody & {
|
|
1891
|
+
/**
|
|
1892
|
+
* The Meta messaging product name.
|
|
1893
|
+
* @default 'whatsapp'
|
|
1894
|
+
*/
|
|
1895
|
+
messaging_product: 'whatsapp';
|
|
1896
|
+
};
|
|
1897
|
+
type StatusObject = {
|
|
1898
|
+
status: 'read';
|
|
1899
|
+
message_id: string;
|
|
1900
|
+
typing_indicator?: TypingIndicatorObject;
|
|
1901
|
+
};
|
|
1902
|
+
type TypingIndicatorObject = {
|
|
1903
|
+
type: 'text';
|
|
1904
|
+
};
|
|
1905
|
+
type StatusRequestBody = GeneralMessageBody & StatusObject;
|
|
1906
|
+
type ConTextObject = {
|
|
1907
|
+
message_id: string;
|
|
1908
|
+
};
|
|
1909
|
+
type MessageRequestBody<T extends MessageTypesEnum> = GeneralMessageBody & {
|
|
1910
|
+
recipient_type?: string;
|
|
1911
|
+
to: string;
|
|
1912
|
+
context?: ConTextObject;
|
|
1913
|
+
type?: T;
|
|
1914
|
+
};
|
|
1915
|
+
interface MessageRequestParams<T> {
|
|
1916
|
+
body: T;
|
|
1917
|
+
to: string;
|
|
1918
|
+
replyMessageId?: string;
|
|
1919
|
+
}
|
|
1920
|
+
interface StatusParams {
|
|
1921
|
+
status: string;
|
|
1922
|
+
messageId: string;
|
|
1923
|
+
typingIndicator?: {
|
|
1924
|
+
type: string;
|
|
1925
|
+
};
|
|
1926
|
+
}
|
|
1927
|
+
type MessagesResponse = GeneralMessageBody & {
|
|
1928
|
+
contacts: [{
|
|
1929
|
+
input: string;
|
|
1930
|
+
wa_id: string;
|
|
1931
|
+
}];
|
|
1932
|
+
messages: [{
|
|
1933
|
+
id: string;
|
|
1934
|
+
}];
|
|
1935
|
+
};
|
|
1936
|
+
declare class MessagesClass extends BaseClass {
|
|
1937
|
+
text(params: TextMessageParams): Promise<MessagesResponse>;
|
|
1938
|
+
template(params: MessageRequestParams<MessageTemplateObject<ComponentTypesEnum>>): Promise<MessagesResponse>;
|
|
1939
|
+
audio(params: MessageRequestParams<AudioMediaObject>): Promise<MessagesResponse>;
|
|
1940
|
+
document(params: MessageRequestParams<DocumentMediaObject>): Promise<MessagesResponse>;
|
|
1941
|
+
image(params: MessageRequestParams<ImageMediaObject>): Promise<MessagesResponse>;
|
|
1942
|
+
video(params: MessageRequestParams<VideoMediaObject>): Promise<MessagesResponse>;
|
|
1943
|
+
sticker(params: MessageRequestParams<StickerMediaObject>): Promise<MessagesResponse>;
|
|
1944
|
+
contacts(params: MessageRequestParams<[ContactObject]>): Promise<MessagesResponse>;
|
|
1945
|
+
location(params: MessageRequestParams<LocationObject>): Promise<MessagesResponse>;
|
|
1946
|
+
interactive(params: MessageRequestParams<InteractiveObject>): Promise<MessagesResponse>;
|
|
1947
|
+
interactiveList(params: MessageRequestParams<InteractiveObject & {
|
|
1948
|
+
type: InteractiveTypesEnum.List;
|
|
1949
|
+
}>): Promise<MessagesResponse>;
|
|
1950
|
+
interactiveCtaUrl(params: MessageRequestParams<InteractiveObject & {
|
|
1951
|
+
type: InteractiveTypesEnum.CtaUrl;
|
|
1952
|
+
}>): Promise<MessagesResponse>;
|
|
1953
|
+
interactiveLocationRequest(params: MessageRequestParams<InteractiveObject & {
|
|
1954
|
+
type: InteractiveTypesEnum.LocationRequest;
|
|
1955
|
+
}>): Promise<MessagesResponse>;
|
|
1956
|
+
interactiveAddressMessage(params: MessageRequestParams<InteractiveObject & {
|
|
1957
|
+
type: InteractiveTypesEnum.AddressMessage;
|
|
1958
|
+
}>): Promise<MessagesResponse>;
|
|
1959
|
+
interactiveReplyButtons(params: MessageRequestParams<InteractiveObject & {
|
|
1960
|
+
type: InteractiveTypesEnum.Button;
|
|
1961
|
+
}>): Promise<MessagesResponse>;
|
|
1962
|
+
interactiveFlow(params: MessageRequestParams<InteractiveObject & {
|
|
1963
|
+
type: InteractiveTypesEnum.Flow;
|
|
1964
|
+
}>): Promise<MessagesResponse>;
|
|
1965
|
+
reaction(params: ReactionParams): Promise<MessagesResponse>;
|
|
1966
|
+
markAsRead(params: {
|
|
1967
|
+
messageId: string;
|
|
1968
|
+
}): Promise<MessagesResponse>;
|
|
1969
|
+
showTypingIndicator(params: {
|
|
1970
|
+
messageId: string;
|
|
1971
|
+
}): Promise<MessagesResponse>;
|
|
1972
|
+
status(params: StatusParams): Promise<MessagesResponse>;
|
|
1973
|
+
}
|
|
1974
|
+
//#endregion
|
|
1975
|
+
//#region src/api/messages/MessageApi.d.ts
|
|
1976
|
+
/**
|
|
1977
|
+
* Maps each message type to its appropriate payload type
|
|
1978
|
+
*/
|
|
1979
|
+
type MessagePayloadType<T extends MessageTypesEnum> = T extends MessageTypesEnum.Audio ? AudioMediaObject : T extends MessageTypesEnum.Contacts ? [ContactObject] : T extends MessageTypesEnum.Document ? DocumentMediaObject : T extends MessageTypesEnum.Image ? ImageMediaObject : T extends MessageTypesEnum.Interactive ? InteractiveObject : T extends MessageTypesEnum.Location ? LocationObject : T extends MessageTypesEnum.Template ? MessageTemplateObject<ComponentTypesEnum> : T extends MessageTypesEnum.Sticker ? StickerMediaObject : T extends MessageTypesEnum.Text ? TextObject : T extends MessageTypesEnum.Video ? VideoMediaObject : T extends MessageTypesEnum.Reaction ? {
|
|
1980
|
+
message_id: string;
|
|
1981
|
+
emoji: string;
|
|
1982
|
+
} : never;
|
|
1983
|
+
declare class MessagesApi extends BaseAPI implements MessagesClass {
|
|
1984
|
+
private readonly commonMethod;
|
|
1985
|
+
private readonly commonEndpoint;
|
|
1986
|
+
constructor(config: WabaConfigType, client: RequesterClass);
|
|
1987
|
+
/**
|
|
1988
|
+
* Builds the request body for WhatsApp API messages
|
|
1989
|
+
* @param type The type of message to send
|
|
1990
|
+
* @param payload The message payload object
|
|
1991
|
+
* @param to The recipient's phone number
|
|
1992
|
+
* @param replyMessageId Optional message ID to reply to
|
|
1993
|
+
* @returns The formatted request body
|
|
1994
|
+
*/
|
|
1995
|
+
bodyBuilder<T extends MessageTypesEnum>(type: T, payload: MessagePayloadType<T>, to: string, replyMessageId?: string): MessageRequestBody<T>;
|
|
1996
|
+
/**
|
|
1997
|
+
* Sends a request to the WhatsApp API
|
|
1998
|
+
* @param body The request body to send
|
|
1999
|
+
* @returns Promise with the API response
|
|
2000
|
+
*/
|
|
2001
|
+
private send;
|
|
2002
|
+
/**
|
|
2003
|
+
* Sends an audio message via WhatsApp
|
|
2004
|
+
* @param params The audio message parameter object
|
|
2005
|
+
* @returns Promise with the message response
|
|
2006
|
+
*/
|
|
2007
|
+
audio(params: MessageRequestParams<AudioMediaObject>): Promise<MessagesResponse>;
|
|
2008
|
+
/**
|
|
2009
|
+
* Sends a contact card via WhatsApp
|
|
2010
|
+
* @param params The contact message parameter object
|
|
2011
|
+
* @returns Promise with the message response
|
|
2012
|
+
*/
|
|
2013
|
+
contacts(params: MessageRequestParams<[ContactObject]>): Promise<MessagesResponse>;
|
|
2014
|
+
/**
|
|
2015
|
+
* Sends a document via WhatsApp
|
|
2016
|
+
* @param params The document message parameter object
|
|
2017
|
+
* @returns Promise with the message response
|
|
2018
|
+
*/
|
|
2019
|
+
document(params: MessageRequestParams<DocumentMediaObject>): Promise<MessagesResponse>;
|
|
2020
|
+
/**
|
|
2021
|
+
* Sends an image via WhatsApp
|
|
2022
|
+
* @param params The image message parameter object
|
|
2023
|
+
* @returns Promise with the message response
|
|
2024
|
+
*/
|
|
2025
|
+
image(params: MessageRequestParams<ImageMediaObject>): Promise<MessagesResponse>;
|
|
2026
|
+
/**
|
|
2027
|
+
* Sends an interactive message via WhatsApp
|
|
2028
|
+
* @param params The interactive message parameter object
|
|
2029
|
+
* @returns Promise with the message response
|
|
2030
|
+
*/
|
|
2031
|
+
interactive(params: MessageRequestParams<InteractiveObject>): Promise<MessagesResponse>;
|
|
2032
|
+
/**
|
|
2033
|
+
* Sends a location via WhatsApp
|
|
2034
|
+
* @param params The location message parameter object
|
|
2035
|
+
* @returns Promise with the message response
|
|
2036
|
+
*/
|
|
2037
|
+
location(params: MessageRequestParams<LocationObject>): Promise<MessagesResponse>;
|
|
2038
|
+
/**
|
|
2039
|
+
* Sends a sticker via WhatsApp
|
|
2040
|
+
* @param params The sticker message parameter object
|
|
2041
|
+
* @returns Promise with the message response
|
|
2042
|
+
*/
|
|
2043
|
+
sticker(params: MessageRequestParams<StickerMediaObject>): Promise<MessagesResponse>;
|
|
2044
|
+
/**
|
|
2045
|
+
* Sends a template message via WhatsApp
|
|
2046
|
+
* @param params The template message parameter object
|
|
2047
|
+
* @returns Promise with the message response
|
|
2048
|
+
*/
|
|
2049
|
+
template(params: MessageRequestParams<MessageTemplateObject<ComponentTypesEnum>>): Promise<MessagesResponse>;
|
|
2050
|
+
/**
|
|
2051
|
+
* Sends a text message via WhatsApp
|
|
2052
|
+
* @param params The text message parameter object
|
|
2053
|
+
* @returns Promise with the message response
|
|
2054
|
+
*/
|
|
2055
|
+
text(params: TextMessageParams): Promise<MessagesResponse>;
|
|
2056
|
+
/**
|
|
2057
|
+
* Sends a video message via WhatsApp
|
|
2058
|
+
* @param params The video message parameter object
|
|
2059
|
+
* @returns Promise with the message response
|
|
2060
|
+
*/
|
|
2061
|
+
video(params: MessageRequestParams<VideoMediaObject>): Promise<MessagesResponse>;
|
|
2062
|
+
/**
|
|
2063
|
+
* Updates message status (mark as read, etc.)
|
|
2064
|
+
* @param params The status update parameters
|
|
2065
|
+
* @returns Promise with the API response
|
|
2066
|
+
*/
|
|
2067
|
+
status(params: StatusParams): Promise<MessagesResponse>;
|
|
2068
|
+
/**
|
|
2069
|
+
* Marks a message as read
|
|
2070
|
+
* @param params Object containing messageId
|
|
2071
|
+
* @returns Promise with the API response
|
|
2072
|
+
*/
|
|
2073
|
+
markAsRead(params: {
|
|
2074
|
+
messageId: string;
|
|
2075
|
+
}): Promise<MessagesResponse>;
|
|
2076
|
+
/**
|
|
2077
|
+
* Shows typing indicator
|
|
2078
|
+
* @param params Object containing messageId
|
|
2079
|
+
* @returns Promise with the API response
|
|
2080
|
+
*/
|
|
2081
|
+
showTypingIndicator(params: {
|
|
2082
|
+
messageId: string;
|
|
2083
|
+
}): Promise<MessagesResponse>;
|
|
2084
|
+
/**
|
|
2085
|
+
* Sends a list interactive message
|
|
2086
|
+
* @param params The list interactive message parameters
|
|
2087
|
+
* @returns Promise with the message response
|
|
2088
|
+
*/
|
|
2089
|
+
interactiveList(params: MessageRequestParams<InteractiveObject & {
|
|
2090
|
+
type: InteractiveTypesEnum.List;
|
|
2091
|
+
}>): Promise<MessagesResponse>;
|
|
2092
|
+
/**
|
|
2093
|
+
* Sends a CTA URL interactive message
|
|
2094
|
+
* @param params The CTA URL interactive message parameters
|
|
2095
|
+
* @returns Promise with the message response
|
|
2096
|
+
*/
|
|
2097
|
+
interactiveCtaUrl(params: MessageRequestParams<InteractiveObject & {
|
|
2098
|
+
type: InteractiveTypesEnum.CtaUrl;
|
|
2099
|
+
}>): Promise<MessagesResponse>;
|
|
2100
|
+
/**
|
|
2101
|
+
* Sends a location request interactive message
|
|
2102
|
+
* @param params The location request interactive message parameters
|
|
2103
|
+
* @returns Promise with the message response
|
|
2104
|
+
*/
|
|
2105
|
+
interactiveLocationRequest(params: MessageRequestParams<InteractiveObject & {
|
|
2106
|
+
type: InteractiveTypesEnum.LocationRequest;
|
|
2107
|
+
}>): Promise<MessagesResponse>;
|
|
2108
|
+
/**
|
|
2109
|
+
* Sends an address message interactive message
|
|
2110
|
+
* @param params The address message interactive message parameters
|
|
2111
|
+
* @returns Promise with the message response
|
|
2112
|
+
*/
|
|
2113
|
+
interactiveAddressMessage(params: MessageRequestParams<InteractiveObject & {
|
|
2114
|
+
type: InteractiveTypesEnum.AddressMessage;
|
|
2115
|
+
}>): Promise<MessagesResponse>;
|
|
2116
|
+
/**
|
|
2117
|
+
* Sends a reply buttons interactive message
|
|
2118
|
+
* @param params The reply buttons interactive message parameters
|
|
2119
|
+
* @returns Promise with the message response
|
|
2120
|
+
*/
|
|
2121
|
+
interactiveReplyButtons(params: MessageRequestParams<InteractiveObject & {
|
|
2122
|
+
type: InteractiveTypesEnum.Button;
|
|
2123
|
+
}>): Promise<MessagesResponse>;
|
|
2124
|
+
/**
|
|
2125
|
+
* Sends a flow interactive message
|
|
2126
|
+
* @param params The flow interactive message parameters
|
|
2127
|
+
* @returns Promise with the message response
|
|
2128
|
+
*/
|
|
2129
|
+
interactiveFlow(params: MessageRequestParams<InteractiveObject & {
|
|
2130
|
+
type: InteractiveTypesEnum.Flow;
|
|
2131
|
+
}>): Promise<MessagesResponse>;
|
|
2132
|
+
/**
|
|
2133
|
+
* Sends a reaction to a message
|
|
2134
|
+
* @param params The reaction parameters
|
|
2135
|
+
* @returns Promise with the message response
|
|
2136
|
+
*/
|
|
2137
|
+
reaction(params: ReactionParams): Promise<MessagesResponse>;
|
|
2138
|
+
}
|
|
2139
|
+
//#endregion
|
|
2140
|
+
//#region src/api/phone/types/common.d.ts
|
|
2141
|
+
type QualityRating = 'GREEN' | 'YELLOW' | 'RED' | 'NA';
|
|
2142
|
+
type AccountMode = 'LIVE' | 'SANDBOX';
|
|
2143
|
+
type CodeVerificationStatus = 'NOT_VERIFIED' | 'VERIFIED' | 'EXPIRED' | 'PENDING' | 'DELETED' | 'MIGRATED' | 'BANNED' | 'RESTRICTED' | 'RATE_LIMITED' | 'FLAGGED' | 'CONNECTED' | 'DISCONNECTED' | 'UNKNOWN' | 'UNVERIFIED';
|
|
2144
|
+
type MessagingLimitTier = 'TIER_50' | 'TIER_250' | 'TIER_1K' | 'TIER_10K' | 'TIER_100K' | 'TIER_UNLIMITED';
|
|
2145
|
+
type PlatformType = 'CLOUD_API' | 'ON_PREMISE' | 'NOT_APPLICABLE';
|
|
2146
|
+
type ThroughputLevel = 'STANDARD' | 'HIGH' | 'NOT_APPLICABLE';
|
|
2147
|
+
type HealthStatusEntity = {
|
|
2148
|
+
entity_type: string;
|
|
2149
|
+
id: string;
|
|
2150
|
+
can_send_message: string;
|
|
2151
|
+
additional_info?: string[];
|
|
2152
|
+
errors?: Array<{
|
|
2153
|
+
error_code: number;
|
|
2154
|
+
error_description: string;
|
|
2155
|
+
possible_solution: string;
|
|
2156
|
+
}>;
|
|
2157
|
+
};
|
|
2158
|
+
type HealthStatus = {
|
|
2159
|
+
can_send_message: string;
|
|
2160
|
+
entities: HealthStatusEntity[];
|
|
2161
|
+
};
|
|
2162
|
+
type QualityScore = {
|
|
2163
|
+
score: QualityRating;
|
|
2164
|
+
};
|
|
2165
|
+
type Throughput = {
|
|
2166
|
+
level: ThroughputLevel;
|
|
2167
|
+
};
|
|
2168
|
+
type PhoneNumberResponse = {
|
|
2169
|
+
display_phone_number: string;
|
|
2170
|
+
id: string;
|
|
2171
|
+
quality_rating: QualityRating;
|
|
2172
|
+
verified_name: string;
|
|
2173
|
+
account_mode?: AccountMode;
|
|
2174
|
+
certificate?: string;
|
|
2175
|
+
code_verification_status?: CodeVerificationStatus;
|
|
2176
|
+
conversational_automation?: Record<string, unknown>;
|
|
2177
|
+
eligibility_for_api_business_global_search?: string;
|
|
2178
|
+
health_status?: HealthStatus;
|
|
2179
|
+
is_official_business_account?: boolean;
|
|
2180
|
+
is_on_biz_app?: boolean;
|
|
2181
|
+
is_pin_enabled?: boolean;
|
|
2182
|
+
is_preverified_number?: boolean;
|
|
2183
|
+
last_onboarded_time?: string;
|
|
2184
|
+
messaging_limit_tier?: MessagingLimitTier;
|
|
2185
|
+
name_status?: string;
|
|
2186
|
+
new_certificate?: string;
|
|
2187
|
+
new_name_status?: string;
|
|
2188
|
+
platform_type?: PlatformType;
|
|
2189
|
+
quality_score?: QualityScore;
|
|
2190
|
+
search_visibility?: string;
|
|
2191
|
+
status?: CodeVerificationStatus;
|
|
2192
|
+
throughput?: Throughput;
|
|
2193
|
+
};
|
|
2194
|
+
type Cursors = {
|
|
2195
|
+
before: string;
|
|
2196
|
+
after: string;
|
|
2197
|
+
};
|
|
2198
|
+
type PhoneNumbersResponse = {
|
|
2199
|
+
data: PhoneNumberResponse[];
|
|
2200
|
+
paging: Paging;
|
|
2201
|
+
};
|
|
2202
|
+
type RequestVerificationCodeRequest = {
|
|
2203
|
+
code_method: 'SMS' | 'VOICE';
|
|
2204
|
+
language: string;
|
|
2205
|
+
};
|
|
2206
|
+
type VerifyCodeRequest = {
|
|
2207
|
+
code: string;
|
|
2208
|
+
};
|
|
2209
|
+
type TwoStepVerificationParams = {
|
|
2210
|
+
pin: string;
|
|
2211
|
+
};
|
|
2212
|
+
interface PhoneNumberClass {
|
|
2213
|
+
getPhoneNumberById(fields?: string): Promise<PhoneNumberResponse>;
|
|
2214
|
+
getPhoneNumbers(): Promise<PhoneNumbersResponse>;
|
|
2215
|
+
requestVerificationCode(params: RequestVerificationCodeRequest): Promise<ResponseSuccess>;
|
|
2216
|
+
verifyCode(params: VerifyCodeRequest): Promise<ResponseSuccess>;
|
|
2217
|
+
}
|
|
2218
|
+
//#endregion
|
|
2219
|
+
//#region src/api/phone/PhoneNumberApi.d.ts
|
|
2220
|
+
/**
|
|
2221
|
+
* API for managing WhatsApp Phone Numb ers.
|
|
2222
|
+
*
|
|
2223
|
+
* This API allows you to:
|
|
2224
|
+
* - Get phone number information by ID
|
|
2225
|
+
* - Get all phone numbers for a business account
|
|
2226
|
+
* - Request verification codes for phone numbers
|
|
2227
|
+
* - Verify phone numbers with codes
|
|
2228
|
+
*/
|
|
2229
|
+
declare class PhoneNumberApi extends BaseAPI implements PhoneNumberClass {
|
|
2230
|
+
private readonly endpoint;
|
|
2231
|
+
constructor(config: WabaConfigType, client: RequesterClass);
|
|
2232
|
+
/**
|
|
2233
|
+
* Get phone number information by ID.
|
|
2234
|
+
*
|
|
2235
|
+
* @param fields Optional comma-separated list of fields to include in the response
|
|
2236
|
+
* @returns Phone number information including verification status, quality rating, etc.
|
|
2237
|
+
*
|
|
2238
|
+
* @example
|
|
2239
|
+
* const phoneNumber = await whatsappClient.phoneNumber.getPhoneNumberById();
|
|
2240
|
+
* const phoneNumberWithFields = await whatsappClient.phoneNumber.getPhoneNumberById('display_phone_number,verified_name');
|
|
2241
|
+
*/
|
|
2242
|
+
getPhoneNumberById(fields?: string): Promise<PhoneNumberResponse>;
|
|
2243
|
+
/**
|
|
2244
|
+
* Get all phone numbers for the business account.
|
|
2245
|
+
*
|
|
2246
|
+
* @returns List of phone numbers associated with the business account
|
|
2247
|
+
*
|
|
2248
|
+
* @example
|
|
2249
|
+
* const phoneNumbers = await whatsappClient.phoneNumber.getPhoneNumbers();
|
|
2250
|
+
*/
|
|
2251
|
+
getPhoneNumbers(): Promise<PhoneNumbersResponse>;
|
|
2252
|
+
/**
|
|
2253
|
+
* Request a verification code for the phone number.
|
|
2254
|
+
*
|
|
2255
|
+
* @param request Verification code request containing method and language
|
|
2256
|
+
* @returns Response indicating success or failure
|
|
2257
|
+
*
|
|
2258
|
+
* @example
|
|
2259
|
+
* await whatsappClient.phoneNumber.requestVerificationCode({
|
|
2260
|
+
* code_method: 'SMS',
|
|
2261
|
+
* language: 'en_US'
|
|
2262
|
+
* });
|
|
2263
|
+
*/
|
|
2264
|
+
requestVerificationCode(request: RequestVerificationCodeRequest): Promise<ResponseSuccess>;
|
|
2265
|
+
/**
|
|
2266
|
+
* Verify the phone number with the received code.
|
|
2267
|
+
*
|
|
2268
|
+
* @param request Verification request containing the code
|
|
2269
|
+
* @returns Response indicating success or failure
|
|
2270
|
+
*
|
|
2271
|
+
* @example
|
|
2272
|
+
* await whatsappClient.phoneNumber.verifyCode({
|
|
2273
|
+
* code: '123456'
|
|
2274
|
+
* });
|
|
2275
|
+
*/
|
|
2276
|
+
verifyCode(request: VerifyCodeRequest): Promise<ResponseSuccess>;
|
|
2277
|
+
}
|
|
2278
|
+
//#endregion
|
|
2279
|
+
//#region src/api/profile/types/upload.d.ts
|
|
2280
|
+
/**
|
|
2281
|
+
* Upload session information for creating upload sessions.
|
|
2282
|
+
*/
|
|
2283
|
+
interface UploadSession {
|
|
2284
|
+
id: string;
|
|
2285
|
+
video?: boolean;
|
|
2286
|
+
}
|
|
2287
|
+
/**
|
|
2288
|
+
* Response from creating an upload session.
|
|
2289
|
+
*/
|
|
2290
|
+
interface UploadSessionResponse {
|
|
2291
|
+
id: string;
|
|
2292
|
+
}
|
|
2293
|
+
/**
|
|
2294
|
+
* Response from uploading business profile media.
|
|
2295
|
+
*/
|
|
2296
|
+
interface UploadBusinessProfileResponse {
|
|
2297
|
+
h: string;
|
|
2298
|
+
}
|
|
2299
|
+
/**
|
|
2300
|
+
* Upload handle information containing file details and handle.
|
|
2301
|
+
*/
|
|
2302
|
+
interface UploadHandle {
|
|
2303
|
+
handle: string;
|
|
2304
|
+
file_size: number;
|
|
2305
|
+
upload_result: {
|
|
2306
|
+
handle_type: string;
|
|
2307
|
+
name: string;
|
|
2308
|
+
};
|
|
2309
|
+
}
|
|
2310
|
+
/**
|
|
2311
|
+
* Request parameters for creating upload session.
|
|
2312
|
+
*/
|
|
2313
|
+
interface CreateUploadSessionParams {
|
|
2314
|
+
/**
|
|
2315
|
+
* Length of the file to be uploaded in bytes.
|
|
2316
|
+
*/
|
|
2317
|
+
fileLength: number;
|
|
2318
|
+
/**
|
|
2319
|
+
* MIME type of the file (e.g., 'image/jpeg').
|
|
2320
|
+
*/
|
|
2321
|
+
fileType: string;
|
|
2322
|
+
/**
|
|
2323
|
+
* Name of the file with extension.
|
|
2324
|
+
*/
|
|
2325
|
+
fileName: string;
|
|
2326
|
+
}
|
|
2327
|
+
/**
|
|
2328
|
+
* Request parameters for uploading media.
|
|
2329
|
+
*/
|
|
2330
|
+
interface UploadMediaParams {
|
|
2331
|
+
/**
|
|
2332
|
+
* The upload session ID from createUploadSession response.
|
|
2333
|
+
*/
|
|
2334
|
+
uploadId: string;
|
|
2335
|
+
/**
|
|
2336
|
+
* The binary data of the file (Buffer).
|
|
2337
|
+
*/
|
|
2338
|
+
file: Buffer;
|
|
2339
|
+
}
|
|
2340
|
+
/**
|
|
2341
|
+
* Request parameters for getting upload handle.
|
|
2342
|
+
*/
|
|
2343
|
+
interface GetUploadHandleParams {
|
|
2344
|
+
/**
|
|
2345
|
+
* The upload session ID from createUploadSession response.
|
|
2346
|
+
*/
|
|
2347
|
+
uploadId: string;
|
|
2348
|
+
}
|
|
2349
|
+
//#endregion
|
|
2350
|
+
//#region src/api/profile/types/common.d.ts
|
|
2351
|
+
/**
|
|
2352
|
+
* Available fields that can be requested when retrieving a business profile.
|
|
2353
|
+
*/
|
|
2354
|
+
type BusinessProfileField = 'about' | 'address' | 'description' | 'email' | 'profile_picture_url' | 'websites' | 'vertical';
|
|
2355
|
+
type BusinessProfileFieldsParam = BusinessProfileField[] | string;
|
|
2356
|
+
/**
|
|
2357
|
+
* Business profile data structure containing all profile information.
|
|
2358
|
+
*/
|
|
2359
|
+
interface BusinessProfileData {
|
|
2360
|
+
/**
|
|
2361
|
+
* The business's About text. This text appears in the business's profile, beneath its profile image,
|
|
2362
|
+
* phone number, and contact buttons.
|
|
2363
|
+
* - String cannot be empty
|
|
2364
|
+
* - Strings must be between 1 and 139 characters
|
|
2365
|
+
* - Rendered emojis are supported however their unicode values are not.
|
|
2366
|
+
* Emoji unicode values must be Java- or JavaScript-escape encoded
|
|
2367
|
+
* - Hyperlinks can be included but will not render as clickable links
|
|
2368
|
+
* - Markdown is not supported
|
|
2369
|
+
*/
|
|
2370
|
+
about?: string;
|
|
2371
|
+
/**
|
|
2372
|
+
* Address of the business. Character limit 256.
|
|
2373
|
+
*/
|
|
2374
|
+
address?: string;
|
|
2375
|
+
/**
|
|
2376
|
+
* Description of the business. Character limit 512.
|
|
2377
|
+
*/
|
|
2378
|
+
description?: string;
|
|
2379
|
+
/**
|
|
2380
|
+
* The contact email address (in valid email format) of the business. Character limit 128.
|
|
2381
|
+
*/
|
|
2382
|
+
email?: string;
|
|
2383
|
+
/**
|
|
2384
|
+
* The messaging service used for the request. Always set it to "whatsapp" if you are using
|
|
2385
|
+
* the WhatsApp Business API.
|
|
2386
|
+
*/
|
|
2387
|
+
messaging_product: string;
|
|
2388
|
+
/**
|
|
2389
|
+
* Profile picture URL.
|
|
2390
|
+
*/
|
|
2391
|
+
profile_picture_url?: string;
|
|
2392
|
+
/**
|
|
2393
|
+
* The URLs associated with the business. For instance, a website, Facebook Page, or Instagram.
|
|
2394
|
+
* - You must include the http:// or https:// portion of the URL
|
|
2395
|
+
* - There is a maximum of 2 websites with a maximum of 256 characters each
|
|
2396
|
+
*/
|
|
2397
|
+
websites?: string[];
|
|
2398
|
+
/**
|
|
2399
|
+
* Business category. This can be either an empty string or one of the predefined business categories.
|
|
2400
|
+
* @see BusinessVerticalEnum for all available options
|
|
2401
|
+
*/
|
|
2402
|
+
vertical?: BusinessVerticalEnum | string;
|
|
2403
|
+
}
|
|
2404
|
+
/**
|
|
2405
|
+
* Response structure for business profile GET requests.
|
|
2406
|
+
*/
|
|
2407
|
+
interface BusinessProfileResponse {
|
|
2408
|
+
data: BusinessProfileData[];
|
|
2409
|
+
}
|
|
2410
|
+
/**
|
|
2411
|
+
* Request structure for updating business profile.
|
|
2412
|
+
*/
|
|
2413
|
+
interface UpdateBusinessProfileRequest {
|
|
2414
|
+
/**
|
|
2415
|
+
* The messaging service used for the request. Always set it to "whatsapp" if you are using
|
|
2416
|
+
* the WhatsApp Business API.
|
|
2417
|
+
* @required
|
|
2418
|
+
*/
|
|
2419
|
+
messaging_product: string;
|
|
2420
|
+
/**
|
|
2421
|
+
* The business's About text. This text appears in the business's profile, beneath its profile image,
|
|
2422
|
+
* phone number, and contact buttons.
|
|
2423
|
+
* - String cannot be empty
|
|
2424
|
+
* - Strings must be between 1 and 139 characters
|
|
2425
|
+
* - Rendered emojis are supported however their unicode values are not.
|
|
2426
|
+
* Emoji unicode values must be Java- or JavaScript-escape encoded
|
|
2427
|
+
* - Hyperlinks can be included but will not render as clickable links
|
|
2428
|
+
* - Markdown is not supported
|
|
2429
|
+
*/
|
|
2430
|
+
about?: string;
|
|
2431
|
+
/**
|
|
2432
|
+
* Address of the business. Character limit 256.
|
|
2433
|
+
*/
|
|
2434
|
+
address?: string;
|
|
2435
|
+
/**
|
|
2436
|
+
* Description of the business. Character limit 512.
|
|
2437
|
+
*/
|
|
2438
|
+
description?: string;
|
|
2439
|
+
/**
|
|
2440
|
+
* Business category. This can be either an empty string or one of the predefined business categories.
|
|
2441
|
+
* @see BusinessVerticalEnum for all available options
|
|
2442
|
+
*/
|
|
2443
|
+
vertical?: BusinessVerticalEnum | string;
|
|
2444
|
+
/**
|
|
2445
|
+
* The contact email address (in valid email format) of the business. Character limit 128.
|
|
2446
|
+
*/
|
|
2447
|
+
email?: string;
|
|
2448
|
+
/**
|
|
2449
|
+
* The URLs associated with the business. For instance, a website, Facebook Page, or Instagram.
|
|
2450
|
+
* - You must include the http:// or https:// portion of the URL
|
|
2451
|
+
* - There is a maximum of 2 websites with a maximum of 256 characters each
|
|
2452
|
+
*/
|
|
2453
|
+
websites?: string[];
|
|
2454
|
+
/**
|
|
2455
|
+
* Handle of the profile picture. This handle is generated when you upload the binary file
|
|
2456
|
+
* for the profile picture to Meta using the Resumable Upload API.
|
|
2457
|
+
*/
|
|
2458
|
+
profile_picture_handle?: string;
|
|
2459
|
+
}
|
|
2460
|
+
declare class BusinessProfileClass extends BaseClass {
|
|
2461
|
+
/**
|
|
2462
|
+
* Get your business profile.
|
|
2463
|
+
* @param fields Specific fields to be returned in the response. If not specified, all fields will be returned.
|
|
2464
|
+
*/
|
|
2465
|
+
getBusinessProfile(fields?: BusinessProfileFieldsParam): Promise<BusinessProfileResponse>;
|
|
2466
|
+
/**
|
|
2467
|
+
* Update your business profile.
|
|
2468
|
+
* @param updateRequest The request object containing the fields to update.
|
|
2469
|
+
*/
|
|
2470
|
+
updateBusinessProfile(updateRequest: UpdateBusinessProfileRequest): Promise<ResponseSuccess>;
|
|
2471
|
+
/**
|
|
2472
|
+
* Create an upload session for profile picture.
|
|
2473
|
+
* @param fileLength Length of the file to be uploaded in bytes.
|
|
2474
|
+
* @param fileType MIME type of the file (e.g., 'image/jpeg').
|
|
2475
|
+
* @param fileName Name of the file.
|
|
2476
|
+
*/
|
|
2477
|
+
createUploadSession(fileLength: number, fileType: string, fileName: string): Promise<UploadSessionResponse>;
|
|
2478
|
+
/**
|
|
2479
|
+
* Upload media file to the upload session.
|
|
2480
|
+
* @param uploadId The ID of the upload session.
|
|
2481
|
+
* @param file The binary data of the file.
|
|
2482
|
+
*/
|
|
2483
|
+
uploadMedia(uploadId: string, file: Buffer): Promise<UploadBusinessProfileResponse>;
|
|
2484
|
+
/**
|
|
2485
|
+
* Get the upload handle information.
|
|
2486
|
+
* @param uploadId The ID of the upload session.
|
|
2487
|
+
*/
|
|
2488
|
+
getUploadHandle(uploadId: string): Promise<UploadHandle>;
|
|
2489
|
+
}
|
|
2490
|
+
//#endregion
|
|
2491
|
+
//#region src/api/profile/BusinessProfileApi.d.ts
|
|
2492
|
+
/**
|
|
2493
|
+
* API for managing WhatsApp Business Profiles and profile pictures.
|
|
2494
|
+
*
|
|
2495
|
+
* This API allows you to:
|
|
2496
|
+
* - Get business profile information
|
|
2497
|
+
* - Update business profile details
|
|
2498
|
+
* - Upload profile pictures using a three-step process:
|
|
2499
|
+
* 1. Create an upload session
|
|
2500
|
+
* 2. Upload the image binary data
|
|
2501
|
+
* 3. Get the upload handle to use when updating the profile
|
|
2502
|
+
*/
|
|
2503
|
+
declare class BusinessProfileApi extends BaseAPI implements BusinessProfileClass {
|
|
2504
|
+
private readonly endpoint;
|
|
2505
|
+
constructor(config: WabaConfigType, client: RequesterClass);
|
|
2506
|
+
/**
|
|
2507
|
+
* Get your business profile information.
|
|
2508
|
+
*
|
|
2509
|
+
* Use this method to retrieve details about your WhatsApp business profile, including
|
|
2510
|
+
* about text, address, description, email, profile picture URL, websites, and vertical.
|
|
2511
|
+
*
|
|
2512
|
+
* @param fields Fields to be returned in the response. If not specified, all fields will be returned.
|
|
2513
|
+
* Possible values: about, address, description, email, profile_picture_url, websites, vertical
|
|
2514
|
+
* @returns The business profile information.
|
|
2515
|
+
*
|
|
2516
|
+
* @example
|
|
2517
|
+
* // Get all business profile fields
|
|
2518
|
+
* const profile = await whatsappClient.businessProfile.getBusinessProfile();
|
|
2519
|
+
*
|
|
2520
|
+
* // Get specific business profile fields
|
|
2521
|
+
* const profile = await whatsappClient.businessProfile.getBusinessProfile('about,address,email');
|
|
2522
|
+
*
|
|
2523
|
+
* // Using the BusinessProfileFieldsParam type
|
|
2524
|
+
* const profile = await whatsappClient.businessProfile.getBusinessProfile(['about', 'address', 'email']);
|
|
2525
|
+
*/
|
|
2526
|
+
getBusinessProfile(fields?: BusinessProfileFieldsParam): Promise<BusinessProfileResponse>;
|
|
2527
|
+
/**
|
|
2528
|
+
* Update your business profile.
|
|
2529
|
+
*
|
|
2530
|
+
* Use this method to update one or more fields of your WhatsApp business profile.
|
|
2531
|
+
*
|
|
2532
|
+
* @param updateRequest The request object containing the fields to update.
|
|
2533
|
+
* - messaging_product: Required. Always set to "whatsapp".
|
|
2534
|
+
* - about: Optional. Business's About text (1-139 characters).
|
|
2535
|
+
* - address: Optional. Business address (max 256 characters).
|
|
2536
|
+
* - description: Optional. Business description (max 512 characters).
|
|
2537
|
+
* - vertical: Optional. Business category (use BusinessVerticalEnum for type safety).
|
|
2538
|
+
* - email: Optional. Contact email (valid format, max 128 characters).
|
|
2539
|
+
* - websites: Optional. Up to 2 URLs (max 256 characters each).
|
|
2540
|
+
* - profile_picture_handle: Optional. Handle from upload process.
|
|
2541
|
+
* @returns Response indicating success or failure.
|
|
2542
|
+
*
|
|
2543
|
+
* @example
|
|
2544
|
+
* // Update business profile with multiple fields including vertical using enum
|
|
2545
|
+
* await whatsappClient.businessProfile.updateBusinessProfile({
|
|
2546
|
+
* messaging_product: 'whatsapp',
|
|
2547
|
+
* about: 'We provide excellent service',
|
|
2548
|
+
* email: 'contact@example.com',
|
|
2549
|
+
* websites: ['https://example.com'],
|
|
2550
|
+
* vertical: BusinessVerticalEnum.RETAIL
|
|
2551
|
+
* });
|
|
2552
|
+
*/
|
|
2553
|
+
updateBusinessProfile(updateRequest: UpdateBusinessProfileRequest): Promise<ResponseSuccess>;
|
|
2554
|
+
/**
|
|
2555
|
+
* Create an upload session for a profile picture.
|
|
2556
|
+
*
|
|
2557
|
+
* This is the first step in the profile picture upload process.
|
|
2558
|
+
*
|
|
2559
|
+
* @param fileLength Length of the file to be uploaded in bytes.
|
|
2560
|
+
* @param fileType MIME type of the file (e.g., 'image/jpeg').
|
|
2561
|
+
* @param fileName Name of the file with extension.
|
|
2562
|
+
* @returns Response containing the upload session ID needed for the next step.
|
|
2563
|
+
*
|
|
2564
|
+
* @example
|
|
2565
|
+
* // Create upload session for profile picture
|
|
2566
|
+
* const session = await whatsappClient.businessProfile.createUploadSession(
|
|
2567
|
+
* fileBuffer.length,
|
|
2568
|
+
* 'image/jpeg',
|
|
2569
|
+
* 'profile.jpg'
|
|
2570
|
+
* );
|
|
2571
|
+
* const uploadSessionId = session.upload_session_id;
|
|
2572
|
+
*/
|
|
2573
|
+
createUploadSession(fileLength: number, fileType: string, fileName: string): Promise<UploadSessionResponse>;
|
|
2574
|
+
/**
|
|
2575
|
+
* Upload media file to the upload session.
|
|
2576
|
+
*
|
|
2577
|
+
* This is the second step in the profile picture upload process.
|
|
2578
|
+
* Upload the binary content of the file to the previously created upload session.
|
|
2579
|
+
*
|
|
2580
|
+
* @param uploadId The upload session ID from createUploadSession response.
|
|
2581
|
+
* @param file The binary data of the file (Buffer).
|
|
2582
|
+
* @returns Response indicating success or failure.
|
|
2583
|
+
*
|
|
2584
|
+
* @example
|
|
2585
|
+
* // Upload the actual file content
|
|
2586
|
+
* await whatsappClient.businessProfile.uploadMedia(
|
|
2587
|
+
* uploadSessionId,
|
|
2588
|
+
* fileBuffer
|
|
2589
|
+
* );
|
|
2590
|
+
*/
|
|
2591
|
+
uploadMedia(uploadId: string, file: Buffer): Promise<UploadBusinessProfileResponse>;
|
|
2592
|
+
/**
|
|
2593
|
+
* Get the upload handle information.
|
|
2594
|
+
*
|
|
2595
|
+
* This is the third step in the profile picture upload process.
|
|
2596
|
+
* After uploading the file, get the handle to use when updating the profile.
|
|
2597
|
+
*
|
|
2598
|
+
* @param uploadId The upload session ID from createUploadSession response.
|
|
2599
|
+
* @returns Response containing the upload handle information.
|
|
2600
|
+
*
|
|
2601
|
+
* @example
|
|
2602
|
+
* // Complete profile picture update process
|
|
2603
|
+
* // 1. Create upload session
|
|
2604
|
+
* const session = await whatsappClient.businessProfile.createUploadSession(
|
|
2605
|
+
* fileBuffer.length, 'image/jpeg', 'profile.jpg'
|
|
2606
|
+
* );
|
|
2607
|
+
*
|
|
2608
|
+
* // 2. Upload the image data
|
|
2609
|
+
* await whatsappClient.businessProfile.uploadMedia(
|
|
2610
|
+
* session.upload_session_id, fileBuffer
|
|
2611
|
+
* );
|
|
2612
|
+
*
|
|
2613
|
+
* // 3. Get the handle for the uploaded file
|
|
2614
|
+
* const handleInfo = await whatsappClient.businessProfile.getUploadHandle(
|
|
2615
|
+
* session.upload_session_id
|
|
2616
|
+
* );
|
|
2617
|
+
*
|
|
2618
|
+
* // 4. Update profile with new picture and business information
|
|
2619
|
+
* await whatsappClient.businessProfile.updateBusinessProfile({
|
|
2620
|
+
* messaging_product: 'whatsapp',
|
|
2621
|
+
* profile_picture_handle: handleInfo.handle,
|
|
2622
|
+
* vertical: BusinessVerticalEnum.RESTAURANT,
|
|
2623
|
+
* about: 'Delicious food served daily'
|
|
2624
|
+
* });
|
|
2625
|
+
*/
|
|
2626
|
+
getUploadHandle(uploadId: string): Promise<UploadHandle>;
|
|
2627
|
+
}
|
|
2628
|
+
//#endregion
|
|
2629
|
+
//#region src/api/qrCode/types/common.d.ts
|
|
2630
|
+
type QrCodeResponse = {
|
|
2631
|
+
code: string;
|
|
2632
|
+
prefilled_message: string;
|
|
2633
|
+
deep_link_url: string;
|
|
2634
|
+
qr_image_url?: string;
|
|
2635
|
+
};
|
|
2636
|
+
type QrCodesResponse = ResponseData<QrCodeResponse[]>;
|
|
2637
|
+
type CreateQrCodeRequest = {
|
|
2638
|
+
prefilled_message: string;
|
|
2639
|
+
generate_qr_image?: 'SVG' | 'PNG';
|
|
2640
|
+
};
|
|
2641
|
+
type UpdateQrCodeRequest = {
|
|
2642
|
+
code: string;
|
|
2643
|
+
prefilled_message: string;
|
|
2644
|
+
};
|
|
2645
|
+
interface QrCodeClass {
|
|
2646
|
+
createQrCode(request: CreateQrCodeRequest): Promise<QrCodeResponse>;
|
|
2647
|
+
getQrCodes(): Promise<QrCodesResponse>;
|
|
2648
|
+
getQrCode(qrCodeId: string): Promise<QrCodeResponse>;
|
|
2649
|
+
updateQrCode(request: UpdateQrCodeRequest): Promise<QrCodeResponse>;
|
|
2650
|
+
deleteQrCode(qrCodeId: string): Promise<ResponseSuccess>;
|
|
2651
|
+
}
|
|
2652
|
+
//#endregion
|
|
2653
|
+
//#region src/api/qrCode/QrCodeApi.d.ts
|
|
2654
|
+
/**
|
|
2655
|
+
* API for managing WhatsApp QR Codes.
|
|
2656
|
+
*
|
|
2657
|
+
* This API allows you to:
|
|
2658
|
+
* - Create QR codes with prefilled messages
|
|
2659
|
+
* - Get all QR codes
|
|
2660
|
+
* - Get specific QR code details
|
|
2661
|
+
* - Update QR code messages
|
|
2662
|
+
* - Delete QR codes
|
|
2663
|
+
*/
|
|
2664
|
+
declare class QrCodeApi extends BaseAPI implements QrCodeClass {
|
|
2665
|
+
private readonly endpoint;
|
|
2666
|
+
constructor(config: WabaConfigType, client: RequesterClass);
|
|
2667
|
+
/**
|
|
2668
|
+
* Create a new QR code with a prefilled message.
|
|
2669
|
+
*
|
|
2670
|
+
* @param request The QR code creation request
|
|
2671
|
+
* @returns QR code information including code, deep link URL, and optional image URL
|
|
2672
|
+
*
|
|
2673
|
+
* @example
|
|
2674
|
+
* const qrCode = await whatsappClient.qrCode.createQrCode({
|
|
2675
|
+
* prefilled_message: 'Hello from WhatsApp!',
|
|
2676
|
+
* generate_qr_image: 'PNG'
|
|
2677
|
+
* });
|
|
2678
|
+
*/
|
|
2679
|
+
createQrCode(request: CreateQrCodeRequest): Promise<QrCodeResponse>;
|
|
2680
|
+
/**
|
|
2681
|
+
* Get all QR codes for the current phone number.
|
|
2682
|
+
*
|
|
2683
|
+
* @returns List of all QR codes
|
|
2684
|
+
*
|
|
2685
|
+
* @example
|
|
2686
|
+
* const qrCodes = await whatsappClient.qrCode.getQrCodes();
|
|
2687
|
+
*/
|
|
2688
|
+
getQrCodes(): Promise<QrCodesResponse>;
|
|
2689
|
+
/**
|
|
2690
|
+
* Get a specific QR code by ID.
|
|
2691
|
+
*
|
|
2692
|
+
* @param qrCodeId The QR code ID to retrieve
|
|
2693
|
+
* @returns QR code information
|
|
2694
|
+
*
|
|
2695
|
+
* @example
|
|
2696
|
+
* const qrCode = await whatsappClient.qrCode.getQrCode('qr_code_123');
|
|
2697
|
+
*/
|
|
2698
|
+
getQrCode(qrCodeId: string): Promise<QrCodeResponse>;
|
|
2699
|
+
/**
|
|
2700
|
+
* Update an existing QR code's prefilled message.
|
|
2701
|
+
*
|
|
2702
|
+
* @param request The QR code update request containing code and new message
|
|
2703
|
+
* @returns Updated QR code information
|
|
2704
|
+
*
|
|
2705
|
+
* @example
|
|
2706
|
+
* const updatedQrCode = await whatsappClient.qrCode.updateQrCode({
|
|
2707
|
+
* code: 'existing_qr_code',
|
|
2708
|
+
* prefilled_message: 'Updated message!'
|
|
2709
|
+
* });
|
|
2710
|
+
*/
|
|
2711
|
+
updateQrCode(request: UpdateQrCodeRequest): Promise<QrCodeResponse>;
|
|
2712
|
+
/**
|
|
2713
|
+
* Delete a QR code.
|
|
2714
|
+
*
|
|
2715
|
+
* @param qrCodeId The QR code ID to delete
|
|
2716
|
+
* @returns Response indicating success or failure
|
|
2717
|
+
*
|
|
2718
|
+
* @example
|
|
2719
|
+
* await whatsappClient.qrCode.deleteQrCode('qr_code_123');
|
|
2720
|
+
*/
|
|
2721
|
+
deleteQrCode(qrCodeId: string): Promise<ResponseSuccess>;
|
|
2722
|
+
}
|
|
2723
|
+
//#endregion
|
|
2724
|
+
//#region src/api/registration/types/common.d.ts
|
|
2725
|
+
type RegistrationRequest = {
|
|
2726
|
+
messaging_product: 'whatsapp';
|
|
2727
|
+
pin: string;
|
|
2728
|
+
data_localization_region?: DataLocalizationRegionEnum;
|
|
2729
|
+
};
|
|
2730
|
+
interface RegistrationClass {
|
|
2731
|
+
register(pin: string, dataLocalizationRegion?: DataLocalizationRegionEnum): Promise<ResponseSuccess>;
|
|
2732
|
+
deregister(): Promise<ResponseSuccess>;
|
|
2733
|
+
}
|
|
2734
|
+
//#endregion
|
|
2735
|
+
//#region src/api/registration/RegistrationApi.d.ts
|
|
2736
|
+
/**
|
|
2737
|
+
* API for managing WhatsApp Business Account registration.
|
|
2738
|
+
*
|
|
2739
|
+
* This API allows you to:
|
|
2740
|
+
* - Register a WhatsApp Business Account with a PIN
|
|
2741
|
+
* - Deregister a WhatsApp Business Account
|
|
2742
|
+
*/
|
|
2743
|
+
declare class RegistrationApi extends BaseAPI implements RegistrationClass {
|
|
2744
|
+
constructor(config: WabaConfigType, client: RequesterClass);
|
|
2745
|
+
/**
|
|
2746
|
+
* Register a WhatsApp Business Account using a PIN.
|
|
2747
|
+
*
|
|
2748
|
+
* @param pin The registration PIN received via SMS or voice call
|
|
2749
|
+
* @param dataLocalizationRegion Optional data localization region
|
|
2750
|
+
* @returns Response indicating success or failure
|
|
2751
|
+
*
|
|
2752
|
+
* @example
|
|
2753
|
+
* await whatsappClient.registration.register('123456', DataLocalizationRegionEnum.Asia);
|
|
2754
|
+
*/
|
|
2755
|
+
register(pin: string, dataLocalizationRegion?: DataLocalizationRegionEnum): Promise<ResponseSuccess>;
|
|
2756
|
+
/**
|
|
2757
|
+
* Deregister a WhatsApp Business Account.
|
|
2758
|
+
*
|
|
2759
|
+
* @returns Response indicating success or failure
|
|
2760
|
+
*
|
|
2761
|
+
* @example
|
|
2762
|
+
* await whatsappClient.registration.deregister();
|
|
2763
|
+
*/
|
|
2764
|
+
deregister(): Promise<ResponseSuccess>;
|
|
2765
|
+
}
|
|
2766
|
+
//#endregion
|
|
2767
|
+
//#region src/api/template/types/common.d.ts
|
|
2768
|
+
type TemplateFormat = 'TEXT' | 'IMAGE' | 'VIDEO' | 'DOCUMENT' | 'LOCATION' | 'PRODUCT';
|
|
2769
|
+
type PhoneNumberButton = {
|
|
2770
|
+
type: 'PHONE_NUMBER';
|
|
2771
|
+
text: string;
|
|
2772
|
+
phone_number: string;
|
|
2773
|
+
};
|
|
2774
|
+
type URLButton = {
|
|
2775
|
+
type: 'URL';
|
|
2776
|
+
text: string;
|
|
2777
|
+
url: string;
|
|
2778
|
+
example?: string[];
|
|
2779
|
+
};
|
|
2780
|
+
type QuickReplyButton = {
|
|
2781
|
+
type: 'QUICK_REPLY';
|
|
2782
|
+
text: string;
|
|
2783
|
+
};
|
|
2784
|
+
type CopyCodeButton = {
|
|
2785
|
+
type: 'COPY_CODE';
|
|
2786
|
+
example: string;
|
|
2787
|
+
};
|
|
2788
|
+
type FlowButton = {
|
|
2789
|
+
type: 'FLOW';
|
|
2790
|
+
text: string;
|
|
2791
|
+
flow_id?: string;
|
|
2792
|
+
flow_name?: string;
|
|
2793
|
+
flow_json?: string;
|
|
2794
|
+
flow_action?: 'navigate' | 'data_exchange';
|
|
2795
|
+
navigate_screen?: string;
|
|
2796
|
+
};
|
|
2797
|
+
type MPMButton = {
|
|
2798
|
+
type: 'MPM';
|
|
2799
|
+
action?: {
|
|
2800
|
+
thumbnail_product_retailer_id: string;
|
|
2801
|
+
sections: Array<{
|
|
2802
|
+
title?: string;
|
|
2803
|
+
product_items: Array<{
|
|
2804
|
+
product_retailer_id: string;
|
|
2805
|
+
}>;
|
|
2806
|
+
}>;
|
|
2807
|
+
};
|
|
2808
|
+
};
|
|
2809
|
+
type OTPButton = {
|
|
2810
|
+
type: 'OTP';
|
|
2811
|
+
};
|
|
2812
|
+
type SPMButton = {
|
|
2813
|
+
type: 'SPM';
|
|
2814
|
+
action?: {
|
|
2815
|
+
product_retailer_id: string;
|
|
2816
|
+
};
|
|
2817
|
+
};
|
|
2818
|
+
type CatalogButton = {
|
|
2819
|
+
type: 'CATALOG';
|
|
2820
|
+
action?: {
|
|
2821
|
+
thumbnail_product_retailer_id: string;
|
|
2822
|
+
};
|
|
2823
|
+
};
|
|
2824
|
+
type TemplateButton = PhoneNumberButton | URLButton | QuickReplyButton | CopyCodeButton | FlowButton | MPMButton | OTPButton | SPMButton | CatalogButton;
|
|
2825
|
+
type TemplateHeaderExample = {
|
|
2826
|
+
header_text?: string[];
|
|
2827
|
+
header_text_named_params?: Array<{
|
|
2828
|
+
param_name: string;
|
|
2829
|
+
example: string;
|
|
2830
|
+
}>;
|
|
2831
|
+
header_handle?: string[];
|
|
2832
|
+
};
|
|
2833
|
+
type TemplateHeader = {
|
|
2834
|
+
type: 'HEADER';
|
|
2835
|
+
format: TemplateFormat;
|
|
2836
|
+
text?: string;
|
|
2837
|
+
example?: TemplateHeaderExample;
|
|
2838
|
+
};
|
|
2839
|
+
type TemplateBody = {
|
|
2840
|
+
type: 'BODY';
|
|
2841
|
+
text: string;
|
|
2842
|
+
example?: {
|
|
2843
|
+
body_text?: Array<Array<string>>;
|
|
2844
|
+
body_text_named_params?: Array<{
|
|
2845
|
+
param_name: string;
|
|
2846
|
+
example: string;
|
|
2847
|
+
}>;
|
|
2848
|
+
};
|
|
2849
|
+
};
|
|
2850
|
+
type TemplateFooter = {
|
|
2851
|
+
type: 'FOOTER';
|
|
2852
|
+
text: string;
|
|
2853
|
+
};
|
|
2854
|
+
type TemplateButtons = {
|
|
2855
|
+
type: 'BUTTONS';
|
|
2856
|
+
buttons: TemplateButton[];
|
|
2857
|
+
};
|
|
2858
|
+
type TemplateLimitedTimeOffer = {
|
|
2859
|
+
type: 'LIMITED_TIME_OFFER';
|
|
2860
|
+
limited_time_offer: {
|
|
2861
|
+
expiration_time_ms: number;
|
|
2862
|
+
};
|
|
2863
|
+
};
|
|
2864
|
+
type TemplateCarousel = {
|
|
2865
|
+
type: 'CAROUSEL';
|
|
2866
|
+
cards: Array<{
|
|
2867
|
+
card_index: number;
|
|
2868
|
+
components: ComponentTypes[];
|
|
2869
|
+
}>;
|
|
2870
|
+
};
|
|
2871
|
+
type CarouselCard$1 = {
|
|
2872
|
+
card_index: number;
|
|
2873
|
+
components: ComponentTypes[];
|
|
2874
|
+
};
|
|
2875
|
+
type MediaCarouselCard = {
|
|
2876
|
+
card_index: number;
|
|
2877
|
+
components: (TemplateHeader | TemplateBody | TemplateButtons)[];
|
|
2878
|
+
};
|
|
2879
|
+
type ProductCarouselCard = {
|
|
2880
|
+
card_index: number;
|
|
2881
|
+
components: TemplateHeader[];
|
|
2882
|
+
};
|
|
2883
|
+
type ComponentTypes = TemplateHeader | TemplateBody | TemplateFooter | TemplateButtons | TemplateLimitedTimeOffer | TemplateCarousel;
|
|
2884
|
+
type TemplateRequestBody = GeneralRequestBody & {
|
|
2885
|
+
name: string;
|
|
2886
|
+
language: LanguagesEnum;
|
|
2887
|
+
category?: CategoryEnum;
|
|
2888
|
+
components?: ComponentTypes[];
|
|
2889
|
+
};
|
|
2890
|
+
type TemplateResponse = {
|
|
2891
|
+
id: string;
|
|
2892
|
+
status: string;
|
|
2893
|
+
language: LanguagesEnum;
|
|
2894
|
+
category: CategoryEnum;
|
|
2895
|
+
name: string;
|
|
2896
|
+
components: ComponentTypes[];
|
|
2897
|
+
};
|
|
2898
|
+
type TemplateGetParams = {
|
|
2899
|
+
limit?: number;
|
|
2900
|
+
name?: string;
|
|
2901
|
+
language?: LanguagesEnum;
|
|
2902
|
+
category?: CategoryEnum;
|
|
2903
|
+
status?: TemplateStatusEnum;
|
|
2904
|
+
};
|
|
2905
|
+
type TemplateDeleteParams = {
|
|
2906
|
+
hsm_id: string;
|
|
2907
|
+
name: string;
|
|
2908
|
+
};
|
|
2909
|
+
declare class TemplateClass {
|
|
2910
|
+
getTemplate(templateId: string): Promise<TemplateResponse>;
|
|
2911
|
+
updateTemplate(templateId: string, template: Partial<TemplateRequestBody>): Promise<ResponseSuccess>;
|
|
2912
|
+
getTemplates(params?: TemplateGetParams): Promise<ResponsePagination<TemplateResponse>>;
|
|
2913
|
+
createTemplate(template: TemplateRequestBody): Promise<TemplateResponse>;
|
|
2914
|
+
deleteTemplate(params: TemplateDeleteParams): Promise<ResponseSuccess>;
|
|
2915
|
+
}
|
|
2916
|
+
//#endregion
|
|
2917
|
+
//#region src/api/template/types/factory.d.ts
|
|
2918
|
+
interface TextParameter {
|
|
2919
|
+
type: 'text';
|
|
2920
|
+
value: string;
|
|
2921
|
+
}
|
|
2922
|
+
interface CurrencyParameter {
|
|
2923
|
+
type: 'currency';
|
|
2924
|
+
amount_1000: number;
|
|
2925
|
+
code: CurrencyCodesEnum;
|
|
2926
|
+
fallback_value: string;
|
|
2927
|
+
}
|
|
2928
|
+
interface DateTimeParameter {
|
|
2929
|
+
type: 'date_time';
|
|
2930
|
+
fallback_value: string;
|
|
2931
|
+
}
|
|
2932
|
+
interface MediaParameter {
|
|
2933
|
+
type: 'image' | 'video' | 'document';
|
|
2934
|
+
handle?: string;
|
|
2935
|
+
link?: string;
|
|
2936
|
+
}
|
|
2937
|
+
interface LocationParameter {
|
|
2938
|
+
type: 'location';
|
|
2939
|
+
latitude?: number;
|
|
2940
|
+
longitude?: number;
|
|
2941
|
+
name?: string;
|
|
2942
|
+
address?: string;
|
|
2943
|
+
}
|
|
2944
|
+
interface ProductParameter {
|
|
2945
|
+
type: 'product';
|
|
2946
|
+
product_retailer_id: string;
|
|
2947
|
+
}
|
|
2948
|
+
type TemplateParameter = TextParameter | CurrencyParameter | DateTimeParameter | MediaParameter | LocationParameter | ProductParameter;
|
|
2949
|
+
interface HeaderOptions {
|
|
2950
|
+
format: TemplateFormat;
|
|
2951
|
+
text?: string;
|
|
2952
|
+
parameters?: TemplateParameter[];
|
|
2953
|
+
example?: {
|
|
2954
|
+
header_text?: string[];
|
|
2955
|
+
header_text_named_params?: Array<{
|
|
2956
|
+
param_name: string;
|
|
2957
|
+
example: string;
|
|
2958
|
+
}>;
|
|
2959
|
+
header_handle?: string[];
|
|
2960
|
+
};
|
|
2961
|
+
}
|
|
2962
|
+
interface BodyOptions {
|
|
2963
|
+
text: string;
|
|
2964
|
+
parameters?: TemplateParameter[];
|
|
2965
|
+
example?: {
|
|
2966
|
+
body_text?: string[][];
|
|
2967
|
+
body_text_named_params?: Array<{
|
|
2968
|
+
param_name: string;
|
|
2969
|
+
example: string;
|
|
2970
|
+
}>;
|
|
2971
|
+
};
|
|
2972
|
+
}
|
|
2973
|
+
interface FooterOptions {
|
|
2974
|
+
text: string;
|
|
2975
|
+
}
|
|
2976
|
+
interface ButtonOptions {
|
|
2977
|
+
phone_number?: {
|
|
2978
|
+
text: string;
|
|
2979
|
+
phone_number: string;
|
|
2980
|
+
};
|
|
2981
|
+
url?: {
|
|
2982
|
+
text: string;
|
|
2983
|
+
url: string;
|
|
2984
|
+
example?: string;
|
|
2985
|
+
};
|
|
2986
|
+
quick_reply?: {
|
|
2987
|
+
text: string;
|
|
2988
|
+
}[];
|
|
2989
|
+
copy_code?: {
|
|
2990
|
+
example: string;
|
|
2991
|
+
};
|
|
2992
|
+
flow?: {
|
|
2993
|
+
text: string;
|
|
2994
|
+
flow_id?: string;
|
|
2995
|
+
flow_name?: string;
|
|
2996
|
+
flow_json?: string;
|
|
2997
|
+
flow_action?: 'navigate' | 'data_exchange';
|
|
2998
|
+
navigate_screen?: string;
|
|
2999
|
+
};
|
|
3000
|
+
mpm?: boolean;
|
|
3001
|
+
otp?: boolean;
|
|
3002
|
+
spm?: boolean;
|
|
3003
|
+
}
|
|
3004
|
+
interface CarouselCard {
|
|
3005
|
+
image?: string;
|
|
3006
|
+
video?: string;
|
|
3007
|
+
product?: string;
|
|
3008
|
+
body?: string;
|
|
3009
|
+
bodyParameters?: TemplateParameter[];
|
|
3010
|
+
buttons?: ButtonOptions;
|
|
3011
|
+
}
|
|
3012
|
+
interface CarouselOptions {
|
|
3013
|
+
cards: CarouselCard[];
|
|
3014
|
+
}
|
|
3015
|
+
interface LimitedTimeOfferOptions {
|
|
3016
|
+
expiration_time_ms: number;
|
|
3017
|
+
}
|
|
3018
|
+
interface ProductSection {
|
|
3019
|
+
title?: string;
|
|
3020
|
+
product_items: Array<{
|
|
3021
|
+
product_retailer_id: string;
|
|
3022
|
+
}>;
|
|
3023
|
+
}
|
|
3024
|
+
interface TemplateOptions {
|
|
3025
|
+
name: string;
|
|
3026
|
+
language: LanguagesEnum;
|
|
3027
|
+
category: CategoryEnum;
|
|
3028
|
+
header?: HeaderOptions;
|
|
3029
|
+
body?: BodyOptions;
|
|
3030
|
+
footer?: FooterOptions;
|
|
3031
|
+
buttons?: ButtonOptions;
|
|
3032
|
+
carousel?: CarouselOptions;
|
|
3033
|
+
limitedTimeOffer?: LimitedTimeOfferOptions;
|
|
3034
|
+
}
|
|
3035
|
+
interface OTPTemplateOptions {
|
|
3036
|
+
name: string;
|
|
3037
|
+
language: LanguagesEnum;
|
|
3038
|
+
code_expiration_minutes?: number;
|
|
3039
|
+
add_security_recommendation?: boolean;
|
|
3040
|
+
}
|
|
3041
|
+
interface AuthenticationTemplateOptions {
|
|
3042
|
+
name: string;
|
|
3043
|
+
language: LanguagesEnum;
|
|
3044
|
+
code_expiration_minutes?: number;
|
|
3045
|
+
add_security_recommendation?: boolean;
|
|
3046
|
+
copy_code_button?: boolean;
|
|
3047
|
+
}
|
|
3048
|
+
interface CatalogTemplateOptions {
|
|
3049
|
+
name: string;
|
|
3050
|
+
language: LanguagesEnum;
|
|
3051
|
+
header?: Omit<HeaderOptions, 'format'>;
|
|
3052
|
+
body: BodyOptions;
|
|
3053
|
+
footer?: FooterOptions;
|
|
3054
|
+
thumbnail_product_retailer_id: string;
|
|
3055
|
+
}
|
|
3056
|
+
interface CouponTemplateOptions {
|
|
3057
|
+
name: string;
|
|
3058
|
+
language: LanguagesEnum;
|
|
3059
|
+
header?: Omit<HeaderOptions, 'format'>;
|
|
3060
|
+
body: BodyOptions;
|
|
3061
|
+
footer?: FooterOptions;
|
|
3062
|
+
coupon_code: string;
|
|
3063
|
+
}
|
|
3064
|
+
interface LimitedTimeOfferTemplateOptions {
|
|
3065
|
+
name: string;
|
|
3066
|
+
language: LanguagesEnum;
|
|
3067
|
+
header?: Omit<HeaderOptions, 'format'>;
|
|
3068
|
+
body: BodyOptions;
|
|
3069
|
+
footer?: FooterOptions;
|
|
3070
|
+
expiration_time_ms: number;
|
|
3071
|
+
}
|
|
3072
|
+
interface MediaCardCarouselTemplateOptions {
|
|
3073
|
+
name: string;
|
|
3074
|
+
language: LanguagesEnum;
|
|
3075
|
+
cards: Array<{
|
|
3076
|
+
header: {
|
|
3077
|
+
format: 'IMAGE' | 'VIDEO';
|
|
3078
|
+
example: {
|
|
3079
|
+
header_handle: string[];
|
|
3080
|
+
};
|
|
3081
|
+
};
|
|
3082
|
+
body: BodyOptions;
|
|
3083
|
+
buttons?: ButtonOptions;
|
|
3084
|
+
}>;
|
|
3085
|
+
}
|
|
3086
|
+
interface MPMTemplateOptions {
|
|
3087
|
+
name: string;
|
|
3088
|
+
language: LanguagesEnum;
|
|
3089
|
+
header?: Omit<HeaderOptions, 'format'>;
|
|
3090
|
+
body: BodyOptions;
|
|
3091
|
+
footer?: FooterOptions;
|
|
3092
|
+
thumbnail_product_retailer_id: string;
|
|
3093
|
+
sections: ProductSection[];
|
|
3094
|
+
}
|
|
3095
|
+
interface ProductCardCarouselTemplateOptions {
|
|
3096
|
+
name: string;
|
|
3097
|
+
language: LanguagesEnum;
|
|
3098
|
+
header?: Omit<HeaderOptions, 'format'>;
|
|
3099
|
+
body: BodyOptions;
|
|
3100
|
+
footer?: FooterOptions;
|
|
3101
|
+
cards: Array<{
|
|
3102
|
+
product_retailer_id: string;
|
|
3103
|
+
}>;
|
|
3104
|
+
}
|
|
3105
|
+
interface SPMTemplateOptions {
|
|
3106
|
+
name: string;
|
|
3107
|
+
language: LanguagesEnum;
|
|
3108
|
+
header?: Omit<HeaderOptions, 'format'>;
|
|
3109
|
+
body: BodyOptions;
|
|
3110
|
+
footer?: FooterOptions;
|
|
3111
|
+
product_retailer_id: string;
|
|
3112
|
+
}
|
|
3113
|
+
//#endregion
|
|
3114
|
+
//#region src/api/template/TemplateApi.d.ts
|
|
3115
|
+
declare class TemplateApi extends BaseAPI implements TemplateClass {
|
|
3116
|
+
private readonly endpoint;
|
|
3117
|
+
constructor(config: WabaConfigType, client: RequesterClass);
|
|
3118
|
+
getTemplate(templateId: string): Promise<TemplateResponse>;
|
|
3119
|
+
updateTemplate(templateId: string, template: Partial<TemplateRequestBody>): Promise<ResponseSuccess>;
|
|
3120
|
+
getTemplates(params?: TemplateGetParams): Promise<ResponsePagination<TemplateResponse>>;
|
|
3121
|
+
createTemplate(template: TemplateRequestBody): Promise<TemplateResponse>;
|
|
3122
|
+
deleteTemplate(params: TemplateDeleteParams): Promise<ResponseSuccess>;
|
|
3123
|
+
}
|
|
3124
|
+
//#endregion
|
|
3125
|
+
//#region src/api/template/factories/index.d.ts
|
|
3126
|
+
declare function createTemplate(options: TemplateOptions): TemplateRequestBody;
|
|
3127
|
+
declare function createOTPTemplate(options: OTPTemplateOptions): TemplateRequestBody;
|
|
3128
|
+
declare function createAuthenticationTemplate(options: AuthenticationTemplateOptions): TemplateRequestBody;
|
|
3129
|
+
declare function createCatalogTemplate(options: CatalogTemplateOptions): TemplateRequestBody;
|
|
3130
|
+
declare function createCouponTemplate(options: CouponTemplateOptions): TemplateRequestBody;
|
|
3131
|
+
declare function createLimitedTimeOfferTemplate(options: LimitedTimeOfferTemplateOptions): TemplateRequestBody;
|
|
3132
|
+
declare function createMediaCardCarouselTemplate(options: MediaCardCarouselTemplateOptions): TemplateRequestBody;
|
|
3133
|
+
declare function createMPMTemplate(options: MPMTemplateOptions): TemplateRequestBody;
|
|
3134
|
+
declare function createProductCardCarouselTemplate(options: ProductCardCarouselTemplateOptions): TemplateRequestBody;
|
|
3135
|
+
declare function createSPMTemplate(options: SPMTemplateOptions): TemplateRequestBody;
|
|
3136
|
+
//#endregion
|
|
3137
|
+
//#region src/api/twoStepVerification/types/common.d.ts
|
|
3138
|
+
type TwoStepVerificationRequest = {
|
|
3139
|
+
pin: string;
|
|
3140
|
+
};
|
|
3141
|
+
interface TwoStepVerificationClass {
|
|
3142
|
+
setTwoStepVerificationCode(pin: string): Promise<ResponseSuccess>;
|
|
3143
|
+
}
|
|
3144
|
+
//#endregion
|
|
3145
|
+
//#region src/api/twoStepVerification/TwoStepVerificationApi.d.ts
|
|
3146
|
+
/**
|
|
3147
|
+
* API for managing WhatsApp Two-Step Verification.
|
|
3148
|
+
*
|
|
3149
|
+
* This API allows you to:
|
|
3150
|
+
* - Set a two-step verification PIN code
|
|
3151
|
+
* - Manage two-step verification settings
|
|
3152
|
+
*/
|
|
3153
|
+
declare class TwoStepVerificationApi extends BaseAPI implements TwoStepVerificationClass {
|
|
3154
|
+
constructor(config: WabaConfigType, client: RequesterClass);
|
|
3155
|
+
/**
|
|
3156
|
+
* Set a two-step verification PIN code.
|
|
3157
|
+
*
|
|
3158
|
+
* @param pin The PIN code to set for two-step verification (6-digit numeric string)
|
|
3159
|
+
* @returns Response indicating success or failure
|
|
3160
|
+
*
|
|
3161
|
+
* @example
|
|
3162
|
+
* await whatsappClient.twoStepVerification.setTwoStepVerificationCode('123456');
|
|
3163
|
+
*/
|
|
3164
|
+
setTwoStepVerificationCode(pin: string): Promise<ResponseSuccess>;
|
|
3165
|
+
}
|
|
3166
|
+
//#endregion
|
|
3167
|
+
//#region src/api/waba/types/common.d.ts
|
|
3168
|
+
/**
|
|
3169
|
+
* WhatsApp Business Account subscription configuration
|
|
3170
|
+
*/
|
|
3171
|
+
type WabaSubscription = {
|
|
3172
|
+
whatsapp_business_api_data: {
|
|
3173
|
+
id: string;
|
|
3174
|
+
link: string;
|
|
3175
|
+
name: string;
|
|
3176
|
+
category: string;
|
|
3177
|
+
};
|
|
3178
|
+
override_callback_uri?: string;
|
|
3179
|
+
};
|
|
3180
|
+
/**
|
|
3181
|
+
* Parameters for updating WABA subscription
|
|
3182
|
+
*/
|
|
3183
|
+
interface UpdateWabaSubscription {
|
|
3184
|
+
override_callback_uri: string;
|
|
3185
|
+
verify_token: string;
|
|
3186
|
+
}
|
|
3187
|
+
/**
|
|
3188
|
+
* Response containing all WABA subscriptions
|
|
3189
|
+
*/
|
|
3190
|
+
interface WabaSubscriptions {
|
|
3191
|
+
data: Array<WabaSubscription>;
|
|
3192
|
+
}
|
|
3193
|
+
/**
|
|
3194
|
+
* WABA account review status enumeration
|
|
3195
|
+
*/
|
|
3196
|
+
declare enum WabaAccountReviewStatus {
|
|
3197
|
+
Approved = "APPROVED",
|
|
3198
|
+
Active = "ACTIVE",
|
|
3199
|
+
Inactive = "INACTIVE",
|
|
3200
|
+
Disabled = "DISABLED",
|
|
3201
|
+
}
|
|
3202
|
+
/**
|
|
3203
|
+
* WABA health status for message sending capability
|
|
3204
|
+
*/
|
|
3205
|
+
declare enum WabaHealthStatusCanSendMessage {
|
|
3206
|
+
Blocked = "BLOCKED",
|
|
3207
|
+
Limited = "LIMITED",
|
|
3208
|
+
Available = "AVAILABLE",
|
|
3209
|
+
}
|
|
3210
|
+
/**
|
|
3211
|
+
* WABA account status enumeration
|
|
3212
|
+
*/
|
|
3213
|
+
declare enum WabaAccountStatus {
|
|
3214
|
+
Approved = "APPROVED",
|
|
3215
|
+
Active = "ACTIVE",
|
|
3216
|
+
Inactive = "INACTIVE",
|
|
3217
|
+
Disabled = "DISABLED",
|
|
3218
|
+
}
|
|
3219
|
+
/**
|
|
3220
|
+
* Business verification status enumeration
|
|
3221
|
+
*/
|
|
3222
|
+
declare enum WabaBusinessVerificationStatus {
|
|
3223
|
+
Verified = "verified",
|
|
3224
|
+
PendingSubmission = "pending_submission",
|
|
3225
|
+
Unverified = "unverified",
|
|
3226
|
+
Rejected = "rejected",
|
|
3227
|
+
}
|
|
3228
|
+
/**
|
|
3229
|
+
* WABA health status error details
|
|
3230
|
+
*/
|
|
3231
|
+
interface WabaHealthStatusError {
|
|
3232
|
+
error_code?: number;
|
|
3233
|
+
error_description?: string;
|
|
3234
|
+
possible_solution?: string;
|
|
3235
|
+
}
|
|
3236
|
+
/**
|
|
3237
|
+
* WABA health status entity information
|
|
3238
|
+
*/
|
|
3239
|
+
interface WabaHealthStatusEntity {
|
|
3240
|
+
entity_type?: string;
|
|
3241
|
+
id?: string;
|
|
3242
|
+
can_send_message?: string;
|
|
3243
|
+
errors?: WabaHealthStatusError[];
|
|
3244
|
+
}
|
|
3245
|
+
/**
|
|
3246
|
+
* Overall WABA health status
|
|
3247
|
+
*/
|
|
3248
|
+
interface WabaHealthStatus {
|
|
3249
|
+
can_send_message?: WabaHealthStatusCanSendMessage;
|
|
3250
|
+
entities?: WabaHealthStatusEntity[];
|
|
3251
|
+
}
|
|
3252
|
+
/**
|
|
3253
|
+
* WhatsApp Business Account information
|
|
3254
|
+
*/
|
|
3255
|
+
interface WabaAccount {
|
|
3256
|
+
account_review_status?: WabaAccountReviewStatus;
|
|
3257
|
+
id?: string;
|
|
3258
|
+
health_status?: WabaHealthStatus;
|
|
3259
|
+
status?: WabaAccountStatus;
|
|
3260
|
+
business_verification_status?: WabaBusinessVerificationStatus;
|
|
3261
|
+
message_template_namespace?: string;
|
|
3262
|
+
name?: string;
|
|
3263
|
+
ownership_type?: string;
|
|
3264
|
+
currency?: string;
|
|
3265
|
+
}
|
|
3266
|
+
/**
|
|
3267
|
+
* Available fields for WABA account queries
|
|
3268
|
+
*/
|
|
3269
|
+
type WabaAccountFields = 'id' | 'name' | 'account_review_status' | 'auth_international_rate_eligibility' | 'business_verification_status' | 'country' | 'currency' | 'health_status' | 'status' | 'ownership_type' | 'message_template_namespace';
|
|
3270
|
+
/**
|
|
3271
|
+
* Parameter type for specifying which WABA account fields to retrieve
|
|
3272
|
+
*/
|
|
3273
|
+
type WabaAccountFieldsParam = WabaAccountFields[];
|
|
3274
|
+
/**
|
|
3275
|
+
* Interface defining all WABA API methods
|
|
3276
|
+
*/
|
|
3277
|
+
interface WABAClass {
|
|
3278
|
+
getWabaAccount(fields?: WabaAccountFieldsParam): Promise<WabaAccount>;
|
|
3279
|
+
getAllWabaSubscriptions(): Promise<WabaSubscriptions>;
|
|
3280
|
+
updateWabaSubscription(params: UpdateWabaSubscription): Promise<ResponseSuccess>;
|
|
3281
|
+
unsubscribeFromWaba(): Promise<ResponseSuccess>;
|
|
3282
|
+
}
|
|
3283
|
+
//#endregion
|
|
3284
|
+
//#region src/api/waba/WabaApi.d.ts
|
|
3285
|
+
/**
|
|
3286
|
+
* API for managing WhatsApp Business Account (WABA).
|
|
3287
|
+
*
|
|
3288
|
+
* This API allows you to:
|
|
3289
|
+
* - Get WABA account information
|
|
3290
|
+
* - Manage WABA subscriptions
|
|
3291
|
+
* - Subscribe/unsubscribe from WABA webhooks
|
|
3292
|
+
* - Update subscription settings
|
|
3293
|
+
*/
|
|
3294
|
+
declare class WabaApi extends BaseAPI implements WABAClass {
|
|
3295
|
+
constructor(config: WabaConfigType, client: RequesterClass);
|
|
3296
|
+
/**
|
|
3297
|
+
* Retrieve WhatsApp Business Account information.
|
|
3298
|
+
*
|
|
3299
|
+
* @param fields Optional array of specific fields to retrieve
|
|
3300
|
+
* @returns WABA account information including status, health, verification status, etc.
|
|
3301
|
+
*
|
|
3302
|
+
* @example
|
|
3303
|
+
* const account = await whatsappClient.waba.getWabaAccount(['id', 'name', 'status']);
|
|
3304
|
+
*/
|
|
3305
|
+
getWabaAccount(fields?: WabaAccountFieldsParam): Promise<WabaAccount>;
|
|
3306
|
+
/**
|
|
3307
|
+
* Get all WABA subscriptions for the business account.
|
|
3308
|
+
*
|
|
3309
|
+
* @returns List of all subscribed apps and their configurations
|
|
3310
|
+
*
|
|
3311
|
+
* @example
|
|
3312
|
+
* const subscriptions = await whatsappClient.waba.getAllWabaSubscriptions();
|
|
3313
|
+
*/
|
|
3314
|
+
getAllWabaSubscriptions(): Promise<WabaSubscriptions>;
|
|
3315
|
+
/**
|
|
3316
|
+
* Update WABA subscription configuration.
|
|
3317
|
+
*
|
|
3318
|
+
* @param params Configuration parameters including callback URI and verify token
|
|
3319
|
+
* @returns Response indicating success or failure
|
|
3320
|
+
*
|
|
3321
|
+
* @example
|
|
3322
|
+
* await whatsappClient.waba.updateWabaSubscription({
|
|
3323
|
+
* override_callback_uri: 'https://example.com/webhook',
|
|
3324
|
+
* verify_token: 'your_verify_token'
|
|
3325
|
+
* });
|
|
3326
|
+
*/
|
|
3327
|
+
updateWabaSubscription({
|
|
3328
|
+
override_callback_uri,
|
|
3329
|
+
verify_token
|
|
3330
|
+
}: UpdateWabaSubscription): Promise<ResponseSuccess>;
|
|
3331
|
+
/**
|
|
3332
|
+
* Unsubscribe from WABA webhooks.
|
|
3333
|
+
*
|
|
3334
|
+
* @returns Response indicating success or failure
|
|
3335
|
+
*
|
|
3336
|
+
* @example
|
|
3337
|
+
* await whatsappClient.waba.unsubscribeFromWaba();
|
|
3338
|
+
*/
|
|
3339
|
+
unsubscribeFromWaba(): Promise<ResponseSuccess>;
|
|
3340
|
+
}
|
|
3341
|
+
//#endregion
|
|
3342
|
+
//#region src/core/whatsapp/WhatsApp.d.ts
|
|
3343
|
+
/**
|
|
3344
|
+
* WhatsApp SDK Main Class following official patterns
|
|
3345
|
+
* Provides unified access to WhatsApp Cloud API and Flows API
|
|
3346
|
+
*/
|
|
3347
|
+
declare class WhatsApp {
|
|
3348
|
+
config: WabaConfigType;
|
|
3349
|
+
requester: Readonly<Requester>;
|
|
3350
|
+
messages: MessagesApi;
|
|
3351
|
+
media: MediaApi;
|
|
3352
|
+
phoneNumbers: PhoneNumberApi;
|
|
3353
|
+
twoStepVerification: TwoStepVerificationApi;
|
|
3354
|
+
flows: FlowApi;
|
|
3355
|
+
businessProfile: BusinessProfileApi;
|
|
3356
|
+
templates: TemplateApi;
|
|
3357
|
+
encryption: EncryptionApi;
|
|
3358
|
+
qrCode: QrCodeApi;
|
|
3359
|
+
registration: RegistrationApi;
|
|
3360
|
+
waba: WabaApi;
|
|
3361
|
+
constructor(config?: WhatsAppConfig);
|
|
3362
|
+
/**
|
|
3363
|
+
* Runtime configuration updates following official patterns
|
|
3364
|
+
*/
|
|
3365
|
+
updateTimeout(timeout: number): void;
|
|
3366
|
+
updateSenderNumberId(phoneNumberId: number): void;
|
|
3367
|
+
updateAccessToken(accessToken: string): void;
|
|
3368
|
+
/**
|
|
3369
|
+
* Get SDK version
|
|
3370
|
+
*/
|
|
3371
|
+
version(): string;
|
|
3372
|
+
/**
|
|
3373
|
+
* Static enums access
|
|
3374
|
+
*/
|
|
3375
|
+
static get Enums(): typeof enums_d_exports;
|
|
3376
|
+
/**
|
|
3377
|
+
* Get User-Agent string
|
|
3378
|
+
*/
|
|
3379
|
+
getUserAgent(): string;
|
|
3380
|
+
}
|
|
3381
|
+
//#endregion
|
|
3382
|
+
//#region src/core/webhook/types.d.ts
|
|
3383
|
+
interface WebhookContact {
|
|
3384
|
+
/**
|
|
3385
|
+
* WhatsApp ID of the contact. Business can respond to this contact using this ID.
|
|
3386
|
+
*/
|
|
3387
|
+
wa_id: string;
|
|
3388
|
+
/**
|
|
3389
|
+
* Additional unique, alphanumeric identifier for a WhatsApp user
|
|
3390
|
+
*/
|
|
3391
|
+
user_id?: string;
|
|
3392
|
+
/**
|
|
3393
|
+
* Profile of Whatsapp user
|
|
3394
|
+
*/
|
|
3395
|
+
profile: {
|
|
3396
|
+
/**
|
|
3397
|
+
* The display name of the contact
|
|
3398
|
+
*/
|
|
3399
|
+
name: string;
|
|
3400
|
+
};
|
|
3401
|
+
}
|
|
3402
|
+
/**
|
|
3403
|
+
* Base message interface with common properties
|
|
3404
|
+
*/
|
|
3405
|
+
interface BaseMessage {
|
|
3406
|
+
id: string;
|
|
3407
|
+
from: string;
|
|
3408
|
+
timestamp: string;
|
|
3409
|
+
type: MessageTypesEnum;
|
|
3410
|
+
/**
|
|
3411
|
+
* Context object, included when a user replies or interacts
|
|
3412
|
+
*/
|
|
3413
|
+
context?: {
|
|
3414
|
+
/**
|
|
3415
|
+
* ID of the message
|
|
3416
|
+
*/
|
|
3417
|
+
id?: string;
|
|
3418
|
+
/**
|
|
3419
|
+
* ID of the sender
|
|
3420
|
+
*/
|
|
3421
|
+
from?: string;
|
|
3422
|
+
/**
|
|
3423
|
+
* ID of the message being replied to or interacted with
|
|
3424
|
+
*/
|
|
3425
|
+
message_id: string;
|
|
3426
|
+
/**
|
|
3427
|
+
* ID of the forwarded message, if applicable
|
|
3428
|
+
*/
|
|
3429
|
+
forwarded?: boolean;
|
|
3430
|
+
/**
|
|
3431
|
+
* Frequently forwarded status
|
|
3432
|
+
*/
|
|
3433
|
+
frequently_forwarded?: boolean;
|
|
3434
|
+
/**
|
|
3435
|
+
* Original message information if the message was referred
|
|
3436
|
+
*/
|
|
3437
|
+
referred_product?: {
|
|
3438
|
+
/**
|
|
3439
|
+
* Catalog ID
|
|
3440
|
+
*/
|
|
3441
|
+
catalog_id: string;
|
|
3442
|
+
/**
|
|
3443
|
+
* Product ID
|
|
3444
|
+
*/
|
|
3445
|
+
product_retailer_id: string;
|
|
3446
|
+
};
|
|
3447
|
+
};
|
|
3448
|
+
/**
|
|
3449
|
+
* Errors array, if the message had errors
|
|
3450
|
+
*/
|
|
3451
|
+
errors?: Array<{
|
|
3452
|
+
/**
|
|
3453
|
+
* Error code
|
|
3454
|
+
*/
|
|
3455
|
+
code: number;
|
|
3456
|
+
/**
|
|
3457
|
+
* Error title
|
|
3458
|
+
*/
|
|
3459
|
+
title: string;
|
|
3460
|
+
/**
|
|
3461
|
+
* Error message
|
|
3462
|
+
*/
|
|
3463
|
+
message: string;
|
|
3464
|
+
/**
|
|
3465
|
+
* Error details object
|
|
3466
|
+
*/
|
|
3467
|
+
error_data?: {
|
|
3468
|
+
/**
|
|
3469
|
+
* Describes the error details
|
|
3470
|
+
*/
|
|
3471
|
+
details: string;
|
|
3472
|
+
};
|
|
3473
|
+
}>;
|
|
3474
|
+
}
|
|
3475
|
+
/**
|
|
3476
|
+
* Text message interface
|
|
3477
|
+
*/
|
|
3478
|
+
interface TextMessage extends BaseMessage {
|
|
3479
|
+
type: MessageTypesEnum.Text;
|
|
3480
|
+
text: {
|
|
3481
|
+
/**
|
|
3482
|
+
* The text content of the message
|
|
3483
|
+
*/
|
|
3484
|
+
body: string;
|
|
3485
|
+
preview_url?: boolean;
|
|
3486
|
+
};
|
|
3487
|
+
}
|
|
3488
|
+
/**
|
|
3489
|
+
* Image message interface
|
|
3490
|
+
*/
|
|
3491
|
+
interface ImageMessage extends BaseMessage {
|
|
3492
|
+
type: MessageTypesEnum.Image;
|
|
3493
|
+
image: {
|
|
3494
|
+
/**
|
|
3495
|
+
* The image caption (if provided)
|
|
3496
|
+
*/
|
|
3497
|
+
caption?: string;
|
|
3498
|
+
/**
|
|
3499
|
+
* The SHA256 hash of the image
|
|
3500
|
+
*/
|
|
3501
|
+
sha256?: string;
|
|
3502
|
+
/**
|
|
3503
|
+
* The ID for the image
|
|
3504
|
+
*/
|
|
3505
|
+
id: string;
|
|
3506
|
+
/**
|
|
3507
|
+
* The MIME type of the image
|
|
3508
|
+
*/
|
|
3509
|
+
mime_type: string;
|
|
3510
|
+
};
|
|
3511
|
+
}
|
|
3512
|
+
/**
|
|
3513
|
+
* Video message interface
|
|
3514
|
+
*/
|
|
3515
|
+
interface VideoMessage extends BaseMessage {
|
|
3516
|
+
type: MessageTypesEnum.Video;
|
|
3517
|
+
video: {
|
|
3518
|
+
/**
|
|
3519
|
+
* The video caption (if provided)
|
|
3520
|
+
*/
|
|
3521
|
+
caption?: string;
|
|
3522
|
+
/**
|
|
3523
|
+
* The SHA256 hash of the video
|
|
3524
|
+
*/
|
|
3525
|
+
sha256?: string;
|
|
3526
|
+
/**
|
|
3527
|
+
* The ID for the video
|
|
3528
|
+
*/
|
|
3529
|
+
id: string;
|
|
3530
|
+
/**
|
|
3531
|
+
* The MIME type of the video
|
|
3532
|
+
*/
|
|
3533
|
+
mime_type: string;
|
|
3534
|
+
};
|
|
3535
|
+
}
|
|
3536
|
+
/**
|
|
3537
|
+
* Audio message interface
|
|
3538
|
+
*/
|
|
3539
|
+
interface AudioMessage extends BaseMessage {
|
|
3540
|
+
type: MessageTypesEnum.Audio;
|
|
3541
|
+
audio: {
|
|
3542
|
+
/**
|
|
3543
|
+
* The ID for the audio file
|
|
3544
|
+
*/
|
|
3545
|
+
id: string;
|
|
3546
|
+
/**
|
|
3547
|
+
* The MIME type of the audio file
|
|
3548
|
+
*/
|
|
3549
|
+
mime_type: string;
|
|
3550
|
+
/**
|
|
3551
|
+
* Whether the audio is a voice message
|
|
3552
|
+
*/
|
|
3553
|
+
voice?: boolean;
|
|
3554
|
+
};
|
|
3555
|
+
}
|
|
3556
|
+
/**
|
|
3557
|
+
* Document message interface
|
|
3558
|
+
*/
|
|
3559
|
+
interface DocumentMessage extends BaseMessage {
|
|
3560
|
+
type: MessageTypesEnum.Document;
|
|
3561
|
+
document: {
|
|
3562
|
+
/**
|
|
3563
|
+
* The document caption (if provided)
|
|
3564
|
+
*/
|
|
3565
|
+
caption?: string;
|
|
3566
|
+
/**
|
|
3567
|
+
* The document filename
|
|
3568
|
+
*/
|
|
3569
|
+
filename: string;
|
|
3570
|
+
/**
|
|
3571
|
+
* The SHA256 hash of the document
|
|
3572
|
+
*/
|
|
3573
|
+
sha256?: string;
|
|
3574
|
+
/**
|
|
3575
|
+
* The ID for the document
|
|
3576
|
+
*/
|
|
3577
|
+
id: string;
|
|
3578
|
+
/**
|
|
3579
|
+
* The MIME type of the document
|
|
3580
|
+
*/
|
|
3581
|
+
mime_type: string;
|
|
3582
|
+
};
|
|
3583
|
+
}
|
|
3584
|
+
/**
|
|
3585
|
+
* Sticker message interface
|
|
3586
|
+
*/
|
|
3587
|
+
interface StickerMessage extends BaseMessage {
|
|
3588
|
+
type: MessageTypesEnum.Sticker;
|
|
3589
|
+
sticker: {
|
|
3590
|
+
/**
|
|
3591
|
+
* The ID for the sticker
|
|
3592
|
+
*/
|
|
3593
|
+
id: string;
|
|
3594
|
+
/**
|
|
3595
|
+
* Whether this is an animated sticker
|
|
3596
|
+
*/
|
|
3597
|
+
animated: boolean;
|
|
3598
|
+
/**
|
|
3599
|
+
* The MIME type of the sticker
|
|
3600
|
+
*/
|
|
3601
|
+
mime_type: string;
|
|
3602
|
+
};
|
|
3603
|
+
}
|
|
3604
|
+
/**
|
|
3605
|
+
* Reaction message interface
|
|
3606
|
+
*/
|
|
3607
|
+
interface ReactionMessage extends BaseMessage {
|
|
3608
|
+
type: MessageTypesEnum.Reaction;
|
|
3609
|
+
reaction: {
|
|
3610
|
+
/**
|
|
3611
|
+
* The ID of the message being reacted to
|
|
3612
|
+
*/
|
|
3613
|
+
message_id: string;
|
|
3614
|
+
/**
|
|
3615
|
+
* Emoji used for the reaction
|
|
3616
|
+
*/
|
|
3617
|
+
emoji: string;
|
|
3618
|
+
};
|
|
3619
|
+
}
|
|
3620
|
+
/**
|
|
3621
|
+
* Contacts message interface
|
|
3622
|
+
*/
|
|
3623
|
+
interface ContactsMessage extends BaseMessage {
|
|
3624
|
+
type: MessageTypesEnum.Contacts;
|
|
3625
|
+
contacts: Array<{
|
|
3626
|
+
/**
|
|
3627
|
+
* The contact's name
|
|
3628
|
+
*/
|
|
3629
|
+
name: {
|
|
3630
|
+
/**
|
|
3631
|
+
* The formatted name
|
|
3632
|
+
*/
|
|
3633
|
+
formatted_name: string;
|
|
3634
|
+
/**
|
|
3635
|
+
* The first name
|
|
3636
|
+
*/
|
|
3637
|
+
first_name?: string;
|
|
3638
|
+
/**
|
|
3639
|
+
* The last name
|
|
3640
|
+
*/
|
|
3641
|
+
last_name?: string;
|
|
3642
|
+
/**
|
|
3643
|
+
* The middle name
|
|
3644
|
+
*/
|
|
3645
|
+
middle_name?: string;
|
|
3646
|
+
/**
|
|
3647
|
+
* The suffix
|
|
3648
|
+
*/
|
|
3649
|
+
suffix?: string;
|
|
3650
|
+
/**
|
|
3651
|
+
* The prefix
|
|
3652
|
+
*/
|
|
3653
|
+
prefix?: string;
|
|
3654
|
+
};
|
|
3655
|
+
/**
|
|
3656
|
+
* The contact's phone numbers
|
|
3657
|
+
*/
|
|
3658
|
+
phones?: Array<{
|
|
3659
|
+
phone: string;
|
|
3660
|
+
type?: string;
|
|
3661
|
+
wa_id?: string;
|
|
3662
|
+
}>;
|
|
3663
|
+
/**
|
|
3664
|
+
* The contact's emails
|
|
3665
|
+
*/
|
|
3666
|
+
emails?: Array<{
|
|
3667
|
+
email: string;
|
|
3668
|
+
type?: string;
|
|
3669
|
+
}>;
|
|
3670
|
+
/**
|
|
3671
|
+
* The contact's addresses
|
|
3672
|
+
*/
|
|
3673
|
+
addresses?: Array<{
|
|
3674
|
+
street?: string;
|
|
3675
|
+
city?: string;
|
|
3676
|
+
state?: string;
|
|
3677
|
+
zip?: string;
|
|
3678
|
+
country?: string;
|
|
3679
|
+
country_code?: string;
|
|
3680
|
+
type?: string;
|
|
3681
|
+
}>;
|
|
3682
|
+
/**
|
|
3683
|
+
* The contact's organizations
|
|
3684
|
+
*/
|
|
3685
|
+
org?: {
|
|
3686
|
+
company?: string;
|
|
3687
|
+
department?: string;
|
|
3688
|
+
title?: string;
|
|
3689
|
+
};
|
|
3690
|
+
/**
|
|
3691
|
+
* The contact's URLs
|
|
3692
|
+
*/
|
|
3693
|
+
urls?: Array<{
|
|
3694
|
+
url: string;
|
|
3695
|
+
type?: string;
|
|
3696
|
+
}>;
|
|
3697
|
+
/**
|
|
3698
|
+
* The contact's birthday (YYYY-MM-DD format)
|
|
3699
|
+
*/
|
|
3700
|
+
birthday?: string;
|
|
3701
|
+
}>;
|
|
3702
|
+
}
|
|
3703
|
+
/**
|
|
3704
|
+
* Location message interface
|
|
3705
|
+
*/
|
|
3706
|
+
interface LocationMessage extends BaseMessage {
|
|
3707
|
+
type: MessageTypesEnum.Location;
|
|
3708
|
+
location: {
|
|
3709
|
+
/**
|
|
3710
|
+
* Latitude of the location
|
|
3711
|
+
*/
|
|
3712
|
+
latitude: number;
|
|
3713
|
+
/**
|
|
3714
|
+
* Longitude of the location
|
|
3715
|
+
*/
|
|
3716
|
+
longitude: number;
|
|
3717
|
+
/**
|
|
3718
|
+
* Name of the location
|
|
3719
|
+
*/
|
|
3720
|
+
name?: string;
|
|
3721
|
+
/**
|
|
3722
|
+
* Address of the location
|
|
3723
|
+
*/
|
|
3724
|
+
address?: string;
|
|
3725
|
+
};
|
|
3726
|
+
}
|
|
3727
|
+
/**
|
|
3728
|
+
* Interactive message interface
|
|
3729
|
+
*/
|
|
3730
|
+
interface InteractiveMessage extends BaseMessage {
|
|
3731
|
+
type: MessageTypesEnum.Interactive;
|
|
3732
|
+
interactive: {
|
|
3733
|
+
/**
|
|
3734
|
+
* Type of the interactive message
|
|
3735
|
+
* Can be: button_reply, list_reply, flow, nfm_reply, etc.
|
|
3736
|
+
*/
|
|
3737
|
+
type: string;
|
|
3738
|
+
/**
|
|
3739
|
+
* ID for the button that was clicked
|
|
3740
|
+
*/
|
|
3741
|
+
button_reply?: {
|
|
3742
|
+
id: string;
|
|
3743
|
+
title: string;
|
|
3744
|
+
};
|
|
3745
|
+
/**
|
|
3746
|
+
* ID for the list item that was selected
|
|
3747
|
+
*/
|
|
3748
|
+
list_reply?: {
|
|
3749
|
+
id: string;
|
|
3750
|
+
title: string;
|
|
3751
|
+
description?: string;
|
|
3752
|
+
};
|
|
3753
|
+
/**
|
|
3754
|
+
* NFM (No-Code Flow Message) reply data
|
|
3755
|
+
*/
|
|
3756
|
+
nfm_reply?: {
|
|
3757
|
+
/**
|
|
3758
|
+
* Response data in JSON format
|
|
3759
|
+
*/
|
|
3760
|
+
response_json: string;
|
|
3761
|
+
/**
|
|
3762
|
+
* Body text of the reply
|
|
3763
|
+
*/
|
|
3764
|
+
body: string;
|
|
3765
|
+
/**
|
|
3766
|
+
* Name of the flow
|
|
3767
|
+
*/
|
|
3768
|
+
name: string;
|
|
3769
|
+
};
|
|
3770
|
+
};
|
|
3771
|
+
}
|
|
3772
|
+
/**
|
|
3773
|
+
* System message interface
|
|
3774
|
+
*/
|
|
3775
|
+
interface SystemMessage extends BaseMessage {
|
|
3776
|
+
type: MessageTypesEnum.System;
|
|
3777
|
+
system: {
|
|
3778
|
+
/**
|
|
3779
|
+
* The type of system update
|
|
3780
|
+
*/
|
|
3781
|
+
type: string;
|
|
3782
|
+
/**
|
|
3783
|
+
* User's identity if the update is a customer identity change
|
|
3784
|
+
*/
|
|
3785
|
+
identity?: string;
|
|
3786
|
+
/**
|
|
3787
|
+
* Old and new phone numbers if the update is a phone number change
|
|
3788
|
+
*/
|
|
3789
|
+
customer?: {
|
|
3790
|
+
/**
|
|
3791
|
+
* The previous phone number
|
|
3792
|
+
*/
|
|
3793
|
+
previous_wa_id: string;
|
|
3794
|
+
/**
|
|
3795
|
+
* The new phone number
|
|
3796
|
+
*/
|
|
3797
|
+
wa_id: string;
|
|
3798
|
+
};
|
|
3799
|
+
};
|
|
3800
|
+
}
|
|
3801
|
+
/**
|
|
3802
|
+
* Order message interface
|
|
3803
|
+
*/
|
|
3804
|
+
interface OrderMessage extends BaseMessage {
|
|
3805
|
+
type: MessageTypesEnum.Order;
|
|
3806
|
+
order: {
|
|
3807
|
+
/**
|
|
3808
|
+
* Catalog ID
|
|
3809
|
+
*/
|
|
3810
|
+
catalog_id: string;
|
|
3811
|
+
/**
|
|
3812
|
+
* Product items in the order
|
|
3813
|
+
*/
|
|
3814
|
+
product_items: Array<{
|
|
3815
|
+
/**
|
|
3816
|
+
* Product ID
|
|
3817
|
+
*/
|
|
3818
|
+
product_retailer_id: string;
|
|
3819
|
+
/**
|
|
3820
|
+
* Quantity of the product
|
|
3821
|
+
*/
|
|
3822
|
+
quantity: number;
|
|
3823
|
+
/**
|
|
3824
|
+
* Item price
|
|
3825
|
+
*/
|
|
3826
|
+
item_price: number;
|
|
3827
|
+
/**
|
|
3828
|
+
* Currency code
|
|
3829
|
+
*/
|
|
3830
|
+
currency: string;
|
|
3831
|
+
}>;
|
|
3832
|
+
/**
|
|
3833
|
+
* Text message included with the order
|
|
3834
|
+
*/
|
|
3835
|
+
text?: string;
|
|
3836
|
+
};
|
|
3837
|
+
}
|
|
3838
|
+
/**
|
|
3839
|
+
* Button message interface
|
|
3840
|
+
*/
|
|
3841
|
+
interface ButtonMessage extends BaseMessage {
|
|
3842
|
+
type: MessageTypesEnum.Button;
|
|
3843
|
+
button: {
|
|
3844
|
+
/**
|
|
3845
|
+
* The payload for the button
|
|
3846
|
+
*/
|
|
3847
|
+
payload: string;
|
|
3848
|
+
/**
|
|
3849
|
+
* Button text
|
|
3850
|
+
*/
|
|
3851
|
+
text: string;
|
|
3852
|
+
};
|
|
3853
|
+
}
|
|
3854
|
+
/**
|
|
3855
|
+
* Union type for all message types
|
|
3856
|
+
*/
|
|
3857
|
+
type WhatsAppMessage = TextMessage | ImageMessage | VideoMessage | AudioMessage | DocumentMessage | StickerMessage | ReactionMessage | ContactsMessage | LocationMessage | InteractiveMessage | SystemMessage | OrderMessage | ButtonMessage;
|
|
3858
|
+
interface WebhookMessageValue {
|
|
3859
|
+
/**
|
|
3860
|
+
* The messaging product
|
|
3861
|
+
*/
|
|
3862
|
+
messaging_product: string;
|
|
3863
|
+
/**
|
|
3864
|
+
* The metadata
|
|
3865
|
+
*/
|
|
3866
|
+
metadata: {
|
|
3867
|
+
/**
|
|
3868
|
+
* The display phone number of the whatsapp business account
|
|
3869
|
+
*/
|
|
3870
|
+
display_phone_number: string;
|
|
3871
|
+
/**
|
|
3872
|
+
* The phone number ID of the whatsapp business account
|
|
3873
|
+
*/
|
|
3874
|
+
phone_number_id: string;
|
|
3875
|
+
};
|
|
3876
|
+
contacts?: Array<{
|
|
3877
|
+
profile: {
|
|
3878
|
+
/**
|
|
3879
|
+
* The display name of the whatsapp user
|
|
3880
|
+
*/
|
|
3881
|
+
name: string;
|
|
3882
|
+
};
|
|
3883
|
+
/**
|
|
3884
|
+
* The whatsapp ID of the user
|
|
3885
|
+
*/
|
|
3886
|
+
wa_id: string;
|
|
3887
|
+
}>;
|
|
3888
|
+
messages: Array<WhatsAppMessage>;
|
|
3889
|
+
statuses?: Array<{
|
|
3890
|
+
/**
|
|
3891
|
+
* The ID of the message
|
|
3892
|
+
*/
|
|
3893
|
+
id: string;
|
|
3894
|
+
/**
|
|
3895
|
+
* The status of the message
|
|
3896
|
+
*/
|
|
3897
|
+
status: MessageStatus;
|
|
3898
|
+
/**
|
|
3899
|
+
* The timestamp of the message
|
|
3900
|
+
*/
|
|
3901
|
+
timestamp: string;
|
|
3902
|
+
/**
|
|
3903
|
+
* The recipient ID ( phone number of the user )
|
|
3904
|
+
*/
|
|
3905
|
+
recipient_id: string;
|
|
3906
|
+
}>;
|
|
3907
|
+
errors?: Array<{
|
|
3908
|
+
/**
|
|
3909
|
+
* The error code
|
|
3910
|
+
*/
|
|
3911
|
+
code: number;
|
|
3912
|
+
/**
|
|
3913
|
+
* The error title
|
|
3914
|
+
*/
|
|
3915
|
+
title: string;
|
|
3916
|
+
/**
|
|
3917
|
+
* The error data
|
|
3918
|
+
*/
|
|
3919
|
+
error_data?: {
|
|
3920
|
+
/**
|
|
3921
|
+
* The error details
|
|
3922
|
+
*/
|
|
3923
|
+
details: string;
|
|
3924
|
+
};
|
|
3925
|
+
}>;
|
|
3926
|
+
}
|
|
3927
|
+
/**
|
|
3928
|
+
* Represents a message received through the webhook
|
|
3929
|
+
* Based on Meta's documentation: https://developers.facebook.com/docs/whatsapp/cloud-api/webhooks/components#messages-object
|
|
3930
|
+
*/
|
|
3931
|
+
interface WebhookMessage {
|
|
3932
|
+
/**
|
|
3933
|
+
* The WhatsApp Business Account ID
|
|
3934
|
+
*/
|
|
3935
|
+
wabaId: string;
|
|
3936
|
+
/**
|
|
3937
|
+
* The message ID
|
|
3938
|
+
*/
|
|
3939
|
+
id: string;
|
|
3940
|
+
/**
|
|
3941
|
+
* The sender's phone number
|
|
3942
|
+
*/
|
|
3943
|
+
from: string;
|
|
3944
|
+
/**
|
|
3945
|
+
* The timestamp of the message
|
|
3946
|
+
*/
|
|
3947
|
+
timestamp: string;
|
|
3948
|
+
/**
|
|
3949
|
+
* The type of message (text, image, etc.)
|
|
3950
|
+
*/
|
|
3951
|
+
type: MessageTypesEnum;
|
|
3952
|
+
/**
|
|
3953
|
+
* The phone number ID that received the message
|
|
3954
|
+
*/
|
|
3955
|
+
phoneNumberId: string;
|
|
3956
|
+
/**
|
|
3957
|
+
* The display phone number that received the message
|
|
3958
|
+
*/
|
|
3959
|
+
displayPhoneNumber: string;
|
|
3960
|
+
/**
|
|
3961
|
+
* The profile name of the sender
|
|
3962
|
+
*/
|
|
3963
|
+
profileName: string;
|
|
3964
|
+
text?: TextMessage['text'];
|
|
3965
|
+
image?: ImageMessage['image'];
|
|
3966
|
+
video?: VideoMessage['video'];
|
|
3967
|
+
audio?: AudioMessage['audio'];
|
|
3968
|
+
document?: DocumentMessage['document'];
|
|
3969
|
+
sticker?: StickerMessage['sticker'];
|
|
3970
|
+
location?: LocationMessage['location'];
|
|
3971
|
+
contacts?: ContactsMessage['contacts'];
|
|
3972
|
+
interactive?: InteractiveMessage['interactive'];
|
|
3973
|
+
button?: ButtonMessage['button'];
|
|
3974
|
+
order?: OrderMessage['order'];
|
|
3975
|
+
system?: SystemMessage['system'];
|
|
3976
|
+
reaction?: ReactionMessage['reaction'];
|
|
3977
|
+
statuses?: {
|
|
3978
|
+
/**
|
|
3979
|
+
* Arbitrary string included in sent message
|
|
3980
|
+
*/
|
|
3981
|
+
biz_opaque_callback_data?: string;
|
|
3982
|
+
/**
|
|
3983
|
+
* Information about the conversation
|
|
3984
|
+
*/
|
|
3985
|
+
conversation?: {
|
|
3986
|
+
/**
|
|
3987
|
+
* Represents the ID of the conversation the given status notification belongs to
|
|
3988
|
+
*/
|
|
3989
|
+
id: string;
|
|
3990
|
+
/**
|
|
3991
|
+
* Describes conversation category
|
|
3992
|
+
*/
|
|
3993
|
+
origin: {
|
|
3994
|
+
/**
|
|
3995
|
+
* Indicates conversation category. This can also be referred to as a conversation entry point
|
|
3996
|
+
* - authentication: Conversation opened by business sending template categorized as AUTHENTICATION
|
|
3997
|
+
* - marketing: Conversation opened by business sending template categorized as MARKETING
|
|
3998
|
+
* - utility: Conversation opened by business sending template categorized as UTILITY
|
|
3999
|
+
* - service: Conversation opened by business replying to customer within service window
|
|
4000
|
+
* - referral_conversion: Free entry point conversation
|
|
4001
|
+
*/
|
|
4002
|
+
type: 'authentication' | 'marketing' | 'utility' | 'service' | 'referral_conversion';
|
|
4003
|
+
};
|
|
4004
|
+
/**
|
|
4005
|
+
* Date when the conversation expires. Only present for messages with status 'sent'
|
|
4006
|
+
*/
|
|
4007
|
+
expiration_timestamp?: string;
|
|
4008
|
+
};
|
|
4009
|
+
/**
|
|
4010
|
+
* Array of error objects describing the error
|
|
4011
|
+
*/
|
|
4012
|
+
errors?: Array<{
|
|
4013
|
+
/**
|
|
4014
|
+
* Error code
|
|
4015
|
+
*/
|
|
4016
|
+
code: number;
|
|
4017
|
+
/**
|
|
4018
|
+
* Error code title
|
|
4019
|
+
*/
|
|
4020
|
+
title: string;
|
|
4021
|
+
/**
|
|
4022
|
+
* Error code message
|
|
4023
|
+
*/
|
|
4024
|
+
message: string;
|
|
4025
|
+
/**
|
|
4026
|
+
* Error details object
|
|
4027
|
+
*/
|
|
4028
|
+
error_data?: {
|
|
4029
|
+
/**
|
|
4030
|
+
* Describes the error details
|
|
4031
|
+
*/
|
|
4032
|
+
details: string;
|
|
4033
|
+
};
|
|
4034
|
+
}>;
|
|
4035
|
+
/**
|
|
4036
|
+
* The ID for the message that the business sent to a customer
|
|
4037
|
+
*/
|
|
4038
|
+
id: string;
|
|
4039
|
+
/**
|
|
4040
|
+
* Pricing information for the message/conversation
|
|
4041
|
+
*/
|
|
4042
|
+
pricing?: {
|
|
4043
|
+
/**
|
|
4044
|
+
* Indicates if the given message or conversation is billable
|
|
4045
|
+
* @deprecated This field is deprecated. Visit the WhatsApp Changelog for more information.
|
|
4046
|
+
*/
|
|
4047
|
+
billable?: boolean;
|
|
4048
|
+
/**
|
|
4049
|
+
* Indicates the conversation category:
|
|
4050
|
+
* - authentication: Authentication conversation
|
|
4051
|
+
* - authentication_international: Authentication-international conversation
|
|
4052
|
+
* - marketing: Marketing conversation
|
|
4053
|
+
* - utility: Utility conversation
|
|
4054
|
+
* - service: Service conversation
|
|
4055
|
+
* - referral_conversion: Free entry point conversation
|
|
4056
|
+
*/
|
|
4057
|
+
category: 'authentication' | 'authentication_international' | 'marketing' | 'utility' | 'service' | 'referral_conversion';
|
|
4058
|
+
/**
|
|
4059
|
+
* Type of pricing model used by the business. Current supported value is CBP
|
|
4060
|
+
*/
|
|
4061
|
+
pricing_model: 'CBP';
|
|
4062
|
+
};
|
|
4063
|
+
/**
|
|
4064
|
+
* The customer's WhatsApp ID. Business can respond to customer using this ID.
|
|
4065
|
+
* This ID may not match the customer's phone number.
|
|
4066
|
+
*/
|
|
4067
|
+
recipient_id: string;
|
|
4068
|
+
/**
|
|
4069
|
+
* Status of the message:
|
|
4070
|
+
* - delivered: Message has been delivered
|
|
4071
|
+
* - read: Message has been read by the customer
|
|
4072
|
+
* - sent: Message has been sent to the customer
|
|
4073
|
+
*/
|
|
4074
|
+
status: 'delivered' | 'read' | 'sent';
|
|
4075
|
+
/**
|
|
4076
|
+
* Unix timestamp for the status message
|
|
4077
|
+
*/
|
|
4078
|
+
timestamp: string;
|
|
4079
|
+
};
|
|
4080
|
+
/**
|
|
4081
|
+
* The original message data as received from the webhook
|
|
4082
|
+
*/
|
|
4083
|
+
originalData: any;
|
|
4084
|
+
}
|
|
4085
|
+
/**
|
|
4086
|
+
* Webhook event received from WhatsApp
|
|
4087
|
+
*/
|
|
4088
|
+
interface WebhookEvent {
|
|
4089
|
+
/**
|
|
4090
|
+
* The field type of the event
|
|
4091
|
+
*/
|
|
4092
|
+
field: string;
|
|
4093
|
+
/**
|
|
4094
|
+
* The event data
|
|
4095
|
+
*/
|
|
4096
|
+
value: any;
|
|
4097
|
+
/**
|
|
4098
|
+
* The timestamp when the event was received
|
|
4099
|
+
*/
|
|
4100
|
+
timestamp: number;
|
|
4101
|
+
}
|
|
4102
|
+
/**
|
|
4103
|
+
* Message handler function type
|
|
4104
|
+
*/
|
|
4105
|
+
type MessageHandler$1 = (message: WebhookMessage) => void | Promise<void>;
|
|
4106
|
+
/**
|
|
4107
|
+
* Message status enum
|
|
4108
|
+
*/
|
|
4109
|
+
declare enum MessageStatus {
|
|
4110
|
+
DELIVERED = "delivered",
|
|
4111
|
+
READ = "read",
|
|
4112
|
+
SENT = "sent",
|
|
4113
|
+
}
|
|
4114
|
+
//#endregion
|
|
4115
|
+
//#region src/utils/flowTypeGuards.d.ts
|
|
4116
|
+
declare const DATA_EXCHANGE_ACTIONS: readonly [FlowActionEnum.DATA_EXCHANGE, FlowActionEnum.INIT, FlowActionEnum.BACK];
|
|
4117
|
+
declare const ERROR_ACTIONS: readonly [FlowActionEnum.DATA_EXCHANGE, FlowActionEnum.INIT];
|
|
4118
|
+
/**
|
|
4119
|
+
* Type guard to check if a request is a Data Exchange request
|
|
4120
|
+
* Validates the request structure according to the Flow API specifications
|
|
4121
|
+
*
|
|
4122
|
+
* @param request The Flow endpoint request to check
|
|
4123
|
+
* @returns True if the request is a valid Data Exchange request, false otherwise
|
|
4124
|
+
*/
|
|
4125
|
+
declare function isFlowDataExchangeRequest(request: FlowEndpointRequest): request is FlowDataExchangeRequest & {
|
|
4126
|
+
action: (typeof DATA_EXCHANGE_ACTIONS)[number];
|
|
4127
|
+
screen?: string;
|
|
4128
|
+
flow_token: string;
|
|
4129
|
+
data?: Record<string, any>;
|
|
4130
|
+
};
|
|
4131
|
+
/**
|
|
4132
|
+
* Type guard to check if a request is an Error Notification request
|
|
4133
|
+
* Validates the request structure according to the Flow API error specifications
|
|
4134
|
+
*
|
|
4135
|
+
* @param request The Flow endpoint request to check
|
|
4136
|
+
* @returns True if the request is a valid Error Notification request, false otherwise
|
|
4137
|
+
*/
|
|
4138
|
+
declare function isFlowErrorRequest(request: FlowEndpointRequest): request is FlowErrorNotificationRequest & {
|
|
4139
|
+
action: (typeof ERROR_ACTIONS)[number];
|
|
4140
|
+
screen: string;
|
|
4141
|
+
flow_token: string;
|
|
4142
|
+
data: {
|
|
4143
|
+
error: string;
|
|
4144
|
+
error_message: string;
|
|
4145
|
+
};
|
|
4146
|
+
};
|
|
4147
|
+
/**
|
|
4148
|
+
* Type guard to check if a request is a Ping (health check) request
|
|
4149
|
+
* Simple validation for health check endpoints in the Flow API
|
|
4150
|
+
*
|
|
4151
|
+
* @param request The Flow endpoint request to check
|
|
4152
|
+
* @returns True if the request is a Ping request, false otherwise
|
|
4153
|
+
*/
|
|
4154
|
+
declare function isFlowPingRequest(request: FlowEndpointRequest): request is FlowHealthCheckRequest;
|
|
4155
|
+
//#endregion
|
|
4156
|
+
//#region src/utils/isMetaError.d.ts
|
|
4157
|
+
interface MetaError extends Error {
|
|
4158
|
+
error: {
|
|
4159
|
+
message: string;
|
|
4160
|
+
type: string;
|
|
4161
|
+
code: number;
|
|
4162
|
+
error_data?: {
|
|
4163
|
+
messaging_product: 'whatsapp';
|
|
4164
|
+
details: string;
|
|
4165
|
+
};
|
|
4166
|
+
error_subcode?: number;
|
|
4167
|
+
fbtrace_id: string;
|
|
4168
|
+
};
|
|
4169
|
+
}
|
|
4170
|
+
/**
|
|
4171
|
+
* Determines if the error is a Meta API error response
|
|
4172
|
+
* @param error Any error object to check
|
|
4173
|
+
* @returns Type guard indicating if error is a Meta API error
|
|
4174
|
+
*/
|
|
4175
|
+
declare function isMetaError(error: any): error is MetaError;
|
|
4176
|
+
//#endregion
|
|
4177
|
+
//#region src/core/whatsapp/types.d.ts
|
|
4178
|
+
declare class WhatsAppClass {
|
|
4179
|
+
constructor(config?: WhatsAppConfig);
|
|
4180
|
+
readonly messages: MessagesApi;
|
|
4181
|
+
readonly templates: TemplateApi;
|
|
4182
|
+
readonly phoneNumber: PhoneNumberApi;
|
|
4183
|
+
readonly qrCode: QrCodeApi;
|
|
4184
|
+
readonly encryption: EncryptionApi;
|
|
4185
|
+
readonly twoStepVerification: TwoStepVerificationApi;
|
|
4186
|
+
readonly registration: RegistrationApi;
|
|
4187
|
+
readonly media: MediaApi;
|
|
4188
|
+
readonly waba: WabaApi;
|
|
4189
|
+
readonly flow: FlowApi;
|
|
4190
|
+
readonly businessProfile: BusinessProfileApi;
|
|
4191
|
+
updateTimeout(ms: number): boolean;
|
|
4192
|
+
updatePhoneNumberId(phoneNumberId: number): boolean;
|
|
4193
|
+
updateAccessToken(accessToken: string): boolean;
|
|
4194
|
+
updateWabaId(wabaId: string): boolean;
|
|
4195
|
+
}
|
|
4196
|
+
//#endregion
|
|
4197
|
+
//#region src/core/webhook/utils/webhookUtils.d.ts
|
|
4198
|
+
type MessageHandler = (whatsapp: WhatsApp, message: WebhookMessage) => void | Promise<void>;
|
|
4199
|
+
type FlowHandler = (whatsapp: WhatsApp, request: FlowEndpointRequest) => any | Promise<any>;
|
|
4200
|
+
/**
|
|
4201
|
+
* Process webhook messages
|
|
4202
|
+
*/
|
|
4203
|
+
declare function processWebhookMessages(request: Request, whatsapp: WhatsApp, handlers: {
|
|
4204
|
+
messageHandlers: Map<MessageTypesEnum, MessageHandler>;
|
|
4205
|
+
preProcessHandler?: MessageHandler;
|
|
4206
|
+
postProcessHandler?: MessageHandler;
|
|
4207
|
+
}): Promise<Response>;
|
|
4208
|
+
/**
|
|
4209
|
+
* Handle flow requests
|
|
4210
|
+
*/
|
|
4211
|
+
declare function processFlowRequest(request: Request, config: WabaConfigType, whatsapp: WhatsApp, flowHandlers: Map<FlowTypeEnum, FlowHandler>): Promise<Response>;
|
|
4212
|
+
/**
|
|
4213
|
+
* Constructs a full URL from framework-specific request headers and URL
|
|
4214
|
+
* @param headers - Request headers containing host and protocol information
|
|
4215
|
+
* @param url - Relative URL path
|
|
4216
|
+
* @returns Full URL string
|
|
4217
|
+
*/
|
|
4218
|
+
declare function constructFullUrl(headers: Record<string, string | string[] | undefined>, url?: string): string;
|
|
4219
|
+
//#endregion
|
|
4220
|
+
//#region src/core/webhook/WebhookProcessor.d.ts
|
|
4221
|
+
interface WebhookResponse {
|
|
4222
|
+
status: number;
|
|
4223
|
+
body: string;
|
|
4224
|
+
headers: Record<string, string>;
|
|
4225
|
+
}
|
|
4226
|
+
declare class WebhookProcessor {
|
|
4227
|
+
private config;
|
|
4228
|
+
private client;
|
|
4229
|
+
private messageHandlers;
|
|
4230
|
+
private preProcessHandler;
|
|
4231
|
+
private postProcessHandler;
|
|
4232
|
+
private flowHandlers;
|
|
4233
|
+
constructor(config: WhatsAppConfig);
|
|
4234
|
+
processVerification(mode: string | null, token: string | null, challenge: string | null): Promise<WebhookResponse>;
|
|
4235
|
+
processWebhook(request: Request): Promise<WebhookResponse>;
|
|
4236
|
+
processFlow(request: Request): Promise<WebhookResponse>;
|
|
4237
|
+
onMessage(type: MessageTypesEnum, handler: MessageHandler): void;
|
|
4238
|
+
onMessagePreProcess(handler: MessageHandler): void;
|
|
4239
|
+
onMessagePostProcess(handler: MessageHandler): void;
|
|
4240
|
+
onFlow(type: FlowTypeEnum, handler: FlowHandler): void;
|
|
4241
|
+
getClient(): WhatsApp;
|
|
4242
|
+
getConfig(): WabaConfigType;
|
|
4243
|
+
}
|
|
4244
|
+
//#endregion
|
|
4245
|
+
//#region src/core/webhook/frameworks/handler.d.ts
|
|
4246
|
+
interface BaseRequest {
|
|
4247
|
+
method?: string;
|
|
4248
|
+
url?: string;
|
|
4249
|
+
headers: Record<string, string | string[] | undefined>;
|
|
4250
|
+
body?: any;
|
|
4251
|
+
query?: Record<string, any> | URLSearchParams;
|
|
4252
|
+
rawBody?: any;
|
|
4253
|
+
}
|
|
4254
|
+
interface BaseResponse<T = any> {
|
|
4255
|
+
status(code: number): T;
|
|
4256
|
+
json?(data: any): T | void;
|
|
4257
|
+
send?(data?: any): T | void;
|
|
4258
|
+
setHeader?(name: string, value: string): void;
|
|
4259
|
+
}
|
|
4260
|
+
interface BaseWebhookConfig extends WhatsAppConfig {}
|
|
4261
|
+
interface WebhookResult {
|
|
4262
|
+
status: number;
|
|
4263
|
+
headers: Record<string, string>;
|
|
4264
|
+
body: any;
|
|
4265
|
+
}
|
|
4266
|
+
/**
|
|
4267
|
+
* Abstract base class for framework-agnostic webhook handlers
|
|
4268
|
+
* Provides common architecture and functionality across all frameworks
|
|
4269
|
+
*/
|
|
4270
|
+
declare abstract class BaseWebhookHandler<TRequest extends BaseRequest, TResponse extends BaseResponse> {
|
|
4271
|
+
protected processor: WebhookProcessor;
|
|
4272
|
+
constructor(config: BaseWebhookConfig);
|
|
4273
|
+
/**
|
|
4274
|
+
* Abstract method for handling GET requests (webhook verification)
|
|
4275
|
+
* Each framework implements this based on their request/response patterns
|
|
4276
|
+
*/
|
|
4277
|
+
protected abstract handleGet(req: TRequest, res: TResponse, ...args: any[]): Promise<any>;
|
|
4278
|
+
/**
|
|
4279
|
+
* Abstract method for handling POST requests (webhook processing)
|
|
4280
|
+
* Each framework implements this based on their request/response patterns
|
|
4281
|
+
*/
|
|
4282
|
+
protected abstract handlePost(req: TRequest, res: TResponse, ...args: any[]): Promise<any>;
|
|
4283
|
+
/**
|
|
4284
|
+
* Abstract method for handling flow requests
|
|
4285
|
+
* Each framework implements this based on their request/response patterns
|
|
4286
|
+
*/
|
|
4287
|
+
protected abstract handleFlow(req: TRequest, res: TResponse, ...args: any[]): Promise<any>;
|
|
4288
|
+
/**
|
|
4289
|
+
* Common webhook verification logic
|
|
4290
|
+
*/
|
|
4291
|
+
protected processVerification(mode: string | null, token: string | null, challenge: string | null): Promise<WebhookResult>;
|
|
4292
|
+
/**
|
|
4293
|
+
* Common webhook processing logic
|
|
4294
|
+
*/
|
|
4295
|
+
protected processWebhook(request: Request): Promise<WebhookResult>;
|
|
4296
|
+
/**
|
|
4297
|
+
* Common flow processing logic
|
|
4298
|
+
*/
|
|
4299
|
+
protected processFlow(request: Request): Promise<WebhookResult>;
|
|
4300
|
+
/**
|
|
4301
|
+
* Helper to construct full URL from headers and path
|
|
4302
|
+
*/
|
|
4303
|
+
protected constructFullUrl(headers: Record<string, string | string[] | undefined>, url?: string): string;
|
|
4304
|
+
/**
|
|
4305
|
+
* Helper to apply result headers to response
|
|
4306
|
+
*/
|
|
4307
|
+
protected applyHeaders(result: WebhookResult, res: TResponse): void;
|
|
4308
|
+
/**
|
|
4309
|
+
* Auto-routing method handler that dispatches based on request method
|
|
4310
|
+
*/
|
|
4311
|
+
protected autoRoute(req: TRequest, res: TResponse, ...args: any[]): Promise<any>;
|
|
4312
|
+
/**
|
|
4313
|
+
* Get the processor instance for handler registration
|
|
4314
|
+
*/
|
|
4315
|
+
get webhookProcessor(): WebhookProcessor;
|
|
4316
|
+
/**
|
|
4317
|
+
* Abstract method to return the clean handler object
|
|
4318
|
+
* Each framework implements this to return their specific handler structure
|
|
4319
|
+
*/
|
|
4320
|
+
abstract getHandlers(): {
|
|
4321
|
+
GET: (...args: any[]) => Promise<any>;
|
|
4322
|
+
POST: (...args: any[]) => Promise<any>;
|
|
4323
|
+
webhook: (...args: any[]) => Promise<any>;
|
|
4324
|
+
flow: (...args: any[]) => Promise<any>;
|
|
4325
|
+
processor: WebhookProcessor;
|
|
4326
|
+
};
|
|
4327
|
+
}
|
|
4328
|
+
//#endregion
|
|
4329
|
+
//#region src/core/webhook/frameworks/express.d.ts
|
|
4330
|
+
interface ExpressRequest extends BaseRequest {
|
|
4331
|
+
method: string;
|
|
4332
|
+
url: string;
|
|
4333
|
+
headers: Record<string, string | string[] | undefined>;
|
|
4334
|
+
body?: any;
|
|
4335
|
+
query: Record<string, any>;
|
|
4336
|
+
rawBody?: any;
|
|
4337
|
+
}
|
|
4338
|
+
interface ExpressResponse extends BaseResponse<ExpressResponse> {
|
|
4339
|
+
status(code: number): ExpressResponse;
|
|
4340
|
+
json(data: any): ExpressResponse;
|
|
4341
|
+
send(data?: any): ExpressResponse;
|
|
4342
|
+
setHeader(name: string, value: string): void;
|
|
4343
|
+
}
|
|
4344
|
+
interface NextFunction {
|
|
4345
|
+
(error?: any): void;
|
|
4346
|
+
}
|
|
4347
|
+
interface ExpressWebhookConfig extends BaseWebhookConfig {
|
|
4348
|
+
path?: string;
|
|
4349
|
+
}
|
|
4350
|
+
declare function webhookHandler(config: ExpressWebhookConfig): {
|
|
4351
|
+
GET: (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => Promise<ExpressResponse>;
|
|
4352
|
+
POST: (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => Promise<ExpressResponse>;
|
|
4353
|
+
webhook: (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => Promise<any>;
|
|
4354
|
+
flow: (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => Promise<ExpressResponse>;
|
|
4355
|
+
processor: WebhookProcessor;
|
|
4356
|
+
};
|
|
4357
|
+
//#endregion
|
|
4358
|
+
//#region src/core/webhook/frameworks/nextjs.d.ts
|
|
4359
|
+
interface BaseApiRequest extends BaseRequest {
|
|
4360
|
+
method?: string;
|
|
4361
|
+
url?: string;
|
|
4362
|
+
headers: Record<string, string | string[] | undefined>;
|
|
4363
|
+
body?: any;
|
|
4364
|
+
query: Partial<Record<string, string | string[]>>;
|
|
4365
|
+
rawBody?: any;
|
|
4366
|
+
}
|
|
4367
|
+
interface BaseApiResponse extends BaseResponse {
|
|
4368
|
+
status(code: number): any;
|
|
4369
|
+
json(data: any): void | any;
|
|
4370
|
+
send(data?: any): void | any;
|
|
4371
|
+
setHeader(name: string, value: string): void;
|
|
4372
|
+
}
|
|
4373
|
+
interface NextJsWebhookConfig extends BaseWebhookConfig {}
|
|
4374
|
+
declare function webhookHandler$1<TRequest extends BaseApiRequest, TResponse extends BaseApiResponse>(config: NextJsWebhookConfig): {
|
|
4375
|
+
GET: (req: TRequest, res: TResponse) => Promise<any>;
|
|
4376
|
+
POST: (req: TRequest, res: TResponse) => Promise<any>;
|
|
4377
|
+
webhook: (req: TRequest, res: TResponse) => Promise<any>;
|
|
4378
|
+
flow: (req: TRequest, res: TResponse) => Promise<any>;
|
|
4379
|
+
processor: WebhookProcessor;
|
|
4380
|
+
};
|
|
4381
|
+
//#endregion
|
|
4382
|
+
//#region src/core/webhook/utils/generateXHub256Sig.d.ts
|
|
4383
|
+
declare const generateXHub256Sig: (body: string, appSecret: string) => string;
|
|
4384
|
+
//#endregion
|
|
4385
|
+
export { type AccountMode, type AudioMediaObject, AudioMediaTypesEnum, type AuthenticationTemplateOptions, type BodyOptions, BusinessProfileApi, type BusinessProfileClass, type BusinessProfileData, type BusinessProfileField, type BusinessProfileFieldsParam, type BusinessProfileResponse, BusinessVerticalEnum, type ButtonOptions, ButtonPositionEnum, type CarouselCard, type CarouselOptions, type CatalogButton, type CatalogTemplateOptions, CategoryEnum, type CodeVerificationStatus, type ComponentTypes, ComponentTypesEnum, type ContactObject, ConversationTypesEnum, type CopyCodeButton, type CouponTemplateOptions, type CreateQrCodeRequest, CurrencyCodesEnum, type CurrencyParameter, type Cursors, DataLocalizationRegionEnum, type DateTimeParameter, type DocumentMediaObject, DocumentMediaTypesEnum, EncryptionApi, type EncryptionPublicKeyResponse, webhookHandler as ExpressWebhook, type Flow, type FlowActionEnum, FlowApi, type FlowAsset, type FlowAssetsResponse, type FlowButton, type FlowCategoryEnum, type FlowClass, type FlowDataExchangeRequest, type FlowDataExchangeResponse, type FlowDecryptedRequestResponse, type FlowEncryptedRequestPayload, type FlowEndpointRequest, type FlowEndpointResponse, type FlowErrorNotificationRequest, type FlowErrorNotificationResponse, type FlowHealthCheckRequest, type FlowHealthCheckResponse, type FlowHttpRequest, type FlowMigrationFailure, type FlowMigrationResponse, type FlowMigrationResult, type FlowPreview, type FlowPreviewResponse, type FlowStatusEnum, type FlowSuccessScreenResponse, type FlowType, type FlowTypeEnum, type FlowValidationError, type FlowValidationErrorPointer, type FlowsListResponse, type FooterOptions, type GeneralHeaderInterface, type GeneralMessageBody, type GeneralRequestBody, type HeaderOptions, type HealthStatus, type HealthStatusEntity, HttpMethodsEnum, type ImageMediaObject, ImageMediaTypesEnum, type InteractiveObject, InteractiveTypesEnum, LanguagesEnum, type LimitedTimeOfferOptions, type LimitedTimeOfferTemplateOptions, type LocationObject, type LocationParameter, type MPMButton, type MPMTemplateOptions, MediaApi, type MediaCardCarouselTemplateOptions, type MediaCarouselCard, type MediaClass, type MediaParameter, type MediaResponse, type MediasResponse, type MessageRequestBody, type MessageRequestParams, type MessageTemplateObject, MessageTypesEnum, MessagesApi, type MessagesClass, type MessagesResponse, type MessagingLimitTier, type MetaError, webhookHandler$1 as NextJsWebhook, type OTPButton, type OTPTemplateOptions, type Pagination, type PaginationCursors, type Paging, ParametersTypesEnum, PhoneNumberApi, type PhoneNumberButton, type PhoneNumberClass, type PhoneNumberResponse, type PhoneNumbersResponse, type PlatformType, type ProductCardCarouselTemplateOptions, type ProductCarouselCard, type ProductParameter, type ProductSection, QrCodeApi, type QrCodeClass, type QrCodeResponse, type QrCodesResponse, type QualityRating, type QualityScore, type QuickReplyButton, type ReactionParams, RegistrationApi, type RegistrationClass, type RegistrationRequest, RequestCodeMethodsEnum, type RequestVerificationCodeRequest, type RequesterResponseInterface, type ResponseData, type ResponsePagination, type ResponseSuccess, type SPMButton, type SPMTemplateOptions, StatusEnum, type StatusParams, type StickerMediaObject, StickerMediaTypesEnum, SubTypeEnum, SystemChangeTypesEnum, TemplateApi, type TemplateBody, type TemplateButton, type TemplateButtons, type TemplateCarousel, type TemplateClass, type TemplateDeleteParams, type TemplateFooter, type TemplateFormat, type TemplateGetParams, type TemplateHeader, type TemplateHeaderExample, type TemplateLimitedTimeOffer, type TemplateOptions, type TemplateParameter, type TemplateRequestBody, type TemplateResponse, TemplateStatusEnum, type TextMessageParams, type TextObject, type TextParameter, type Throughput, type ThroughputLevel, TwoStepVerificationApi, type TwoStepVerificationClass, type TwoStepVerificationParams, type TwoStepVerificationRequest, type URLButton, type UpdateBusinessProfileRequest, type UpdateFlowResponse, type UpdateQrCodeRequest, type UpdateWabaSubscription, type UploadMediaResponse, type ValidateFlowJsonResponse, type VerifyCodeRequest, type VideoMediaObject, VideoMediaTypesEnum, type WABAClass, type WabaAccount, type WabaAccountFields, type WabaAccountFieldsParam, WabaAccountReviewStatus, WabaAccountStatus, WabaApi, WabaBusinessVerificationStatus, WabaConfigEnum, type WabaConfigType, type WabaHealthStatus, WabaHealthStatusCanSendMessage, type WabaHealthStatusEntity, type WabaHealthStatusError, type WabaSubscription, type WabaSubscriptions, type WebhookContact, type WebhookEvent, type WebhookMessage, WebhookTypesEnum, WhatsApp, type WhatsAppConfig, WhatsApp as WhatsAppLegacy, isFlowDataExchangeRequest, isFlowErrorRequest, isFlowPingRequest, isMetaError };
|
|
4386
|
+
//# sourceMappingURL=index.d.ts.map
|