meta-cloud-api 1.0.0 → 1.0.1
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/LICENSE +21 -0
- package/README.md +405 -0
- package/dist/BusinessProfileApi-WXscSgo-.d.ts +353 -0
- package/dist/EncryptionApi-D7pt-OXT.d.ts +22 -0
- package/dist/FlowApi-UAvzhJfV.d.ts +136 -0
- package/dist/MediaApi-BrEKpqi_.d.ts +90 -0
- package/dist/MessageApi-Circorzz.d.ts +587 -0
- package/dist/PhoneNumberApi-DKlu9PHl.d.ts +142 -0
- package/dist/QrCodeApi-7vDwIBHR.d.ts +98 -0
- package/dist/RegistrationApi-qO_qoti9.d.ts +47 -0
- package/dist/TemplateApi-xGgIZt89.d.ts +161 -0
- package/dist/TwoStepVerificationApi-DfNPIz-C.d.ts +33 -0
- package/dist/WabaApi-DqQi_68m.d.ts +175 -0
- package/dist/WebhookProcessor-ByAe7Kf_.d.ts +707 -0
- package/dist/WhatsApp-BIBtT-y9.d.ts +82 -0
- package/dist/api/encryption/index.d.ts +10 -0
- package/dist/api/encryption/index.js +2 -0
- package/dist/api/encryption/index.js.map +1 -0
- package/dist/api/flow/index.d.ts +10 -0
- package/dist/api/flow/index.js +2 -0
- package/dist/api/flow/index.js.map +1 -0
- package/dist/api/index.d.ts +16 -0
- package/dist/api/index.js +2 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/media/index.d.ts +10 -0
- package/dist/api/media/index.js +2 -0
- package/dist/api/media/index.js.map +1 -0
- package/dist/api/messages/index.d.ts +10 -0
- package/dist/api/messages/index.js +2 -0
- package/dist/api/messages/index.js.map +1 -0
- package/dist/api/phone/index.d.ts +10 -0
- package/dist/api/phone/index.js +2 -0
- package/dist/api/phone/index.js.map +1 -0
- package/dist/api/profile/index.d.ts +10 -0
- package/dist/api/profile/index.js +2 -0
- package/dist/api/profile/index.js.map +1 -0
- package/dist/api/qrCode/index.d.ts +10 -0
- package/dist/api/qrCode/index.js +2 -0
- package/dist/api/qrCode/index.js.map +1 -0
- package/dist/api/registration/index.d.ts +10 -0
- package/dist/api/registration/index.js +2 -0
- package/dist/api/registration/index.js.map +1 -0
- package/dist/api/template/index.d.ts +215 -0
- package/dist/api/template/index.js +2 -0
- package/dist/api/template/index.js.map +1 -0
- package/dist/api/twoStepVerification/index.d.ts +10 -0
- package/dist/api/twoStepVerification/index.js +2 -0
- package/dist/api/twoStepVerification/index.js.map +1 -0
- package/dist/api/waba/index.d.ts +10 -0
- package/dist/api/waba/index.js +2 -0
- package/dist/api/waba/index.js.map +1 -0
- package/dist/base-CdGDdVEl.d.ts +18 -0
- package/dist/chunk-7QBIZCJ4.js +2 -0
- package/dist/chunk-7QBIZCJ4.js.map +1 -0
- package/dist/chunk-AMHQGG6Z.js +2 -0
- package/dist/chunk-AMHQGG6Z.js.map +1 -0
- package/dist/chunk-B7DCL6I7.js +10 -0
- package/dist/chunk-B7DCL6I7.js.map +1 -0
- package/dist/chunk-CRZ7EUYR.js +2 -0
- package/dist/chunk-CRZ7EUYR.js.map +1 -0
- package/dist/chunk-FKXSL2JK.js +3 -0
- package/dist/chunk-FKXSL2JK.js.map +1 -0
- package/dist/chunk-FSKBLPGE.js +2 -0
- package/dist/chunk-FSKBLPGE.js.map +1 -0
- package/dist/chunk-HJGN3PO4.js +3 -0
- package/dist/chunk-HJGN3PO4.js.map +1 -0
- package/dist/chunk-IYSR44P6.js +2 -0
- package/dist/chunk-IYSR44P6.js.map +1 -0
- package/dist/chunk-JC6YMVID.js +2 -0
- package/dist/chunk-JC6YMVID.js.map +1 -0
- package/dist/chunk-JPAV644F.js +2 -0
- package/dist/chunk-JPAV644F.js.map +1 -0
- package/dist/chunk-JXCLRKQ7.js +2 -0
- package/dist/chunk-JXCLRKQ7.js.map +1 -0
- package/dist/chunk-KMAH6636.js +2 -0
- package/dist/chunk-KMAH6636.js.map +1 -0
- package/dist/chunk-L4ESAO2S.js +2 -0
- package/dist/chunk-L4ESAO2S.js.map +1 -0
- package/dist/chunk-LV3TULSI.js +2 -0
- package/dist/chunk-LV3TULSI.js.map +1 -0
- package/dist/chunk-MJEG3K4V.js +2 -0
- package/dist/chunk-MJEG3K4V.js.map +1 -0
- package/dist/chunk-NLF2JGYY.js +2 -0
- package/dist/chunk-NLF2JGYY.js.map +1 -0
- package/dist/chunk-OA2SW4AF.js +2 -0
- package/dist/chunk-OA2SW4AF.js.map +1 -0
- package/dist/chunk-PHPQ5HP3.js +2 -0
- package/dist/chunk-PHPQ5HP3.js.map +1 -0
- package/dist/chunk-RIL6QABY.js +2 -0
- package/dist/chunk-RIL6QABY.js.map +1 -0
- package/dist/chunk-RWCVPWRC.js +2 -0
- package/dist/chunk-RWCVPWRC.js.map +1 -0
- package/dist/chunk-SNNRWNGZ.js +2 -0
- package/dist/chunk-SNNRWNGZ.js.map +1 -0
- package/dist/chunk-UCBYECNQ.js +2 -0
- package/dist/chunk-UCBYECNQ.js.map +1 -0
- package/dist/chunk-VHAODWCN.js +2 -0
- package/dist/chunk-VHAODWCN.js.map +1 -0
- package/dist/chunk-WGGN32O2.js +2 -0
- package/dist/chunk-WGGN32O2.js.map +1 -0
- package/dist/common-DDXsNyLF.d.ts +376 -0
- package/dist/core/webhook/frameworks/express.d.ts +48 -0
- package/dist/core/webhook/frameworks/express.js +2 -0
- package/dist/core/webhook/frameworks/express.js.map +1 -0
- package/dist/core/webhook/frameworks/nextjs.d.ts +44 -0
- package/dist/core/webhook/frameworks/nextjs.js +2 -0
- package/dist/core/webhook/frameworks/nextjs.js.map +1 -0
- package/dist/core/webhook/index.d.ts +26 -0
- package/dist/core/webhook/index.js +2 -0
- package/dist/core/webhook/index.js.map +1 -0
- package/dist/core/whatsapp/index.d.ts +40 -0
- package/dist/core/whatsapp/index.js +2 -0
- package/dist/core/whatsapp/index.js.map +1 -0
- package/dist/enums-BZd9T2ul.d.ts +707 -0
- package/dist/httpsClient-v4gmltzS.d.ts +19 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/logger-BdE0Vyim.d.ts +9 -0
- package/dist/request-vYMaEfk5.d.ts +50 -0
- package/dist/types/config.d.ts +78 -0
- package/dist/types/config.js +2 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/enums.d.ts +1 -0
- package/dist/types/enums.js +2 -0
- package/dist/types/enums.js.map +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/index.d.ts +98 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +240 -8
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { B as BaseAPI } from './base-CdGDdVEl.js';
|
|
2
|
+
import { WabaConfigType } from './types/config.js';
|
|
3
|
+
import { P as Paging, e as ResponseSuccess, R as RequesterClass } from './request-vYMaEfk5.js';
|
|
4
|
+
|
|
5
|
+
type QualityRating = 'GREEN' | 'YELLOW' | 'RED' | 'NA';
|
|
6
|
+
type AccountMode = 'LIVE' | 'SANDBOX';
|
|
7
|
+
type CodeVerificationStatus = 'NOT_VERIFIED' | 'VERIFIED' | 'EXPIRED' | 'PENDING' | 'DELETED' | 'MIGRATED' | 'BANNED' | 'RESTRICTED' | 'RATE_LIMITED' | 'FLAGGED' | 'CONNECTED' | 'DISCONNECTED' | 'UNKNOWN' | 'UNVERIFIED';
|
|
8
|
+
type MessagingLimitTier = 'TIER_50' | 'TIER_250' | 'TIER_1K' | 'TIER_10K' | 'TIER_100K' | 'TIER_UNLIMITED';
|
|
9
|
+
type PlatformType = 'CLOUD_API' | 'ON_PREMISE' | 'NOT_APPLICABLE';
|
|
10
|
+
type ThroughputLevel = 'STANDARD' | 'HIGH' | 'NOT_APPLICABLE';
|
|
11
|
+
type HealthStatusEntity = {
|
|
12
|
+
entity_type: string;
|
|
13
|
+
id: string;
|
|
14
|
+
can_send_message: string;
|
|
15
|
+
additional_info?: string[];
|
|
16
|
+
errors?: Array<{
|
|
17
|
+
error_code: number;
|
|
18
|
+
error_description: string;
|
|
19
|
+
possible_solution: string;
|
|
20
|
+
}>;
|
|
21
|
+
};
|
|
22
|
+
type HealthStatus = {
|
|
23
|
+
can_send_message: string;
|
|
24
|
+
entities: HealthStatusEntity[];
|
|
25
|
+
};
|
|
26
|
+
type QualityScore = {
|
|
27
|
+
score: QualityRating;
|
|
28
|
+
};
|
|
29
|
+
type Throughput = {
|
|
30
|
+
level: ThroughputLevel;
|
|
31
|
+
};
|
|
32
|
+
type PhoneNumberResponse = {
|
|
33
|
+
display_phone_number: string;
|
|
34
|
+
id: string;
|
|
35
|
+
quality_rating: QualityRating;
|
|
36
|
+
verified_name: string;
|
|
37
|
+
account_mode?: AccountMode;
|
|
38
|
+
certificate?: string;
|
|
39
|
+
code_verification_status?: CodeVerificationStatus;
|
|
40
|
+
conversational_automation?: Record<string, unknown>;
|
|
41
|
+
eligibility_for_api_business_global_search?: string;
|
|
42
|
+
health_status?: HealthStatus;
|
|
43
|
+
is_official_business_account?: boolean;
|
|
44
|
+
is_on_biz_app?: boolean;
|
|
45
|
+
is_pin_enabled?: boolean;
|
|
46
|
+
is_preverified_number?: boolean;
|
|
47
|
+
last_onboarded_time?: string;
|
|
48
|
+
messaging_limit_tier?: MessagingLimitTier;
|
|
49
|
+
name_status?: string;
|
|
50
|
+
new_certificate?: string;
|
|
51
|
+
new_name_status?: string;
|
|
52
|
+
platform_type?: PlatformType;
|
|
53
|
+
quality_score?: QualityScore;
|
|
54
|
+
search_visibility?: string;
|
|
55
|
+
status?: CodeVerificationStatus;
|
|
56
|
+
throughput?: Throughput;
|
|
57
|
+
};
|
|
58
|
+
type Cursors = {
|
|
59
|
+
before: string;
|
|
60
|
+
after: string;
|
|
61
|
+
};
|
|
62
|
+
type PhoneNumbersResponse = {
|
|
63
|
+
data: PhoneNumberResponse[];
|
|
64
|
+
paging: Paging;
|
|
65
|
+
};
|
|
66
|
+
type RequestVerificationCodeRequest = {
|
|
67
|
+
code_method: 'SMS' | 'VOICE';
|
|
68
|
+
language: string;
|
|
69
|
+
};
|
|
70
|
+
type VerifyCodeRequest = {
|
|
71
|
+
code: string;
|
|
72
|
+
};
|
|
73
|
+
type TwoStepVerificationParams = {
|
|
74
|
+
pin: string;
|
|
75
|
+
};
|
|
76
|
+
interface PhoneNumberClass {
|
|
77
|
+
getPhoneNumberById(fields?: string): Promise<PhoneNumberResponse>;
|
|
78
|
+
getPhoneNumbers(): Promise<PhoneNumbersResponse>;
|
|
79
|
+
requestVerificationCode(params: RequestVerificationCodeRequest): Promise<ResponseSuccess>;
|
|
80
|
+
verifyCode(params: VerifyCodeRequest): Promise<ResponseSuccess>;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* API for managing WhatsApp Phone Numb ers.
|
|
85
|
+
*
|
|
86
|
+
* This API allows you to:
|
|
87
|
+
* - Get phone number information by ID
|
|
88
|
+
* - Get all phone numbers for a business account
|
|
89
|
+
* - Request verification codes for phone numbers
|
|
90
|
+
* - Verify phone numbers with codes
|
|
91
|
+
*/
|
|
92
|
+
declare class PhoneNumberApi extends BaseAPI implements PhoneNumberClass {
|
|
93
|
+
private readonly endpoint;
|
|
94
|
+
constructor(config: WabaConfigType, client: RequesterClass);
|
|
95
|
+
/**
|
|
96
|
+
* Get phone number information by ID.
|
|
97
|
+
*
|
|
98
|
+
* @param fields Optional comma-separated list of fields to include in the response
|
|
99
|
+
* @returns Phone number information including verification status, quality rating, etc.
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* const phoneNumber = await whatsappClient.phoneNumber.getPhoneNumberById();
|
|
103
|
+
* const phoneNumberWithFields = await whatsappClient.phoneNumber.getPhoneNumberById('display_phone_number,verified_name');
|
|
104
|
+
*/
|
|
105
|
+
getPhoneNumberById(fields?: string): Promise<PhoneNumberResponse>;
|
|
106
|
+
/**
|
|
107
|
+
* Get all phone numbers for the business account.
|
|
108
|
+
*
|
|
109
|
+
* @returns List of phone numbers associated with the business account
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* const phoneNumbers = await whatsappClient.phoneNumber.getPhoneNumbers();
|
|
113
|
+
*/
|
|
114
|
+
getPhoneNumbers(): Promise<PhoneNumbersResponse>;
|
|
115
|
+
/**
|
|
116
|
+
* Request a verification code for the phone number.
|
|
117
|
+
*
|
|
118
|
+
* @param request Verification code request containing method and language
|
|
119
|
+
* @returns Response indicating success or failure
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* await whatsappClient.phoneNumber.requestVerificationCode({
|
|
123
|
+
* code_method: 'SMS',
|
|
124
|
+
* language: 'en_US'
|
|
125
|
+
* });
|
|
126
|
+
*/
|
|
127
|
+
requestVerificationCode(request: RequestVerificationCodeRequest): Promise<ResponseSuccess>;
|
|
128
|
+
/**
|
|
129
|
+
* Verify the phone number with the received code.
|
|
130
|
+
*
|
|
131
|
+
* @param request Verification request containing the code
|
|
132
|
+
* @returns Response indicating success or failure
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* await whatsappClient.phoneNumber.verifyCode({
|
|
136
|
+
* code: '123456'
|
|
137
|
+
* });
|
|
138
|
+
*/
|
|
139
|
+
verifyCode(request: VerifyCodeRequest): Promise<ResponseSuccess>;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
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 Cursors as a, type HealthStatusEntity as b, type PhoneNumberClass as c, type PhoneNumberResponse as d, type PhoneNumbersResponse as e, type PlatformType as f, type QualityScore as g, type ThroughputLevel as h, type TwoStepVerificationParams as i };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { B as BaseAPI } from './base-CdGDdVEl.js';
|
|
2
|
+
import { WabaConfigType } from './types/config.js';
|
|
3
|
+
import { c as ResponseData, e as ResponseSuccess, R as RequesterClass } from './request-vYMaEfk5.js';
|
|
4
|
+
|
|
5
|
+
type QrCodeResponse = {
|
|
6
|
+
code: string;
|
|
7
|
+
prefilled_message: string;
|
|
8
|
+
deep_link_url: string;
|
|
9
|
+
qr_image_url?: string;
|
|
10
|
+
};
|
|
11
|
+
type QrCodesResponse = ResponseData<QrCodeResponse[]>;
|
|
12
|
+
type CreateQrCodeRequest = {
|
|
13
|
+
prefilled_message: string;
|
|
14
|
+
generate_qr_image?: 'SVG' | 'PNG';
|
|
15
|
+
};
|
|
16
|
+
type UpdateQrCodeRequest = {
|
|
17
|
+
code: string;
|
|
18
|
+
prefilled_message: string;
|
|
19
|
+
};
|
|
20
|
+
interface QrCodeClass {
|
|
21
|
+
createQrCode(request: CreateQrCodeRequest): Promise<QrCodeResponse>;
|
|
22
|
+
getQrCodes(): Promise<QrCodesResponse>;
|
|
23
|
+
getQrCode(qrCodeId: string): Promise<QrCodeResponse>;
|
|
24
|
+
updateQrCode(request: UpdateQrCodeRequest): Promise<QrCodeResponse>;
|
|
25
|
+
deleteQrCode(qrCodeId: string): Promise<ResponseSuccess>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* API for managing WhatsApp QR Codes.
|
|
30
|
+
*
|
|
31
|
+
* This API allows you to:
|
|
32
|
+
* - Create QR codes with prefilled messages
|
|
33
|
+
* - Get all QR codes
|
|
34
|
+
* - Get specific QR code details
|
|
35
|
+
* - Update QR code messages
|
|
36
|
+
* - Delete QR codes
|
|
37
|
+
*/
|
|
38
|
+
declare class QrCodeApi extends BaseAPI implements QrCodeClass {
|
|
39
|
+
private readonly endpoint;
|
|
40
|
+
constructor(config: WabaConfigType, client: RequesterClass);
|
|
41
|
+
/**
|
|
42
|
+
* Create a new QR code with a prefilled message.
|
|
43
|
+
*
|
|
44
|
+
* @param request The QR code creation request
|
|
45
|
+
* @returns QR code information including code, deep link URL, and optional image URL
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* const qrCode = await whatsappClient.qrCode.createQrCode({
|
|
49
|
+
* prefilled_message: 'Hello from WhatsApp!',
|
|
50
|
+
* generate_qr_image: 'PNG'
|
|
51
|
+
* });
|
|
52
|
+
*/
|
|
53
|
+
createQrCode(request: CreateQrCodeRequest): Promise<QrCodeResponse>;
|
|
54
|
+
/**
|
|
55
|
+
* Get all QR codes for the current phone number.
|
|
56
|
+
*
|
|
57
|
+
* @returns List of all QR codes
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* const qrCodes = await whatsappClient.qrCode.getQrCodes();
|
|
61
|
+
*/
|
|
62
|
+
getQrCodes(): Promise<QrCodesResponse>;
|
|
63
|
+
/**
|
|
64
|
+
* Get a specific QR code by ID.
|
|
65
|
+
*
|
|
66
|
+
* @param qrCodeId The QR code ID to retrieve
|
|
67
|
+
* @returns QR code information
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* const qrCode = await whatsappClient.qrCode.getQrCode('qr_code_123');
|
|
71
|
+
*/
|
|
72
|
+
getQrCode(qrCodeId: string): Promise<QrCodeResponse>;
|
|
73
|
+
/**
|
|
74
|
+
* Update an existing QR code's prefilled message.
|
|
75
|
+
*
|
|
76
|
+
* @param request The QR code update request containing code and new message
|
|
77
|
+
* @returns Updated QR code information
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* const updatedQrCode = await whatsappClient.qrCode.updateQrCode({
|
|
81
|
+
* code: 'existing_qr_code',
|
|
82
|
+
* prefilled_message: 'Updated message!'
|
|
83
|
+
* });
|
|
84
|
+
*/
|
|
85
|
+
updateQrCode(request: UpdateQrCodeRequest): Promise<QrCodeResponse>;
|
|
86
|
+
/**
|
|
87
|
+
* Delete a QR code.
|
|
88
|
+
*
|
|
89
|
+
* @param qrCodeId The QR code ID to delete
|
|
90
|
+
* @returns Response indicating success or failure
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* await whatsappClient.qrCode.deleteQrCode('qr_code_123');
|
|
94
|
+
*/
|
|
95
|
+
deleteQrCode(qrCodeId: string): Promise<ResponseSuccess>;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export { type CreateQrCodeRequest as C, QrCodeApi as Q, type UpdateQrCodeRequest as U, type QrCodeClass as a, type QrCodeResponse as b, type QrCodesResponse as c };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { B as BaseAPI } from './base-CdGDdVEl.js';
|
|
2
|
+
import { WabaConfigType } from './types/config.js';
|
|
3
|
+
import { j as DataLocalizationRegionEnum } from './enums-BZd9T2ul.js';
|
|
4
|
+
import { e as ResponseSuccess, R as RequesterClass } from './request-vYMaEfk5.js';
|
|
5
|
+
|
|
6
|
+
type RegistrationRequest = {
|
|
7
|
+
messaging_product: 'whatsapp';
|
|
8
|
+
pin: string;
|
|
9
|
+
data_localization_region?: DataLocalizationRegionEnum;
|
|
10
|
+
};
|
|
11
|
+
interface RegistrationClass {
|
|
12
|
+
register(pin: string, dataLocalizationRegion?: DataLocalizationRegionEnum): Promise<ResponseSuccess>;
|
|
13
|
+
deregister(): Promise<ResponseSuccess>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* API for managing WhatsApp Business Account registration.
|
|
18
|
+
*
|
|
19
|
+
* This API allows you to:
|
|
20
|
+
* - Register a WhatsApp Business Account with a PIN
|
|
21
|
+
* - Deregister a WhatsApp Business Account
|
|
22
|
+
*/
|
|
23
|
+
declare class RegistrationApi extends BaseAPI implements RegistrationClass {
|
|
24
|
+
constructor(config: WabaConfigType, client: RequesterClass);
|
|
25
|
+
/**
|
|
26
|
+
* Register a WhatsApp Business Account using a PIN.
|
|
27
|
+
*
|
|
28
|
+
* @param pin The registration PIN received via SMS or voice call
|
|
29
|
+
* @param dataLocalizationRegion Optional data localization region
|
|
30
|
+
* @returns Response indicating success or failure
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* await whatsappClient.registration.register('123456', DataLocalizationRegionEnum.Asia);
|
|
34
|
+
*/
|
|
35
|
+
register(pin: string, dataLocalizationRegion?: DataLocalizationRegionEnum): Promise<ResponseSuccess>;
|
|
36
|
+
/**
|
|
37
|
+
* Deregister a WhatsApp Business Account.
|
|
38
|
+
*
|
|
39
|
+
* @returns Response indicating success or failure
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* await whatsappClient.registration.deregister();
|
|
43
|
+
*/
|
|
44
|
+
deregister(): Promise<ResponseSuccess>;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export { RegistrationApi as R, type RegistrationClass as a, type RegistrationRequest as b };
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { B as BaseAPI } from './base-CdGDdVEl.js';
|
|
2
|
+
import { WabaConfigType } from './types/config.js';
|
|
3
|
+
import { a as GeneralRequestBody, e as ResponseSuccess, d as ResponsePagination, R as RequesterClass } from './request-vYMaEfk5.js';
|
|
4
|
+
import { L as LanguagesEnum, a as CategoryEnum, T as TemplateStatusEnum } from './enums-BZd9T2ul.js';
|
|
5
|
+
|
|
6
|
+
type TemplateFormat = 'TEXT' | 'IMAGE' | 'VIDEO' | 'DOCUMENT' | 'LOCATION' | 'PRODUCT';
|
|
7
|
+
type PhoneNumberButton = {
|
|
8
|
+
type: 'PHONE_NUMBER';
|
|
9
|
+
text: string;
|
|
10
|
+
phone_number: string;
|
|
11
|
+
};
|
|
12
|
+
type URLButton = {
|
|
13
|
+
type: 'URL';
|
|
14
|
+
text: string;
|
|
15
|
+
url: string;
|
|
16
|
+
example?: string[];
|
|
17
|
+
};
|
|
18
|
+
type QuickReplyButton = {
|
|
19
|
+
type: 'QUICK_REPLY';
|
|
20
|
+
text: string;
|
|
21
|
+
};
|
|
22
|
+
type CopyCodeButton = {
|
|
23
|
+
type: 'COPY_CODE';
|
|
24
|
+
example: string;
|
|
25
|
+
};
|
|
26
|
+
type FlowButton = {
|
|
27
|
+
type: 'FLOW';
|
|
28
|
+
text: string;
|
|
29
|
+
flow_id?: string;
|
|
30
|
+
flow_name?: string;
|
|
31
|
+
flow_json?: string;
|
|
32
|
+
flow_action?: 'navigate' | 'data_exchange';
|
|
33
|
+
navigate_screen?: string;
|
|
34
|
+
};
|
|
35
|
+
type MPMButton = {
|
|
36
|
+
type: 'MPM';
|
|
37
|
+
action?: {
|
|
38
|
+
thumbnail_product_retailer_id: string;
|
|
39
|
+
sections: Array<{
|
|
40
|
+
title?: string;
|
|
41
|
+
product_items: Array<{
|
|
42
|
+
product_retailer_id: string;
|
|
43
|
+
}>;
|
|
44
|
+
}>;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
type OTPButton = {
|
|
48
|
+
type: 'OTP';
|
|
49
|
+
};
|
|
50
|
+
type SPMButton = {
|
|
51
|
+
type: 'SPM';
|
|
52
|
+
action?: {
|
|
53
|
+
product_retailer_id: string;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
type CatalogButton = {
|
|
57
|
+
type: 'CATALOG';
|
|
58
|
+
action?: {
|
|
59
|
+
thumbnail_product_retailer_id: string;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
type TemplateButton = PhoneNumberButton | URLButton | QuickReplyButton | CopyCodeButton | FlowButton | MPMButton | OTPButton | SPMButton | CatalogButton;
|
|
63
|
+
type TemplateHeaderExample = {
|
|
64
|
+
header_text?: string[];
|
|
65
|
+
header_text_named_params?: Array<{
|
|
66
|
+
param_name: string;
|
|
67
|
+
example: string;
|
|
68
|
+
}>;
|
|
69
|
+
header_handle?: string[];
|
|
70
|
+
};
|
|
71
|
+
type TemplateHeader = {
|
|
72
|
+
type: 'HEADER';
|
|
73
|
+
format: TemplateFormat;
|
|
74
|
+
text?: string;
|
|
75
|
+
example?: TemplateHeaderExample;
|
|
76
|
+
};
|
|
77
|
+
type TemplateBody = {
|
|
78
|
+
type: 'BODY';
|
|
79
|
+
text: string;
|
|
80
|
+
example?: {
|
|
81
|
+
body_text?: Array<Array<string>>;
|
|
82
|
+
body_text_named_params?: Array<{
|
|
83
|
+
param_name: string;
|
|
84
|
+
example: string;
|
|
85
|
+
}>;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
type TemplateFooter = {
|
|
89
|
+
type: 'FOOTER';
|
|
90
|
+
text: string;
|
|
91
|
+
};
|
|
92
|
+
type TemplateButtons = {
|
|
93
|
+
type: 'BUTTONS';
|
|
94
|
+
buttons: TemplateButton[];
|
|
95
|
+
};
|
|
96
|
+
type TemplateLimitedTimeOffer = {
|
|
97
|
+
type: 'LIMITED_TIME_OFFER';
|
|
98
|
+
limited_time_offer: {
|
|
99
|
+
expiration_time_ms: number;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
type TemplateCarousel = {
|
|
103
|
+
type: 'CAROUSEL';
|
|
104
|
+
cards: Array<{
|
|
105
|
+
card_index: number;
|
|
106
|
+
components: ComponentTypes[];
|
|
107
|
+
}>;
|
|
108
|
+
};
|
|
109
|
+
type MediaCarouselCard = {
|
|
110
|
+
card_index: number;
|
|
111
|
+
components: (TemplateHeader | TemplateBody | TemplateButtons)[];
|
|
112
|
+
};
|
|
113
|
+
type ProductCarouselCard = {
|
|
114
|
+
card_index: number;
|
|
115
|
+
components: TemplateHeader[];
|
|
116
|
+
};
|
|
117
|
+
type ComponentTypes = TemplateHeader | TemplateBody | TemplateFooter | TemplateButtons | TemplateLimitedTimeOffer | TemplateCarousel;
|
|
118
|
+
type TemplateRequestBody = GeneralRequestBody & {
|
|
119
|
+
name: string;
|
|
120
|
+
language: LanguagesEnum;
|
|
121
|
+
category?: CategoryEnum;
|
|
122
|
+
components?: ComponentTypes[];
|
|
123
|
+
};
|
|
124
|
+
type TemplateResponse = {
|
|
125
|
+
id: string;
|
|
126
|
+
status: string;
|
|
127
|
+
language: LanguagesEnum;
|
|
128
|
+
category: CategoryEnum;
|
|
129
|
+
name: string;
|
|
130
|
+
components: ComponentTypes[];
|
|
131
|
+
};
|
|
132
|
+
type TemplateGetParams = {
|
|
133
|
+
limit?: number;
|
|
134
|
+
name?: string;
|
|
135
|
+
language?: LanguagesEnum;
|
|
136
|
+
category?: CategoryEnum;
|
|
137
|
+
status?: TemplateStatusEnum;
|
|
138
|
+
};
|
|
139
|
+
type TemplateDeleteParams = {
|
|
140
|
+
hsm_id: string;
|
|
141
|
+
name: string;
|
|
142
|
+
};
|
|
143
|
+
declare class TemplateClass {
|
|
144
|
+
getTemplate(templateId: string): Promise<TemplateResponse>;
|
|
145
|
+
updateTemplate(templateId: string, template: Partial<TemplateRequestBody>): Promise<ResponseSuccess>;
|
|
146
|
+
getTemplates(params?: TemplateGetParams): Promise<ResponsePagination<TemplateResponse>>;
|
|
147
|
+
createTemplate(template: TemplateRequestBody): Promise<TemplateResponse>;
|
|
148
|
+
deleteTemplate(params: TemplateDeleteParams): Promise<ResponseSuccess>;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
declare class TemplateApi extends BaseAPI implements TemplateClass {
|
|
152
|
+
private readonly endpoint;
|
|
153
|
+
constructor(config: WabaConfigType, client: RequesterClass);
|
|
154
|
+
getTemplate(templateId: string): Promise<TemplateResponse>;
|
|
155
|
+
updateTemplate(templateId: string, template: Partial<TemplateRequestBody>): Promise<ResponseSuccess>;
|
|
156
|
+
getTemplates(params?: TemplateGetParams): Promise<ResponsePagination<TemplateResponse>>;
|
|
157
|
+
createTemplate(template: TemplateRequestBody): Promise<TemplateResponse>;
|
|
158
|
+
deleteTemplate(params: TemplateDeleteParams): Promise<ResponseSuccess>;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export { type CatalogButton as C, type FlowButton as F, type MPMButton as M, type OTPButton as O, type PhoneNumberButton as P, type QuickReplyButton as Q, type SPMButton as S, TemplateApi as T, type URLButton as U, TemplateClass as a, type TemplateDeleteParams as b, type TemplateGetParams as c, type TemplateRequestBody as d, type TemplateResponse as e, type TemplateFormat as f, type ComponentTypes as g, type CopyCodeButton as h, type TemplateBody as i, type TemplateButton as j, type TemplateButtons as k, type TemplateCarousel as l, type TemplateFooter as m, type TemplateHeader as n, type TemplateHeaderExample as o, type TemplateLimitedTimeOffer as p, type MediaCarouselCard as q, type ProductCarouselCard as r };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { B as BaseAPI } from './base-CdGDdVEl.js';
|
|
2
|
+
import { WabaConfigType } from './types/config.js';
|
|
3
|
+
import { e as ResponseSuccess, R as RequesterClass } from './request-vYMaEfk5.js';
|
|
4
|
+
|
|
5
|
+
type TwoStepVerificationRequest = {
|
|
6
|
+
pin: string;
|
|
7
|
+
};
|
|
8
|
+
interface TwoStepVerificationClass {
|
|
9
|
+
setTwoStepVerificationCode(pin: string): Promise<ResponseSuccess>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* API for managing WhatsApp Two-Step Verification.
|
|
14
|
+
*
|
|
15
|
+
* This API allows you to:
|
|
16
|
+
* - Set a two-step verification PIN code
|
|
17
|
+
* - Manage two-step verification settings
|
|
18
|
+
*/
|
|
19
|
+
declare class TwoStepVerificationApi extends BaseAPI implements TwoStepVerificationClass {
|
|
20
|
+
constructor(config: WabaConfigType, client: RequesterClass);
|
|
21
|
+
/**
|
|
22
|
+
* Set a two-step verification PIN code.
|
|
23
|
+
*
|
|
24
|
+
* @param pin The PIN code to set for two-step verification (6-digit numeric string)
|
|
25
|
+
* @returns Response indicating success or failure
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* await whatsappClient.twoStepVerification.setTwoStepVerificationCode('123456');
|
|
29
|
+
*/
|
|
30
|
+
setTwoStepVerificationCode(pin: string): Promise<ResponseSuccess>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { TwoStepVerificationApi as T, type TwoStepVerificationClass as a, type TwoStepVerificationRequest as b };
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { B as BaseAPI } from './base-CdGDdVEl.js';
|
|
2
|
+
import { WabaConfigType } from './types/config.js';
|
|
3
|
+
import { e as ResponseSuccess, R as RequesterClass } from './request-vYMaEfk5.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* WhatsApp Business Account subscription configuration
|
|
7
|
+
*/
|
|
8
|
+
type WabaSubscription = {
|
|
9
|
+
whatsapp_business_api_data: {
|
|
10
|
+
id: string;
|
|
11
|
+
link: string;
|
|
12
|
+
name: string;
|
|
13
|
+
category: string;
|
|
14
|
+
};
|
|
15
|
+
override_callback_uri?: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Parameters for updating WABA subscription
|
|
19
|
+
*/
|
|
20
|
+
interface UpdateWabaSubscription {
|
|
21
|
+
override_callback_uri: string;
|
|
22
|
+
verify_token: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Response containing all WABA subscriptions
|
|
26
|
+
*/
|
|
27
|
+
interface WabaSubscriptions {
|
|
28
|
+
data: Array<WabaSubscription>;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* WABA account review status enumeration
|
|
32
|
+
*/
|
|
33
|
+
declare enum WabaAccountReviewStatus {
|
|
34
|
+
Approved = "APPROVED",
|
|
35
|
+
Active = "ACTIVE",
|
|
36
|
+
Inactive = "INACTIVE",
|
|
37
|
+
Disabled = "DISABLED"
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* WABA health status for message sending capability
|
|
41
|
+
*/
|
|
42
|
+
declare enum WabaHealthStatusCanSendMessage {
|
|
43
|
+
Blocked = "BLOCKED",
|
|
44
|
+
Limited = "LIMITED",
|
|
45
|
+
Available = "AVAILABLE"
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* WABA account status enumeration
|
|
49
|
+
*/
|
|
50
|
+
declare enum WabaAccountStatus {
|
|
51
|
+
Approved = "APPROVED",
|
|
52
|
+
Active = "ACTIVE",
|
|
53
|
+
Inactive = "INACTIVE",
|
|
54
|
+
Disabled = "DISABLED"
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Business verification status enumeration
|
|
58
|
+
*/
|
|
59
|
+
declare enum WabaBusinessVerificationStatus {
|
|
60
|
+
Verified = "verified",
|
|
61
|
+
PendingSubmission = "pending_submission",
|
|
62
|
+
Unverified = "unverified",
|
|
63
|
+
Rejected = "rejected"
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* WABA health status error details
|
|
67
|
+
*/
|
|
68
|
+
interface WabaHealthStatusError {
|
|
69
|
+
error_code?: number;
|
|
70
|
+
error_description?: string;
|
|
71
|
+
possible_solution?: string;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* WABA health status entity information
|
|
75
|
+
*/
|
|
76
|
+
interface WabaHealthStatusEntity {
|
|
77
|
+
entity_type?: string;
|
|
78
|
+
id?: string;
|
|
79
|
+
can_send_message?: string;
|
|
80
|
+
errors?: WabaHealthStatusError[];
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Overall WABA health status
|
|
84
|
+
*/
|
|
85
|
+
interface WabaHealthStatus {
|
|
86
|
+
can_send_message?: WabaHealthStatusCanSendMessage;
|
|
87
|
+
entities?: WabaHealthStatusEntity[];
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* WhatsApp Business Account information
|
|
91
|
+
*/
|
|
92
|
+
interface WabaAccount {
|
|
93
|
+
account_review_status?: WabaAccountReviewStatus;
|
|
94
|
+
id?: string;
|
|
95
|
+
health_status?: WabaHealthStatus;
|
|
96
|
+
status?: WabaAccountStatus;
|
|
97
|
+
business_verification_status?: WabaBusinessVerificationStatus;
|
|
98
|
+
message_template_namespace?: string;
|
|
99
|
+
name?: string;
|
|
100
|
+
ownership_type?: string;
|
|
101
|
+
currency?: string;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Available fields for WABA account queries
|
|
105
|
+
*/
|
|
106
|
+
type WabaAccountFields = 'id' | 'name' | 'account_review_status' | 'auth_international_rate_eligibility' | 'business_verification_status' | 'country' | 'currency' | 'health_status' | 'status' | 'ownership_type' | 'message_template_namespace';
|
|
107
|
+
/**
|
|
108
|
+
* Parameter type for specifying which WABA account fields to retrieve
|
|
109
|
+
*/
|
|
110
|
+
type WabaAccountFieldsParam = WabaAccountFields[];
|
|
111
|
+
/**
|
|
112
|
+
* Interface defining all WABA API methods
|
|
113
|
+
*/
|
|
114
|
+
interface WABAClass {
|
|
115
|
+
getWabaAccount(fields?: WabaAccountFieldsParam): Promise<WabaAccount>;
|
|
116
|
+
getAllWabaSubscriptions(): Promise<WabaSubscriptions>;
|
|
117
|
+
updateWabaSubscription(params: UpdateWabaSubscription): Promise<ResponseSuccess>;
|
|
118
|
+
unsubscribeFromWaba(): Promise<ResponseSuccess>;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* API for managing WhatsApp Business Account (WABA).
|
|
123
|
+
*
|
|
124
|
+
* This API allows you to:
|
|
125
|
+
* - Get WABA account information
|
|
126
|
+
* - Manage WABA subscriptions
|
|
127
|
+
* - Subscribe/unsubscribe from WABA webhooks
|
|
128
|
+
* - Update subscription settings
|
|
129
|
+
*/
|
|
130
|
+
declare class WabaApi extends BaseAPI implements WABAClass {
|
|
131
|
+
constructor(config: WabaConfigType, client: RequesterClass);
|
|
132
|
+
/**
|
|
133
|
+
* Retrieve WhatsApp Business Account information.
|
|
134
|
+
*
|
|
135
|
+
* @param fields Optional array of specific fields to retrieve
|
|
136
|
+
* @returns WABA account information including status, health, verification status, etc.
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* const account = await whatsappClient.waba.getWabaAccount(['id', 'name', 'status']);
|
|
140
|
+
*/
|
|
141
|
+
getWabaAccount(fields?: WabaAccountFieldsParam): Promise<WabaAccount>;
|
|
142
|
+
/**
|
|
143
|
+
* Get all WABA subscriptions for the business account.
|
|
144
|
+
*
|
|
145
|
+
* @returns List of all subscribed apps and their configurations
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* const subscriptions = await whatsappClient.waba.getAllWabaSubscriptions();
|
|
149
|
+
*/
|
|
150
|
+
getAllWabaSubscriptions(): Promise<WabaSubscriptions>;
|
|
151
|
+
/**
|
|
152
|
+
* Update WABA subscription configuration.
|
|
153
|
+
*
|
|
154
|
+
* @param params Configuration parameters including callback URI and verify token
|
|
155
|
+
* @returns Response indicating success or failure
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* await whatsappClient.waba.updateWabaSubscription({
|
|
159
|
+
* override_callback_uri: 'https://example.com/webhook',
|
|
160
|
+
* verify_token: 'your_verify_token'
|
|
161
|
+
* });
|
|
162
|
+
*/
|
|
163
|
+
updateWabaSubscription({ override_callback_uri, verify_token, }: UpdateWabaSubscription): Promise<ResponseSuccess>;
|
|
164
|
+
/**
|
|
165
|
+
* Unsubscribe from WABA webhooks.
|
|
166
|
+
*
|
|
167
|
+
* @returns Response indicating success or failure
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* await whatsappClient.waba.unsubscribeFromWaba();
|
|
171
|
+
*/
|
|
172
|
+
unsubscribeFromWaba(): Promise<ResponseSuccess>;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export { type UpdateWabaSubscription as U, WabaApi as W, type WabaAccount as a, type WABAClass as b, type WabaSubscriptions as c };
|