meta-cloud-api 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/{FlowApi-UAvzhJfV.d.ts → FlowApi-B2ffO-HD.d.ts} +1 -1
  2. package/dist/MessageApi-BgsSpDno.d.ts +171 -0
  3. package/dist/{WebhookProcessor-ByAe7Kf_.d.ts → WebhookProcessor-BXYunz4N.d.ts} +2 -2
  4. package/dist/{WhatsApp-BIBtT-y9.d.ts → WhatsApp-pTZPQm81.d.ts} +2 -2
  5. package/dist/api/flow/index.d.ts +2 -2
  6. package/dist/api/index.d.ts +4 -3
  7. package/dist/api/index.js +1 -1
  8. package/dist/api/messages/builders/index.d.ts +536 -0
  9. package/dist/api/messages/builders/index.js +4 -0
  10. package/dist/api/messages/builders/index.js.map +1 -0
  11. package/dist/api/messages/index.d.ts +2 -2
  12. package/dist/{chunk-B7DCL6I7.js → chunk-BAOZ4U74.js} +3 -3
  13. package/dist/{chunk-B7DCL6I7.js.map → chunk-BAOZ4U74.js.map} +1 -1
  14. package/dist/{chunk-HJGN3PO4.js → chunk-JPGXONBQ.js} +3 -3
  15. package/dist/{chunk-HJGN3PO4.js.map → chunk-JPGXONBQ.js.map} +1 -1
  16. package/dist/{chunk-OA2SW4AF.js → chunk-NOJFGTRT.js} +2 -2
  17. package/dist/{chunk-OA2SW4AF.js.map → chunk-NOJFGTRT.js.map} +1 -1
  18. package/dist/{chunk-UCBYECNQ.js → chunk-YXZ4L2OK.js} +2 -2
  19. package/dist/{chunk-UCBYECNQ.js.map → chunk-YXZ4L2OK.js.map} +1 -1
  20. package/dist/{MessageApi-Circorzz.d.ts → common-BiRA_uz3.d.ts} +8 -170
  21. package/dist/{common-DDXsNyLF.d.ts → common-lV0NsO7t.d.ts} +1 -1
  22. package/dist/core/webhook/frameworks/express.d.ts +6 -5
  23. package/dist/core/webhook/frameworks/express.js +1 -1
  24. package/dist/core/webhook/frameworks/nextjs.d.ts +6 -5
  25. package/dist/core/webhook/frameworks/nextjs.js +1 -1
  26. package/dist/core/webhook/index.d.ts +6 -5
  27. package/dist/core/webhook/index.js +1 -1
  28. package/dist/core/whatsapp/index.d.ts +5 -4
  29. package/dist/core/whatsapp/index.js +1 -1
  30. package/dist/index.d.ts +7 -5
  31. package/dist/index.js +1 -1
  32. package/dist/isMetaError-CXWJwW58.d.ts +63 -0
  33. package/dist/utils/index.d.ts +3 -62
  34. package/package.json +24 -17
@@ -1,7 +1,7 @@
1
1
  import { B as BaseAPI } from './base-CdGDdVEl.js';
2
2
  import { WabaConfigType } from './types/config.js';
3
3
  import { R as RequesterClass, e as ResponseSuccess } from './request-vYMaEfk5.js';
4
- import { e as FlowClass, j as FlowsListResponse, d as FlowCategoryEnum, C as CreateFlowResponse, F as Flow, i as FlowPreviewResponse, c as FlowAssetsResponse, U as UpdateFlowResponse, V as ValidateFlowJsonResponse, h as FlowMigrationResponse } from './common-DDXsNyLF.js';
4
+ import { h as FlowClass, k as FlowsListResponse, g as FlowCategoryEnum, C as CreateFlowResponse, c as Flow, j as FlowPreviewResponse, f as FlowAssetsResponse, U as UpdateFlowResponse, V as ValidateFlowJsonResponse, i as FlowMigrationResponse } from './common-lV0NsO7t.js';
5
5
 
6
6
  /**
7
7
  * API for managing WhatsApp Flows.
@@ -0,0 +1,171 @@
1
+ import { B as BaseAPI } from './base-CdGDdVEl.js';
2
+ import { WabaConfigType } from './types/config.js';
3
+ import { M as MessageTypesEnum, C as ComponentTypesEnum, I as InteractiveTypesEnum } from './enums-BZd9T2ul.js';
4
+ import { R as RequesterClass } from './request-vYMaEfk5.js';
5
+ import { f as MessagesClass, A as AudioMediaObject, C as ContactObject, D as DocumentMediaObject, I as ImageMediaObject, a as InteractiveObject, L as LocationObject, c as MessageTemplateObject, d as StickerMediaObject, e as TextObject, V as VideoMediaObject, g as MessageRequestBody, M as MessageRequestParams, b as MessagesResponse, T as TextMessageParams, S as StatusParams, R as ReactionParams } from './common-BiRA_uz3.js';
6
+
7
+ /**
8
+ * Maps each message type to its appropriate payload type
9
+ */
10
+ type MessagePayloadType<T extends MessageTypesEnum> = T extends MessageTypesEnum.Audio ? AudioMediaObject : T extends MessageTypesEnum.Contacts ? [ContactObject] : T extends MessageTypesEnum.Document ? DocumentMediaObject : T extends MessageTypesEnum.Image ? ImageMediaObject : T extends MessageTypesEnum.Interactive ? InteractiveObject : T extends MessageTypesEnum.Location ? LocationObject : T extends MessageTypesEnum.Template ? MessageTemplateObject<ComponentTypesEnum> : T extends MessageTypesEnum.Sticker ? StickerMediaObject : T extends MessageTypesEnum.Text ? TextObject : T extends MessageTypesEnum.Video ? VideoMediaObject : T extends MessageTypesEnum.Reaction ? {
11
+ message_id: string;
12
+ emoji: string;
13
+ } : never;
14
+ declare class MessagesApi extends BaseAPI implements MessagesClass {
15
+ private readonly commonMethod;
16
+ private readonly commonEndpoint;
17
+ constructor(config: WabaConfigType, client: RequesterClass);
18
+ /**
19
+ * Builds the request body for WhatsApp API messages
20
+ * @param type The type of message to send
21
+ * @param payload The message payload object
22
+ * @param to The recipient's phone number
23
+ * @param replyMessageId Optional message ID to reply to
24
+ * @returns The formatted request body
25
+ */
26
+ bodyBuilder<T extends MessageTypesEnum>(type: T, payload: MessagePayloadType<T>, to: string, replyMessageId?: string): MessageRequestBody<T>;
27
+ /**
28
+ * Sends a request to the WhatsApp API
29
+ * @param body The request body to send
30
+ * @returns Promise with the API response
31
+ */
32
+ private send;
33
+ /**
34
+ * Sends an audio message via WhatsApp
35
+ * @param params The audio message parameter object
36
+ * @returns Promise with the message response
37
+ */
38
+ audio(params: MessageRequestParams<AudioMediaObject>): Promise<MessagesResponse>;
39
+ /**
40
+ * Sends a contact card via WhatsApp
41
+ * @param params The contact message parameter object
42
+ * @returns Promise with the message response
43
+ */
44
+ contacts(params: MessageRequestParams<[ContactObject]>): Promise<MessagesResponse>;
45
+ /**
46
+ * Sends a document via WhatsApp
47
+ * @param params The document message parameter object
48
+ * @returns Promise with the message response
49
+ */
50
+ document(params: MessageRequestParams<DocumentMediaObject>): Promise<MessagesResponse>;
51
+ /**
52
+ * Sends an image via WhatsApp
53
+ * @param params The image message parameter object
54
+ * @returns Promise with the message response
55
+ */
56
+ image(params: MessageRequestParams<ImageMediaObject>): Promise<MessagesResponse>;
57
+ /**
58
+ * Sends an interactive message via WhatsApp
59
+ * @param params The interactive message parameter object
60
+ * @returns Promise with the message response
61
+ */
62
+ interactive(params: MessageRequestParams<InteractiveObject>): Promise<MessagesResponse>;
63
+ /**
64
+ * Sends a location via WhatsApp
65
+ * @param params The location message parameter object
66
+ * @returns Promise with the message response
67
+ */
68
+ location(params: MessageRequestParams<LocationObject>): Promise<MessagesResponse>;
69
+ /**
70
+ * Sends a sticker via WhatsApp
71
+ * @param params The sticker message parameter object
72
+ * @returns Promise with the message response
73
+ */
74
+ sticker(params: MessageRequestParams<StickerMediaObject>): Promise<MessagesResponse>;
75
+ /**
76
+ * Sends a template message via WhatsApp
77
+ * @param params The template message parameter object
78
+ * @returns Promise with the message response
79
+ */
80
+ template(params: MessageRequestParams<MessageTemplateObject<ComponentTypesEnum>>): Promise<MessagesResponse>;
81
+ /**
82
+ * Sends a text message via WhatsApp
83
+ * @param params The text message parameter object
84
+ * @returns Promise with the message response
85
+ */
86
+ text(params: TextMessageParams): Promise<MessagesResponse>;
87
+ /**
88
+ * Sends a video message via WhatsApp
89
+ * @param params The video message parameter object
90
+ * @returns Promise with the message response
91
+ */
92
+ video(params: MessageRequestParams<VideoMediaObject>): Promise<MessagesResponse>;
93
+ /**
94
+ * Updates message status (mark as read, etc.)
95
+ * @param params The status update parameters
96
+ * @returns Promise with the API response
97
+ */
98
+ status(params: StatusParams): Promise<MessagesResponse>;
99
+ /**
100
+ * Marks a message as read
101
+ * @param params Object containing messageId
102
+ * @returns Promise with the API response
103
+ */
104
+ markAsRead(params: {
105
+ messageId: string;
106
+ }): Promise<MessagesResponse>;
107
+ /**
108
+ * Shows typing indicator
109
+ * @param params Object containing messageId
110
+ * @returns Promise with the API response
111
+ */
112
+ showTypingIndicator(params: {
113
+ messageId: string;
114
+ }): Promise<MessagesResponse>;
115
+ /**
116
+ * Sends a list interactive message
117
+ * @param params The list interactive message parameters
118
+ * @returns Promise with the message response
119
+ */
120
+ interactiveList(params: MessageRequestParams<InteractiveObject & {
121
+ type: InteractiveTypesEnum.List;
122
+ }>): Promise<MessagesResponse>;
123
+ /**
124
+ * Sends a CTA URL interactive message
125
+ * @param params The CTA URL interactive message parameters
126
+ * @returns Promise with the message response
127
+ */
128
+ interactiveCtaUrl(params: MessageRequestParams<InteractiveObject & {
129
+ type: InteractiveTypesEnum.CtaUrl;
130
+ }>): Promise<MessagesResponse>;
131
+ /**
132
+ * Sends a location request interactive message
133
+ * @param params The location request interactive message parameters
134
+ * @returns Promise with the message response
135
+ */
136
+ interactiveLocationRequest(params: MessageRequestParams<InteractiveObject & {
137
+ type: InteractiveTypesEnum.LocationRequest;
138
+ }>): Promise<MessagesResponse>;
139
+ /**
140
+ * Sends an address message interactive message
141
+ * @param params The address message interactive message parameters
142
+ * @returns Promise with the message response
143
+ */
144
+ interactiveAddressMessage(params: MessageRequestParams<InteractiveObject & {
145
+ type: InteractiveTypesEnum.AddressMessage;
146
+ }>): Promise<MessagesResponse>;
147
+ /**
148
+ * Sends a reply buttons interactive message
149
+ * @param params The reply buttons interactive message parameters
150
+ * @returns Promise with the message response
151
+ */
152
+ interactiveReplyButtons(params: MessageRequestParams<InteractiveObject & {
153
+ type: InteractiveTypesEnum.Button;
154
+ }>): Promise<MessagesResponse>;
155
+ /**
156
+ * Sends a flow interactive message
157
+ * @param params The flow interactive message parameters
158
+ * @returns Promise with the message response
159
+ */
160
+ interactiveFlow(params: MessageRequestParams<InteractiveObject & {
161
+ type: InteractiveTypesEnum.Flow;
162
+ }>): Promise<MessagesResponse>;
163
+ /**
164
+ * Sends a reaction to a message
165
+ * @param params The reaction parameters
166
+ * @returns Promise with the message response
167
+ */
168
+ reaction(params: ReactionParams): Promise<MessagesResponse>;
169
+ }
170
+
171
+ export { MessagesApi as M };
@@ -1,7 +1,7 @@
1
- import { f as FlowEndpointRequest, l as FlowTypeEnum } from './common-DDXsNyLF.js';
1
+ import { a as FlowEndpointRequest, F as FlowTypeEnum } from './common-lV0NsO7t.js';
2
2
  import { WabaConfigType, WhatsAppConfig } from './types/config.js';
3
3
  import { M as MessageTypesEnum } from './enums-BZd9T2ul.js';
4
- import { W as WhatsApp } from './WhatsApp-BIBtT-y9.js';
4
+ import { W as WhatsApp } from './WhatsApp-pTZPQm81.js';
5
5
 
6
6
  interface WebhookContact {
7
7
  /**
@@ -4,9 +4,9 @@ import { R as RequesterClass } from './request-vYMaEfk5.js';
4
4
  import { H as HttpsClientClass, a as HttpsClientResponseClass } from './httpsClient-v4gmltzS.js';
5
5
  import { Agent } from 'https';
6
6
  import { E as EncryptionApi } from './EncryptionApi-D7pt-OXT.js';
7
- import { F as FlowApi } from './FlowApi-UAvzhJfV.js';
7
+ import { F as FlowApi } from './FlowApi-B2ffO-HD.js';
8
8
  import { M as MediaApi } from './MediaApi-BrEKpqi_.js';
9
- import { M as MessagesApi } from './MessageApi-Circorzz.js';
9
+ import { M as MessagesApi } from './MessageApi-BgsSpDno.js';
10
10
  import { P as PhoneNumberApi } from './PhoneNumberApi-DKlu9PHl.js';
11
11
  import { B as BusinessProfileApi } from './BusinessProfileApi-WXscSgo-.js';
12
12
  import { Q as QrCodeApi } from './QrCodeApi-7vDwIBHR.js';
@@ -1,5 +1,5 @@
1
- import { F as FlowApi } from '../../FlowApi-UAvzhJfV.js';
2
- export { C as CreateFlowResponse, F as Flow, b as FlowActionEnum, c as FlowAssetsResponse, d as FlowCategoryEnum, e as FlowClass, f as FlowEndpointRequest, g as FlowEndpointResponse, h as FlowMigrationResponse, i as FlowPreviewResponse, k as FlowStatusEnum, a as FlowType, l as FlowTypeEnum, m as FlowValidationError, j as FlowsListResponse, U as UpdateFlowResponse, V as ValidateFlowJsonResponse } from '../../common-DDXsNyLF.js';
1
+ import { F as FlowApi } from '../../FlowApi-B2ffO-HD.js';
2
+ export { C as CreateFlowResponse, c as Flow, e as FlowActionEnum, f as FlowAssetsResponse, g as FlowCategoryEnum, h as FlowClass, a as FlowEndpointRequest, b as FlowEndpointResponse, i as FlowMigrationResponse, j as FlowPreviewResponse, l as FlowStatusEnum, d as FlowType, F as FlowTypeEnum, m as FlowValidationError, k as FlowsListResponse, U as UpdateFlowResponse, V as ValidateFlowJsonResponse } from '../../common-lV0NsO7t.js';
3
3
  import '../../base-CdGDdVEl.js';
4
4
  import '../../types/config.js';
5
5
  import '../../enums-BZd9T2ul.js';
@@ -1,8 +1,9 @@
1
1
  export { E as EncryptionApi, a as EncryptionClass, b as EncryptionPublicKeyResponse } from '../EncryptionApi-D7pt-OXT.js';
2
- export { F as FlowApi } from '../FlowApi-UAvzhJfV.js';
3
- export { C as CreateFlowResponse, F as Flow, b as FlowActionEnum, c as FlowAssetsResponse, d as FlowCategoryEnum, e as FlowClass, f as FlowEndpointRequest, g as FlowEndpointResponse, h as FlowMigrationResponse, i as FlowPreviewResponse, k as FlowStatusEnum, a as FlowType, l as FlowTypeEnum, m as FlowValidationError, j as FlowsListResponse, U as UpdateFlowResponse, V as ValidateFlowJsonResponse } from '../common-DDXsNyLF.js';
2
+ export { F as FlowApi } from '../FlowApi-B2ffO-HD.js';
3
+ export { C as CreateFlowResponse, c as Flow, e as FlowActionEnum, f as FlowAssetsResponse, g as FlowCategoryEnum, h as FlowClass, a as FlowEndpointRequest, b as FlowEndpointResponse, i as FlowMigrationResponse, j as FlowPreviewResponse, l as FlowStatusEnum, d as FlowType, F as FlowTypeEnum, m as FlowValidationError, k as FlowsListResponse, U as UpdateFlowResponse, V as ValidateFlowJsonResponse } from '../common-lV0NsO7t.js';
4
4
  export { M as MediaApi, a as MediaClass, b as MediaResponse, c as MediasResponse, U as UploadMediaResponse } from '../MediaApi-BrEKpqi_.js';
5
- export { A as AudioMediaObject, C as ContactObject, D as DocumentMediaObject, I as ImageMediaObject, a as InteractiveObject, L as LocationObject, b as MessageRequestParams, d as MessageTemplateObject, M as MessagesApi, c as MessagesResponse, R as ReactionParams, S as StatusParams, e as StickerMediaObject, T as TextMessageParams, f as TextObject, V as VideoMediaObject } from '../MessageApi-Circorzz.js';
5
+ export { M as MessagesApi } from '../MessageApi-BgsSpDno.js';
6
+ export { A as AudioMediaObject, C as ContactObject, D as DocumentMediaObject, I as ImageMediaObject, a as InteractiveObject, L as LocationObject, M as MessageRequestParams, c as MessageTemplateObject, b as MessagesResponse, R as ReactionParams, S as StatusParams, d as StickerMediaObject, T as TextMessageParams, e as TextObject, V as VideoMediaObject } from '../common-BiRA_uz3.js';
6
7
  export { A as AccountMode, C as CodeVerificationStatus, a as Cursors, H as HealthStatus, b as HealthStatusEntity, M as MessagingLimitTier, P as PhoneNumberApi, c as PhoneNumberClass, d as PhoneNumberResponse, e as PhoneNumbersResponse, f as PlatformType, Q as QualityRating, g as QualityScore, R as RequestVerificationCodeRequest, T as Throughput, h as ThroughputLevel, i as TwoStepVerificationParams, V as VerifyCodeRequest } from '../PhoneNumberApi-DKlu9PHl.js';
7
8
  export { B as BusinessProfileApi, a as BusinessProfileClass, b as BusinessProfileData, c as BusinessProfileField, d as BusinessProfileFieldsParam, e as BusinessProfileResponse, C as CreateUploadSessionParams, G as GetUploadHandleParams, U as UpdateBusinessProfileRequest, f as UploadBusinessProfileResponse, g as UploadHandle, h as UploadMediaParams, i as UploadSession, j as UploadSessionResponse } from '../BusinessProfileApi-WXscSgo-.js';
8
9
  export { C as CreateQrCodeRequest, Q as QrCodeApi, a as QrCodeClass, b as QrCodeResponse, c as QrCodesResponse, U as UpdateQrCodeRequest } from '../QrCodeApi-7vDwIBHR.js';
package/dist/api/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import'../chunk-AMHQGG6Z.js';export{b as QrCodeApi}from'../chunk-JPAV644F.js';export{b as RegistrationApi}from'../chunk-PHPQ5HP3.js';export{b as EncryptionApi}from'../chunk-IYSR44P6.js';export{b as TwoStepVerificationApi}from'../chunk-SNNRWNGZ.js';export{b as WabaApi}from'../chunk-L4ESAO2S.js';export{b as MessagesApi}from'../chunk-7QBIZCJ4.js';export{b as MediaApi}from'../chunk-JXCLRKQ7.js';export{b as BusinessProfileApi}from'../chunk-LV3TULSI.js';import'../chunk-CRZ7EUYR.js';export{b as FlowApi}from'../chunk-JC6YMVID.js';import'../chunk-NLF2JGYY.js';export{b as PhoneNumberApi}from'../chunk-FSKBLPGE.js';export{a as TemplateApi}from'../chunk-VHAODWCN.js';import'../chunk-MJEG3K4V.js';import'../chunk-RIL6QABY.js';import'../chunk-KMAH6636.js';//# sourceMappingURL=index.js.map
1
+ import'../chunk-AMHQGG6Z.js';export{a as TemplateApi}from'../chunk-VHAODWCN.js';export{b as QrCodeApi}from'../chunk-JPAV644F.js';export{b as RegistrationApi}from'../chunk-PHPQ5HP3.js';export{b as EncryptionApi}from'../chunk-IYSR44P6.js';export{b as TwoStepVerificationApi}from'../chunk-SNNRWNGZ.js';export{b as WabaApi}from'../chunk-L4ESAO2S.js';export{b as MessagesApi}from'../chunk-7QBIZCJ4.js';export{b as MediaApi}from'../chunk-JXCLRKQ7.js';export{b as BusinessProfileApi}from'../chunk-LV3TULSI.js';import'../chunk-CRZ7EUYR.js';export{b as FlowApi}from'../chunk-JC6YMVID.js';import'../chunk-NLF2JGYY.js';export{b as PhoneNumberApi}from'../chunk-FSKBLPGE.js';import'../chunk-MJEG3K4V.js';import'../chunk-RIL6QABY.js';import'../chunk-KMAH6636.js';//# sourceMappingURL=index.js.map
2
2
  //# sourceMappingURL=index.js.map