meta-cloud-api 0.2.30 → 0.2.31

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 (74) hide show
  1. package/dist/chunk-AQTZR5SI.js +2 -0
  2. package/dist/chunk-AQTZR5SI.js.map +1 -0
  3. package/dist/chunk-EYGUX4EA.js +2 -0
  4. package/dist/chunk-EYGUX4EA.js.map +1 -0
  5. package/dist/{chunk-GT3XQN7Y.js → chunk-FFOE5YKT.js} +2 -2
  6. package/dist/chunk-FFOE5YKT.js.map +1 -0
  7. package/dist/{chunk-R36L2XYO.js → chunk-XIIJD6SG.js} +2 -2
  8. package/dist/chunk-XIIJD6SG.js.map +1 -0
  9. package/dist/features/encryption/index.js +1 -1
  10. package/dist/features/flow/index.js +1 -1
  11. package/dist/features/media/index.js +1 -1
  12. package/dist/features/messages/index.js +1 -1
  13. package/dist/features/phone/index.js +1 -1
  14. package/dist/features/profile/index.js +1 -1
  15. package/dist/features/qrCode/index.js +1 -1
  16. package/dist/features/registration/index.js +1 -1
  17. package/dist/features/template/index.js +1 -1
  18. package/dist/features/twoStepVerification/index.js +1 -1
  19. package/dist/features/waba/index.js +1 -1
  20. package/dist/index.js +2 -1
  21. package/dist/index.js.map +1 -1
  22. package/dist/shared/types/config.js +1 -1
  23. package/dist/shared/types/enums.js +1 -1
  24. package/package.json +2 -1
  25. package/dist/BusinessProfileApi-Dt8jkESv.d.ts +0 -352
  26. package/dist/EncryptionApi-CwGwcpiZ.d.ts +0 -21
  27. package/dist/FlowApi-bENOxS_4.d.ts +0 -471
  28. package/dist/MediaApi-DvAoklbt.d.ts +0 -89
  29. package/dist/MessageApi-vNrieuce.d.ts +0 -591
  30. package/dist/PhoneNumberApi-DiGL3drr.d.ts +0 -141
  31. package/dist/QrCodeApi-BYUCrcp3.d.ts +0 -97
  32. package/dist/RegistrationApi-CS9TCeHz.d.ts +0 -46
  33. package/dist/TemplateApi-DfzQkRxJ.d.ts +0 -117
  34. package/dist/TwoStepVerificationApi-B2pZzlUJ.d.ts +0 -32
  35. package/dist/WabaApi-GGQLjvio.d.ts +0 -174
  36. package/dist/base-DwevK2tJ.d.ts +0 -46
  37. package/dist/chunk-A264MT4Q.js +0 -2
  38. package/dist/chunk-A264MT4Q.js.map +0 -1
  39. package/dist/chunk-GT3XQN7Y.js.map +0 -1
  40. package/dist/chunk-H55VIWDI.js +0 -2
  41. package/dist/chunk-H55VIWDI.js.map +0 -1
  42. package/dist/chunk-HEVRZRB4.js +0 -3
  43. package/dist/chunk-HEVRZRB4.js.map +0 -1
  44. package/dist/chunk-I222VSWK.js +0 -2
  45. package/dist/chunk-I222VSWK.js.map +0 -1
  46. package/dist/chunk-R36L2XYO.js.map +0 -1
  47. package/dist/chunk-SMHCU5MN.js +0 -2
  48. package/dist/chunk-SMHCU5MN.js.map +0 -1
  49. package/dist/chunk-TEJIY4ZS.js +0 -3
  50. package/dist/chunk-TEJIY4ZS.js.map +0 -1
  51. package/dist/chunk-W2U7MN7M.js +0 -2
  52. package/dist/chunk-W2U7MN7M.js.map +0 -1
  53. package/dist/core/webhook/index.d.ts +0 -820
  54. package/dist/core/webhook/index.js +0 -2
  55. package/dist/core/webhook/index.js.map +0 -1
  56. package/dist/core/whatsapp/index.d.ts +0 -100
  57. package/dist/core/whatsapp/index.js +0 -2
  58. package/dist/core/whatsapp/index.js.map +0 -1
  59. package/dist/enums-iedeomKw.d.ts +0 -688
  60. package/dist/features/encryption/index.d.ts +0 -9
  61. package/dist/features/flow/index.d.ts +0 -9
  62. package/dist/features/media/index.d.ts +0 -9
  63. package/dist/features/messages/index.d.ts +0 -9
  64. package/dist/features/phone/index.d.ts +0 -9
  65. package/dist/features/profile/index.d.ts +0 -9
  66. package/dist/features/qrCode/index.d.ts +0 -9
  67. package/dist/features/registration/index.d.ts +0 -9
  68. package/dist/features/template/index.d.ts +0 -9
  69. package/dist/features/twoStepVerification/index.d.ts +0 -9
  70. package/dist/features/waba/index.d.ts +0 -9
  71. package/dist/index.d.ts +0 -21
  72. package/dist/shared/types/config.d.ts +0 -78
  73. package/dist/shared/types/enums.d.ts +0 -1
  74. package/dist/shared/utils/isMetaError.d.ts +0 -21
@@ -1,141 +0,0 @@
1
- import { P as Paging, R as ResponseSuccess, B as BaseAPI, a as RequesterClass } from './base-DwevK2tJ.js';
2
- import { WabaConfigType } from './shared/types/config.js';
3
-
4
- type QualityRating = 'GREEN' | 'YELLOW' | 'RED' | 'NA';
5
- type AccountMode = 'LIVE' | 'SANDBOX';
6
- type CodeVerificationStatus = 'NOT_VERIFIED' | 'VERIFIED' | 'EXPIRED' | 'PENDING' | 'DELETED' | 'MIGRATED' | 'BANNED' | 'RESTRICTED' | 'RATE_LIMITED' | 'FLAGGED' | 'CONNECTED' | 'DISCONNECTED' | 'UNKNOWN' | 'UNVERIFIED';
7
- type MessagingLimitTier = 'TIER_50' | 'TIER_250' | 'TIER_1K' | 'TIER_10K' | 'TIER_100K' | 'TIER_UNLIMITED';
8
- type PlatformType = 'CLOUD_API' | 'ON_PREMISE' | 'NOT_APPLICABLE';
9
- type ThroughputLevel = 'STANDARD' | 'HIGH' | 'NOT_APPLICABLE';
10
- type HealthStatusEntity = {
11
- entity_type: string;
12
- id: string;
13
- can_send_message: string;
14
- additional_info?: string[];
15
- errors?: Array<{
16
- error_code: number;
17
- error_description: string;
18
- possible_solution: string;
19
- }>;
20
- };
21
- type HealthStatus = {
22
- can_send_message: string;
23
- entities: HealthStatusEntity[];
24
- };
25
- type QualityScore = {
26
- score: QualityRating;
27
- };
28
- type Throughput = {
29
- level: ThroughputLevel;
30
- };
31
- type PhoneNumberResponse = {
32
- display_phone_number: string;
33
- id: string;
34
- quality_rating: QualityRating;
35
- verified_name: string;
36
- account_mode?: AccountMode;
37
- certificate?: string;
38
- code_verification_status?: CodeVerificationStatus;
39
- conversational_automation?: Record<string, unknown>;
40
- eligibility_for_api_business_global_search?: string;
41
- health_status?: HealthStatus;
42
- is_official_business_account?: boolean;
43
- is_on_biz_app?: boolean;
44
- is_pin_enabled?: boolean;
45
- is_preverified_number?: boolean;
46
- last_onboarded_time?: string;
47
- messaging_limit_tier?: MessagingLimitTier;
48
- name_status?: string;
49
- new_certificate?: string;
50
- new_name_status?: string;
51
- platform_type?: PlatformType;
52
- quality_score?: QualityScore;
53
- search_visibility?: string;
54
- status?: CodeVerificationStatus;
55
- throughput?: Throughput;
56
- };
57
- type Cursors = {
58
- before: string;
59
- after: string;
60
- };
61
- type PhoneNumbersResponse = {
62
- data: PhoneNumberResponse[];
63
- paging: Paging;
64
- };
65
- type RequestVerificationCodeRequest = {
66
- code_method: 'SMS' | 'VOICE';
67
- language: string;
68
- };
69
- type VerifyCodeRequest = {
70
- code: string;
71
- };
72
- type TwoStepVerificationParams = {
73
- pin: string;
74
- };
75
- interface PhoneNumberClass {
76
- getPhoneNumberById(fields?: string): Promise<PhoneNumberResponse>;
77
- getPhoneNumbers(): Promise<PhoneNumbersResponse>;
78
- requestVerificationCode(params: RequestVerificationCodeRequest): Promise<ResponseSuccess>;
79
- verifyCode(params: VerifyCodeRequest): Promise<ResponseSuccess>;
80
- }
81
-
82
- /**
83
- * API for managing WhatsApp Phone Numbers.
84
- *
85
- * This API allows you to:
86
- * - Get phone number information by ID
87
- * - Get all phone numbers for a business account
88
- * - Request verification codes for phone numbers
89
- * - Verify phone numbers with codes
90
- */
91
- declare class PhoneNumberApi extends BaseAPI implements PhoneNumberClass {
92
- private readonly endpoint;
93
- constructor(config: WabaConfigType, client: RequesterClass);
94
- /**
95
- * Get phone number information by ID.
96
- *
97
- * @param fields Optional comma-separated list of fields to include in the response
98
- * @returns Phone number information including verification status, quality rating, etc.
99
- *
100
- * @example
101
- * const phoneNumber = await whatsappClient.phoneNumber.getPhoneNumberById();
102
- * const phoneNumberWithFields = await whatsappClient.phoneNumber.getPhoneNumberById('display_phone_number,verified_name');
103
- */
104
- getPhoneNumberById(fields?: string): Promise<PhoneNumberResponse>;
105
- /**
106
- * Get all phone numbers for the business account.
107
- *
108
- * @returns List of phone numbers associated with the business account
109
- *
110
- * @example
111
- * const phoneNumbers = await whatsappClient.phoneNumber.getPhoneNumbers();
112
- */
113
- getPhoneNumbers(): Promise<PhoneNumbersResponse>;
114
- /**
115
- * Request a verification code for the phone number.
116
- *
117
- * @param request Verification code request containing method and language
118
- * @returns Response indicating success or failure
119
- *
120
- * @example
121
- * await whatsappClient.phoneNumber.requestVerificationCode({
122
- * code_method: 'SMS',
123
- * language: 'en_US'
124
- * });
125
- */
126
- requestVerificationCode(request: RequestVerificationCodeRequest): Promise<ResponseSuccess>;
127
- /**
128
- * Verify the phone number with the received code.
129
- *
130
- * @param request Verification request containing the code
131
- * @returns Response indicating success or failure
132
- *
133
- * @example
134
- * await whatsappClient.phoneNumber.verifyCode({
135
- * code: '123456'
136
- * });
137
- */
138
- verifyCode(request: VerifyCodeRequest): Promise<ResponseSuccess>;
139
- }
140
-
141
- export { type AccountMode as A, type CodeVerificationStatus as C, type HealthStatus as H, type MessagingLimitTier as M, PhoneNumberApi as P, type QualityRating as Q, type RequestVerificationCodeRequest as R, type Throughput as T, type VerifyCodeRequest as V, type PhoneNumberClass as a, type PhoneNumberResponse as b, type Cursors as c, type HealthStatusEntity as d, type PhoneNumbersResponse as e, type PlatformType as f, type QualityScore as g, type ThroughputLevel as h, type TwoStepVerificationParams as i };
@@ -1,97 +0,0 @@
1
- import { c as ResponseData, R as ResponseSuccess, B as BaseAPI, a as RequesterClass } from './base-DwevK2tJ.js';
2
- import { WabaConfigType } from './shared/types/config.js';
3
-
4
- type QrCodeResponse = {
5
- code: string;
6
- prefilled_message: string;
7
- deep_link_url: string;
8
- qr_image_url?: string;
9
- };
10
- type QrCodesResponse = ResponseData<QrCodeResponse[]>;
11
- type CreateQrCodeRequest = {
12
- prefilled_message: string;
13
- generate_qr_image?: 'SVG' | 'PNG';
14
- };
15
- type UpdateQrCodeRequest = {
16
- code: string;
17
- prefilled_message: string;
18
- };
19
- interface QrCodeClass {
20
- createQrCode(request: CreateQrCodeRequest): Promise<QrCodeResponse>;
21
- getQrCodes(): Promise<QrCodesResponse>;
22
- getQrCode(qrCodeId: string): Promise<QrCodeResponse>;
23
- updateQrCode(request: UpdateQrCodeRequest): Promise<QrCodeResponse>;
24
- deleteQrCode(qrCodeId: string): Promise<ResponseSuccess>;
25
- }
26
-
27
- /**
28
- * API for managing WhatsApp QR Codes.
29
- *
30
- * This API allows you to:
31
- * - Create QR codes with prefilled messages
32
- * - Get all QR codes
33
- * - Get specific QR code details
34
- * - Update QR code messages
35
- * - Delete QR codes
36
- */
37
- declare class QrCodeApi extends BaseAPI implements QrCodeClass {
38
- private readonly endpoint;
39
- constructor(config: WabaConfigType, client: RequesterClass);
40
- /**
41
- * Create a new QR code with a prefilled message.
42
- *
43
- * @param request The QR code creation request
44
- * @returns QR code information including code, deep link URL, and optional image URL
45
- *
46
- * @example
47
- * const qrCode = await whatsappClient.qrCode.createQrCode({
48
- * prefilled_message: 'Hello from WhatsApp!',
49
- * generate_qr_image: 'PNG'
50
- * });
51
- */
52
- createQrCode(request: CreateQrCodeRequest): Promise<QrCodeResponse>;
53
- /**
54
- * Get all QR codes for the current phone number.
55
- *
56
- * @returns List of all QR codes
57
- *
58
- * @example
59
- * const qrCodes = await whatsappClient.qrCode.getQrCodes();
60
- */
61
- getQrCodes(): Promise<QrCodesResponse>;
62
- /**
63
- * Get a specific QR code by ID.
64
- *
65
- * @param qrCodeId The QR code ID to retrieve
66
- * @returns QR code information
67
- *
68
- * @example
69
- * const qrCode = await whatsappClient.qrCode.getQrCode('qr_code_123');
70
- */
71
- getQrCode(qrCodeId: string): Promise<QrCodeResponse>;
72
- /**
73
- * Update an existing QR code's prefilled message.
74
- *
75
- * @param request The QR code update request containing code and new message
76
- * @returns Updated QR code information
77
- *
78
- * @example
79
- * const updatedQrCode = await whatsappClient.qrCode.updateQrCode({
80
- * code: 'existing_qr_code',
81
- * prefilled_message: 'Updated message!'
82
- * });
83
- */
84
- updateQrCode(request: UpdateQrCodeRequest): Promise<QrCodeResponse>;
85
- /**
86
- * Delete a QR code.
87
- *
88
- * @param qrCodeId The QR code ID to delete
89
- * @returns Response indicating success or failure
90
- *
91
- * @example
92
- * await whatsappClient.qrCode.deleteQrCode('qr_code_123');
93
- */
94
- deleteQrCode(qrCodeId: string): Promise<ResponseSuccess>;
95
- }
96
-
97
- export { type CreateQrCodeRequest as C, QrCodeApi as Q, type UpdateQrCodeRequest as U, type QrCodeClass as a, type QrCodeResponse as b, type QrCodesResponse as c };
@@ -1,46 +0,0 @@
1
- import { R as ResponseSuccess, B as BaseAPI, a as RequesterClass } from './base-DwevK2tJ.js';
2
- import { WabaConfigType } from './shared/types/config.js';
3
- import { j as DataLocalizationRegionEnum } from './enums-iedeomKw.js';
4
-
5
- type RegistrationRequest = {
6
- messaging_product: 'whatsapp';
7
- pin: string;
8
- data_localization_region?: DataLocalizationRegionEnum;
9
- };
10
- interface RegistrationClass {
11
- register(pin: string, dataLocalizationRegion?: DataLocalizationRegionEnum): Promise<ResponseSuccess>;
12
- deregister(): Promise<ResponseSuccess>;
13
- }
14
-
15
- /**
16
- * API for managing WhatsApp Business Account registration.
17
- *
18
- * This API allows you to:
19
- * - Register a WhatsApp Business Account with a PIN
20
- * - Deregister a WhatsApp Business Account
21
- */
22
- declare class RegistrationApi extends BaseAPI implements RegistrationClass {
23
- constructor(config: WabaConfigType, client: RequesterClass);
24
- /**
25
- * Register a WhatsApp Business Account using a PIN.
26
- *
27
- * @param pin The registration PIN received via SMS or voice call
28
- * @param dataLocalizationRegion Optional data localization region
29
- * @returns Response indicating success or failure
30
- *
31
- * @example
32
- * await whatsappClient.registration.register('123456', DataLocalizationRegionEnum.Asia);
33
- */
34
- register(pin: string, dataLocalizationRegion?: DataLocalizationRegionEnum): Promise<ResponseSuccess>;
35
- /**
36
- * Deregister a WhatsApp Business Account.
37
- *
38
- * @returns Response indicating success or failure
39
- *
40
- * @example
41
- * await whatsappClient.registration.deregister();
42
- */
43
- deregister(): Promise<ResponseSuccess>;
44
- }
45
-
46
- export { RegistrationApi as R, type RegistrationClass as a, type RegistrationRequest as b };
@@ -1,117 +0,0 @@
1
- import { G as GeneralRequestBody, R as ResponseSuccess, b as ResponsePagination, B as BaseAPI, a as RequesterClass } from './base-DwevK2tJ.js';
2
- import { WabaConfigType } from './shared/types/config.js';
3
- import { L as LanguagesEnum, C as CategoryEnum, T as TemplateStatusEnum } from './enums-iedeomKw.js';
4
-
5
- type TemplateFormat = 'TEXT' | 'IMAGE' | 'VIDEO' | 'DOCUMENT' | 'LOCATION';
6
- type PhoneNumberButton = {
7
- type: 'PHONE_NUMBER';
8
- text: string;
9
- phone_number: string;
10
- };
11
- type URLButton = {
12
- type: 'URL';
13
- text: string;
14
- url: string;
15
- example?: string[];
16
- };
17
- type QuickReplyButton = {
18
- type: 'QUICK_REPLY';
19
- text: string;
20
- };
21
- type CopyCodeButton = {
22
- type: 'COPY_CODE';
23
- example: string;
24
- };
25
- type FlowButton = {
26
- type: 'FLOW';
27
- text: string;
28
- flow_id?: string;
29
- flow_name?: string;
30
- flow_json?: string;
31
- flow_action?: 'navigate' | 'data_exchange';
32
- navigate_screen?: string;
33
- };
34
- type MPMButton = {
35
- type: 'MPM';
36
- };
37
- type OTPButton = {
38
- type: 'OTP';
39
- };
40
- type SPMButton = {
41
- type: 'SPM';
42
- };
43
- type TemplateButton = PhoneNumberButton | URLButton | QuickReplyButton | CopyCodeButton | FlowButton | MPMButton | OTPButton | SPMButton;
44
- type TemplateHeaderExample = {
45
- header_text?: string[];
46
- header_text_named_params?: Array<{
47
- param_name: string;
48
- example: string;
49
- }>;
50
- header_handle?: string[];
51
- };
52
- type TemplateHeader = {
53
- type: 'HEADER';
54
- format: TemplateFormat;
55
- text?: string;
56
- example?: TemplateHeaderExample;
57
- };
58
- type TemplateBody = {
59
- type: 'BODY';
60
- text: string;
61
- example?: {
62
- body_text?: Array<Array<string>>;
63
- body_text_named_params?: Array<{
64
- param_name: string;
65
- example: string;
66
- }>;
67
- };
68
- };
69
- type TemplateFooter = {
70
- type: 'FOOTER';
71
- text: string;
72
- };
73
- type ComponentTypes = TemplateHeader | TemplateBody | TemplateFooter | TemplateButton;
74
- type TemplateRequestBody = GeneralRequestBody & {
75
- name: string;
76
- language: LanguagesEnum;
77
- category?: CategoryEnum;
78
- components?: ComponentTypes[];
79
- };
80
- type TemplateResponse = {
81
- id: string;
82
- status: string;
83
- language: LanguagesEnum;
84
- category: CategoryEnum;
85
- name: string;
86
- components: ComponentTypes[];
87
- };
88
- type TemplateGetParams = {
89
- limit?: number;
90
- name?: string;
91
- language?: LanguagesEnum;
92
- category?: CategoryEnum;
93
- status?: TemplateStatusEnum;
94
- };
95
- type TemplateDeleteParams = {
96
- hsm_id: string;
97
- name: string;
98
- };
99
- declare class TemplateClass {
100
- getTemplate(templateId: string): Promise<TemplateResponse>;
101
- updateTemplate(templateId: string, template: Partial<TemplateRequestBody>): Promise<ResponseSuccess>;
102
- getTemplates(params?: TemplateGetParams): Promise<ResponsePagination<TemplateResponse>>;
103
- createTemplate(template: TemplateRequestBody): Promise<TemplateResponse>;
104
- deleteTemplate(params: TemplateDeleteParams): Promise<ResponseSuccess>;
105
- }
106
-
107
- declare class TemplateApi extends BaseAPI implements TemplateClass {
108
- private readonly endpoint;
109
- constructor(config: WabaConfigType, client: RequesterClass);
110
- getTemplate(templateId: string): Promise<TemplateResponse>;
111
- updateTemplate(templateId: string, template: Partial<TemplateRequestBody>): Promise<ResponseSuccess>;
112
- getTemplates(params?: TemplateGetParams): Promise<ResponsePagination<TemplateResponse>>;
113
- createTemplate(template: TemplateRequestBody): Promise<TemplateResponse>;
114
- deleteTemplate(params: TemplateDeleteParams): Promise<ResponseSuccess>;
115
- }
116
-
117
- export { TemplateApi as T, TemplateClass as a, type TemplateResponse as b, type TemplateDeleteParams as c, type TemplateGetParams as d, type TemplateRequestBody as e };
@@ -1,32 +0,0 @@
1
- import { R as ResponseSuccess, B as BaseAPI, a as RequesterClass } from './base-DwevK2tJ.js';
2
- import { WabaConfigType } from './shared/types/config.js';
3
-
4
- type TwoStepVerificationRequest = {
5
- pin: string;
6
- };
7
- interface TwoStepVerificationClass {
8
- setTwoStepVerificationCode(pin: string): Promise<ResponseSuccess>;
9
- }
10
-
11
- /**
12
- * API for managing WhatsApp Two-Step Verification.
13
- *
14
- * This API allows you to:
15
- * - Set a two-step verification PIN code
16
- * - Manage two-step verification settings
17
- */
18
- declare class TwoStepVerificationApi extends BaseAPI implements TwoStepVerificationClass {
19
- constructor(config: WabaConfigType, client: RequesterClass);
20
- /**
21
- * Set a two-step verification PIN code.
22
- *
23
- * @param pin The PIN code to set for two-step verification (6-digit numeric string)
24
- * @returns Response indicating success or failure
25
- *
26
- * @example
27
- * await whatsappClient.twoStepVerification.setTwoStepVerificationCode('123456');
28
- */
29
- setTwoStepVerificationCode(pin: string): Promise<ResponseSuccess>;
30
- }
31
-
32
- export { TwoStepVerificationApi as T, type TwoStepVerificationClass as a, type TwoStepVerificationRequest as b };
@@ -1,174 +0,0 @@
1
- import { R as ResponseSuccess, B as BaseAPI, a as RequesterClass } from './base-DwevK2tJ.js';
2
- import { WabaConfigType } from './shared/types/config.js';
3
-
4
- /**
5
- * WhatsApp Business Account subscription configuration
6
- */
7
- type WabaSubscription = {
8
- whatsapp_business_api_data: {
9
- id: string;
10
- link: string;
11
- name: string;
12
- category: string;
13
- };
14
- override_callback_uri?: string;
15
- };
16
- /**
17
- * Parameters for updating WABA subscription
18
- */
19
- interface UpdateWabaSubscription {
20
- override_callback_uri: string;
21
- verify_token: string;
22
- }
23
- /**
24
- * Response containing all WABA subscriptions
25
- */
26
- interface WabaSubscriptions {
27
- data: Array<WabaSubscription>;
28
- }
29
- /**
30
- * WABA account review status enumeration
31
- */
32
- declare enum WabaAccountReviewStatus {
33
- Approved = "APPROVED",
34
- Active = "ACTIVE",
35
- Inactive = "INACTIVE",
36
- Disabled = "DISABLED"
37
- }
38
- /**
39
- * WABA health status for message sending capability
40
- */
41
- declare enum WabaHealthStatusCanSendMessage {
42
- Blocked = "BLOCKED",
43
- Limited = "LIMITED",
44
- Available = "AVAILABLE"
45
- }
46
- /**
47
- * WABA account status enumeration
48
- */
49
- declare enum WabaAccountStatus {
50
- Approved = "APPROVED",
51
- Active = "ACTIVE",
52
- Inactive = "INACTIVE",
53
- Disabled = "DISABLED"
54
- }
55
- /**
56
- * Business verification status enumeration
57
- */
58
- declare enum WabaBusinessVerificationStatus {
59
- Verified = "verified",
60
- PendingSubmission = "pending_submission",
61
- Unverified = "unverified",
62
- Rejected = "rejected"
63
- }
64
- /**
65
- * WABA health status error details
66
- */
67
- interface WabaHealthStatusError {
68
- error_code?: number;
69
- error_description?: string;
70
- possible_solution?: string;
71
- }
72
- /**
73
- * WABA health status entity information
74
- */
75
- interface WabaHealthStatusEntity {
76
- entity_type?: string;
77
- id?: string;
78
- can_send_message?: string;
79
- errors?: WabaHealthStatusError[];
80
- }
81
- /**
82
- * Overall WABA health status
83
- */
84
- interface WabaHealthStatus {
85
- can_send_message?: WabaHealthStatusCanSendMessage;
86
- entities?: WabaHealthStatusEntity[];
87
- }
88
- /**
89
- * WhatsApp Business Account information
90
- */
91
- interface WabaAccount {
92
- account_review_status?: WabaAccountReviewStatus;
93
- id?: string;
94
- health_status?: WabaHealthStatus;
95
- status?: WabaAccountStatus;
96
- business_verification_status?: WabaBusinessVerificationStatus;
97
- message_template_namespace?: string;
98
- name?: string;
99
- ownership_type?: string;
100
- currency?: string;
101
- }
102
- /**
103
- * Available fields for WABA account queries
104
- */
105
- type WabaAccountFields = 'id' | 'name' | 'account_review_status' | 'auth_international_rate_eligibility' | 'business_verification_status' | 'country' | 'currency' | 'health_status' | 'status' | 'ownership_type' | 'message_template_namespace';
106
- /**
107
- * Parameter type for specifying which WABA account fields to retrieve
108
- */
109
- type WabaAccountFieldsParam = WabaAccountFields[];
110
- /**
111
- * Interface defining all WABA API methods
112
- */
113
- interface WABAClass {
114
- getWabaAccount(fields?: WabaAccountFieldsParam): Promise<WabaAccount>;
115
- getAllWabaSubscriptions(): Promise<WabaSubscriptions>;
116
- updateWabaSubscription(params: UpdateWabaSubscription): Promise<ResponseSuccess>;
117
- unsubscribeFromWaba(): Promise<ResponseSuccess>;
118
- }
119
-
120
- /**
121
- * API for managing WhatsApp Business Account (WABA).
122
- *
123
- * This API allows you to:
124
- * - Get WABA account information
125
- * - Manage WABA subscriptions
126
- * - Subscribe/unsubscribe from WABA webhooks
127
- * - Update subscription settings
128
- */
129
- declare class WabaApi extends BaseAPI implements WABAClass {
130
- constructor(config: WabaConfigType, client: RequesterClass);
131
- /**
132
- * Retrieve WhatsApp Business Account information.
133
- *
134
- * @param fields Optional array of specific fields to retrieve
135
- * @returns WABA account information including status, health, verification status, etc.
136
- *
137
- * @example
138
- * const account = await whatsappClient.waba.getWabaAccount(['id', 'name', 'status']);
139
- */
140
- getWabaAccount(fields?: WabaAccountFieldsParam): Promise<WabaAccount>;
141
- /**
142
- * Get all WABA subscriptions for the business account.
143
- *
144
- * @returns List of all subscribed apps and their configurations
145
- *
146
- * @example
147
- * const subscriptions = await whatsappClient.waba.getAllWabaSubscriptions();
148
- */
149
- getAllWabaSubscriptions(): Promise<WabaSubscriptions>;
150
- /**
151
- * Update WABA subscription configuration.
152
- *
153
- * @param params Configuration parameters including callback URI and verify token
154
- * @returns Response indicating success or failure
155
- *
156
- * @example
157
- * await whatsappClient.waba.updateWabaSubscription({
158
- * override_callback_uri: 'https://example.com/webhook',
159
- * verify_token: 'your_verify_token'
160
- * });
161
- */
162
- updateWabaSubscription({ override_callback_uri, verify_token, }: UpdateWabaSubscription): Promise<ResponseSuccess>;
163
- /**
164
- * Unsubscribe from WABA webhooks.
165
- *
166
- * @returns Response indicating success or failure
167
- *
168
- * @example
169
- * await whatsappClient.waba.unsubscribeFromWaba();
170
- */
171
- unsubscribeFromWaba(): Promise<ResponseSuccess>;
172
- }
173
-
174
- export { type UpdateWabaSubscription as U, WabaApi as W, type WabaAccount as a, type WABAClass as b, type WabaSubscriptions as c };
@@ -1,46 +0,0 @@
1
- import { WabaConfigType } from './shared/types/config.js';
2
- import { H as HttpMethodsEnum } from './enums-iedeomKw.js';
3
-
4
- type GeneralRequestBody = Record<string, unknown>;
5
- interface RequesterResponseInterface<T> {
6
- json: () => Promise<T>;
7
- }
8
- interface ResponseSuccess {
9
- success: boolean;
10
- }
11
- interface ResponseData<T> {
12
- data: T;
13
- }
14
- interface ResponsePagination<T> {
15
- data: T[];
16
- paging: Paging;
17
- }
18
- interface Paging {
19
- cursors: {
20
- before: string;
21
- after: string;
22
- };
23
- next: string;
24
- }
25
- declare class RequesterClass {
26
- constructor(apiVersion: string, phoneNumberId: number, accessToken: string, businessAcctId: string, userAgent: string);
27
- sendRequest: (method: HttpMethodsEnum, path: string, timeout: number, body?: GeneralRequestBody, contentType?: string, additionalHeaders?: Record<string, string>) => Promise<RequesterResponseInterface<unknown>>;
28
- getJson<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: GeneralRequestBody, additionalHeaders?: Record<string, string>): Promise<T>;
29
- sendFormData<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: FormData, additionalHeaders?: Record<string, string>): Promise<T>;
30
- sendUrlEncodedForm<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: Record<string, string>, additionalHeaders?: Record<string, string>): Promise<T>;
31
- }
32
-
33
- declare class BaseClass {
34
- constructor(config: WabaConfigType);
35
- }
36
-
37
- declare class BaseAPI implements BaseClass {
38
- protected config: WabaConfigType;
39
- protected client: RequesterClass;
40
- constructor(config: WabaConfigType, client: RequesterClass);
41
- protected sendJson<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any): Promise<T>;
42
- protected sendFormData<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any): Promise<T>;
43
- protected sendUrlEncodedForm<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any): Promise<T>;
44
- }
45
-
46
- export { BaseAPI as B, type GeneralRequestBody as G, type Paging as P, type ResponseSuccess as R, RequesterClass as a, type ResponsePagination as b, type ResponseData as c, BaseClass as d };
@@ -1,2 +0,0 @@
1
- import {a as a$1,b}from'./chunk-VW3LGHTJ.js';var p="FlowAPI",f=false,a=new a$1(p,process.env.DEBUG==="true"||f),i=class extends b{constructor(s,e){super(s,e),a.log("FlowAPI initialized");}async listFlows(s){return this.sendJson("GET",`/${s}/flows`,this.config.REQUEST_TIMEOUT,null)}async createFlow(s,e){let o={name:e.name,categories:e.categories,...e.endpoint_uri&&{endpoint_uri:e.endpoint_uri},...e.clone_flow_id&&{clone_flow_id:e.clone_flow_id},...e.flow_json&&{flow_json:e.flow_json},...e.publish!==void 0&&{publish:e.publish}};return this.sendJson("POST",`/${s}/flows`,this.config.REQUEST_TIMEOUT,JSON.stringify(o))}async getFlow(s,e,o){let n=new URLSearchParams;e&&n.append("fields",e),o&&n.append("date_format",o);let t=n.toString()?`?${n.toString()}`:"";return this.sendJson("GET",`/${s}${t}`,this.config.REQUEST_TIMEOUT,null)}async getFlowPreview(s,e=false){let o=`preview.invalidate(${e})`;return this.getFlow(s,o)}async updateFlowMetadata(s,e){let o={...e.name&&{name:e.name},...e.categories&&{categories:e.categories},...e.endpoint_uri&&{endpoint_uri:e.endpoint_uri},...e.application_id&&{application_id:e.application_id}};return this.sendJson("POST",`/${s}`,this.config.REQUEST_TIMEOUT,JSON.stringify(o))}async deleteFlow(s){return this.sendJson("DELETE",`/${s}`,this.config.REQUEST_TIMEOUT,null)}async listAssets(s){return this.sendJson("GET",`/${s}/assets`,this.config.REQUEST_TIMEOUT,null)}async updateFlowJson(s,e){let o=new FormData,n;if(e.file instanceof Buffer)n=new globalThis.Blob([e.file]),o.append("file",n);else if(typeof e.file=="object"&&!(e.file instanceof Blob))try{n=new globalThis.Blob([JSON.stringify(e.file,null,2)],{type:"application/json"}),o.append("file",n);}catch{throw new Error("Failed to stringify JSON object for Flow JSON update.")}else if(e.file instanceof Blob)n=e.file,o.append("file",n);else throw new Error("Invalid file type provided for Flow JSON update. Must be a Buffer, JSON object, or Blob.");return o.append("asset_type","FLOW_JSON"),o.append("name",e.name||"flow.json"),this.sendFormData("POST",`/${s}/assets`,this.config.REQUEST_TIMEOUT,o)}async validateFlowJson(s,e){try{let o=await this.updateFlowJson(s,{file:e}),n=!o.validation_errors||o.validation_errors.length===0;return {...o,valid:n}}catch(o){throw a.error("Error during Flow JSON validation attempt:",o),o}}async publishFlow(s){return this.sendJson("POST",`/${s}/publish`,this.config.REQUEST_TIMEOUT,JSON.stringify({}))}async deprecateFlow(s){return this.sendJson("POST",`/${s}/deprecate`,this.config.REQUEST_TIMEOUT,JSON.stringify({}))}async migrateFlows(s,e){let o={source_waba_id:e.source_waba_id,...e.source_flow_names&&{source_flow_names:e.source_flow_names}};return this.sendJson("POST",`/${s}/migrate_flows`,this.config.REQUEST_TIMEOUT,JSON.stringify(o))}};var d=i;export{i as a,d as b};//# sourceMappingURL=chunk-A264MT4Q.js.map
2
- //# sourceMappingURL=chunk-A264MT4Q.js.map