@apostlejs/whatsapp 0.0.0 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,21 +1,5 @@
1
1
  import { z } from 'zod';
2
2
 
3
- type WhatsappSDKSettings = {
4
- GRAPH_API_VERSION: string;
5
- META_APP_ACCESS_TOKEN: string;
6
- META_APP_ID: string;
7
- META_APP_SECRET: string;
8
- WHATSAPP_MESSAGE_NAMESPACE: string;
9
- WHATSAPP_WEBHOOK_KEY: string;
10
- WHATSAPP_NUMBER_ID: string;
11
- WHATSAPP_ACCOUNT_ID: string;
12
- WHATSAPP_ACCOUNT_ENCRYPTION_PUBLIC_KEY: string;
13
- WHATSAPP_ACCOUNT_ENCRYPTION_PRIVATE_KEY: string;
14
- WHATSAPP_ACCOUNT_ENCRYPTION_PASSPHRASE: string;
15
- WHATSAPP_FLOWS_MODE: string;
16
- WHATSAPP_UNNOFICIAL_AUTHENTICATION_STRING: string;
17
- };
18
-
19
3
  type AnyType = any;
20
4
  type Defined<T> = Exclude<T, undefined>;
21
5
 
@@ -35,6 +19,158 @@ type Endpoint<Url extends string, Method extends HttpMethod, Req extends IReques
35
19
  response?: Res;
36
20
  };
37
21
 
22
+ /**
23
+ * This follows the BCP 47 language tag format.
24
+ */
25
+ declare enum LanguageTag {
26
+ AR_SA = "ar-SA",
27
+ BN_BD = "bn-BD",
28
+ BN_IN = "bn-IN",
29
+ CS_CZ = "cs-CZ",
30
+ DA_DK = "da-DK",
31
+ DE_AT = "de-AT",
32
+ DE_CH = "de-CH",
33
+ DE_DE = "de-DE",
34
+ EL_GR = "el-GR",
35
+ EN_AU = "en-AU",
36
+ EN_CA = "en-CA",
37
+ EN_GB = "en-GB",
38
+ EN_IE = "en-IE",
39
+ EN_IN = "en-IN",
40
+ EN_NZ = "en-NZ",
41
+ EN_US = "en-US",
42
+ EN_ZA = "en-ZA",
43
+ ES_AR = "es-AR",
44
+ ES_CL = "es-CL",
45
+ ES_CO = "es-CO",
46
+ ES_ES = "es-ES",
47
+ ES_MX = "es-MX",
48
+ ES_US = "es-US",
49
+ FI_FI = "fi-FI",
50
+ FR_BE = "fr-BE",
51
+ FR_CA = "fr-CA",
52
+ FR_CH = "fr-CH",
53
+ FR_FR = "fr-FR",
54
+ HE_IL = "he-IL",
55
+ HI_IN = "hi-IN",
56
+ HU_HU = "hu-HU",
57
+ ID_ID = "id-ID",
58
+ IT_CH = "it-CH",
59
+ IT_IT = "it-IT",
60
+ JA_JP = "ja-JP",
61
+ KO_KR = "ko-KR",
62
+ NL_BE = "nl-BE",
63
+ NL_NL = "nl-NL",
64
+ NO_NO = "no-NO",
65
+ PL_PL = "pl-PL",
66
+ PT_BR = "pt-BR",
67
+ PT_PT = "pt-PT",
68
+ RO_RO = "ro-RO",
69
+ RU_RU = "ru-RU",
70
+ SK_SK = "sk-SK",
71
+ SV_SE = "sv-SE",
72
+ TA_IN = "ta-IN",
73
+ TA_LK = "ta-LK",
74
+ TH_TH = "th-TH",
75
+ TR_TR = "tr-TR",
76
+ ZH_CN = "zh-CN",
77
+ ZH_HK = "zh-HK",
78
+ ZH_TW = "zh-TW"
79
+ }
80
+
81
+ declare const flowMediaData: z.ZodObject<{
82
+ media_id: z.ZodString;
83
+ cdn_url: z.ZodString;
84
+ file_name: z.ZodString;
85
+ encryption_metadata: z.ZodObject<{
86
+ encrypted_hash: z.ZodString;
87
+ iv: z.ZodString;
88
+ encryption_key: z.ZodString;
89
+ hmac_key: z.ZodString;
90
+ plaintext_hash: z.ZodString;
91
+ }, "strip", z.ZodTypeAny, {
92
+ encrypted_hash: string;
93
+ iv: string;
94
+ encryption_key: string;
95
+ hmac_key: string;
96
+ plaintext_hash: string;
97
+ }, {
98
+ encrypted_hash: string;
99
+ iv: string;
100
+ encryption_key: string;
101
+ hmac_key: string;
102
+ plaintext_hash: string;
103
+ }>;
104
+ }, "strip", z.ZodTypeAny, {
105
+ media_id: string;
106
+ cdn_url: string;
107
+ file_name: string;
108
+ encryption_metadata: {
109
+ encrypted_hash: string;
110
+ iv: string;
111
+ encryption_key: string;
112
+ hmac_key: string;
113
+ plaintext_hash: string;
114
+ };
115
+ }, {
116
+ media_id: string;
117
+ cdn_url: string;
118
+ file_name: string;
119
+ encryption_metadata: {
120
+ encrypted_hash: string;
121
+ iv: string;
122
+ encryption_key: string;
123
+ hmac_key: string;
124
+ plaintext_hash: string;
125
+ };
126
+ }>;
127
+ type FlowMediaData = z.infer<typeof flowMediaData>;
128
+
129
+ declare function decryptFlowMedia(media: FlowMediaData[]): Promise<Buffer<ArrayBufferLike>[]>;
130
+
131
+ declare function encryptFlowResponse(data: AnyType, encryptionMetadata: {
132
+ aesKeyBuffer: Buffer;
133
+ initialVectorBuffer: Buffer;
134
+ }): string;
135
+
136
+ declare const flowAction: z.ZodEnum<["INIT", "BACK", "data_exchange", "navigate", "ping"]>;
137
+ type FlowAction = z.infer<typeof flowAction>;
138
+
139
+ declare const flowScreen: z.ZodUnion<[z.ZodLiteral<"SUCCESS">, z.ZodString]>;
140
+ type FlowScreen = z.infer<typeof flowScreen>;
141
+
142
+ interface WhatsappFlowDecryptedWebhookBody {
143
+ version: "3.0";
144
+ screen: FlowScreen;
145
+ action: FlowAction;
146
+ data: Record<string, AnyType>;
147
+ flow_token: string;
148
+ }
149
+ interface WhatsappFlowResponse {
150
+ screen: FlowScreen;
151
+ data: Record<string, AnyType>;
152
+ }
153
+ interface WhatsappFlowPingResponse {
154
+ data: {
155
+ status: "active";
156
+ };
157
+ }
158
+ interface WhatsappFlowEncryptionData {
159
+ aesKeyBuffer: Buffer;
160
+ initialVectorBuffer: Buffer;
161
+ }
162
+ interface WhatsappFlowEncryptedWebhookBody {
163
+ encrypted_aes_key: string;
164
+ encrypted_flow_data: string;
165
+ initial_vector: string;
166
+ }
167
+ type WhatsappFlowErrorMessages<T> = Partial<Record<keyof T, string>>;
168
+ interface WhatsappFlowInfo {
169
+ id: string;
170
+ mode: "draft" | "published";
171
+ name: string;
172
+ }
173
+
38
174
  declare const endpoints: {
39
175
  flows: {
40
176
  create: Endpoint<"/{waba_id}/flows", "post", {
@@ -217,59 +353,8 @@ declare const flowsEndpoints: {
217
353
  publish: Endpoint<"/{flow_id}/publish", "post", IRequest, WhatsappPublishFlowResponse>;
218
354
  };
219
355
 
220
- declare const flowAction: z.ZodEnum<["INIT", "BACK", "data_exchange", "navigate", "ping"]>;
221
- type FlowAction = z.infer<typeof flowAction>;
222
-
223
356
  type FlowData<K extends string = string> = Record<K, AnyType>;
224
357
 
225
- declare const flowMediaData: z.ZodObject<{
226
- media_id: z.ZodString;
227
- cdn_url: z.ZodString;
228
- file_name: z.ZodString;
229
- encryption_metadata: z.ZodObject<{
230
- encrypted_hash: z.ZodString;
231
- iv: z.ZodString;
232
- encryption_key: z.ZodString;
233
- hmac_key: z.ZodString;
234
- plaintext_hash: z.ZodString;
235
- }, "strip", z.ZodTypeAny, {
236
- encrypted_hash: string;
237
- iv: string;
238
- encryption_key: string;
239
- hmac_key: string;
240
- plaintext_hash: string;
241
- }, {
242
- encrypted_hash: string;
243
- iv: string;
244
- encryption_key: string;
245
- hmac_key: string;
246
- plaintext_hash: string;
247
- }>;
248
- }, "strip", z.ZodTypeAny, {
249
- media_id: string;
250
- cdn_url: string;
251
- file_name: string;
252
- encryption_metadata: {
253
- encrypted_hash: string;
254
- iv: string;
255
- encryption_key: string;
256
- hmac_key: string;
257
- plaintext_hash: string;
258
- };
259
- }, {
260
- media_id: string;
261
- cdn_url: string;
262
- file_name: string;
263
- encryption_metadata: {
264
- encrypted_hash: string;
265
- iv: string;
266
- encryption_key: string;
267
- hmac_key: string;
268
- plaintext_hash: string;
269
- };
270
- }>;
271
- type FlowMediaData = z.infer<typeof flowMediaData>;
272
-
273
358
  declare const flowMetadata: z.ZodObject<{
274
359
  name: z.ZodString;
275
360
  categories: z.ZodArray<z.ZodEnum<["SIGN_UP", "SIGN_IN", "APPOINTMENT_BOOKING", "LEAD_GENERATION", "CONTACT_US", "CUSTOMER_SUPPORT", "SURVEY", "OTHER"]>, "many">;
@@ -288,11 +373,8 @@ declare const flowMetadata: z.ZodObject<{
288
373
  }>;
289
374
  type FlowMetadata = z.infer<typeof flowMetadata>;
290
375
 
291
- declare const flowScreen: z.ZodUnion<[z.ZodLiteral<"SUCCESS">, z.ZodString]>;
292
- type FlowScreen = z.infer<typeof flowScreen>;
293
-
294
376
  type WaOutgoingContactsMessage = Array<{
295
- addresses: Array<Partial<{
377
+ addresses?: Array<Partial<{
296
378
  street: string;
297
379
  city: string;
298
380
  state: string;
@@ -301,8 +383,8 @@ type WaOutgoingContactsMessage = Array<{
301
383
  country_code: string;
302
384
  type: string;
303
385
  }>>;
304
- birthday: `${number}${number}${number}${number}-${number}${number}-${number}${number}`;
305
- emails: Array<Partial<{
386
+ birthday?: `${number}${number}${number}${number}-${number}${number}-${number}${number}`;
387
+ emails?: Array<Partial<{
306
388
  email: string;
307
389
  type: string;
308
390
  }>>;
@@ -314,17 +396,17 @@ type WaOutgoingContactsMessage = Array<{
314
396
  prefix?: string;
315
397
  suffix?: string;
316
398
  };
317
- org: Partial<{
399
+ org?: Partial<{
318
400
  company: string;
319
401
  department: string;
320
402
  title: string;
321
403
  }>;
322
- phones: Array<Partial<{
404
+ phones: Array<{
323
405
  phone: string;
324
- type: string;
325
- wa_id: string;
326
- }>>;
327
- urls: Array<Partial<{
406
+ type?: string;
407
+ wa_id?: string;
408
+ }>;
409
+ urls?: Array<Partial<{
328
410
  url: string;
329
411
  type: string;
330
412
  }>>;
@@ -349,10 +431,8 @@ type WaOutgoingDocumentMessage = {
349
431
  };
350
432
  type WaOutgoingAudioMessage = {
351
433
  id: string;
352
- caption?: string;
353
434
  } | {
354
435
  link: string;
355
- caption?: string;
356
436
  };
357
437
  type WaOutgoingVideoMessage = {
358
438
  id: string;
@@ -384,8 +464,10 @@ interface WaInteractiveAction {
384
464
  button?: string;
385
465
  buttons?: Array<{
386
466
  type: "reply";
387
- title: string;
388
- id: string;
467
+ reply: {
468
+ title: string;
469
+ id: string;
470
+ };
389
471
  }>;
390
472
  catalog_id?: string;
391
473
  product_retailer_id?: string;
@@ -416,13 +498,7 @@ interface WaInteractiveHeader {
416
498
  type: "text" | "video" | "image" | "document";
417
499
  }
418
500
  type WaInteractiveActionType = "button" | "catalog_message" | "list" | "product" | "product_list" | "flow";
419
- declare class WaInteractiveBase {
420
- constructor({ type, body, footer, header, }: {
421
- type: WaInteractiveActionType;
422
- body?: WaInteractiveBody;
423
- footer?: WaInteractiveFooter;
424
- header?: WaInteractiveHeader;
425
- });
501
+ interface WaInteractiveBase {
426
502
  type: WaInteractiveActionType;
427
503
  body?: WaInteractiveBody;
428
504
  footer?: WaInteractiveFooter;
@@ -444,10 +520,12 @@ interface WaOutgoingReactionMessage {
444
520
  emoji: string;
445
521
  }
446
522
 
523
+ type WhatsappLanguageTag = "af" | "sq" | "ar" | "az" | "bn" | "bg" | "ca" | "zh_CN" | "zh_HK" | "zh_TW" | "hr" | "cs" | "da" | "nl" | "en" | "en_GB" | "en_US" | "et" | "fil" | "fi" | "fr" | "de" | "el" | "gu" | "ha" | "he" | "hi" | "hu" | "id" | "ga" | "it" | "ja" | "kn" | "kk" | "ko" | "lo" | "lv" | "lt" | "mk" | "ms" | "ml" | "mr" | "nb" | "fa" | "pl" | "pt_PT" | "pt_BR" | "pa" | "ro" | "ru" | "sr" | "sk" | "sl" | "es" | "es_AR" | "es_ES" | "es_MX" | "sw" | "sv" | "ta" | "te" | "th" | "tr" | "uk" | "ur" | "uz" | "vi" | "zu";
524
+
447
525
  type WaOutgoingTemplateMessage = {
448
526
  name: string;
449
527
  language: {
450
- code: string;
528
+ code: WhatsappLanguageTag;
451
529
  };
452
530
  namespace?: string;
453
531
  components?: Array<{
@@ -503,7 +581,9 @@ type WaIncomingContacts = Array<WaIncomingContactObject>;
503
581
  type WhatsappSendMessageRequestConfig = {
504
582
  to: string;
505
583
  preview_url?: boolean;
506
- context?: string;
584
+ context?: {
585
+ message_id: string;
586
+ };
507
587
  biz_opaque_callback_data?: string;
508
588
  recipient_type?: "individual";
509
589
  messaging_product?: "whatsapp";
@@ -749,92 +829,1056 @@ type WhatsappApplicationWebhookBody = {
749
829
  }>;
750
830
  };
751
831
 
752
- interface WhatsappFlowDecryptedWebhookBody {
753
- version: "3.0";
754
- screen: FlowScreen;
755
- action: FlowAction;
756
- data: Record<string, AnyType>;
757
- flow_token: string;
758
- }
759
- interface WhatsappFlowResponse {
760
- screen: FlowScreen;
761
- data: Record<string, AnyType>;
762
- }
763
- interface WhatsappFlowPingResponse {
764
- data: {
765
- status: "active";
766
- };
767
- }
768
- interface WhatsappFlowEncryptionData {
769
- aesKeyBuffer: Buffer;
770
- initialVectorBuffer: Buffer;
771
- }
772
- interface WhatsappFlowEncryptedWebhookBody {
773
- encrypted_aes_key: string;
774
- encrypted_flow_data: string;
775
- initial_vector: string;
776
- }
777
- type WhatsappFlowErrorMessages<T> = Partial<Record<keyof T, string>>;
778
- interface WhatsappFlowInfo {
779
- id: string;
780
- mode: "draft" | "published";
781
- name: string;
782
- }
783
-
784
- declare function _delete(flow_id: string): Promise<WhatsappDeleteFlowResponse>;
785
-
786
- declare function verifyFlowIntegrity(flowID: string): Promise<string | void>;
787
-
788
- declare const unnoficial_verifyFlowIntegrity: typeof verifyFlowIntegrity;
789
- declare namespace unnoficial {
790
- export { unnoficial_verifyFlowIntegrity as verifyFlowIntegrity };
791
- }
792
-
793
- type WaSDKButtonMessage = Omit<WaInteractiveBase, "type"> & {
794
- type: "button";
795
- buttons: Array<{
796
- id: string;
797
- text: string;
798
- }>;
799
- };
800
-
801
- interface FlowPayload {
802
- screen: string;
803
- data?: Record<string, AnyType>;
804
- }
805
- interface BaseFlowConfig {
806
- name: string;
807
- buttonText: string;
808
- parameters?: Record<string, string | number>;
809
- mode?: "draft" | "published";
810
- }
811
- interface NavigateFlowConfig extends BaseFlowConfig {
812
- action?: "navigate";
813
- payload: FlowPayload;
814
- }
815
- interface DataExchangeFlowConfig extends BaseFlowConfig {
816
- action?: "data_exchange";
817
- payload?: FlowPayload;
818
- }
819
- type FlowConfig = NavigateFlowConfig | DataExchangeFlowConfig;
820
- type WaSDKOutgoingFlowMessage = Omit<WaInteractiveBase, "type"> & {
821
- type: "flow";
822
- flow: FlowConfig;
823
- };
824
-
825
- type WaSDKOutgoingListMessage = Omit<WaInteractiveBase, "type"> & {
826
- type: "list";
827
- list: {
828
- buttonText: string;
829
- sections: Array<{
830
- rows: Array<{
831
- id: string;
832
- title: string;
833
- description?: string;
834
- }>;
835
- title: string;
836
- }>;
837
- };
832
+ /**
833
+ * Cloud API Error Codes
834
+ *
835
+ * Enum representing specific error codes returned by the Cloud API.
836
+ */
837
+ declare enum WhatsappErrorCode {
838
+ /**
839
+ * Error Code: 0
840
+ *
841
+ * Details:
842
+ * AuthException
843
+ *
844
+ * Description:
845
+ * We were unable to authenticate the app user. Typically this means the included access token has expired, been invalidated, or the app user has changed a setting to prevent all apps from accessing their data.
846
+ *
847
+ * Solution:
848
+ * We recommend that you get a new access token from the app user.
849
+ *
850
+ * HTTP Response:
851
+ * 401 - Unauthorized
852
+ */
853
+ e0AuthException = 0,
854
+ /**
855
+ * Error Code: 3
856
+ *
857
+ * Details:
858
+ * API Method
859
+ *
860
+ * Description:
861
+ * Capability or permissions issue.
862
+ *
863
+ * Solution:
864
+ * Use the access token debugger to verify that your app has been granted the permissions required by the endpoint.
865
+ *
866
+ * HTTP Response:
867
+ * 500 - Internal Server Error
868
+ */
869
+ e3ApiMethod = 3,
870
+ /**
871
+ * Error Code: 10
872
+ *
873
+ * Details:
874
+ * Permission Denied
875
+ *
876
+ * Description:
877
+ * Permission is either not granted or has been removed.
878
+ *
879
+ * Solution:
880
+ * Use the access token debugger to verify that your app has been granted the permissions required by the endpoint. Ensure that the phone number used to set the business public key is allowlisted.
881
+ *
882
+ * HTTP Response:
883
+ * 403 - Forbidden
884
+ */
885
+ e10PermissionDenied = 10,
886
+ /**
887
+ * Error Code: 190
888
+ *
889
+ * Details:
890
+ * Access token has expired
891
+ *
892
+ * Description:
893
+ * Your access token has expired.
894
+ *
895
+ * Solution:
896
+ * Get a new access token.
897
+ *
898
+ * HTTP Response:
899
+ * 401 - Unauthorized
900
+ */
901
+ e190AccessTokenExpired = 190,
902
+ /**
903
+ * Error Code: 200-299
904
+ *
905
+ * Details:
906
+ * API Permission
907
+ *
908
+ * Description:
909
+ * Permission is either not granted or has been removed within the 200-299 range of API Permission errors.
910
+ *
911
+ * Solution:
912
+ * Use the access token debugger to verify that your app has been granted the permissions required by the endpoint.
913
+ *
914
+ * HTTP Response:
915
+ * 403 - Forbidden
916
+ */
917
+ e2xxApiPermission = 200,
918
+ /**
919
+ * Error Code: 368
920
+ *
921
+ * Details:
922
+ * Temporarily blocked for policies violations
923
+ *
924
+ * Description:
925
+ * The WhatsApp Business Account associated with the app has been restricted or disabled for violating a platform policy.
926
+ *
927
+ * Solution:
928
+ * See the Policy Enforcement document to learn about policy violations and how to resolve them.
929
+ *
930
+ * HTTP Response:
931
+ * 403 - Forbidden
932
+ */
933
+ e368TemporarilyBlockedForPolicyViolations = 368,
934
+ /**
935
+ * Error Code: 130497
936
+ *
937
+ * Details:
938
+ * Business account is restricted from messaging users in this country.
939
+ *
940
+ * Description:
941
+ * The WhatsApp Business Account is restricted from messaging to users in certain countries.
942
+ *
943
+ * Solution:
944
+ * See WhatsApp Business Messaging Policy for details on allowed countries for messaging in your business category.
945
+ *
946
+ * HTTP Response:
947
+ * 403 - Forbidden
948
+ */
949
+ e130497BusinessAccountRestrictedByCountry = 130497,
950
+ /**
951
+ * Error Code: 131031
952
+ *
953
+ * Details:
954
+ * Account has been locked
955
+ *
956
+ * Description:
957
+ * The WhatsApp Business Account associated with the app has been restricted or disabled for violating a platform policy, or we were unable to verify data included in the request against data set on the WhatsApp Business Account (e.g, the two-step pin included in the request is incorrect).
958
+ *
959
+ * Solution:
960
+ * See the Policy Enforcement document to learn about policy violations and how to resolve them. You can also use the Health Status API, which may provide additional insight into the reason or reasons for the account lock.
961
+ *
962
+ * HTTP Response:
963
+ * 403 - Forbidden
964
+ */
965
+ e131031AccountLocked = 131031,
966
+ /**
967
+ * Error Code: 1
968
+ *
969
+ * Details:
970
+ * API Unknown
971
+ *
972
+ * Description:
973
+ * Invalid request or possible server error.
974
+ *
975
+ * Solution:
976
+ * Check the WhatsApp Business Platform Status page to see API status information. If there are no server outages, check the endpoint reference and verify that your request is formatted correctly and meets all endpoint requirements.
977
+ *
978
+ * HTTP Response:
979
+ * 400 - Bad Request
980
+ */
981
+ e1ApiUnknown = 1,
982
+ /**
983
+ * Error Code: 2
984
+ *
985
+ * Details:
986
+ * API Service
987
+ *
988
+ * Description:
989
+ * Temporary due to downtime or due to being overloaded.
990
+ *
991
+ * Solution:
992
+ * Check the WhatsApp Business Platform Status page to see API status information before trying again.
993
+ *
994
+ * HTTP Response:
995
+ * 503 - Service Unavailable
996
+ */
997
+ e2ApiService = 2,
998
+ /**
999
+ * Error Code: 33
1000
+ *
1001
+ * Details:
1002
+ * Parameter value is not valid
1003
+ *
1004
+ * Description:
1005
+ * The business phone number has been deleted.
1006
+ *
1007
+ * Solution:
1008
+ * Verify that the business phone number is correct.
1009
+ *
1010
+ * HTTP Response:
1011
+ * 400 - Bad Request
1012
+ */
1013
+ e33ParameterValueNotValid = 33,
1014
+ /**
1015
+ * Error Code: 100
1016
+ *
1017
+ * Details:
1018
+ * Invalid parameter
1019
+ *
1020
+ * Description:
1021
+ * The request included one or more unsupported or misspelled parameters.
1022
+ *
1023
+ * Solution:
1024
+ * See the endpoint's reference to determine which parameters are supported and how they are spelled. Ensure when setting the business public key, it is a valid 2048-bit RSA public key in PEM format. Ensure there is no mismatch between the phone number id you are registering and a previously stored phone number id. Ensure your parameter is under any length restriction for the type.
1025
+ *
1026
+ * HTTP Response:
1027
+ * 400 - Bad Request
1028
+ */
1029
+ e100InvalidParameter = 100,
1030
+ /**
1031
+ * Error Code: 130472
1032
+ *
1033
+ * Details:
1034
+ * User's number is part of an experiment
1035
+ *
1036
+ * Description:
1037
+ * Message was not sent as part of an experiment.
1038
+ *
1039
+ * Solution:
1040
+ * See Marketing Message Experiment.
1041
+ *
1042
+ * HTTP Response:
1043
+ * 400 - Bad Request
1044
+ */
1045
+ e130472UserNumberPartOfExperiment = 130472,
1046
+ /**
1047
+ * Error Code: 131000
1048
+ *
1049
+ * Details:
1050
+ * Something went wrong
1051
+ *
1052
+ * Description:
1053
+ * Message failed to send due to an unknown error. When setting a business public key, it either failed to calculate the signature, call the GraphQL endpoint, or the GraphQL endpoint returned an error.
1054
+ *
1055
+ * Solution:
1056
+ * Try again. If the error persists, open a Direct Support ticket.
1057
+ *
1058
+ * HTTP Response:
1059
+ * 500 - Internal Server Error
1060
+ */
1061
+ e131000SomethingWentWrong = 131000,
1062
+ /**
1063
+ * Error Code: 131005
1064
+ *
1065
+ * Details:
1066
+ * Access denied
1067
+ *
1068
+ * Description:
1069
+ * Permission is either not granted or has been removed.
1070
+ *
1071
+ * Solution:
1072
+ * Use the access token debugger to verify that your app has been granted the permissions required by the endpoint.
1073
+ *
1074
+ * HTTP Response:
1075
+ * 403 - Forbidden
1076
+ */
1077
+ e131005AccessDenied = 131005,
1078
+ /**
1079
+ * Error Code: 131008
1080
+ *
1081
+ * Details:
1082
+ * Required parameter is missing
1083
+ *
1084
+ * Description:
1085
+ * The request is missing a required parameter.
1086
+ *
1087
+ * Solution:
1088
+ * See the endpoint's reference to determine which parameters are required.
1089
+ *
1090
+ * HTTP Response:
1091
+ * 400 - Bad Request
1092
+ */
1093
+ e131008RequiredParameterMissing = 131008,
1094
+ /**
1095
+ * Error Code: 131009
1096
+ *
1097
+ * Details:
1098
+ * Parameter value is not valid
1099
+ *
1100
+ * Description:
1101
+ * One or more parameter values are invalid.
1102
+ *
1103
+ * Solution:
1104
+ * See the endpoint's reference to determine which values are supported for each parameter, and see Phone Numbers to learn how to add a phone number to a WhatsApp Business Account.
1105
+ *
1106
+ * HTTP Response:
1107
+ * 400 - Bad Request
1108
+ */
1109
+ e131009ParameterValueNotValid = 131009,
1110
+ /**
1111
+ * Error Code: 131016
1112
+ *
1113
+ * Details:
1114
+ * Service unavailable
1115
+ *
1116
+ * Description:
1117
+ * A service is temporarily unavailable.
1118
+ *
1119
+ * Solution:
1120
+ * Check the WhatsApp Business Platform Status page to see API status information before trying again.
1121
+ *
1122
+ * HTTP Response:
1123
+ * 500 - Internal Server Error
1124
+ */
1125
+ e131016ServiceUnavailable = 131016,
1126
+ /**
1127
+ * Error Code: 131021
1128
+ *
1129
+ * Details:
1130
+ * Recipient cannot be sender
1131
+ *
1132
+ * Description:
1133
+ * The sender and recipient phone numbers are the same.
1134
+ *
1135
+ * Solution:
1136
+ * Send a message to a different phone number than the sender.
1137
+ *
1138
+ * HTTP Response:
1139
+ * 400 - Bad Request
1140
+ */
1141
+ e131021RecipientCannotBeSender = 131021,
1142
+ /**
1143
+ * Error Code: 131026
1144
+ *
1145
+ * Details:
1146
+ * Message Undeliverable
1147
+ *
1148
+ * Description:
1149
+ * Unable to deliver message. Reasons can include: The recipient phone number is not a WhatsApp phone number. Recipient has not accepted our new Terms of Service and Privacy Policy. Recipient using an old WhatsApp version; must use the following WhatsApp version or greater: Android: 2.21.15.15, SMBA: 2.21.15.15, iOS: 2.21.170.4, SMBI: 2.21.170.4, KaiOS: 2.2130.10, Web: 2.2132.6.
1150
+ *
1151
+ * Solution:
1152
+ * Using a non-WhatsApp communication method, ask the WhatsApp user to: Confirm that they can actually send a message to your WhatsApp business phone number. Confirm that they have accepted our latest Terms of Service (Settings > Help, or Settings > Application information will prompt them to accept the latest terms/policies if they haven't done so already). Update to the latest version of the WhatsApp client.
1153
+ *
1154
+ * HTTP Response:
1155
+ * 400 - Bad Request
1156
+ */
1157
+ e131026MessageUndeliverable = 131026,
1158
+ /**
1159
+ * Error Code: 131030
1160
+ *
1161
+ * Details:
1162
+ * Recipient not allowed in list
1163
+ *
1164
+ * Description:
1165
+ * Recipient phone number not in allowed list.
1166
+ *
1167
+ * Solution:
1168
+ * Add recipient phone number to recipient list and try again.
1169
+ *
1170
+ * HTTP Response:
1171
+ * 400 - Bad Request
1172
+ */
1173
+ e131030RecipientNotAllowedInList = 131030,
1174
+ /**
1175
+ * Error Code: 131037
1176
+ *
1177
+ * Details:
1178
+ * WhatsApp provided number needs display name approval before message can be sent.
1179
+ *
1180
+ * Description:
1181
+ * The 555 business phone number used to send the request does not have an approved display name.
1182
+ *
1183
+ * Solution:
1184
+ * Change the 555 business phone number's display name. See our How to change your WhatsApp Business display name Help Center article to learn how.
1185
+ *
1186
+ * HTTP Response:
1187
+ * 400 - Bad Request
1188
+ */
1189
+ e131037DisplayNameApprovalNeeded = 131037,
1190
+ /**
1191
+ * Error Code: 131042
1192
+ *
1193
+ * Details:
1194
+ * Business eligibility payment issue
1195
+ *
1196
+ * Description:
1197
+ * There was an error related to your payment method.
1198
+ *
1199
+ * Solution:
1200
+ * See About Billing For Your WhatsApp Business Account and verify that you have set up billing correctly. Common problems: Payment account is not attached to a WhatsApp Business Account, Credit line is over the limit, Credit line (Payment Account) not set or active, WhatsApp Business Account is deleted, WhatsApp Business Account is suspended, Timezone not set, Currency not set, MessagingFor request (On Behalf Of) is pending or declined.
1201
+ *
1202
+ * HTTP Response:
1203
+ * 400 - Bad Request
1204
+ */
1205
+ e131042BusinessEligibilityPaymentIssue = 131042,
1206
+ /**
1207
+ * Error Code: 131045
1208
+ *
1209
+ * Details:
1210
+ * Incorrect certificate
1211
+ *
1212
+ * Description:
1213
+ * Message failed to send due to a phone number registration error.
1214
+ *
1215
+ * Solution:
1216
+ * Register the phone number before trying again.
1217
+ *
1218
+ * HTTP Response:
1219
+ * 500 - Internal Server Error
1220
+ */
1221
+ e131045IncorrectCertificate = 131045,
1222
+ /**
1223
+ * Error Code: 131047
1224
+ *
1225
+ * Details:
1226
+ * Re-engagement message
1227
+ *
1228
+ * Description:
1229
+ * More than 24 hours have passed since the recipient last replied to the sender number.
1230
+ *
1231
+ * Solution:
1232
+ * Send the recipient a business-initiated message using a message template instead.
1233
+ *
1234
+ * HTTP Response:
1235
+ * 400 - Bad Request
1236
+ */
1237
+ e131047ReEngagementMessage = 131047,
1238
+ /**
1239
+ * Error Code: 131049
1240
+ *
1241
+ * Details:
1242
+ * Meta chose not to deliver.
1243
+ *
1244
+ * Description:
1245
+ * This message was not delivered to maintain healthy ecosystem engagement.
1246
+ *
1247
+ * Solution:
1248
+ * Do not retry immediately if you do receive this error code and suspect it is due to the limit. Instead, retry in increasing larger time increments until the message is delivered, since the limit may be in effect for differing periods of time. See Per-User Marketing Template Message Limits for additional information.
1249
+ *
1250
+ * HTTP Response:
1251
+ * 400 - Bad Request
1252
+ */
1253
+ e131049MetaChoseNotToDeliver = 131049,
1254
+ /**
1255
+ * Error Code: 131050
1256
+ *
1257
+ * Details:
1258
+ * User has stopped receipt of marketing messages.
1259
+ *
1260
+ * Description:
1261
+ * Unable to deliver the message. This recipient has chosen to stop receiving marketing messages on WhatsApp from your business.
1262
+ *
1263
+ * Solution:
1264
+ * Do not retry sending messages to this user as they will not be received. To be notified whenever a WhatsApp user stops or resumes delivery of marketing template messages from your business, subscribe to the user_preferences webhook.
1265
+ *
1266
+ * HTTP Response:
1267
+ * 400 - Bad Request
1268
+ */
1269
+ e131050UserStoppedMarketingMessages = 131050,
1270
+ /**
1271
+ * Error Code: 131051
1272
+ *
1273
+ * Details:
1274
+ * Unsupported message type
1275
+ *
1276
+ * Description:
1277
+ * Unsupported message type.
1278
+ *
1279
+ * Solution:
1280
+ * See Messages for supported message types before trying again with a supported message type.
1281
+ *
1282
+ * HTTP Response:
1283
+ * 400 - Bad Request
1284
+ */
1285
+ e131051UnsupportedMessageType = 131051,
1286
+ /**
1287
+ * Error Code: 131052
1288
+ *
1289
+ * Details:
1290
+ * Media download error
1291
+ *
1292
+ * Description:
1293
+ * Unable to download the media sent by the user.
1294
+ *
1295
+ * Solution:
1296
+ * We were unable to download media included in the WhatsApp user's message. For more information, refer to the error.error_data.details value in any messages webhooks triggered when this message was received. Ask the WhatsApp user to send you the media file using a non-WhatsApp method.
1297
+ *
1298
+ * HTTP Response:
1299
+ * 400 - Bad Request
1300
+ */
1301
+ e131052MediaDownloadError = 131052,
1302
+ /**
1303
+ * Error Code: 131053
1304
+ *
1305
+ * Details:
1306
+ * Media upload error
1307
+ *
1308
+ * Description:
1309
+ * Unable to upload the media used in the message.
1310
+ *
1311
+ * Solution:
1312
+ * We were unable to upload the media for one or more reasons, such as an unsupported media type. For more information, refer to the error.error_data.details value in any messages webhooks triggered when this message fails to send. We recommend that you inspect any media files that are causing errors and confirm that they are in fact supported. For example, in UNIX you can use file inspection via the command line to determine its MIME type: file -I rejected-file.mov You can then confirm if its MIME type is supported. See Supported Media Types.
1313
+ *
1314
+ * HTTP Response:
1315
+ * 400 - Bad Request
1316
+ */
1317
+ e131053MediaUploadError = 131053,
1318
+ /**
1319
+ * Error Code: 131057
1320
+ *
1321
+ * Details:
1322
+ * Account in maintenance mode
1323
+ *
1324
+ * Description:
1325
+ * Business Account is in maintenance mode. The WhatsApp Business Account is in maintenance mode. One reason for this could be that the account is undergoing a throughput upgrade.
1326
+ *
1327
+ * Solution:
1328
+ * (No specific solution provided, implies waiting or contact support.)
1329
+ *
1330
+ * HTTP Response:
1331
+ * 500 - Bad Request
1332
+ */
1333
+ e131057AccountInMaintenanceMode = 131057,
1334
+ /**
1335
+ * Error Code: 132000
1336
+ *
1337
+ * Details:
1338
+ * Template Param Count Mismatch
1339
+ *
1340
+ * Description:
1341
+ * The number of variable parameter values included in the request did not match the number of variable parameters defined in the template.
1342
+ *
1343
+ * Solution:
1344
+ * See Message Template Guidelines and make sure the request includes all of the variable parameter values that have been defined in the template.
1345
+ *
1346
+ * HTTP Response:
1347
+ * 400 - Bad Request
1348
+ */
1349
+ e132000TemplateParamCountMismatch = 132000,
1350
+ /**
1351
+ * Error Code: 132001
1352
+ *
1353
+ * Details:
1354
+ * Template does not exist
1355
+ *
1356
+ * Description:
1357
+ * The template does not exist in the specified language or the template has not been approved.
1358
+ *
1359
+ * Solution:
1360
+ * Make sure your template has been approved and the template name and language locale are correct. Please ensure you follow message template guidelines.
1361
+ *
1362
+ * HTTP Response:
1363
+ * 404 - Not Found
1364
+ */
1365
+ e132001TemplateDoesNotExist = 132001,
1366
+ /**
1367
+ * Error Code: 132005
1368
+ *
1369
+ * Details:
1370
+ * Template Hydrated Text Too Long
1371
+ *
1372
+ * Description:
1373
+ * Translated text is too long.
1374
+ *
1375
+ * Solution:
1376
+ * Check the WhatsApp Manager to verify that your template has been translated. See Quality Rating and Template Status.
1377
+ *
1378
+ * HTTP Response:
1379
+ * 400 - Bad Request
1380
+ */
1381
+ e132005TemplateHydratedTextTooLong = 132005,
1382
+ /**
1383
+ * Error Code: 132007
1384
+ *
1385
+ * Details:
1386
+ * Template Format Character Policy Violated
1387
+ *
1388
+ * Description:
1389
+ * Template content violates a WhatsApp policy.
1390
+ *
1391
+ * Solution:
1392
+ * See Rejection Reasons to determine possible reasons for violation.
1393
+ *
1394
+ * HTTP Response:
1395
+ * 400 - Bad Request
1396
+ */
1397
+ e132007TemplateFormatCharacterPolicyViolated = 132007,
1398
+ /**
1399
+ * Error Code: 132012
1400
+ *
1401
+ * Details:
1402
+ * Template Parameter Format Mismatch
1403
+ *
1404
+ * Description:
1405
+ * Variable parameter values formatted incorrectly.
1406
+ *
1407
+ * Solution:
1408
+ * The variable parameter values included in the request are not using the format specified in the template. See Message Template Guidelines.
1409
+ *
1410
+ * HTTP Response:
1411
+ * 400 - Bad Request
1412
+ */
1413
+ e132012TemplateParameterFormatMismatch = 132012,
1414
+ /**
1415
+ * Error Code: 132015
1416
+ *
1417
+ * Details:
1418
+ * Template is Paused
1419
+ *
1420
+ * Description:
1421
+ * Template is paused due to low quality so it cannot be sent in a template message.
1422
+ *
1423
+ * Solution:
1424
+ * Edit the template to improve its quality and try again once it is approved.
1425
+ *
1426
+ * HTTP Response:
1427
+ * 400 - Bad Request
1428
+ */
1429
+ e132015TemplateIsPaused = 132015,
1430
+ /**
1431
+ * Error Code: 132016
1432
+ *
1433
+ * Details:
1434
+ * Template is Disabled
1435
+ *
1436
+ * Description:
1437
+ * Template has been paused too many times due to low quality and is now permanently disabled.
1438
+ *
1439
+ * Solution:
1440
+ * Create a new template with different content.
1441
+ *
1442
+ * HTTP Response:
1443
+ * 400 - Bad Request
1444
+ */
1445
+ e132016TemplateIsDisabled = 132016,
1446
+ /**
1447
+ * Error Code: 132068
1448
+ *
1449
+ * Details:
1450
+ * Flow is blocked
1451
+ *
1452
+ * Description:
1453
+ * Flow is in blocked state.
1454
+ *
1455
+ * Solution:
1456
+ * Correct the Flow.
1457
+ *
1458
+ * HTTP Response:
1459
+ * 400 - Bad Request
1460
+ */
1461
+ e132068FlowIsBlocked = 132068,
1462
+ /**
1463
+ * Error Code: 132069
1464
+ *
1465
+ * Details:
1466
+ * Flow is throttled
1467
+ *
1468
+ * Description:
1469
+ * Flow is in throttled state and 10 messages using this flow were already sent in the last hour.
1470
+ *
1471
+ * Solution:
1472
+ * Correct the Flow.
1473
+ *
1474
+ * HTTP Response:
1475
+ * 400 - Bad Request
1476
+ */
1477
+ e132069FlowIsThrottled = 132069,
1478
+ /**
1479
+ * Error Code: 133000
1480
+ *
1481
+ * Details:
1482
+ * Incomplete Deregistration
1483
+ *
1484
+ * Description:
1485
+ * A previous deregistration attempt failed.
1486
+ *
1487
+ * Solution:
1488
+ * Deregister the number again before registering.
1489
+ *
1490
+ * HTTP Response:
1491
+ * 500 - Internal Server Error
1492
+ */
1493
+ e133000IncompleteDeregistration = 133000,
1494
+ /**
1495
+ * Error Code: 133004
1496
+ *
1497
+ * Details:
1498
+ * Server Temporarily Unavailable
1499
+ *
1500
+ * Description:
1501
+ * Server is temporarily unavailable.
1502
+ *
1503
+ * Solution:
1504
+ * Check the WhatsApp Business Platform Status page to see API status information and check the response details value before trying again.
1505
+ *
1506
+ * HTTP Response:
1507
+ * 503 - Service Unavailable
1508
+ */
1509
+ e133004ServerTemporarilyUnavailable = 133004,
1510
+ /**
1511
+ * Error Code: 133005
1512
+ *
1513
+ * Details:
1514
+ * Two step verification PIN Mismatch
1515
+ *
1516
+ * Description:
1517
+ * Two-step verification PIN incorrect.
1518
+ *
1519
+ * Solution:
1520
+ * Verify that the two-step verification PIN included in the request is correct. To reset the two-step verification PIN: Disable two-step verification. Send a POST request that includes the new PIN to the Phone Number endpoint.
1521
+ *
1522
+ * HTTP Response:
1523
+ * 400 - Bad Request
1524
+ */
1525
+ e133005TwoStepVerificationPinMismatch = 133005,
1526
+ /**
1527
+ * Error Code: 133006
1528
+ *
1529
+ * Details:
1530
+ * Phone number re-verification needed
1531
+ *
1532
+ * Description:
1533
+ * Phone number needs to be verified before registering.
1534
+ *
1535
+ * Solution:
1536
+ * Verify the phone number before registering it.
1537
+ *
1538
+ * HTTP Response:
1539
+ * 400 - Bad Request
1540
+ */
1541
+ e133006PhoneNumberReVerificationNeeded = 133006,
1542
+ /**
1543
+ * Error Code: 133008
1544
+ *
1545
+ * Details:
1546
+ * Too Many two step verification PIN Guesses
1547
+ *
1548
+ * Description:
1549
+ * Too many two-step verification PIN guesses for this phone number.
1550
+ *
1551
+ * Solution:
1552
+ * Try again after the amount of time specified in the details response value.
1553
+ *
1554
+ * HTTP Response:
1555
+ * 400 - Bad Request
1556
+ */
1557
+ e133008TooManyTwoStepVerificationPinGuesses = 133008,
1558
+ /**
1559
+ * Error Code: 133009
1560
+ *
1561
+ * Details:
1562
+ * Two step verification PIN Guessed Too Fast
1563
+ *
1564
+ * Description:
1565
+ * Two-step verification PIN was entered too quickly.
1566
+ *
1567
+ * Solution:
1568
+ * Check the details response value before trying again.
1569
+ *
1570
+ * HTTP Response:
1571
+ * 400 - Bad Request
1572
+ */
1573
+ e133009TwoStepVerificationPinGuessedTooFast = 133009,
1574
+ /**
1575
+ * Error Code: 133010
1576
+ *
1577
+ * Details:
1578
+ * Phone number Not Registered
1579
+ *
1580
+ * Description:
1581
+ * Phone number not registered on the WhatsApp Business Platform.
1582
+ *
1583
+ * Solution:
1584
+ * Register the phone number before trying again.
1585
+ *
1586
+ * HTTP Response:
1587
+ * 400 - Bad Request
1588
+ */
1589
+ e133010PhoneNumberNotRegistered = 133010,
1590
+ /**
1591
+ * Error Code: 133015
1592
+ *
1593
+ * Details:
1594
+ * Please wait a few minutes before attempting to register this phone number
1595
+ *
1596
+ * Description:
1597
+ * The phone number you are attempting to register was recently deleted, and deletion has not yet completed.
1598
+ *
1599
+ * Solution:
1600
+ * Wait 5 minutes before re-trying the request.
1601
+ *
1602
+ * HTTP Response:
1603
+ * 400 - Bad Request
1604
+ */
1605
+ e133015PhoneNumberDeletionPending = 133015,
1606
+ /**
1607
+ * Error Code: 134011
1608
+ *
1609
+ * Details:
1610
+ * WhatsApp Payments terms of service has not been accepted
1611
+ *
1612
+ * Description:
1613
+ * Message failed to send because WhatsApp Payments terms of service acceptance is pending for this WhatsApp Business Account.
1614
+ *
1615
+ * Solution:
1616
+ * Accept the WhatsApp Payments terms of service using the link provided in the error message before trying again.
1617
+ *
1618
+ * HTTP Response:
1619
+ * 400 - Bad Request
1620
+ */
1621
+ e134011PaymentsTermsNotAccepted = 134011,
1622
+ /**
1623
+ * Error Code: 135000
1624
+ *
1625
+ * Details:
1626
+ * Generic user error
1627
+ *
1628
+ * Description:
1629
+ * Message failed to send because of an unknown error with your request parameters.
1630
+ *
1631
+ * Solution:
1632
+ * See the endpoint's reference to determine if you are querying the endpoint using the correct syntax. Contact customer support if you continue receiving this error code in response.
1633
+ *
1634
+ * HTTP Response:
1635
+ * 400 - Bad Request
1636
+ */
1637
+ e135000GenericUserError = 135000,
1638
+ /**
1639
+ * Error Code: 2593107
1640
+ *
1641
+ * Details:
1642
+ * Synchronization Request limit exceeded
1643
+ *
1644
+ * Description:
1645
+ * You have exceeded the maximum number of times to call the synchronization API for this phone number.
1646
+ *
1647
+ * Solution:
1648
+ * You can only call this endpoint once to synchronize the business phone number contacts and once to synchronize its messaging history. See Onboarding business app users. Offboard the business customer and re-onboard them.
1649
+ *
1650
+ * HTTP Response:
1651
+ * 400 - Bad Request
1652
+ */
1653
+ e2593107SynchronizationRequestLimitExceeded = 2593107,
1654
+ /**
1655
+ * Error Code: 2593108
1656
+ *
1657
+ * Details:
1658
+ * Synchronization Request made outside of allowed time window
1659
+ *
1660
+ * Description:
1661
+ * Synchronization request can only be made within 24 hours of onboarding.
1662
+ *
1663
+ * Solution:
1664
+ * You can only initiate contacts and messaging history synchronization of an onboarded WhatsApp Business app user within 24 hours of onboarding the user. See Onboarding business app users. Offboard the user and re-onboard them.
1665
+ *
1666
+ * HTTP Response:
1667
+ * 400 - Bad Request
1668
+ */
1669
+ e2593108SynchronizationRequestOutsideTimeWindow = 2593108,
1670
+ /**
1671
+ * Error Code: 4
1672
+ *
1673
+ * Details:
1674
+ * API Too Many Calls
1675
+ *
1676
+ * Description:
1677
+ * The app has reached its API call rate limit.
1678
+ *
1679
+ * Solution:
1680
+ * Load the app in the App Dashboard and view the Application Rate Limit section to verify that the app has reached its rate limit. If it has, try again later or reduce the frequency or amount of API queries the app is making.
1681
+ *
1682
+ * HTTP Response:
1683
+ * 400 - Bad Request
1684
+ */
1685
+ e4ApiTooManyCalls = 4,
1686
+ /**
1687
+ * Error Code: 80007
1688
+ *
1689
+ * Details:
1690
+ * Rate limit issues
1691
+ *
1692
+ * Description:
1693
+ * The WhatsApp Business Account has reached its rate limit.
1694
+ *
1695
+ * Solution:
1696
+ * See WhatsApp Business Account Rate Limits. Try again later or reduce the frequency or amount of API queries the app is making.
1697
+ *
1698
+ * HTTP Response:
1699
+ * 400 - Bad Request
1700
+ */
1701
+ e80007RateLimitIssues = 80007,
1702
+ /**
1703
+ * Error Code: 130429
1704
+ *
1705
+ * Details:
1706
+ * Rate limit hit
1707
+ *
1708
+ * Description:
1709
+ * Cloud API message throughput has been reached.
1710
+ *
1711
+ * Solution:
1712
+ * The app has reached the API's throughput limit. See Throughput. Try again later or reduce the frequency with which the app sends messages.
1713
+ *
1714
+ * HTTP Response:
1715
+ * 400 - Bad Request
1716
+ */
1717
+ e130429RateLimitHit = 130429,
1718
+ /**
1719
+ * Error Code: 131048
1720
+ *
1721
+ * Details:
1722
+ * Spam rate limit hit
1723
+ *
1724
+ * Description:
1725
+ * Message failed to send because there are restrictions on how many messages can be sent from this phone number. This may be because too many previous messages were blocked or flagged as spam.
1726
+ *
1727
+ * Solution:
1728
+ * Check your quality status in the WhatsApp Manager and see the Quality-Based Rate Limits documentation for more information.
1729
+ *
1730
+ * HTTP Response:
1731
+ * 400 - Bad Request
1732
+ */
1733
+ e131048SpamRateLimitHit = 131048,
1734
+ /**
1735
+ * Error Code: 131056
1736
+ *
1737
+ * Details:
1738
+ * (Business Account, Consumer Account) pair rate limit hit
1739
+ *
1740
+ * Description:
1741
+ * Too many messages sent from the sender phone number to the same recipient phone number in a short period of time.
1742
+ *
1743
+ * Solution:
1744
+ * Wait and retry the operation, if you intend to send messages to the same phone number. You can still send messages to a different phone number without waiting.
1745
+ *
1746
+ * HTTP Response:
1747
+ * 400 - Bad Request
1748
+ */
1749
+ e131056BusinessConsumerPairRateLimitHit = 131056,
1750
+ /**
1751
+ * Error Code: 133016
1752
+ *
1753
+ * Details:
1754
+ * Account register deregister rate limit exceeded
1755
+ *
1756
+ * Description:
1757
+ * Registration or Deregistration failed because there were too many attempts for this phone number in a short period of time.
1758
+ *
1759
+ * Solution:
1760
+ * The business phone number is being blocked because it has reached its registration/deregistration attempt limit. Try again once the number is unblocked. See Limitations in the Registration document.
1761
+ *
1762
+ * HTTP Response:
1763
+ * 400 - Bad Request
1764
+ */
1765
+ e133016AccountRegisterDeregisterRateLimitExceeded = 133016
1766
+ }
1767
+
1768
+ type WaSDKFlowPayload = WhatsappFlowDecryptedWebhookBody;
1769
+ type WaSDKFlowDecryptedWebhookBody = {
1770
+ payload: WaSDKFlowPayload;
1771
+ encryptionMetadata: WhatsappFlowEncryptionData;
1772
+ };
1773
+ type WaSDKFlowExchangeEventPayload = WaSDKFlowDecryptedWebhookBody & {
1774
+ pingResponse: WhatsappFlowPingResponse;
1775
+ };
1776
+
1777
+ type FlowUpdateEventPayload = {
1778
+ event: string;
1779
+ message: string;
1780
+ flow_id: string;
1781
+ };
1782
+
1783
+ interface MessageStatusUpdateEvent {
1784
+ messageId: string;
1785
+ metadata: string;
1786
+ timestamp: number;
1787
+ errors: WaIncomingErrors;
1788
+ status: WaIncomingMessageStatuses;
1789
+ }
1790
+
1791
+ interface BaseMessageReceivedEventPayload {
1792
+ id: string;
1793
+ type: WaIncomingMessageType;
1794
+ timestamp: number;
1795
+ metadata: {
1796
+ forwarded?: boolean;
1797
+ frequentlyForwarded?: boolean;
1798
+ };
1799
+ }
1800
+ type MessageReceivedEventPayload = BaseMessageReceivedEventPayload & {
1801
+ chatId: string;
1802
+ text: string | null;
1803
+ reply?: string;
1804
+ interaction?: {
1805
+ button?: {
1806
+ id: string | null;
1807
+ title: string;
1808
+ payload: string | null;
1809
+ };
1810
+ selectedOption?: {
1811
+ id: string;
1812
+ title: string;
1813
+ description: string;
1814
+ };
1815
+ flowResponse?: {
1816
+ flow_token: string;
1817
+ intent: string | null;
1818
+ } & {
1819
+ [key: string]: AnyType;
1820
+ };
1821
+ };
1822
+ media?: {
1823
+ id: string;
1824
+ caption: string | null;
1825
+ mime_type: string;
1826
+ type: "audio" | "document" | "image" | "video";
1827
+ filename?: string;
1828
+ sha256?: string;
1829
+ };
1830
+ };
1831
+
1832
+ type WaSDKButtonMessage = Omit<WaInteractiveBase, "type"> & {
1833
+ type: "button";
1834
+ buttons: Array<{
1835
+ id: string;
1836
+ text: string;
1837
+ }>;
1838
+ };
1839
+
1840
+ type WaSDKOutgoingContactMessage = {
1841
+ type: "contact";
1842
+ contacts: WaOutgoingContactsMessage;
1843
+ };
1844
+
1845
+ interface FlowPayload {
1846
+ screen: string;
1847
+ data?: Record<string, AnyType>;
1848
+ }
1849
+ interface BaseFlowConfig {
1850
+ name: string;
1851
+ button: string;
1852
+ parameters?: Record<string, string | number>;
1853
+ mode?: "draft" | "published";
1854
+ }
1855
+ interface NavigateFlowConfig extends BaseFlowConfig {
1856
+ action?: "navigate";
1857
+ payload: FlowPayload;
1858
+ }
1859
+ interface DataExchangeFlowConfig extends BaseFlowConfig {
1860
+ action?: "data_exchange";
1861
+ payload?: FlowPayload;
1862
+ }
1863
+ type FlowConfig = NavigateFlowConfig | DataExchangeFlowConfig;
1864
+ type WaSDKOutgoingFlowMessage = Omit<WaInteractiveBase, "type"> & {
1865
+ type: "flow";
1866
+ flow: FlowConfig;
1867
+ };
1868
+
1869
+ type WaSDKOutgoingListMessage = Omit<WaInteractiveBase, "type"> & {
1870
+ type: "list";
1871
+ list: {
1872
+ button: string;
1873
+ sections: Array<{
1874
+ rows: Array<{
1875
+ id: string;
1876
+ title: string;
1877
+ description?: string;
1878
+ }>;
1879
+ title: string;
1880
+ }>;
1881
+ };
838
1882
  };
839
1883
 
840
1884
  type WaSDKOutgoingMediaMessage = {
@@ -859,7 +1903,6 @@ type WaSDKOutgoingMediaMessage = {
859
1903
  type: "media";
860
1904
  audio: {
861
1905
  ref: string;
862
- caption?: string;
863
1906
  };
864
1907
  } | {
865
1908
  type: "media";
@@ -871,7 +1914,7 @@ type WaSDKOutgoingMediaMessage = {
871
1914
 
872
1915
  type WaSDKOutgoingTemplateMessage = Omit<WaOutgoingTemplateMessage, "namespace" | "language"> & {
873
1916
  type: "template";
874
- language: string;
1917
+ language: `${LanguageTag}`;
875
1918
  };
876
1919
 
877
1920
  type WaSDKOutgoingTextMessage = {
@@ -880,7 +1923,7 @@ type WaSDKOutgoingTextMessage = {
880
1923
  previewUrl?: boolean;
881
1924
  };
882
1925
 
883
- type WaSDKSendMessageData = WaSDKButtonMessage | WaSDKOutgoingFlowMessage | WaSDKOutgoingListMessage | WaSDKOutgoingTextMessage | WaSDKOutgoingTemplateMessage | WaSDKOutgoingMediaMessage;
1926
+ type WaSDKSendMessageData = WaSDKButtonMessage | WaSDKOutgoingFlowMessage | WaSDKOutgoingListMessage | WaSDKOutgoingTextMessage | WaSDKOutgoingTemplateMessage | WaSDKOutgoingMediaMessage | WaSDKOutgoingContactMessage;
884
1927
 
885
1928
  interface WaSDKSendMessageConfig {
886
1929
  showUrlPreviewImage?: boolean;
@@ -892,7 +1935,58 @@ type WaSDKSendMessageBody = WaSDKSendMessageConfig & {
892
1935
  message: WaSDKSendMessageData;
893
1936
  };
894
1937
 
895
- declare function send(body: WaSDKSendMessageBody): Promise<WhatsappSendMessageResponse>;
1938
+ type WaSDKGetFlowWebPreviewPageRequestQuery = {
1939
+ flow_action: "data_exchange" | "navigate";
1940
+ phone_number: string;
1941
+ interactive?: boolean;
1942
+ recipient_id?: string;
1943
+ flow_action_payload?: {
1944
+ screen: string;
1945
+ data: Record<string, AnyType>;
1946
+ };
1947
+ flow_parameters?: FlowParameters;
1948
+ };
1949
+ type FlowParameters = Record<string, string | number>;
1950
+
1951
+ declare function decryptFlowBody(body: WhatsappFlowEncryptedWebhookBody): WaSDKFlowDecryptedWebhookBody;
1952
+
1953
+ declare function generateWabaEncryption(): Promise<{
1954
+ passphrase: `${string}-${string}-${string}-${string}-${string}`;
1955
+ publicKey: string;
1956
+ privateKey: string;
1957
+ }>;
1958
+
1959
+ type WebhookSignatureChallengeArguments = {
1960
+ rawBody: string;
1961
+ untrustedSignature: string;
1962
+ };
1963
+ declare function verifySignature(request: Request, rawBody: string): Promise<boolean>;
1964
+
1965
+ declare function verifyHub(request: Request): string | false;
1966
+
1967
+ interface WaSDKEventPayload {
1968
+ healthCheck: string;
1969
+ flowExchange: WaSDKFlowExchangeEventPayload;
1970
+ application: {
1971
+ errors?: WaIncomingErrors[];
1972
+ profileUpdate?: BaseMessageReceivedEventPayload & {
1973
+ identity: WaIncomingIdentityObject;
1974
+ system: WaIncomingSystemObject;
1975
+ }[];
1976
+ messageStatusUpdate?: MessageStatusUpdateEvent[];
1977
+ messageReceived?: MessageReceivedEventPayload[];
1978
+ flowUpdate?: FlowUpdateEventPayload[];
1979
+ };
1980
+ }
1981
+ type WaSDKEventType = keyof WaSDKEventPayload;
1982
+ interface WaSDKEvent<T extends WaSDKEventType = WaSDKEventType> {
1983
+ type: T;
1984
+ payload: WaSDKEventPayload[T];
1985
+ }
1986
+
1987
+ declare function webhook(request: Request): Promise<WaSDKEvent<"healthCheck"> | WaSDKEvent<"application"> | WaSDKEvent<"flowExchange"> | {
1988
+ error: boolean;
1989
+ }>;
896
1990
 
897
1991
  declare function uploadWabaEncryption(publicKey: string): Promise<unknown>;
898
1992
 
@@ -902,12 +1996,15 @@ interface Payload {
902
1996
  }
903
1997
  declare function registerNumber({ dataRegion, pin }: Payload): Promise<unknown>;
904
1998
 
1999
+ declare function _delete(flow_id: string): Promise<WhatsappDeleteFlowResponse>;
2000
+
2001
+ declare function send(body: WaSDKSendMessageBody): Promise<WhatsappSendMessageResponse>;
2002
+
905
2003
  declare const actions: {
906
2004
  messages: {
907
2005
  send: typeof send;
908
2006
  };
909
2007
  flows: {
910
- unnoficial: typeof unnoficial;
911
2008
  create(body: WhatsappCreateFlowRequestBody): Promise<WhatsappCreateFlowResponse>;
912
2009
  updateMetadata(flow_id: string, body: WhatsappFlowUpdateMetadataRequestBody): Promise<WhatsappFlowUpdateMetadataResponse>;
913
2010
  updateJson(flow_id: string, json: Record<string, AnyType>): Promise<WhatsappUpdateFlowJsonResponse>;
@@ -927,95 +2024,9 @@ declare const actions: {
927
2024
  };
928
2025
  };
929
2026
 
930
- interface BaseMessageReceivedEventPayload {
931
- id: string;
932
- type: WaIncomingMessageType;
933
- timestamp: number;
934
- metadata: {
935
- forwarded?: boolean;
936
- frequentlyForwarded?: boolean;
937
- };
938
- }
939
- type MessageReceivedEventPayload = BaseMessageReceivedEventPayload & {
940
- chatId: string;
941
- text: string | null;
942
- reply?: string;
943
- interaction?: {
944
- button?: {
945
- id: string | null;
946
- title: string;
947
- payload: string | null;
948
- };
949
- selectedOption?: {
950
- id: string;
951
- title: string;
952
- description: string;
953
- };
954
- flowResponse?: {
955
- flow_token: string;
956
- intent: string | null;
957
- } & {
958
- [key: string]: AnyType;
959
- };
960
- };
961
- media?: {
962
- id: string;
963
- caption: string | null;
964
- mime_type: string;
965
- type: "audio" | "document" | "image" | "video";
966
- filename?: string;
967
- sha256?: string;
968
- };
969
- };
970
-
971
- interface MessageStatusUpdateEvent {
972
- messageId: string;
973
- metadata: string;
974
- timestamp: number;
975
- errors: WaIncomingErrors;
976
- status: WaIncomingMessageStatuses;
977
- }
978
-
979
- type WaSDKFlowPayload = WhatsappFlowDecryptedWebhookBody;
980
- type WaSDKFlowDecryptedWebhookBody = {
981
- payload: WaSDKFlowPayload;
982
- encryptionMetadata: WhatsappFlowEncryptionData;
983
- };
984
- type WaSDKFlowExchangeEventPayload = WaSDKFlowDecryptedWebhookBody & {
985
- pingResponse: WhatsappFlowPingResponse;
986
- };
987
-
988
- type FlowUpdateEventPayload = {
989
- event: string;
990
- message: string;
991
- flow_id: string;
992
- };
993
-
994
- interface WaSDKEventPayload {
995
- healthCheck: string;
996
- flowExchange: WaSDKFlowExchangeEventPayload;
997
- application: {
998
- errors?: WaIncomingErrors[];
999
- profileUpdate?: BaseMessageReceivedEventPayload & {
1000
- identity: WaIncomingIdentityObject;
1001
- system: WaIncomingSystemObject;
1002
- }[];
1003
- messageStatusUpdate?: MessageStatusUpdateEvent[];
1004
- messageReceived?: MessageReceivedEventPayload[];
1005
- flowUpdate?: FlowUpdateEventPayload[];
1006
- };
1007
- }
1008
- type WaSDKEventType = keyof WaSDKEventPayload;
1009
- interface WaSDKEvent<T extends WaSDKEventType = WaSDKEventType> {
1010
- type: T;
1011
- payload: WaSDKEventPayload[T];
1012
- }
1013
-
1014
- declare function webhook(request: Request): Promise<WaSDKEvent<"healthCheck"> | WaSDKEvent<"application"> | WaSDKEvent<"flowExchange">>;
1015
-
1016
2027
  declare const parsers: {
1017
2028
  toGraph: {
1018
- sendMessage: (body: WaSDKSendMessageBody) => WhatsappSendMessageRequestBody<any> | WhatsappSendMessageRequestBody<"interactive"> | WhatsappSendMessageRequestBody<"text"> | WhatsappSendMessageRequestBody<"template">;
2029
+ sendMessage: (body: WaSDKSendMessageBody) => WhatsappSendMessageRequestBody<any> | WhatsappSendMessageRequestBody<"interactive"> | WhatsappSendMessageRequestBody<"text"> | WhatsappSendMessageRequestBody<"template"> | WhatsappSendMessageRequestBody<"contacts">;
1019
2030
  flowResponse: (flow_token: string, response: WhatsappFlowResponse) => WhatsappFlowResponse;
1020
2031
  };
1021
2032
  toSDK: {
@@ -1023,43 +2034,9 @@ declare const parsers: {
1023
2034
  };
1024
2035
  };
1025
2036
 
1026
- type MessageReceivedEvent = Defined<WaSDKEventPayload["application"]["messageReceived"]>[0];
1027
-
1028
- type WaSDKGetFlowWebPreviewPageRequestQuery = {
1029
- flow_action: "data_exchange" | "navigate";
1030
- phone_number: string;
1031
- interactive?: boolean;
1032
- recipient_id?: string;
1033
- flow_action_payload?: {
1034
- screen: string;
1035
- data: Record<string, AnyType>;
1036
- };
1037
- flow_parameters?: FlowParameters;
1038
- };
1039
- type FlowParameters = Record<string, string | number>;
1040
-
1041
- declare function decryptFlowBody(body: WhatsappFlowEncryptedWebhookBody): WaSDKFlowDecryptedWebhookBody;
1042
-
1043
- declare function decryptFlowMedia(media: FlowMediaData[]): Promise<Buffer<ArrayBufferLike>[]>;
2037
+ declare const toGraphLanguageTag: (languageTag: `${LanguageTag}`) => WhatsappLanguageTag;
1044
2038
 
1045
- declare function encryptFlowResponse(data: AnyType, encryptionMetadata: {
1046
- aesKeyBuffer: Buffer;
1047
- initialVectorBuffer: Buffer;
1048
- }): string;
1049
-
1050
- declare function generateWabaEncryption(): Promise<{
1051
- passphrase: `${string}-${string}-${string}-${string}-${string}`;
1052
- publicKey: string;
1053
- privateKey: string;
1054
- }>;
1055
-
1056
- declare function verifyHub(request: Request): string | false;
1057
-
1058
- type WebhookSignatureChallengeArguments = {
1059
- rawBody: string;
1060
- untrustedSignature: string;
1061
- };
1062
- declare function verifySignature(request: Request, rawBody: string): Promise<boolean>;
2039
+ type MessageReceivedEvent = Defined<WaSDKEventPayload["application"]["messageReceived"]>[0];
1063
2040
 
1064
2041
  declare const security: {
1065
2042
  verifyHub: typeof verifyHub;
@@ -1104,42 +2081,101 @@ declare const utils: {
1104
2081
  };
1105
2082
  };
1106
2083
 
1107
- type sdk_BaseMessageReceivedEventPayload = BaseMessageReceivedEventPayload;
1108
- type sdk_DataExchangeFlowConfig = DataExchangeFlowConfig;
1109
- type sdk_FlowConfig = FlowConfig;
1110
- type sdk_FlowParameters = FlowParameters;
1111
- type sdk_FlowUpdateEventPayload = FlowUpdateEventPayload;
1112
- type sdk_MessageReceivedEvent = MessageReceivedEvent;
1113
- type sdk_MessageReceivedEventPayload = MessageReceivedEventPayload;
1114
- type sdk_MessageStatusUpdateEvent = MessageStatusUpdateEvent;
1115
- type sdk_NavigateFlowConfig = NavigateFlowConfig;
1116
- type sdk_WaSDKButtonMessage = WaSDKButtonMessage;
1117
- type sdk_WaSDKEvent<T extends WaSDKEventType = WaSDKEventType> = WaSDKEvent<T>;
1118
- type sdk_WaSDKEventPayload = WaSDKEventPayload;
1119
- type sdk_WaSDKEventType = WaSDKEventType;
1120
- type sdk_WaSDKFlowDecryptedWebhookBody = WaSDKFlowDecryptedWebhookBody;
1121
- type sdk_WaSDKFlowExchangeEventPayload = WaSDKFlowExchangeEventPayload;
1122
- type sdk_WaSDKFlowPayload = WaSDKFlowPayload;
1123
- type sdk_WaSDKGetFlowWebPreviewPageRequestQuery = WaSDKGetFlowWebPreviewPageRequestQuery;
1124
- type sdk_WaSDKOutgoingFlowMessage = WaSDKOutgoingFlowMessage;
1125
- type sdk_WaSDKOutgoingListMessage = WaSDKOutgoingListMessage;
1126
- type sdk_WaSDKOutgoingMediaMessage = WaSDKOutgoingMediaMessage;
1127
- type sdk_WaSDKOutgoingTemplateMessage = WaSDKOutgoingTemplateMessage;
1128
- type sdk_WaSDKOutgoingTextMessage = WaSDKOutgoingTextMessage;
1129
- type sdk_WaSDKSendMessageBody = WaSDKSendMessageBody;
1130
- type sdk_WaSDKSendMessageConfig = WaSDKSendMessageConfig;
1131
- type sdk_WaSDKSendMessageData = WaSDKSendMessageData;
1132
- type sdk_WebhookSignatureChallengeArguments = WebhookSignatureChallengeArguments;
1133
- declare const sdk_actions: typeof actions;
1134
- declare const sdk_flows: typeof flows;
1135
- declare const sdk_parsers: typeof parsers;
1136
- declare const sdk_security: typeof security;
1137
- declare const sdk_utils: typeof utils;
1138
- declare namespace sdk {
1139
- export { type sdk_BaseMessageReceivedEventPayload as BaseMessageReceivedEventPayload, type sdk_DataExchangeFlowConfig as DataExchangeFlowConfig, type sdk_FlowConfig as FlowConfig, type sdk_FlowParameters as FlowParameters, type sdk_FlowUpdateEventPayload as FlowUpdateEventPayload, type sdk_MessageReceivedEvent as MessageReceivedEvent, type sdk_MessageReceivedEventPayload as MessageReceivedEventPayload, type sdk_MessageStatusUpdateEvent as MessageStatusUpdateEvent, type sdk_NavigateFlowConfig as NavigateFlowConfig, type sdk_WaSDKButtonMessage as WaSDKButtonMessage, type sdk_WaSDKEvent as WaSDKEvent, type sdk_WaSDKEventPayload as WaSDKEventPayload, type sdk_WaSDKEventType as WaSDKEventType, type sdk_WaSDKFlowDecryptedWebhookBody as WaSDKFlowDecryptedWebhookBody, type sdk_WaSDKFlowExchangeEventPayload as WaSDKFlowExchangeEventPayload, type sdk_WaSDKFlowPayload as WaSDKFlowPayload, type sdk_WaSDKGetFlowWebPreviewPageRequestQuery as WaSDKGetFlowWebPreviewPageRequestQuery, type sdk_WaSDKOutgoingFlowMessage as WaSDKOutgoingFlowMessage, type sdk_WaSDKOutgoingListMessage as WaSDKOutgoingListMessage, type sdk_WaSDKOutgoingMediaMessage as WaSDKOutgoingMediaMessage, type sdk_WaSDKOutgoingTemplateMessage as WaSDKOutgoingTemplateMessage, type sdk_WaSDKOutgoingTextMessage as WaSDKOutgoingTextMessage, type sdk_WaSDKSendMessageBody as WaSDKSendMessageBody, type sdk_WaSDKSendMessageConfig as WaSDKSendMessageConfig, type sdk_WaSDKSendMessageData as WaSDKSendMessageData, type sdk_WebhookSignatureChallengeArguments as WebhookSignatureChallengeArguments, sdk_actions as actions, sdk_flows as flows, sdk_parsers as parsers, sdk_security as security, sdk_utils as utils };
1140
- }
2084
+ type WhatsappSDKSettings = {
2085
+ GRAPH_API_VERSION: string;
2086
+ META_APP_ACCESS_TOKEN: string;
2087
+ META_APP_ID: string;
2088
+ META_APP_SECRET: string;
2089
+ WHATSAPP_MESSAGE_NAMESPACE: string;
2090
+ WHATSAPP_WEBHOOK_KEY: string;
2091
+ WHATSAPP_NUMBER_ID: string;
2092
+ WHATSAPP_ACCOUNT_ID: string;
2093
+ WHATSAPP_ACCOUNT_ENCRYPTION_PUBLIC_KEY: string;
2094
+ WHATSAPP_ACCOUNT_ENCRYPTION_PRIVATE_KEY: string;
2095
+ WHATSAPP_ACCOUNT_ENCRYPTION_PASSPHRASE: string;
2096
+ WHATSAPP_FLOWS_MODE: string;
2097
+ };
1141
2098
 
1142
- declare const whatsapp: {
2099
+ declare const createWhatsapp: () => {
2100
+ settings: {
2101
+ setup: (stg?: Partial<WhatsappSDKSettings>) => void;
2102
+ get: (key: keyof WhatsappSDKSettings) => string;
2103
+ };
2104
+ sdk: {
2105
+ actions: {
2106
+ messages: {
2107
+ send: typeof send;
2108
+ };
2109
+ flows: {
2110
+ create(body: WhatsappCreateFlowRequestBody): Promise<WhatsappCreateFlowResponse>;
2111
+ updateMetadata(flow_id: string, body: WhatsappFlowUpdateMetadataRequestBody): Promise<WhatsappFlowUpdateMetadataResponse>;
2112
+ updateJson(flow_id: string, json: Record<string, AnyType>): Promise<WhatsappUpdateFlowJsonResponse>;
2113
+ getPreview(flow_id: string, query?: WhatsappGetFlowWebPreviewPageRequestQuery): Promise<string>;
2114
+ get(flow_id: string, query?: {
2115
+ fields: Array<keyof WhatsappGetFlowsRequestResponse>;
2116
+ }): Promise<WhatsappGetManyFlowsRequestResponse>;
2117
+ getMany(): Promise<WhatsappGetManyFlowsRequestResponse>;
2118
+ publish(flow_id: string): Promise<WhatsappPublishFlowResponse>;
2119
+ delete: typeof _delete;
2120
+ };
2121
+ waba: {
2122
+ registerNumber: typeof registerNumber;
2123
+ encryption: {
2124
+ upload: typeof uploadWabaEncryption;
2125
+ };
2126
+ };
2127
+ };
2128
+ flows: {
2129
+ createToken: ({ flow_name, flow_parameters, chatId, }: {
2130
+ flow_name: string;
2131
+ flow_parameters?: Record<string, string | number>;
2132
+ chatId: string;
2133
+ }) => string;
2134
+ getName: (token: string) => string;
2135
+ destructureFlowToken: (token: string) => {
2136
+ paramsString: string;
2137
+ flowName: string;
2138
+ chatId: string;
2139
+ flowIdentifier: string;
2140
+ flowParameters: Record<string, string>;
2141
+ };
2142
+ };
2143
+ parsers: {
2144
+ toGraph: {
2145
+ sendMessage: (body: WaSDKSendMessageBody) => WhatsappSendMessageRequestBody<any> | WhatsappSendMessageRequestBody<"interactive"> | WhatsappSendMessageRequestBody<"text"> | WhatsappSendMessageRequestBody<"template"> | WhatsappSendMessageRequestBody<"contacts">;
2146
+ flowResponse: (flow_token: string, response: WhatsappFlowResponse) => WhatsappFlowResponse;
2147
+ };
2148
+ toSDK: {
2149
+ webhook: typeof webhook;
2150
+ };
2151
+ };
2152
+ security: {
2153
+ verifyHub: typeof verifyHub;
2154
+ verifySignature: typeof verifySignature;
2155
+ generateWabaEncryption: typeof generateWabaEncryption;
2156
+ decryptFlowBody: typeof decryptFlowBody;
2157
+ encryptFlowResponse: typeof encryptFlowResponse;
2158
+ decryptFlowMedia: typeof decryptFlowMedia;
2159
+ };
2160
+ utils: {
2161
+ flows: {
2162
+ createToken: ({ flow_name, flow_parameters, chatId, }: {
2163
+ flow_name: string;
2164
+ flow_parameters?: Record<string, string | number>;
2165
+ chatId: string;
2166
+ }) => string;
2167
+ getName: (token: string) => string;
2168
+ destructureFlowToken: (token: string) => {
2169
+ paramsString: string;
2170
+ flowName: string;
2171
+ chatId: string;
2172
+ flowIdentifier: string;
2173
+ flowParameters: Record<string, string>;
2174
+ };
2175
+ };
2176
+ };
2177
+ toGraphLanguageTag: (languageTag: `${LanguageTag}`) => WhatsappLanguageTag;
2178
+ };
1143
2179
  graph: {
1144
2180
  endpoints: {
1145
2181
  flows: {
@@ -1175,11 +2211,6 @@ declare const whatsapp: {
1175
2211
  };
1176
2212
  };
1177
2213
  };
1178
- settings: {
1179
- setup: (stg?: Partial<WhatsappSDKSettings>) => void;
1180
- get: (key: keyof WhatsappSDKSettings) => string;
1181
- };
1182
- sdk: typeof sdk;
1183
2214
  };
1184
2215
 
1185
- export { type BaseMessageReceivedEventPayload, type ConversationType, type DataExchangeFlowConfig, type FlowAction, type FlowCanSendMessageStatus, type FlowCategory, type FlowConfig, type FlowData, type FlowMediaData, type FlowMetadata, type FlowParameters, type FlowScreen, type FlowStatus, type FlowUpdateEventPayload, type FlowValidationError, type ISOCountryCode, type MediaTypes, type MessageField, type MessageReceivedEvent, type MessageReceivedEventPayload, type MessageStatusUpdateEvent, type MetadataObject, type NavigateFlowConfig, type WaIncomingAudioObject, type WaIncomingButtonObject, type WaIncomingContactObject, type WaIncomingContacts, type WaIncomingContextObject, type WaIncomingDocumentObject, type WaIncomingErrorObject, type WaIncomingErrors, type WaIncomingIdentityObject, type WaIncomingImageObject, type WaIncomingInteractiveObject, type WaIncomingMessageStatus, type WaIncomingMessageStatuses, type WaIncomingMessageType, type WaIncomingMessages, type WaIncomingOrderObject, type WaIncomingReferralObject, type WaIncomingStickerObject, type WaIncomingSystemObject, type WaIncomingTextObject, type WaIncomingVideoObject, type WaInteractiveAction, type WaInteractiveActionType, WaInteractiveBase, type WaInteractiveBody, type WaInteractiveFooter, type WaInteractiveHeader, type WaMessageType, type WaOutgoingAudioMessage, type WaOutgoingContactsMessage, type WaOutgoingDocumentMessage, type WaOutgoingImageMessage, type WaOutgoingInteractiveMessage, type WaOutgoingLocationMessage, type WaOutgoingMessage, type WaOutgoingReactionMessage, type WaOutgoingStickerMessage, type WaOutgoingTemplateMessage, type WaOutgoingTextMessage, type WaOutgoingVideoMessage, type WaSDKButtonMessage, type WaSDKEvent, type WaSDKEventPayload, type WaSDKEventType, type WaSDKFlowDecryptedWebhookBody, type WaSDKFlowExchangeEventPayload, type WaSDKFlowPayload, type WaSDKGetFlowWebPreviewPageRequestQuery, type WaSDKOutgoingFlowMessage, type WaSDKOutgoingListMessage, type WaSDKOutgoingMediaMessage, type WaSDKOutgoingTemplateMessage, type WaSDKOutgoingTextMessage, type WaSDKSendMessageBody, type WaSDKSendMessageConfig, type WaSDKSendMessageData, type WebhookSignatureChallengeArguments, type WhatsappApplicationWebhookBody, type WhatsappCreateFlowRequestBody, type WhatsappCreateFlowResponse, type WhatsappDeleteFlowResponse, type WhatsappFlowDecryptedWebhookBody, type WhatsappFlowEncryptedWebhookBody, type WhatsappFlowEncryptionData, type WhatsappFlowErrorMessages, type WhatsappFlowInfo, type WhatsappFlowPingResponse, type WhatsappFlowResponse, type WhatsappFlowUpdateMetadataRequestBody, type WhatsappFlowUpdateMetadataResponse, type WhatsappGetFlowWebPreviewPageRequestQuery, type WhatsappGetFlowWebPreviewURLResponse, type WhatsappGetFlowsRequestQuery, type WhatsappGetFlowsRequestResponse, type WhatsappGetManyFlowsRequestResponse, type WhatsappPublishFlowResponse, type WhatsappRegisterPhoneNumberRequestBody, type WhatsappSendMessageRequestBody, type WhatsappSendMessageRequestConfig, type WhatsappSendMessageResponse, type WhatsappUpdateFlowJsonRequestBody, type WhatsappUpdateFlowJsonResponse, type WhatsappWabaUploadEncryptionRequestBody, actions, endpoints, flowAction, flowCanSendMessageStatus, flowCategory, flowMediaData, flowMetadata, flowScreen, flowStatus, flowValidationError, flows, flowsEndpoints, messagesEndpoints, parsers, security, utils, wabaEndpoints, whatsapp };
2216
+ export { type BaseMessageReceivedEventPayload, type ConversationType, type DataExchangeFlowConfig, type FlowAction, type FlowCanSendMessageStatus, type FlowCategory, type FlowConfig, type FlowData, type FlowMediaData, type FlowMetadata, type FlowParameters, type FlowScreen, type FlowStatus, type FlowUpdateEventPayload, type FlowValidationError, type ISOCountryCode, type MediaTypes, type MessageField, type MessageReceivedEvent, type MessageReceivedEventPayload, type MessageStatusUpdateEvent, type MetadataObject, type NavigateFlowConfig, type Payload, type WaIncomingAudioObject, type WaIncomingButtonObject, type WaIncomingContactObject, type WaIncomingContacts, type WaIncomingContextObject, type WaIncomingDocumentObject, type WaIncomingErrorObject, type WaIncomingErrors, type WaIncomingIdentityObject, type WaIncomingImageObject, type WaIncomingInteractiveObject, type WaIncomingMessageStatus, type WaIncomingMessageStatuses, type WaIncomingMessageType, type WaIncomingMessages, type WaIncomingOrderObject, type WaIncomingReferralObject, type WaIncomingStickerObject, type WaIncomingSystemObject, type WaIncomingTextObject, type WaIncomingVideoObject, type WaInteractiveAction, type WaInteractiveActionType, type WaInteractiveBase, type WaInteractiveBody, type WaInteractiveFooter, type WaInteractiveHeader, type WaMessageType, type WaOutgoingAudioMessage, type WaOutgoingContactsMessage, type WaOutgoingDocumentMessage, type WaOutgoingImageMessage, type WaOutgoingInteractiveMessage, type WaOutgoingLocationMessage, type WaOutgoingMessage, type WaOutgoingReactionMessage, type WaOutgoingStickerMessage, type WaOutgoingTemplateMessage, type WaOutgoingTextMessage, type WaOutgoingVideoMessage, type WaSDKButtonMessage, type WaSDKEvent, type WaSDKEventPayload, type WaSDKEventType, type WaSDKFlowDecryptedWebhookBody, type WaSDKFlowExchangeEventPayload, type WaSDKFlowPayload, type WaSDKGetFlowWebPreviewPageRequestQuery, type WaSDKOutgoingContactMessage, type WaSDKOutgoingFlowMessage, type WaSDKOutgoingListMessage, type WaSDKOutgoingMediaMessage, type WaSDKOutgoingTemplateMessage, type WaSDKOutgoingTextMessage, type WaSDKSendMessageBody, type WaSDKSendMessageConfig, type WaSDKSendMessageData, type WebhookSignatureChallengeArguments, type WhatsappApplicationWebhookBody, type WhatsappCreateFlowRequestBody, type WhatsappCreateFlowResponse, type WhatsappDeleteFlowResponse, WhatsappErrorCode, type WhatsappFlowDecryptedWebhookBody, type WhatsappFlowEncryptedWebhookBody, type WhatsappFlowEncryptionData, type WhatsappFlowErrorMessages, type WhatsappFlowInfo, type WhatsappFlowPingResponse, type WhatsappFlowResponse, type WhatsappFlowUpdateMetadataRequestBody, type WhatsappFlowUpdateMetadataResponse, type WhatsappGetFlowWebPreviewPageRequestQuery, type WhatsappGetFlowWebPreviewURLResponse, type WhatsappGetFlowsRequestQuery, type WhatsappGetFlowsRequestResponse, type WhatsappGetManyFlowsRequestResponse, type WhatsappLanguageTag, type WhatsappPublishFlowResponse, type WhatsappRegisterPhoneNumberRequestBody, type WhatsappSendMessageRequestBody, type WhatsappSendMessageRequestConfig, type WhatsappSendMessageResponse, type WhatsappUpdateFlowJsonRequestBody, type WhatsappUpdateFlowJsonResponse, type WhatsappWabaUploadEncryptionRequestBody, actions, createWhatsapp, endpoints, flowAction, flowCanSendMessageStatus, flowCategory, flowMediaData, flowMetadata, flowScreen, flowStatus, flowValidationError, flows, flowsEndpoints, messagesEndpoints, parsers, security, toGraphLanguageTag, utils, wabaEndpoints };