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.
Files changed (159) hide show
  1. package/dist/base.d.ts +19 -0
  2. package/dist/base.d.ts.map +1 -0
  3. package/dist/chunk-PECeCxCb.js +15 -0
  4. package/dist/config.d.ts +80 -0
  5. package/dist/config.d.ts.map +1 -0
  6. package/dist/enums.d.ts +668 -0
  7. package/dist/enums.d.ts.map +1 -0
  8. package/dist/enums.js +681 -0
  9. package/dist/enums.js.map +1 -0
  10. package/dist/httpsClient.d.ts +21 -0
  11. package/dist/httpsClient.d.ts.map +1 -0
  12. package/dist/index.d.ts +4386 -27
  13. package/dist/index.d.ts.map +1 -0
  14. package/dist/index.js +3436 -1
  15. package/dist/index.js.map +1 -1
  16. package/dist/logger.d.ts +11 -0
  17. package/dist/logger.d.ts.map +1 -0
  18. package/dist/request.d.ts +52 -0
  19. package/dist/request.d.ts.map +1 -0
  20. package/package.json +11 -118
  21. package/dist/BusinessProfileApi-C_sEOrWM.d.ts +0 -353
  22. package/dist/EncryptionApi-CcCfeK2b.d.ts +0 -22
  23. package/dist/FlowApi-DDHrFT_Q.d.ts +0 -136
  24. package/dist/MediaApi-CY9RVo7u.d.ts +0 -90
  25. package/dist/MessageApi-CX_jN8da.d.ts +0 -171
  26. package/dist/PhoneNumberApi-B-hY7g1M.d.ts +0 -142
  27. package/dist/QrCodeApi-DRICKN04.d.ts +0 -98
  28. package/dist/RegistrationApi-CFPzU1Vw.d.ts +0 -47
  29. package/dist/TemplateApi-fCIlzBtK.d.ts +0 -161
  30. package/dist/TwoStepVerificationApi-C0jpAKfu.d.ts +0 -33
  31. package/dist/WabaApi-x5PhsLT3.d.ts +0 -175
  32. package/dist/WebhookProcessor-DEIZ2PRU.d.ts +0 -707
  33. package/dist/WhatsApp-BFsBgjJO.d.ts +0 -82
  34. package/dist/api/encryption/index.d.ts +0 -10
  35. package/dist/api/encryption/index.js +0 -2
  36. package/dist/api/encryption/index.js.map +0 -1
  37. package/dist/api/flow/index.d.ts +0 -11
  38. package/dist/api/flow/index.js +0 -2
  39. package/dist/api/flow/index.js.map +0 -1
  40. package/dist/api/index.d.ts +0 -18
  41. package/dist/api/index.js +0 -2
  42. package/dist/api/index.js.map +0 -1
  43. package/dist/api/media/index.d.ts +0 -10
  44. package/dist/api/media/index.js +0 -2
  45. package/dist/api/media/index.js.map +0 -1
  46. package/dist/api/messages/builders/index.d.ts +0 -536
  47. package/dist/api/messages/builders/index.js +0 -4
  48. package/dist/api/messages/builders/index.js.map +0 -1
  49. package/dist/api/messages/index.d.ts +0 -10
  50. package/dist/api/messages/index.js +0 -2
  51. package/dist/api/messages/index.js.map +0 -1
  52. package/dist/api/phone/index.d.ts +0 -10
  53. package/dist/api/phone/index.js +0 -2
  54. package/dist/api/phone/index.js.map +0 -1
  55. package/dist/api/profile/index.d.ts +0 -10
  56. package/dist/api/profile/index.js +0 -2
  57. package/dist/api/profile/index.js.map +0 -1
  58. package/dist/api/qrCode/index.d.ts +0 -10
  59. package/dist/api/qrCode/index.js +0 -2
  60. package/dist/api/qrCode/index.js.map +0 -1
  61. package/dist/api/registration/index.d.ts +0 -10
  62. package/dist/api/registration/index.js +0 -2
  63. package/dist/api/registration/index.js.map +0 -1
  64. package/dist/api/template/index.d.ts +0 -21
  65. package/dist/api/template/index.js +0 -2
  66. package/dist/api/template/index.js.map +0 -1
  67. package/dist/api/twoStepVerification/index.d.ts +0 -10
  68. package/dist/api/twoStepVerification/index.js +0 -2
  69. package/dist/api/twoStepVerification/index.js.map +0 -1
  70. package/dist/api/waba/index.d.ts +0 -10
  71. package/dist/api/waba/index.js +0 -2
  72. package/dist/api/waba/index.js.map +0 -1
  73. package/dist/base-BV6DyzGS.d.ts +0 -18
  74. package/dist/chunk-5577QQ7V.js +0 -2
  75. package/dist/chunk-5577QQ7V.js.map +0 -1
  76. package/dist/chunk-6DFC5L3X.js +0 -2
  77. package/dist/chunk-6DFC5L3X.js.map +0 -1
  78. package/dist/chunk-7QBIZCJ4.js +0 -2
  79. package/dist/chunk-7QBIZCJ4.js.map +0 -1
  80. package/dist/chunk-AMHQGG6Z.js +0 -2
  81. package/dist/chunk-AMHQGG6Z.js.map +0 -1
  82. package/dist/chunk-BAOZ4U74.js +0 -10
  83. package/dist/chunk-BAOZ4U74.js.map +0 -1
  84. package/dist/chunk-CRZ7EUYR.js +0 -2
  85. package/dist/chunk-CRZ7EUYR.js.map +0 -1
  86. package/dist/chunk-FKXSL2JK.js +0 -3
  87. package/dist/chunk-FKXSL2JK.js.map +0 -1
  88. package/dist/chunk-FSKBLPGE.js +0 -2
  89. package/dist/chunk-FSKBLPGE.js.map +0 -1
  90. package/dist/chunk-GM63NGNV.js +0 -2
  91. package/dist/chunk-GM63NGNV.js.map +0 -1
  92. package/dist/chunk-IYSR44P6.js +0 -2
  93. package/dist/chunk-IYSR44P6.js.map +0 -1
  94. package/dist/chunk-J2JPTKU6.js +0 -2
  95. package/dist/chunk-J2JPTKU6.js.map +0 -1
  96. package/dist/chunk-JC6YMVID.js +0 -2
  97. package/dist/chunk-JC6YMVID.js.map +0 -1
  98. package/dist/chunk-JPAV644F.js +0 -2
  99. package/dist/chunk-JPAV644F.js.map +0 -1
  100. package/dist/chunk-JXCLRKQ7.js +0 -2
  101. package/dist/chunk-JXCLRKQ7.js.map +0 -1
  102. package/dist/chunk-KMAH6636.js +0 -2
  103. package/dist/chunk-KMAH6636.js.map +0 -1
  104. package/dist/chunk-L4ESAO2S.js +0 -2
  105. package/dist/chunk-L4ESAO2S.js.map +0 -1
  106. package/dist/chunk-LV3TULSI.js +0 -2
  107. package/dist/chunk-LV3TULSI.js.map +0 -1
  108. package/dist/chunk-MJEG3K4V.js +0 -2
  109. package/dist/chunk-MJEG3K4V.js.map +0 -1
  110. package/dist/chunk-PHPQ5HP3.js +0 -2
  111. package/dist/chunk-PHPQ5HP3.js.map +0 -1
  112. package/dist/chunk-RIL6QABY.js +0 -2
  113. package/dist/chunk-RIL6QABY.js.map +0 -1
  114. package/dist/chunk-RWCVPWRC.js +0 -2
  115. package/dist/chunk-RWCVPWRC.js.map +0 -1
  116. package/dist/chunk-SNNRWNGZ.js +0 -2
  117. package/dist/chunk-SNNRWNGZ.js.map +0 -1
  118. package/dist/chunk-U5FBZ6UB.js +0 -3
  119. package/dist/chunk-U5FBZ6UB.js.map +0 -1
  120. package/dist/chunk-VHAODWCN.js +0 -2
  121. package/dist/chunk-VHAODWCN.js.map +0 -1
  122. package/dist/chunk-ZMNXRMWK.js +0 -2
  123. package/dist/chunk-ZMNXRMWK.js.map +0 -1
  124. package/dist/common-B8kp4RdL.d.ts +0 -403
  125. package/dist/common-CGbls9Y8.d.ts +0 -425
  126. package/dist/core/webhook/frameworks/express.d.ts +0 -53
  127. package/dist/core/webhook/frameworks/express.js +0 -2
  128. package/dist/core/webhook/frameworks/express.js.map +0 -1
  129. package/dist/core/webhook/frameworks/nextjs-app.d.ts +0 -48
  130. package/dist/core/webhook/frameworks/nextjs-app.js +0 -2
  131. package/dist/core/webhook/frameworks/nextjs-app.js.map +0 -1
  132. package/dist/core/webhook/frameworks/nextjs.d.ts +0 -49
  133. package/dist/core/webhook/frameworks/nextjs.js +0 -2
  134. package/dist/core/webhook/frameworks/nextjs.js.map +0 -1
  135. package/dist/core/webhook/index.d.ts +0 -29
  136. package/dist/core/webhook/index.js +0 -2
  137. package/dist/core/webhook/index.js.map +0 -1
  138. package/dist/core/whatsapp/index.d.ts +0 -42
  139. package/dist/core/whatsapp/index.js +0 -2
  140. package/dist/core/whatsapp/index.js.map +0 -1
  141. package/dist/enums-DIimUG6s.d.ts +0 -707
  142. package/dist/factory-kNha6WaY.d.ts +0 -200
  143. package/dist/handler-DbySwF0E.d.ts +0 -20
  144. package/dist/httpsClient-Cbd2Y6mg.d.ts +0 -19
  145. package/dist/isMetaError-CQLXyEL4.d.ts +0 -63
  146. package/dist/logger-BdE0Vyim.d.ts +0 -9
  147. package/dist/request-CUjrMn8R.d.ts +0 -50
  148. package/dist/types/config.d.ts +0 -78
  149. package/dist/types/config.js +0 -2
  150. package/dist/types/config.js.map +0 -1
  151. package/dist/types/enums.d.ts +0 -1
  152. package/dist/types/enums.js +0 -2
  153. package/dist/types/enums.js.map +0 -1
  154. package/dist/types/index.d.ts +0 -6
  155. package/dist/types/index.js +0 -2
  156. package/dist/types/index.js.map +0 -1
  157. package/dist/utils/index.d.ts +0 -40
  158. package/dist/utils/index.js +0 -2
  159. package/dist/utils/index.js.map +0 -1
@@ -0,0 +1,52 @@
1
+ import { HttpMethodsEnum } from "./enums.js";
2
+
3
+ //#region src/types/request.d.ts
4
+ type GeneralRequestBody = Record<string, unknown>;
5
+ interface GeneralHeaderInterface {
6
+ /**
7
+ * Authorization token. This is required for all HTTP requests made to the graph API.
8
+ * @default 'Bearer '
9
+ */
10
+ Authorization: string;
11
+ /**
12
+ * Content type of the message being sent. This is required for all HTTP requests made to the graph API.
13
+ * @default 'application/json'
14
+ */
15
+ 'Content-Type': string;
16
+ /**
17
+ * User agent field sent in all requests. This is used to gather SDK usage metrics and help
18
+ * better triage support requests.
19
+ * @default `WA_SDK/${ SDK_version } (Node.js ${ process.version })`
20
+ */
21
+ 'User-Agent': string;
22
+ }
23
+ interface RequesterResponseInterface<T> {
24
+ json: () => Promise<T>;
25
+ }
26
+ interface ResponseSuccess {
27
+ success: boolean;
28
+ }
29
+ interface ResponseData<T> {
30
+ data: T;
31
+ }
32
+ interface ResponsePagination<T> {
33
+ data: T[];
34
+ paging: Paging;
35
+ }
36
+ interface Paging {
37
+ cursors: {
38
+ before: string;
39
+ after: string;
40
+ };
41
+ next: string;
42
+ }
43
+ declare class RequesterClass {
44
+ constructor(apiVersion: string, phoneNumberId: number, accessToken: string, businessAcctId: string, userAgent: string);
45
+ sendRequest: (method: HttpMethodsEnum, path: string, timeout: number, body?: GeneralRequestBody, contentType?: string, additionalHeaders?: Record<string, string>) => Promise<RequesterResponseInterface<unknown>>;
46
+ getJson<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: GeneralRequestBody, additionalHeaders?: Record<string, string>): Promise<T>;
47
+ sendFormData<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: FormData, additionalHeaders?: Record<string, string>): Promise<T>;
48
+ sendUrlEncodedForm<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: Record<string, string>, additionalHeaders?: Record<string, string>): Promise<T>;
49
+ }
50
+ //#endregion
51
+ export { GeneralRequestBody, RequesterClass, ResponseSuccess };
52
+ //# sourceMappingURL=request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.d.ts","names":[],"sources":["../src/types/request.ts"],"sourcesContent":[],"mappings":";;;KAEY,kBAAA,GAAqB;UAEhB,sBAAA;EAFL;AAEZ;AAqBA;;eACwB,EAAA,MAAA;;;AAGxB;AAIA;EAIiB,cAAA,EAAA,MAAkB;EAAA;;;;AAKnC;EAQqB,YAAA,EAAA,MAAc;;AAUnB,UAnCC,0BAmCD,CAAA,CAAA,CAAA,CAAA;MAGD,EAAA,GAAA,GArCC,OAqCD,CArCS,CAqCT,CAAA;;AAGE,UArCA,eAAA,CAqCA;SAAR,EAAA,OAAA;;AAMM,UAvCE,YAuCF,CAAA,CAAA,CAAA,CAAA;MACa,EAvClB,CAuCkB;;AACrB,UArCU,kBAqCV,CAAA,CAAA,CAAA,CAAA;MAGS,EAvCN,CAuCM,EAAA;QAGE,EAzCN,MAyCM;;AAEH,UAxCE,MAAA,CAwCF;SAAR,EAAA;IAGS,MAAA,EAAA,MAAA;IAGE,KAAA,EAAA,MAAA;;MAEH,EAAA,MAAA;;AAAD,cAxCO,cAAA,CAwCP;;wBA9BE,uDAGD,8DAEa,2BACnB,QAAQ;qBAGD,2DAGD,wCACa,yBACrB,QAAQ;0BAGC,8DAGE,8BACU,yBACrB,QAAQ;gCAGC,8DAGE,4CACU,yBACrB,QAAQ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meta-cloud-api",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "TypeScript wrapper for Meta's Cloud API",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -10,8 +10,8 @@
10
10
  "prepublishOnly": "pnpm build",
11
11
  "prepare": "husky",
12
12
  "cz": "cz",
13
- "dev": "tsup --watch",
14
- "build": "tsup --clean",
13
+ "dev": "tsdown --watch",
14
+ "build": "tsdown --clean",
15
15
  "format": "prettier .",
16
16
  "lint": "eslint .",
17
17
  "clean": "rm -rf dist node_modules",
@@ -29,123 +29,15 @@
29
29
  "exports": {
30
30
  ".": {
31
31
  "types": "./dist/index.d.ts",
32
- "import": "./dist/index.js",
33
32
  "default": "./dist/index.js"
34
33
  },
35
- "./api": {
36
- "types": "./dist/api/index.d.ts",
37
- "import": "./dist/api/index.js",
38
- "default": "./dist/api/index.js"
39
- },
40
- "./api/messages": {
41
- "types": "./dist/api/messages/index.d.ts",
42
- "import": "./dist/api/messages/index.js",
43
- "default": "./dist/api/messages/index.js"
44
- },
45
- "./api/messages/builders": {
46
- "types": "./dist/api/messages/builders/index.d.ts",
47
- "import": "./dist/api/messages/builders/index.js",
48
- "default": "./dist/api/messages/builders/index.js"
49
- },
50
- "./api/media": {
51
- "types": "./dist/api/media/index.d.ts",
52
- "import": "./dist/api/media/index.js",
53
- "default": "./dist/api/media/index.js"
54
- },
55
- "./api/flow": {
56
- "types": "./dist/api/flow/index.d.ts",
57
- "import": "./dist/api/flow/index.js",
58
- "default": "./dist/api/flow/index.js"
59
- },
60
- "./api/phone": {
61
- "types": "./dist/api/phone/index.d.ts",
62
- "import": "./dist/api/phone/index.js",
63
- "default": "./dist/api/phone/index.js"
64
- },
65
- "./api/profile": {
66
- "types": "./dist/api/profile/index.d.ts",
67
- "import": "./dist/api/profile/index.js",
68
- "default": "./dist/api/profile/index.js"
69
- },
70
- "./api/template": {
71
- "types": "./dist/api/template/index.d.ts",
72
- "import": "./dist/api/template/index.js",
73
- "default": "./dist/api/template/index.js"
74
- },
75
- "./api/qrCode": {
76
- "types": "./dist/api/qrCode/index.d.ts",
77
- "import": "./dist/api/qrCode/index.js",
78
- "default": "./dist/api/qrCode/index.js"
79
- },
80
- "./api/registration": {
81
- "types": "./dist/api/registration/index.d.ts",
82
- "import": "./dist/api/registration/index.js",
83
- "default": "./dist/api/registration/index.js"
84
- },
85
- "./api/encryption": {
86
- "types": "./dist/api/encryption/index.d.ts",
87
- "import": "./dist/api/encryption/index.js",
88
- "default": "./dist/api/encryption/index.js"
89
- },
90
- "./api/twoStepVerification": {
91
- "types": "./dist/api/twoStepVerification/index.d.ts",
92
- "import": "./dist/api/twoStepVerification/index.js",
93
- "default": "./dist/api/twoStepVerification/index.js"
94
- },
95
- "./api/waba": {
96
- "types": "./dist/api/waba/index.d.ts",
97
- "import": "./dist/api/waba/index.js",
98
- "default": "./dist/api/waba/index.js"
99
- },
100
- "./utils": {
101
- "types": "./dist/utils/index.d.ts",
102
- "import": "./dist/utils/index.js",
103
- "default": "./dist/utils/index.js"
104
- },
105
- "./webhook": {
106
- "types": "./dist/core/webhook/index.d.ts",
107
- "import": "./dist/core/webhook/index.js",
108
- "default": "./dist/core/webhook/index.js"
109
- },
110
- "./webhook/express": {
111
- "types": "./dist/core/webhook/frameworks/express.d.ts",
112
- "import": "./dist/core/webhook/frameworks/express.js",
113
- "default": "./dist/core/webhook/frameworks/express.js"
114
- },
115
- "./webhook/nextjs": {
116
- "types": "./dist/core/webhook/frameworks/nextjs.d.ts",
117
- "import": "./dist/core/webhook/frameworks/nextjs.js",
118
- "default": "./dist/core/webhook/frameworks/nextjs.js"
119
- },
120
- "./webhook/nextjs-app": {
121
- "types": "./dist/core/webhook/frameworks/nextjs-app.d.ts",
122
- "import": "./dist/core/webhook/frameworks/nextjs-app.js",
123
- "default": "./dist/core/webhook/frameworks/nextjs-app.js"
34
+ "./enums": {
35
+ "types": "./dist/enums.d.ts",
36
+ "default": "./dist/enums.js"
124
37
  },
125
38
  "./types": {
126
- "types": "./dist/types/index.d.ts",
127
- "import": "./dist/types/index.js",
128
- "default": "./dist/types/index.js"
129
- },
130
- "./types/enums": {
131
- "types": "./dist/types/enums.d.ts",
132
- "import": "./dist/types/enums.js",
133
- "default": "./dist/types/enums.js"
134
- },
135
- "./types/config": {
136
- "types": "./dist/types/config.d.ts",
137
- "import": "./dist/types/config.js",
138
- "default": "./dist/types/config.js"
139
- },
140
- "./core/webhook": {
141
- "types": "./dist/core/webhook/index.d.ts",
142
- "import": "./dist/core/webhook/index.js",
143
- "default": "./dist/core/webhook/index.js"
144
- },
145
- "./core/whatsapp": {
146
- "types": "./dist/core/whatsapp/index.d.ts",
147
- "import": "./dist/core/whatsapp/index.js",
148
- "default": "./dist/core/whatsapp/index.js"
39
+ "types": "./dist/client.d.ts",
40
+ "default": "./dist/client.js"
149
41
  },
150
42
  "./package.json": "./package.json"
151
43
  },
@@ -215,7 +107,7 @@
215
107
  "lint-staged": "^15.3.0",
216
108
  "next": "^15.3.5",
217
109
  "prettier": "^3.5.0",
218
- "tsup": "^8.3.6",
110
+ "tsdown": "^0.15.0",
219
111
  "typescript": "^5.7.3",
220
112
  "typescript-eslint": "^8.23.0",
221
113
  "vitest": "^2.1.8"
@@ -230,5 +122,6 @@
230
122
  "commitizen": {
231
123
  "path": "@commitlint/cz-commitlint"
232
124
  }
233
- }
125
+ },
126
+ "module": "./dist/index.js"
234
127
  }
@@ -1,353 +0,0 @@
1
- import { a as BaseClass, B as BaseAPI } from './base-BV6DyzGS.js';
2
- import { WabaConfigType } from './types/config.js';
3
- import { d as ResponseSuccess, e as RequesterClass } from './request-CUjrMn8R.js';
4
- import { B as BusinessVerticalEnum } from './enums-DIimUG6s.js';
5
-
6
- /**
7
- * Upload session information for creating upload sessions.
8
- */
9
- interface UploadSession {
10
- id: string;
11
- video?: boolean;
12
- }
13
- /**
14
- * Response from creating an upload session.
15
- */
16
- interface UploadSessionResponse {
17
- id: string;
18
- }
19
- /**
20
- * Response from uploading business profile media.
21
- */
22
- interface UploadBusinessProfileResponse {
23
- h: string;
24
- }
25
- /**
26
- * Upload handle information containing file details and handle.
27
- */
28
- interface UploadHandle {
29
- handle: string;
30
- file_size: number;
31
- upload_result: {
32
- handle_type: string;
33
- name: string;
34
- };
35
- }
36
- /**
37
- * Request parameters for creating upload session.
38
- */
39
- interface CreateUploadSessionParams {
40
- /**
41
- * Length of the file to be uploaded in bytes.
42
- */
43
- fileLength: number;
44
- /**
45
- * MIME type of the file (e.g., 'image/jpeg').
46
- */
47
- fileType: string;
48
- /**
49
- * Name of the file with extension.
50
- */
51
- fileName: string;
52
- }
53
- /**
54
- * Request parameters for uploading media.
55
- */
56
- interface UploadMediaParams {
57
- /**
58
- * The upload session ID from createUploadSession response.
59
- */
60
- uploadId: string;
61
- /**
62
- * The binary data of the file (Buffer).
63
- */
64
- file: Buffer;
65
- }
66
- /**
67
- * Request parameters for getting upload handle.
68
- */
69
- interface GetUploadHandleParams {
70
- /**
71
- * The upload session ID from createUploadSession response.
72
- */
73
- uploadId: string;
74
- }
75
-
76
- /**
77
- * Available fields that can be requested when retrieving a business profile.
78
- */
79
- type BusinessProfileField = 'about' | 'address' | 'description' | 'email' | 'profile_picture_url' | 'websites' | 'vertical';
80
- type BusinessProfileFieldsParam = BusinessProfileField[] | string;
81
- /**
82
- * Business profile data structure containing all profile information.
83
- */
84
- interface BusinessProfileData {
85
- /**
86
- * The business's About text. This text appears in the business's profile, beneath its profile image,
87
- * phone number, and contact buttons.
88
- * - String cannot be empty
89
- * - Strings must be between 1 and 139 characters
90
- * - Rendered emojis are supported however their unicode values are not.
91
- * Emoji unicode values must be Java- or JavaScript-escape encoded
92
- * - Hyperlinks can be included but will not render as clickable links
93
- * - Markdown is not supported
94
- */
95
- about?: string;
96
- /**
97
- * Address of the business. Character limit 256.
98
- */
99
- address?: string;
100
- /**
101
- * Description of the business. Character limit 512.
102
- */
103
- description?: string;
104
- /**
105
- * The contact email address (in valid email format) of the business. Character limit 128.
106
- */
107
- email?: string;
108
- /**
109
- * The messaging service used for the request. Always set it to "whatsapp" if you are using
110
- * the WhatsApp Business API.
111
- */
112
- messaging_product: string;
113
- /**
114
- * Profile picture URL.
115
- */
116
- profile_picture_url?: string;
117
- /**
118
- * The URLs associated with the business. For instance, a website, Facebook Page, or Instagram.
119
- * - You must include the http:// or https:// portion of the URL
120
- * - There is a maximum of 2 websites with a maximum of 256 characters each
121
- */
122
- websites?: string[];
123
- /**
124
- * Business category. This can be either an empty string or one of the predefined business categories.
125
- * @see BusinessVerticalEnum for all available options
126
- */
127
- vertical?: BusinessVerticalEnum | string;
128
- }
129
- /**
130
- * Response structure for business profile GET requests.
131
- */
132
- interface BusinessProfileResponse {
133
- data: BusinessProfileData[];
134
- }
135
- /**
136
- * Request structure for updating business profile.
137
- */
138
- interface UpdateBusinessProfileRequest {
139
- /**
140
- * The messaging service used for the request. Always set it to "whatsapp" if you are using
141
- * the WhatsApp Business API.
142
- * @required
143
- */
144
- messaging_product: string;
145
- /**
146
- * The business's About text. This text appears in the business's profile, beneath its profile image,
147
- * phone number, and contact buttons.
148
- * - String cannot be empty
149
- * - Strings must be between 1 and 139 characters
150
- * - Rendered emojis are supported however their unicode values are not.
151
- * Emoji unicode values must be Java- or JavaScript-escape encoded
152
- * - Hyperlinks can be included but will not render as clickable links
153
- * - Markdown is not supported
154
- */
155
- about?: string;
156
- /**
157
- * Address of the business. Character limit 256.
158
- */
159
- address?: string;
160
- /**
161
- * Description of the business. Character limit 512.
162
- */
163
- description?: string;
164
- /**
165
- * Business category. This can be either an empty string or one of the predefined business categories.
166
- * @see BusinessVerticalEnum for all available options
167
- */
168
- vertical?: BusinessVerticalEnum | string;
169
- /**
170
- * The contact email address (in valid email format) of the business. Character limit 128.
171
- */
172
- email?: string;
173
- /**
174
- * The URLs associated with the business. For instance, a website, Facebook Page, or Instagram.
175
- * - You must include the http:// or https:// portion of the URL
176
- * - There is a maximum of 2 websites with a maximum of 256 characters each
177
- */
178
- websites?: string[];
179
- /**
180
- * Handle of the profile picture. This handle is generated when you upload the binary file
181
- * for the profile picture to Meta using the Resumable Upload API.
182
- */
183
- profile_picture_handle?: string;
184
- }
185
- declare class BusinessProfileClass extends BaseClass {
186
- /**
187
- * Get your business profile.
188
- * @param fields Specific fields to be returned in the response. If not specified, all fields will be returned.
189
- */
190
- getBusinessProfile(fields?: BusinessProfileFieldsParam): Promise<BusinessProfileResponse>;
191
- /**
192
- * Update your business profile.
193
- * @param updateRequest The request object containing the fields to update.
194
- */
195
- updateBusinessProfile(updateRequest: UpdateBusinessProfileRequest): Promise<ResponseSuccess>;
196
- /**
197
- * Create an upload session for profile picture.
198
- * @param fileLength Length of the file to be uploaded in bytes.
199
- * @param fileType MIME type of the file (e.g., 'image/jpeg').
200
- * @param fileName Name of the file.
201
- */
202
- createUploadSession(fileLength: number, fileType: string, fileName: string): Promise<UploadSessionResponse>;
203
- /**
204
- * Upload media file to the upload session.
205
- * @param uploadId The ID of the upload session.
206
- * @param file The binary data of the file.
207
- */
208
- uploadMedia(uploadId: string, file: Buffer): Promise<UploadBusinessProfileResponse>;
209
- /**
210
- * Get the upload handle information.
211
- * @param uploadId The ID of the upload session.
212
- */
213
- getUploadHandle(uploadId: string): Promise<UploadHandle>;
214
- }
215
-
216
- /**
217
- * API for managing WhatsApp Business Profiles and profile pictures.
218
- *
219
- * This API allows you to:
220
- * - Get business profile information
221
- * - Update business profile details
222
- * - Upload profile pictures using a three-step process:
223
- * 1. Create an upload session
224
- * 2. Upload the image binary data
225
- * 3. Get the upload handle to use when updating the profile
226
- */
227
- declare class BusinessProfileApi extends BaseAPI implements BusinessProfileClass {
228
- private readonly endpoint;
229
- constructor(config: WabaConfigType, client: RequesterClass);
230
- /**
231
- * Get your business profile information.
232
- *
233
- * Use this method to retrieve details about your WhatsApp business profile, including
234
- * about text, address, description, email, profile picture URL, websites, and vertical.
235
- *
236
- * @param fields Fields to be returned in the response. If not specified, all fields will be returned.
237
- * Possible values: about, address, description, email, profile_picture_url, websites, vertical
238
- * @returns The business profile information.
239
- *
240
- * @example
241
- * // Get all business profile fields
242
- * const profile = await whatsappClient.businessProfile.getBusinessProfile();
243
- *
244
- * // Get specific business profile fields
245
- * const profile = await whatsappClient.businessProfile.getBusinessProfile('about,address,email');
246
- *
247
- * // Using the BusinessProfileFieldsParam type
248
- * const profile = await whatsappClient.businessProfile.getBusinessProfile(['about', 'address', 'email']);
249
- */
250
- getBusinessProfile(fields?: BusinessProfileFieldsParam): Promise<BusinessProfileResponse>;
251
- /**
252
- * Update your business profile.
253
- *
254
- * Use this method to update one or more fields of your WhatsApp business profile.
255
- *
256
- * @param updateRequest The request object containing the fields to update.
257
- * - messaging_product: Required. Always set to "whatsapp".
258
- * - about: Optional. Business's About text (1-139 characters).
259
- * - address: Optional. Business address (max 256 characters).
260
- * - description: Optional. Business description (max 512 characters).
261
- * - vertical: Optional. Business category (use BusinessVerticalEnum for type safety).
262
- * - email: Optional. Contact email (valid format, max 128 characters).
263
- * - websites: Optional. Up to 2 URLs (max 256 characters each).
264
- * - profile_picture_handle: Optional. Handle from upload process.
265
- * @returns Response indicating success or failure.
266
- *
267
- * @example
268
- * // Update business profile with multiple fields including vertical using enum
269
- * await whatsappClient.businessProfile.updateBusinessProfile({
270
- * messaging_product: 'whatsapp',
271
- * about: 'We provide excellent service',
272
- * email: 'contact@example.com',
273
- * websites: ['https://example.com'],
274
- * vertical: BusinessVerticalEnum.RETAIL
275
- * });
276
- */
277
- updateBusinessProfile(updateRequest: UpdateBusinessProfileRequest): Promise<ResponseSuccess>;
278
- /**
279
- * Create an upload session for a profile picture.
280
- *
281
- * This is the first step in the profile picture upload process.
282
- *
283
- * @param fileLength Length of the file to be uploaded in bytes.
284
- * @param fileType MIME type of the file (e.g., 'image/jpeg').
285
- * @param fileName Name of the file with extension.
286
- * @returns Response containing the upload session ID needed for the next step.
287
- *
288
- * @example
289
- * // Create upload session for profile picture
290
- * const session = await whatsappClient.businessProfile.createUploadSession(
291
- * fileBuffer.length,
292
- * 'image/jpeg',
293
- * 'profile.jpg'
294
- * );
295
- * const uploadSessionId = session.upload_session_id;
296
- */
297
- createUploadSession(fileLength: number, fileType: string, fileName: string): Promise<UploadSessionResponse>;
298
- /**
299
- * Upload media file to the upload session.
300
- *
301
- * This is the second step in the profile picture upload process.
302
- * Upload the binary content of the file to the previously created upload session.
303
- *
304
- * @param uploadId The upload session ID from createUploadSession response.
305
- * @param file The binary data of the file (Buffer).
306
- * @returns Response indicating success or failure.
307
- *
308
- * @example
309
- * // Upload the actual file content
310
- * await whatsappClient.businessProfile.uploadMedia(
311
- * uploadSessionId,
312
- * fileBuffer
313
- * );
314
- */
315
- uploadMedia(uploadId: string, file: Buffer): Promise<UploadBusinessProfileResponse>;
316
- /**
317
- * Get the upload handle information.
318
- *
319
- * This is the third step in the profile picture upload process.
320
- * After uploading the file, get the handle to use when updating the profile.
321
- *
322
- * @param uploadId The upload session ID from createUploadSession response.
323
- * @returns Response containing the upload handle information.
324
- *
325
- * @example
326
- * // Complete profile picture update process
327
- * // 1. Create upload session
328
- * const session = await whatsappClient.businessProfile.createUploadSession(
329
- * fileBuffer.length, 'image/jpeg', 'profile.jpg'
330
- * );
331
- *
332
- * // 2. Upload the image data
333
- * await whatsappClient.businessProfile.uploadMedia(
334
- * session.upload_session_id, fileBuffer
335
- * );
336
- *
337
- * // 3. Get the handle for the uploaded file
338
- * const handleInfo = await whatsappClient.businessProfile.getUploadHandle(
339
- * session.upload_session_id
340
- * );
341
- *
342
- * // 4. Update profile with new picture and business information
343
- * await whatsappClient.businessProfile.updateBusinessProfile({
344
- * messaging_product: 'whatsapp',
345
- * profile_picture_handle: handleInfo.handle,
346
- * vertical: BusinessVerticalEnum.RESTAURANT,
347
- * about: 'Delicious food served daily'
348
- * });
349
- */
350
- getUploadHandle(uploadId: string): Promise<UploadHandle>;
351
- }
352
-
353
- export { BusinessProfileApi as B, type CreateUploadSessionParams as C, type GetUploadHandleParams as G, type UpdateBusinessProfileRequest as U, type BusinessProfileData as a, type BusinessProfileResponse as b, type BusinessProfileField as c, type BusinessProfileFieldsParam as d, BusinessProfileClass as e, type UploadBusinessProfileResponse as f, type UploadHandle as g, type UploadMediaParams as h, type UploadSession as i, type UploadSessionResponse as j };
@@ -1,22 +0,0 @@
1
- import { B as BaseAPI } from './base-BV6DyzGS.js';
2
- import { WabaConfigType } from './types/config.js';
3
- import { b as ResponseData, d as ResponseSuccess, e as RequesterClass } from './request-CUjrMn8R.js';
4
-
5
- type EncryptionPublicKeyResponse = ResponseData<{
6
- business_public_key: string;
7
- business_public_key_signature_status: 'VALID' | 'MISMATCH';
8
- }>;
9
-
10
- interface EncryptionClass {
11
- getEncryptionPublicKey(): Promise<EncryptionPublicKeyResponse>;
12
- setEncryptionPublicKey(businessPublicKey: string): Promise<ResponseSuccess>;
13
- }
14
-
15
- declare class EncryptionApi extends BaseAPI implements EncryptionClass {
16
- private readonly endpoint;
17
- constructor(config: WabaConfigType, client: RequesterClass);
18
- getEncryptionPublicKey(): Promise<EncryptionPublicKeyResponse>;
19
- setEncryptionPublicKey(businessPublicKey: string): Promise<ResponseSuccess>;
20
- }
21
-
22
- export { EncryptionApi as E, type EncryptionPublicKeyResponse as a, type EncryptionClass as b };