meta-cloud-api 0.2.19 → 0.2.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BusinessProfileApi-BjOyDR-8.d.ts → BusinessProfileApi-CNU7GpJK.d.ts} +3 -3
- package/dist/{EncryptionApi-B3hzgZwc.d.ts → EncryptionApi-r6_0rWwx.d.ts} +1 -1
- package/dist/{FlowApi-OEAji2dP.d.ts → FlowApi-BhpWbli2.d.ts} +2 -2
- package/dist/{MediaApi-C2-eC3BR.d.ts → MediaApi-DM3WohTN.d.ts} +2 -2
- package/dist/{MessageApi-BQhqbAOY.d.ts → MessageApi-Cr3Q6qg4.d.ts} +2 -2
- package/dist/{PhoneNumberApi-BgfYrui-.d.ts → PhoneNumberApi-Dc2KKn0M.d.ts} +2 -2
- package/dist/{QrCodeApi-CimaUuYP.d.ts → QrCodeApi-z9XTnlcP.d.ts} +1 -1
- package/dist/{RegistrationApi-BSDXRJlL.d.ts → RegistrationApi-CYrP_F0R.d.ts} +2 -2
- package/dist/{TemplateApi-B7dTBIlN.d.ts → TemplateApi-Bjc2IfNX.d.ts} +3 -3
- package/dist/{TwoStepVerificationApi-BY0eD8R2.d.ts → TwoStepVerificationApi-nJ12648J.d.ts} +1 -1
- package/dist/{WabaApi-BFbVUUlw.d.ts → WabaApi-BIP6G4pB.d.ts} +1 -1
- package/dist/{base-B4QLc9vb.d.ts → base--LmzWHx3.d.ts} +1 -1
- package/dist/{chunk-34SVEEB7.js → chunk-2QZCD34C.js} +3 -3
- package/dist/{chunk-34SVEEB7.js.map → chunk-2QZCD34C.js.map} +1 -1
- package/dist/chunk-W2U7MN7M.js +2 -0
- package/dist/chunk-W2U7MN7M.js.map +1 -0
- package/dist/core/webhook/index.d.ts +13 -13
- package/dist/core/webhook/index.js +1 -1
- package/dist/core/whatsapp/index.d.ts +13 -13
- package/dist/{enums-CL4CRQAe.d.ts → enums-CI7vzKhn.d.ts} +1 -1
- package/dist/features/encryption/index.d.ts +4 -4
- package/dist/features/flow/index.d.ts +4 -4
- package/dist/features/media/index.d.ts +4 -4
- package/dist/features/messages/index.d.ts +4 -4
- package/dist/features/phone/index.d.ts +4 -4
- package/dist/features/profile/index.d.ts +4 -4
- package/dist/features/qrCode/index.d.ts +4 -4
- package/dist/features/registration/index.d.ts +4 -4
- package/dist/features/template/index.d.ts +4 -4
- package/dist/features/twoStepVerification/index.d.ts +4 -4
- package/dist/features/waba/index.d.ts +4 -4
- package/dist/index.d.ts +17 -18
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/shared/types/config.d.ts +1 -1
- package/dist/shared/types/config.js +1 -1
- package/dist/shared/types/enums.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { d as BaseClass, R as ResponseSuccess, B as BaseAPI, a as RequesterClass } from './base
|
|
1
|
+
import { d as BaseClass, R as ResponseSuccess, B as BaseAPI, a as RequesterClass } from './base--LmzWHx3.js';
|
|
2
2
|
import { WabaConfigType } from './shared/types/config.js';
|
|
3
|
-
import {
|
|
3
|
+
import { k as BusinessVerticalEnum } from './enums-CI7vzKhn.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Upload session information for creating upload sessions.
|
|
@@ -349,4 +349,4 @@ declare class BusinessProfileApi extends BaseAPI implements BusinessProfileClass
|
|
|
349
349
|
getUploadHandle(uploadId: string): Promise<UploadHandle>;
|
|
350
350
|
}
|
|
351
351
|
|
|
352
|
-
export { BusinessProfileApi as B, type CreateUploadSessionParams as C, type GetUploadHandleParams as G, type UpdateBusinessProfileRequest as U, BusinessProfileClass as a, type
|
|
352
|
+
export { BusinessProfileApi as B, type CreateUploadSessionParams as C, type GetUploadHandleParams as G, type UpdateBusinessProfileRequest as U, BusinessProfileClass as a, type BusinessProfileResponse as b, type BusinessProfileData as c, type BusinessProfileField as d, type BusinessProfileFieldsParam as e, type UploadBusinessProfileResponse as f, type UploadHandle as g, type UploadMediaParams as h, type UploadSession as i, type UploadSessionResponse as j };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as ResponseData, R as ResponseSuccess, B as BaseAPI, a as RequesterClass } from './base
|
|
1
|
+
import { c as ResponseData, R as ResponseSuccess, B as BaseAPI, a as RequesterClass } from './base--LmzWHx3.js';
|
|
2
2
|
import { WabaConfigType } from './shared/types/config.js';
|
|
3
3
|
|
|
4
4
|
type EncryptionPublicKeyResponse = ResponseData<{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as ResponseSuccess, B as BaseAPI, a as RequesterClass } from './base
|
|
1
|
+
import { R as ResponseSuccess, B as BaseAPI, a as RequesterClass } from './base--LmzWHx3.js';
|
|
2
2
|
import { WabaConfigType } from './shared/types/config.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -468,4 +468,4 @@ declare class FlowApi extends BaseAPI implements FlowClass {
|
|
|
468
468
|
}): Promise<FlowMigrationResponse>;
|
|
469
469
|
}
|
|
470
470
|
|
|
471
|
-
export { type CreateFlowResponse as C, FlowApi as F, type UpdateFlowResponse as U, type ValidateFlowJsonResponse as V, type Flow as a,
|
|
471
|
+
export { type CreateFlowResponse as C, FlowApi as F, type UpdateFlowResponse as U, type ValidateFlowJsonResponse as V, type Flow as a, type FlowClass as b, type FlowEndpointRequest as c, type FlowEndpointResponse as d, FlowActionEnum as e, type FlowAssetsResponse as f, FlowCategoryEnum as g, type FlowMigrationResponse as h, type FlowPreviewResponse as i, type FlowsListResponse as j, FlowStatusEnum as k, type FlowValidationError as l, FlowTypeEnum as m };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as ResponseSuccess, B as BaseAPI, a as RequesterClass } from './base
|
|
1
|
+
import { R as ResponseSuccess, B as BaseAPI, a as RequesterClass } from './base--LmzWHx3.js';
|
|
2
2
|
import { WabaConfigType } from './shared/types/config.js';
|
|
3
3
|
|
|
4
4
|
type MediaResponse = {
|
|
@@ -86,4 +86,4 @@ declare class MediaApi extends BaseAPI implements MediaClass {
|
|
|
86
86
|
downloadMedia(mediaUrl: string): Promise<Blob>;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
export {
|
|
89
|
+
export { type MediaClass as M, type UploadMediaResponse as U, type MediaResponse as a, type MediasResponse as b, MediaApi as c };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { d as BaseClass, G as GeneralRequestBody, B as BaseAPI, a as RequesterClass } from './base
|
|
1
|
+
import { d as BaseClass, G as GeneralRequestBody, B as BaseAPI, a as RequesterClass } from './base--LmzWHx3.js';
|
|
2
2
|
import { WabaConfigType } from './shared/types/config.js';
|
|
3
|
-
import { I as InteractiveTypesEnum, b as ComponentTypesEnum, L as LanguagesEnum, P as ParametersTypesEnum,
|
|
3
|
+
import { I as InteractiveTypesEnum, b as ComponentTypesEnum, L as LanguagesEnum, P as ParametersTypesEnum, i as CurrencyCodesEnum, B as ButtonTypesEnum, a as ButtonPositionEnum, M as MessageTypesEnum } from './enums-CI7vzKhn.js';
|
|
4
4
|
|
|
5
5
|
interface ReactionParams {
|
|
6
6
|
messageId: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as Paging, R as ResponseSuccess, B as BaseAPI, a as RequesterClass } from './base
|
|
1
|
+
import { P as Paging, R as ResponseSuccess, B as BaseAPI, a as RequesterClass } from './base--LmzWHx3.js';
|
|
2
2
|
import { WabaConfigType } from './shared/types/config.js';
|
|
3
3
|
|
|
4
4
|
type QualityRating = 'GREEN' | 'YELLOW' | 'RED' | 'NA';
|
|
@@ -138,4 +138,4 @@ declare class PhoneNumberApi extends BaseAPI implements PhoneNumberClass {
|
|
|
138
138
|
verifyCode(request: VerifyCodeRequest): Promise<ResponseSuccess>;
|
|
139
139
|
}
|
|
140
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
|
|
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,4 +1,4 @@
|
|
|
1
|
-
import { c as ResponseData, R as ResponseSuccess, B as BaseAPI, a as RequesterClass } from './base
|
|
1
|
+
import { c as ResponseData, R as ResponseSuccess, B as BaseAPI, a as RequesterClass } from './base--LmzWHx3.js';
|
|
2
2
|
import { WabaConfigType } from './shared/types/config.js';
|
|
3
3
|
|
|
4
4
|
type QrCodeResponse = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { R as ResponseSuccess, B as BaseAPI, a as RequesterClass } from './base
|
|
1
|
+
import { R as ResponseSuccess, B as BaseAPI, a as RequesterClass } from './base--LmzWHx3.js';
|
|
2
2
|
import { WabaConfigType } from './shared/types/config.js';
|
|
3
|
-
import {
|
|
3
|
+
import { j as DataLocalizationRegionEnum } from './enums-CI7vzKhn.js';
|
|
4
4
|
|
|
5
5
|
type RegistrationRequest = {
|
|
6
6
|
messaging_product: 'whatsapp';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { G as GeneralRequestBody, R as ResponseSuccess, b as ResponsePagination, B as BaseAPI, a as RequesterClass } from './base
|
|
1
|
+
import { G as GeneralRequestBody, R as ResponseSuccess, b as ResponsePagination, B as BaseAPI, a as RequesterClass } from './base--LmzWHx3.js';
|
|
2
2
|
import { WabaConfigType } from './shared/types/config.js';
|
|
3
|
-
import { L as LanguagesEnum, C as CategoryEnum, T as TemplateStatusEnum } from './enums-
|
|
3
|
+
import { L as LanguagesEnum, C as CategoryEnum, T as TemplateStatusEnum } from './enums-CI7vzKhn.js';
|
|
4
4
|
|
|
5
5
|
type TemplateFormat = 'TEXT' | 'IMAGE' | 'VIDEO' | 'DOCUMENT' | 'LOCATION';
|
|
6
6
|
type PhoneNumberButton = {
|
|
@@ -114,4 +114,4 @@ declare class TemplateApi extends BaseAPI implements TemplateClass {
|
|
|
114
114
|
deleteTemplate(params: TemplateDeleteParams): Promise<ResponseSuccess>;
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
export { TemplateApi as T, TemplateClass as a, type
|
|
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,4 +1,4 @@
|
|
|
1
|
-
import { R as ResponseSuccess, B as BaseAPI, a as RequesterClass } from './base
|
|
1
|
+
import { R as ResponseSuccess, B as BaseAPI, a as RequesterClass } from './base--LmzWHx3.js';
|
|
2
2
|
import { WabaConfigType } from './shared/types/config.js';
|
|
3
3
|
|
|
4
4
|
type TwoStepVerificationRequest = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WabaConfigType } from './shared/types/config.js';
|
|
2
|
-
import { H as HttpMethodsEnum } from './enums-
|
|
2
|
+
import { H as HttpMethodsEnum } from './enums-CI7vzKhn.js';
|
|
3
3
|
|
|
4
4
|
type GeneralRequestBody = Record<string, unknown>;
|
|
5
5
|
interface RequesterResponseInterface<T> {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {a as a$1,b}from'./chunk-BSNA6RYF.js';import {a}from'./chunk-VW3LGHTJ.js';import l from'crypto';var P=(
|
|
2
|
-
`),a=this.config.FLOW_API_PASSPHRASE,s=l.createPrivateKey({key:
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import {a as a$1,b}from'./chunk-BSNA6RYF.js';import {a}from'./chunk-VW3LGHTJ.js';import l from'crypto';var P=(o=>(o.DELIVERED="delivered",o.READ="read",o.SENT="sent",o))(P||{}),x=(a=>(a.MESSAGES="messages",a.STATUSES="statuses",a.MESSAGE_TEMPLATE_STATUS_UPDATE="message_template_status_update",a.PHONE_NUMBER_QUALITY_UPDATE="phone_number_quality_update",a.PHONE_NUMBER_NAME_UPDATE="phone_number_name_update",a.UNKNOWN="unknown",a))(x||{});function _(d){return typeof d=="object"&&d!==null}function g(d){return typeof d=="string"}var S=["data_exchange","INIT","BACK"],W=["data_exchange","INIT"];function w(d){if(!("flow_token"in d&&g(d.flow_token)&&"action"in d))return false;let{action:t,version:e,screen:o,data:r}=d,n=e==="3.0",a=S.includes(t),s=typeof o>"u"||g(o)&&o!=="SUCCESS",u=t==="data_exchange"||_(r);return n&&a&&s&&u}function v(d){if(!("flow_token"in d&&g(d.flow_token)&&"action"in d))return false;let{action:t,screen:e,data:o}=d,r=W.includes(t),n=g(e),a=_(o)&&"error_key"in o&&g(o.error)&&"error_message"in o&&g(o.error_message);return r&&n&&a}function E(d){return "action"in d&&d.action==="ping"}var T="WEBHOOK",N=false,i=new a(T,process.env.DEBUG==="true"||N),h=class{config;client;messageHandlers=new Map;eventHandlers=new Map;preProcessHandler=null;postProcessHandler=null;flowHandlers=new Map;constructor(t){let e=a$1(t);this.config=e,this.client=new b(t),i.log("WebhookHandler instantiated!");}handleVerificationRequest(t,e){let o=t.query["hub.mode"],r=t.query["hub.verify_token"],n=t.query["hub.challenge"];if(o==="subscribe"&&r===this.config.WEBHOOK_VERIFICATION_TOKEN)if(i.log("Webhook verified successfully"),e){e.status(200).send(n);return}else return i.log("Returning challenge for manual handling"),n;else if(i.log("Webhook verification failed"),e){e.status(403).end();return}else throw i.log("Verification failed - throwing error for manual handling"),new Error("Webhook verification failed")}async handleWebhookRequest(t,e){let o=t.body,r=[];if(o.object!=="whatsapp_business_account"){let n="Received webhook for non-WhatsApp event";if(i.log(n),e){e.status(404).end();return}else return r.push(n),{success:false,errors:r}}for(let n of o.entry)try{let a=n.changes;for(let s of a)s.field==="messages"?await this.processMessages(s.value):await this.processEvent(s.field,s.value);}catch(a){let s=`Error processing webhook: ${a}`;i.log(s),r.push(s);}if(e){e.status(200).end();return}else return {success:r.length===0,errors:r.length>0?r:void 0}}handleRequest(t,e){if(t.method==="GET")return e?this.handleVerificationRequest(t,e):this.handleVerificationRequest(t);if(t.method==="POST")return e?this.handleWebhookRequest(t,e):this.handleWebhookRequest(t);if(e){e.status(405).end();return}else throw new Error("Method not allowed")}async processMessages(t){let e=t.metadata,o=e.display_phone_number,r=e.phone_number_id,n=t.contacts[0].profile.name,a=t.messages;if(a&&a.length>0)for(let s of a){let u=s.type,c={id:s.id,from:s.from,timestamp:s.timestamp,type:s.type,phoneNumberId:r,displayPhoneNumber:o,profileName:n,originalData:s};switch(s.type){case "text":c.text=s.text;break;case "image":c.image=s.image;break;case "video":c.video=s.video;break;case "audio":c.audio=s.audio;break;case "document":c.document=s.document;break;case "sticker":c.sticker=s.sticker;break;case "location":c.location=s.location;break;case "contacts":c.contacts=s.contacts;break;case "interactive":c.interactive=s.interactive;break;case "button":c.button=s.button;break;case "order":c.order=s.order;break;case "system":c.system=s.system;break;}if(s.context&&(c.context=s.context),s.errors&&(c.errors=s.errors),this.preProcessHandler)try{await this.preProcessHandler(this.client,c);}catch(p){i.log(`Error in pre-process handler: ${p}`);}let f=this.messageHandlers.get(u);if(f)try{await f(this.client,c);}catch(p){i.log(`Error in message handler for ${u}: ${p}`);}if(this.postProcessHandler)try{await this.postProcessHandler(this.client,c);}catch(p){i.log(`Error in post-process handler: ${p}`);}}}async processEvent(t,e){let o={field:t,value:e,timestamp:Date.now()},r=this.eventHandlers.get(t);if(r)try{await r(o);}catch(n){i.log(`Error in event handler for ${t}: ${n}`);}}onMessage(t,e){this.messageHandlers.set(t,e),i.log(`Registered message handler for ${t}`);}onEvent(t,e){this.eventHandlers.set(t,e),i.log(`Registered event handler for ${t}`);}onMessagePreProcess(t){this.preProcessHandler=t,i.log("Registered pre-process handler");}onMessagePostProcess(t){this.postProcessHandler=t,i.log("Registered post-process handler");}async handleFlowRequest(t,e){try{if(!this.isRequestSignatureValid(t)){let s={error:"Unauthorized"};if(i.log("Invalid request signature"),e){e.status(401).json(s);return}else return {statusCode:401,body:s}}let o=JSON.parse(t.rawBody),{decryptedBody:r}=this.decryptRequest(o),n=this.flowHandlers.get("*");if(!n){let s={error:"Handler not found"};if(i.log(`No handler registered for flow action: ${r.action}`),e){e.status(404).json(s);return}else return {statusCode:404,body:s}}if(E(r)){let s={version:"3.0",data:{status:"active"}};if(e){e.status(200).json(s);return}else return {statusCode:200,body:s}}if(v(r)){i.log(`Flow error: ${JSON.stringify(r)}`);let s={};if(e){e.status(200).json(s);return}else return {statusCode:200,body:s}}if(w(r)){let s=await n(this.client,r),u=this.encryptResponse(s,Buffer.from(o.aes_key,"base64"),Buffer.from(o.initial_vector,"base64"));if(e){e.status(200).json(u);return}else return {statusCode:200,body:u}}let a={error:"Unknown request type"};if(i.log(`Unknown flow request type: ${JSON.stringify(r)}`),e){e.status(400).json(a);return}else return {statusCode:400,body:a}}catch(o){let r={error:"Internal server error"};if(i.log(`Error handling flow request: ${o}`),e){e.status(500).json(r);return}else return {statusCode:500,body:r}}}isRequestSignatureValid(t){let e=t.headers["x-hub-signature-256"];if(!e)return false;let r=`sha256=${l.createHmac("sha256",this.config.WEBHOOK_VERIFICATION_TOKEN||"").update(t.rawBody,"utf8").digest("hex")}`;return l.timingSafeEqual(Buffer.from(e),Buffer.from(r))}decryptRequest(t){i.log("Received body for decryption:",JSON.stringify(t,null,2));let{encrypted_aes_key:e,encrypted_flow_data:o,initial_vector:r}=t;if(!e)throw new Error("Missing required property: encrypted_aes_key");if(!o)throw new Error("Missing required property: encrypted_flow_data");if(!r)throw new Error("Missing required property: initial_vector");i.log("Received body for privatePem:",JSON.stringify(this.config.FLOW_API_PRIVATE_PEM,null,2)),i.log("Received body for passphrase:",JSON.stringify(this.config.FLOW_API_PASSPHRASE,null,2));let n=this.config.FLOW_API_PRIVATE_PEM.replace(/\\n/g,`
|
|
2
|
+
`),a=this.config.FLOW_API_PASSPHRASE,s=l.createPrivateKey({key:n,passphrase:a}),u=null;try{u=l.privateDecrypt({key:s,padding:l.constants.RSA_PKCS1_OAEP_PADDING,oaepHash:"sha256"},Buffer.from(e,"base64"));}catch(I){throw i.error(I),new Error("Failed to decrypt the request. Please verify your private key.")}let c=Buffer.from(o,"base64"),f=Buffer.from(r,"base64"),q=c.subarray(0,-16),A=c.subarray(-16),m=l.createDecipheriv("aes-128-gcm",u,f);m.setAuthTag(A);let k=Buffer.concat([m.update(q),m.final()]).toString("utf-8");return {decryptedBody:JSON.parse(k),aesKeyBuffer:u,initialVectorBuffer:f}}encryptResponse(t,e,o){let r=[];for(let n of Array.from(o.entries()))r.push(~n[1]);try{let n=l.createCipheriv("aes-128-gcm",e,Buffer.from(r));return Buffer.concat([n.update(JSON.stringify(t||{}),"utf-8"),n.final(),n.getAuthTag()]).toString("base64")}catch(n){throw i.error("Response encryption error:",n),new Error("Failed to encrypt response. Internal server error.")}}onFlow(t,e){this.flowHandlers.set(t,e),i.log(`Registered flow handler for ${t}`);}};export{P as a,x as b,h as c};//# sourceMappingURL=chunk-2QZCD34C.js.map
|
|
3
|
+
//# sourceMappingURL=chunk-2QZCD34C.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/webhook/types.ts","../src/shared/utils/flowTypeGuards.ts","../src/core/webhook/WebhookHandler.ts"],"names":["MessageStatus","EventField","isObject","value","isString","DATA_EXCHANGE_ACTIONS","ERROR_ACTIONS","isFlowDataExchangeRequest","request","action","version","screen","data","hasValidVersion","hasValidAction","hasValidScreen","hasValidData","isFlowErrorRequest","isFlowPingRequest","LIB_NAME","LOG_LOCAL","LOGGER","Logger","WebhookHandler","config","configuration","importConfig","WhatsApp","req","res","mode","token","challenge","body","errors","errorMsg","entry","changes","change","error","metadata","displayPhoneNumber","phoneNumberId","profileName","messages","message","messageType","processedMessage","handler","field","event","type","decryptedBody","response","result","encryptedResponse","errorResponse","signature","formattedExpectedSignature","crypto","encrypted_aes_key","encrypted_flow_data","initial_vector","privatePem","passphrase","privateKey","decryptedAesKey","flowDataBuffer","initialVectorBuffer","TAG_LENGTH","encrypted_flow_data_body","encrypted_flow_data_tag","decipher","decryptedJSONString","aesKeyBuffer","flipped_iv","pair","cipher"],"mappings":"uGAwgBO,IAAKA,CACRA,CAAAA,CAAAA,CAAAA,GAAAA,CAAAA,CAAA,SAAY,CAAA,WAAA,CACZA,EAAA,IAAO,CAAA,MAAA,CACPA,CAAA,CAAA,IAAA,CAAO,OAHCA,CAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA,CASAC,CACRA,CAAAA,CAAAA,CAAAA,GAAAA,CAAAA,CAAA,SAAW,UACXA,CAAAA,CAAAA,CAAA,QAAW,CAAA,UAAA,CACXA,CAAA,CAAA,8BAAA,CAAiC,gCACjCA,CAAAA,CAAAA,CAAA,4BAA8B,6BAC9BA,CAAAA,CAAAA,CAAA,wBAA2B,CAAA,0BAAA,CAC3BA,EAAA,OAAU,CAAA,SAAA,CANFA,CAAA,CAAA,EAAA,CAAA,EAAA,EAAA,ECpgBZ,SAASC,CAASC,CAAAA,CAAAA,CAAkD,CAChE,OAAO,OAAOA,CAAAA,EAAU,QAAYA,EAAAA,CAAAA,GAAU,IAClD,CAOA,SAASC,CAASD,CAAAA,CAAAA,CAAiC,CAC/C,OAAO,OAAOA,CAAU,EAAA,QAC5B,CAGA,IAAME,CAAAA,CAAwB,CAAuE,eAAA,CAAA,MAAA,CAAA,MAAA,CAAA,CAG/FC,EAAgB,CAAkD,eAAA,CAAA,MAAA,CAAA,CASjE,SAASC,CAAAA,CAA0BC,EAKxC,CAEE,GAAI,EAAE,YAAA,GAAgBA,GAAWJ,CAASI,CAAAA,CAAAA,CAAQ,UAAU,CAAA,EAAK,WAAYA,CACzE,CAAA,CAAA,OAAO,MAGX,CAAA,GAAM,CAAE,MAAA,CAAAC,CAAQ,CAAA,OAAA,CAAAC,EAAS,MAAAC,CAAAA,CAAAA,CAAQ,IAAAC,CAAAA,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,CAAO,MAAM,4BAA8BkB,CAAAA,CAAK,CAC1C,CAAA,IAAI,KAAM,CAAA,oDAAoD,CACxE,CACJ,CAKO,MACHY,CAAAA,CAAAA,CACAH,CACI,CAAA,CACJ,KAAK,YAAa,CAAA,GAAA,CAAIG,CAAMH,CAAAA,CAAO,CACnC3B,CAAAA,CAAAA,CAAO,IAAI,CAA+B8B,4BAAAA,EAAAA,CAAI,CAAE,CAAA,EACpD,CACJ","file":"chunk-34SVEEB7.js","sourcesContent":["import { MessageTypesEnum } from '@shared/types/enums';\n\nexport interface WebhookContact {\n /**\n * WhatsApp ID of the contact. Business can respond to this contact using this ID.\n */\n wa_id: string;\n /**\n * Additional unique, alphanumeric identifier for a WhatsApp user\n */\n user_id?: string;\n /**\n * Profile of Whatsapp user\n */\n profile: {\n /**\n * The display name of the contact\n */\n name: string;\n };\n}\n\n/**\n * Represents a message received through the webhook\n * Based on Meta's documentation: https://developers.facebook.com/docs/whatsapp/cloud-api/webhooks/components#messages-object\n */\nexport interface WebhookMessage {\n /**\n * The message ID\n */\n id: string;\n\n /**\n * The sender's phone number\n */\n from: string;\n\n /**\n * The timestamp of the message\n */\n timestamp: string;\n\n /**\n * The type of message (text, image, etc.)\n */\n type: MessageTypesEnum;\n\n /**\n * The phone number ID that received the message\n */\n phoneNumberId: string;\n\n /**\n * The display phone number that received the message\n */\n displayPhoneNumber: string;\n\n /**\n * The profile name of the sender\n */\n profileName: string;\n\n /**\n * Text object for text messages\n */\n text?: {\n /**\n * The text content of the message\n */\n body: string;\n };\n\n /**\n * Image object for image messages\n */\n image?: {\n /**\n * The image caption (if provided)\n */\n caption?: string;\n /**\n * The SHA256 hash of the image\n */\n sha256?: string;\n /**\n * The ID for the image\n */\n id: string;\n /**\n * The MIME type of the image\n */\n mime_type: string;\n };\n\n /**\n * Video object for video messages\n */\n video?: {\n /**\n * The video caption (if provided)\n */\n caption?: string;\n /**\n * The SHA256 hash of the video\n */\n sha256?: string;\n /**\n * The ID for the video\n */\n id: string;\n /**\n * The MIME type of the video\n */\n mime_type: string;\n };\n\n /**\n * Audio object for audio messages\n */\n audio?: {\n /**\n * The ID for the audio file\n */\n id: string;\n /**\n * The MIME type of the audio file\n */\n mime_type: string;\n /**\n * Whether the audio is a voice message\n */\n voice?: boolean;\n };\n\n /**\n * Document object for document messages\n */\n document?: {\n /**\n * The document caption (if provided)\n */\n caption?: string;\n /**\n * The document filename\n */\n filename: string;\n /**\n * The SHA256 hash of the document\n */\n sha256?: string;\n /**\n * The ID for the document\n */\n id: string;\n /**\n * The MIME type of the document\n */\n mime_type: string;\n };\n\n /**\n * Sticker object for sticker messages\n */\n sticker?: {\n /**\n * The ID for the sticker\n */\n id: string;\n /**\n * Whether this is an animated sticker\n */\n animated: boolean;\n /**\n * The MIME type of the sticker\n */\n mime_type: string;\n };\n\n /**\n * Reaction object for reaction messages\n */\n reaction?: {\n /**\n * The ID of the message being reacted to\n */\n message_id: string;\n /**\n * Emoji used for the reaction\n */\n emoji: string;\n };\n\n /**\n * Contacts object for contact messages\n */\n contacts?: Array<{\n /**\n * The contact's name\n */\n name: {\n /**\n * The formatted name\n */\n formatted_name: string;\n /**\n * The first name\n */\n first_name?: string;\n /**\n * The last name\n */\n last_name?: string;\n /**\n * The middle name\n */\n middle_name?: string;\n /**\n * The suffix\n */\n suffix?: string;\n /**\n * The prefix\n */\n prefix?: string;\n };\n /**\n * The contact's phone numbers\n */\n phones?: Array<{\n phone: string;\n type?: string;\n wa_id?: string;\n }>;\n /**\n * The contact's emails\n */\n emails?: Array<{\n email: string;\n type?: string;\n }>;\n /**\n * The contact's addresses\n */\n addresses?: Array<{\n street?: string;\n city?: string;\n state?: string;\n zip?: string;\n country?: string;\n country_code?: string;\n type?: string;\n }>;\n /**\n * The contact's organizations\n */\n org?: {\n company?: string;\n department?: string;\n title?: string;\n };\n /**\n * The contact's URLs\n */\n urls?: Array<{\n url: string;\n type?: string;\n }>;\n /**\n * The contact's birthday (YYYY-MM-DD format)\n */\n birthday?: string;\n }>;\n\n /**\n * Location object for location messages\n */\n location?: {\n /**\n * Latitude of the location\n */\n latitude: number;\n /**\n * Longitude of the location\n */\n longitude: number;\n /**\n * Name of the location\n */\n name?: string;\n /**\n * Address of the location\n */\n address?: string;\n };\n\n /**\n * Interactive object for interactive messages\n */\n interactive?: {\n /**\n * Type of the interactive message\n * Can be: button_reply, list_reply, flow, nfm_reply, etc.\n */\n type: string;\n /**\n * ID for the button that was clicked\n */\n button_reply?: {\n id: string;\n title: string;\n };\n /**\n * ID for the list item that was selected\n */\n list_reply?: {\n id: string;\n title: string;\n description?: string;\n };\n\n /**\n * NFM (No-Code Flow Message) reply data\n */\n nfm_reply?: {\n /**\n * Response data in JSON format\n */\n response_json: string;\n /**\n * Body text of the reply\n */\n body: string;\n /**\n * Name of the flow\n */\n name: string;\n };\n };\n\n /**\n * System object for system messages (like user phone number changes)\n */\n system?: {\n /**\n * The type of system update\n */\n type: string;\n /**\n * User's identity if the update is a customer identity change\n */\n identity?: string;\n /**\n * Old and new phone numbers if the update is a phone number change\n */\n customer?: {\n /**\n * The previous phone number\n */\n previous_wa_id: string;\n /**\n * The new phone number\n */\n wa_id: string;\n };\n };\n\n /**\n * Order object for order messages\n */\n order?: {\n /**\n * Catalog ID\n */\n catalog_id: string;\n /**\n * Product items in the order\n */\n product_items: Array<{\n /**\n * Product ID\n */\n product_retailer_id: string;\n /**\n * Quantity of the product\n */\n quantity: number;\n /**\n * Item price\n */\n item_price: number;\n /**\n * Currency code\n */\n currency: string;\n }>;\n /**\n * Text message included with the order\n */\n text?: string;\n };\n\n /**\n * Context object, included when a user replies or interacts\n */\n context?: {\n /**\n * ID of the message\n */\n id?: string;\n /**\n * ID of the sender\n */\n from?: string;\n /**\n * ID of the message being replied to or interacted with\n */\n message_id: string;\n /**\n * ID of the forwarded message, if applicable\n */\n forwarded?: boolean;\n /**\n * Frequently forwarded status\n */\n frequently_forwarded?: boolean;\n /**\n * Original message information if the message was referred\n */\n referred_product?: {\n /**\n * Catalog ID\n */\n catalog_id: string;\n /**\n * Product ID\n */\n product_retailer_id: string;\n };\n };\n\n /**\n * Errors array, if the message had errors\n */\n errors?: Array<{\n /**\n * Error code\n */\n code: number;\n /**\n * Error title\n */\n title: string;\n /**\n * Error message\n */\n message: string;\n /**\n * Error details object\n */\n error_data?: {\n /**\n * Describes the error details\n */\n details: string;\n };\n }>;\n\n /**\n * Button object for button messages\n */\n button?: {\n /**\n * The payload for the button\n */\n payload: string;\n /**\n * Button text\n */\n text: string;\n };\n\n /**\n * The original message data as received from the webhook\n */\n originalData: any;\n}\n\n/**\n * Webhook event received from WhatsApp\n */\nexport interface WebhookEvent {\n /**\n * The field type of the event\n */\n field: string;\n\n /**\n * The event data\n */\n value: any;\n\n /**\n * The timestamp when the event was received\n */\n timestamp: number;\n}\n\n/**\n * Message handler function type\n */\nexport type MessageHandler = (message: WebhookMessage) => void | Promise<void>;\n\n/**\n * Event handler function type\n */\nexport type EventHandler = (event: WebhookEvent) => void | Promise<void>;\n\n/**\n * Message status enum\n */\nexport enum MessageStatus {\n DELIVERED = 'delivered',\n READ = 'read',\n SENT = 'sent',\n}\n\n/**\n * Event field enum for webhook events\n */\nexport enum EventField {\n MESSAGES = 'messages',\n STATUSES = 'statuses',\n MESSAGE_TEMPLATE_STATUS_UPDATE = 'message_template_status_update',\n PHONE_NUMBER_QUALITY_UPDATE = 'phone_number_quality_update',\n PHONE_NUMBER_NAME_UPDATE = 'phone_number_name_update',\n UNKNOWN = 'unknown',\n}\n","import {\n FlowActionEnum,\n FlowDataExchangeRequest,\n FlowEndpointRequest,\n FlowErrorNotificationRequest,\n FlowHealthCheckRequest,\n} from '@features/flow/types';\n\n/**\n * Helper function to check if a value is an object\n * @param value The value to check\n * @returns True if the value is a non-null object\n */\nfunction isObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n\n/**\n * Helper function to check if a value is a string\n * @param value The value to check\n * @returns True if the value is a string\n */\nfunction isString(value: unknown): value is string {\n return typeof value === 'string';\n}\n\n// Array of allowed action types for data exchange requests\nconst DATA_EXCHANGE_ACTIONS = [FlowActionEnum.DATA_EXCHANGE, FlowActionEnum.INIT, FlowActionEnum.BACK] as const;\n\n// Array of allowed action types for error notification requests\nconst ERROR_ACTIONS = [FlowActionEnum.DATA_EXCHANGE, FlowActionEnum.INIT] as const;\n\n/**\n * Type guard to check if a request is a Data Exchange request\n * Validates the request structure according to the Flow API specifications\n *\n * @param request The Flow endpoint request to check\n * @returns True if the request is a valid Data Exchange request, false otherwise\n */\nexport function isFlowDataExchangeRequest(request: FlowEndpointRequest): request is FlowDataExchangeRequest & {\n action: (typeof DATA_EXCHANGE_ACTIONS)[number];\n screen?: string;\n flow_token: string;\n data?: Record<string, any>;\n} {\n // Check for basic required fields\n if (!('flow_token' in request && isString(request.flow_token) && 'action' in request)) {\n return false;\n }\n\n const { action, version, screen, data } = request;\n\n // Validate API version\n const hasValidVersion = version === '3.0';\n\n // Check if the action is one of the allowed actions for data exchange\n const hasValidAction = DATA_EXCHANGE_ACTIONS.includes(action as any);\n\n // Screen is optional, but when present must be a string and not 'SUCCESS'\n const hasValidScreen = typeof screen === 'undefined' || (isString(screen) && screen !== 'SUCCESS');\n\n // Data is required except for DATA_EXCHANGE action\n const hasValidData = action === FlowActionEnum.DATA_EXCHANGE || isObject(data);\n\n // All conditions must be met for a valid data exchange request\n return hasValidVersion && hasValidAction && hasValidScreen && hasValidData;\n}\n\n/**\n * Type guard to check if a request is an Error Notification request\n * Validates the request structure according to the Flow API error specifications\n *\n * @param request The Flow endpoint request to check\n * @returns True if the request is a valid Error Notification request, false otherwise\n */\nexport function isFlowErrorRequest(request: FlowEndpointRequest): request is FlowErrorNotificationRequest & {\n action: (typeof ERROR_ACTIONS)[number];\n screen: string;\n flow_token: string;\n data: {\n error: string;\n error_message: string;\n };\n} {\n // Check for basic required fields\n if (!('flow_token' in request && isString(request.flow_token) && 'action' in request)) {\n return false;\n }\n\n const { action, screen, data } = request;\n\n // Check if the action is one of the allowed actions for error notifications\n const hasValidAction = ERROR_ACTIONS.includes(action as any);\n\n // Screen is required for error notifications\n const hasValidScreen = isString(screen);\n\n // Validate error data structure\n const hasValidData =\n isObject(data) &&\n 'error_key' in data &&\n isString(data.error) &&\n 'error_message' in data &&\n isString(data.error_message);\n\n // All conditions must be met for a valid error notification request\n return hasValidAction && hasValidScreen && hasValidData;\n}\n\n/**\n * Type guard to check if a request is a Ping (health check) request\n * Simple validation for health check endpoints in the Flow API\n *\n * @param request The Flow endpoint request to check\n * @returns True if the request is a Ping request, false otherwise\n */\nexport function isFlowPingRequest(request: FlowEndpointRequest): request is FlowHealthCheckRequest {\n // A ping request only requires the 'action' field with value 'ping'\n return 'action' in request && request.action === 'ping';\n}\n","import { MessageTypesEnum } from '@shared/types';\nimport { WabaConfigType, WhatsAppConfig } from '@shared/types/config';\nimport { IncomingMessage } from 'http';\n\nimport { FlowEndpointRequest } from '@features/flow';\nimport { isFlowDataExchangeRequest, isFlowErrorRequest, isFlowPingRequest } from '@shared/utils/flowTypeGuards';\nimport Logger from '@shared/utils/logger';\nimport crypto from 'crypto';\nimport { WhatsApp } from '../whatsapp';\n\nimport { FlowTypeEnum } from '@features/flow/types';\nimport { importConfig } from '@shared/config/importConfig';\nimport { EventField, WebhookEvent, WebhookMessage } from './types';\nconst LIB_NAME = 'WEBHOOK';\nconst LOG_LOCAL = false;\nconst LOGGER = new Logger(LIB_NAME, process.env.DEBUG === 'true' || LOG_LOCAL);\n\nexport interface IRequest extends IncomingMessage {\n body: any;\n query: Record<string, any>;\n method?: string;\n}\nexport interface IResponse {\n status: (code: number) => IResponse;\n send: (body: any) => IResponse | void;\n json: (body: any) => IResponse | void;\n end: () => void;\n}\n\n/**\n * Webhook handler for WhatsApp Cloud API\n */\nexport default class WebhookHandler {\n private config: WabaConfigType;\n private client: WhatsApp;\n private messageHandlers: Map<\n MessageTypesEnum,\n (whatsapp: WhatsApp, message: WebhookMessage) => void | Promise<void>\n > = new Map();\n private eventHandlers: Map<string, (event: WebhookEvent) => void | Promise<void>> = new Map();\n private preProcessHandler: ((whatsapp: WhatsApp, message: WebhookMessage) => void | Promise<void>) | null = null;\n private postProcessHandler: ((whatsapp: WhatsApp, message: WebhookMessage) => void | Promise<void>) | null = null;\n private flowHandlers: Map<FlowTypeEnum, (whatsapp: WhatsApp, request: FlowEndpointRequest) => any | Promise<any>> =\n new Map();\n\n /**\n * Create a new WebhookHandler\n * @param config The WhatsApp configuration\n */\n constructor(config: WhatsAppConfig) {\n const configuration = importConfig(config);\n this.config = configuration;\n this.client = new WhatsApp(config);\n LOGGER.log('WebhookHandler instantiated!');\n }\n\n /**\n * Handle a GET request for webhook verification\n */\n public handleVerificationRequest<Req extends IRequest, Res extends IResponse>(req: Req, res: Res): void;\n public handleVerificationRequest<Req extends IRequest>(req: Req): string;\n public handleVerificationRequest<Req extends IRequest, Res extends IResponse>(req: Req, res?: Res): void | string {\n const mode = req.query['hub.mode'];\n const token = req.query['hub.verify_token'];\n const challenge = req.query['hub.challenge'];\n\n const VERIFICATION_SUCCESS = mode === 'subscribe' && token === this.config.WEBHOOK_VERIFICATION_TOKEN;\n\n if (VERIFICATION_SUCCESS) {\n LOGGER.log('Webhook verified successfully');\n if (res) {\n res.status(200).send(challenge);\n return;\n } else {\n LOGGER.log('Returning challenge for manual handling');\n return challenge;\n }\n } else {\n LOGGER.log('Webhook verification failed');\n if (res) {\n res.status(403).end();\n return;\n } else {\n LOGGER.log('Verification failed - throwing error for manual handling');\n throw new Error('Webhook verification failed');\n }\n }\n }\n\n /**\n * Handle a POST request for webhook events\n */\n public async handleWebhookRequest<Req extends IRequest, Res extends IResponse>(req: Req, res: Res): Promise<void>;\n public async handleWebhookRequest<Req extends IRequest>(req: Req): Promise<{ success: boolean; errors?: string[] }>;\n public async handleWebhookRequest<Req extends IRequest, Res extends IResponse>(\n req: Req,\n res?: Res,\n ): Promise<void | { success: boolean; errors?: string[] }> {\n const body = req.body;\n const errors: string[] = [];\n\n // Check this is a WhatsApp Business Account webhook\n if (body.object !== 'whatsapp_business_account') {\n const errorMsg = 'Received webhook for non-WhatsApp event';\n LOGGER.log(errorMsg);\n\n if (res) {\n res.status(404).end();\n return;\n } else {\n errors.push(errorMsg);\n return { success: false, errors };\n }\n }\n\n // Process each entry\n for (const entry of body.entry) {\n try {\n const changes = entry.changes;\n for (const change of changes) {\n if (change.field === EventField.MESSAGES) {\n await this.processMessages(change.value);\n } else {\n // Handle other event types\n await this.processEvent(change.field, change.value);\n }\n }\n } catch (error) {\n const errorMsg = `Error processing webhook: ${error}`;\n LOGGER.log(errorMsg);\n errors.push(errorMsg);\n }\n }\n\n if (res) {\n // Always respond with 200 to acknowledge receipt\n res.status(200).end();\n return;\n } else {\n // Return processing result\n return { success: errors.length === 0, errors: errors.length > 0 ? errors : undefined };\n }\n }\n\n /**\n * Handle webhook requests (both verification and events)\n */\n public handleRequest<Req extends IRequest, Res extends IResponse>(req: Req, res: Res): void | Promise<void>;\n public handleRequest<Req extends IRequest>(req: Req): string | Promise<{ success: boolean; errors?: string[] }>;\n public handleRequest<Req extends IRequest, Res extends IResponse>(\n req: Req,\n res?: Res,\n ): void | string | Promise<void | { success: boolean; errors?: string[] }> {\n if (req.method === 'GET') {\n if (res) {\n return this.handleVerificationRequest(req, res);\n } else {\n return this.handleVerificationRequest(req);\n }\n } else if (req.method === 'POST') {\n if (res) {\n return this.handleWebhookRequest(req, res);\n } else {\n return this.handleWebhookRequest(req);\n }\n } else {\n if (res) {\n res.status(405).end(); // Method not allowed\n return;\n } else {\n throw new Error('Method not allowed');\n }\n }\n }\n\n /**\n * Process incoming messages\n */\n private async processMessages(value: any): Promise<void> {\n // Extract metadata\n const metadata = value.metadata;\n const displayPhoneNumber = metadata.display_phone_number;\n const phoneNumberId = metadata.phone_number_id;\n const profileName = value.contacts[0].profile.name;\n const messages = value.messages as WebhookMessage[];\n\n // Process messages if present\n if (messages && messages.length > 0) {\n for (const message of messages) {\n const messageType = message.type;\n\n // Create the base message object\n const processedMessage: WebhookMessage = {\n id: message.id,\n from: message.from,\n timestamp: message.timestamp,\n type: message.type,\n phoneNumberId,\n displayPhoneNumber,\n profileName,\n originalData: message,\n };\n\n // Add type-specific data based on the message type\n switch (message.type) {\n case MessageTypesEnum.Text:\n processedMessage.text = message.text;\n break;\n case MessageTypesEnum.Image:\n processedMessage.image = message.image;\n break;\n case MessageTypesEnum.Video:\n processedMessage.video = message.video;\n break;\n case MessageTypesEnum.Audio:\n processedMessage.audio = message.audio;\n break;\n case MessageTypesEnum.Document:\n processedMessage.document = message.document;\n break;\n case MessageTypesEnum.Sticker:\n processedMessage.sticker = message.sticker;\n break;\n case MessageTypesEnum.Location:\n processedMessage.location = message.location;\n break;\n case MessageTypesEnum.Contacts:\n processedMessage.contacts = message.contacts;\n break;\n case MessageTypesEnum.Interactive:\n processedMessage.interactive = message.interactive;\n break;\n case MessageTypesEnum.Button:\n processedMessage.button = message.button;\n break;\n case MessageTypesEnum.Order:\n processedMessage.order = message.order;\n break;\n case MessageTypesEnum.System:\n processedMessage.system = message.system;\n break;\n default:\n // Unknown message type\n break;\n }\n\n // Add context if available\n if (message.context) {\n processedMessage.context = message.context;\n }\n\n // Add errors if available\n if (message.errors) {\n processedMessage.errors = message.errors;\n }\n\n // 1. Execute pre-processing handler if exists\n if (this.preProcessHandler) {\n try {\n await this.preProcessHandler(this.client, processedMessage);\n } catch (error) {\n LOGGER.log(`Error in pre-process handler: ${error}`);\n }\n }\n\n // 2. Execute type-specific message handler if registered\n const handler = this.messageHandlers.get(messageType);\n if (handler) {\n try {\n await handler(this.client, processedMessage);\n } catch (error) {\n LOGGER.log(`Error in message handler for ${messageType}: ${error}`);\n }\n }\n\n // 3. Execute post-processing handler if exists\n if (this.postProcessHandler) {\n try {\n await this.postProcessHandler(this.client, processedMessage);\n } catch (error) {\n LOGGER.log(`Error in post-process handler: ${error}`);\n }\n }\n }\n }\n }\n\n /**\n * Process other webhook events\n */\n private async processEvent(field: string, value: any): Promise<void> {\n const event: WebhookEvent = {\n field,\n value,\n timestamp: Date.now(),\n };\n\n const handler = this.eventHandlers.get(field);\n if (handler) {\n try {\n await handler(event);\n } catch (error) {\n LOGGER.log(`Error in event handler for ${field}: ${error}`);\n }\n }\n }\n\n /**\n * Register a message handler for a specific message type\n */\n public onMessage(\n type: MessageTypesEnum,\n handler: (whatsapp: WhatsApp, message: WebhookMessage) => void | Promise<void>,\n ): void {\n this.messageHandlers.set(type, handler);\n LOGGER.log(`Registered message handler for ${type}`);\n }\n\n /**\n * Register an event handler for a specific field\n */\n public onEvent(field: string, handler: (event: WebhookEvent) => void | Promise<void>): void {\n this.eventHandlers.set(field, handler);\n LOGGER.log(`Registered event handler for ${field}`);\n }\n\n /**\n * Register a pre-process handler that runs before all message handlers\n */\n public onMessagePreProcess(handler: (whatsapp: WhatsApp, message: WebhookMessage) => void | Promise<void>): void {\n this.preProcessHandler = handler;\n LOGGER.log('Registered pre-process handler');\n }\n\n /**\n * Register a post-process handler that runs after all message handlers\n */\n public onMessagePostProcess(handler: (whatsapp: WhatsApp, message: WebhookMessage) => void | Promise<void>): void {\n this.postProcessHandler = handler;\n LOGGER.log('Registered post-process handler');\n }\n\n public async handleFlowRequest<Req extends IRequest & { rawBody: string }, Res extends IResponse>(\n req: Req,\n res: Res,\n ): Promise<void>;\n public async handleFlowRequest<Req extends IRequest & { rawBody: string }>(\n req: Req,\n ): Promise<{ statusCode: number; body: any; headers?: Record<string, string> }>;\n public async handleFlowRequest<Req extends IRequest & { rawBody: string }, Res extends IResponse>(\n req: Req,\n res?: Res,\n ): Promise<void | { statusCode: number; body: any; headers?: Record<string, string> }> {\n try {\n // Validate request signature\n if (!this.isRequestSignatureValid(req)) {\n const error = { error: 'Unauthorized' };\n LOGGER.log('Invalid request signature');\n\n if (res) {\n res.status(401).json(error);\n return;\n } else {\n return { statusCode: 401, body: error };\n }\n }\n\n const body = JSON.parse(req.rawBody);\n\n // Decrypt the request\n const { decryptedBody } = this.decryptRequest(body);\n\n // Get the flow handler\n const handler = this.flowHandlers.get(FlowTypeEnum.All);\n if (!handler) {\n const error = { error: 'Handler not found' };\n LOGGER.log(`No handler registered for flow action: ${decryptedBody.action}`);\n\n if (res) {\n res.status(404).json(error);\n return;\n } else {\n return { statusCode: 404, body: error };\n }\n }\n\n // Handle different flow types\n if (isFlowPingRequest(decryptedBody)) {\n // For ping requests, just respond with version\n const response = {\n version: '3.0',\n data: {\n status: 'active',\n },\n };\n\n if (res) {\n res.status(200).json(response);\n return;\n } else {\n return { statusCode: 200, body: response };\n }\n }\n\n if (isFlowErrorRequest(decryptedBody)) {\n LOGGER.log(`Flow error: ${JSON.stringify(decryptedBody)}`);\n const response = {};\n\n if (res) {\n res.status(200).json(response);\n return;\n } else {\n return { statusCode: 200, body: response };\n }\n }\n\n if (isFlowDataExchangeRequest(decryptedBody)) {\n // Process data exchange request\n const result = await handler(this.client, decryptedBody);\n\n // Encrypt and send response\n const encryptedResponse = this.encryptResponse(\n result,\n Buffer.from(body.aes_key, 'base64'),\n Buffer.from(body.initial_vector, 'base64'),\n );\n\n if (res) {\n res.status(200).json(encryptedResponse);\n return;\n } else {\n return { statusCode: 200, body: encryptedResponse };\n }\n }\n\n // Unknown flow type\n const error = { error: 'Unknown request type' };\n LOGGER.log(`Unknown flow request type: ${JSON.stringify(decryptedBody)}`);\n\n if (res) {\n res.status(400).json(error);\n return;\n } else {\n return { statusCode: 400, body: error };\n }\n } catch (error) {\n const errorResponse = { error: 'Internal server error' };\n LOGGER.log(`Error handling flow request: ${error}`);\n\n if (res) {\n res.status(500).json(errorResponse);\n return;\n } else {\n return { statusCode: 500, body: errorResponse };\n }\n }\n }\n\n /**\n * Validate the request signature\n */\n public isRequestSignatureValid(req: IRequest & { rawBody: string }): boolean {\n const signature = req.headers['x-hub-signature-256'] as string;\n if (!signature) {\n return false;\n }\n\n const expectedSignature = crypto\n .createHmac('sha256', this.config.WEBHOOK_VERIFICATION_TOKEN || '')\n .update(req.rawBody, 'utf8')\n .digest('hex');\n\n const formattedExpectedSignature = `sha256=${expectedSignature}`;\n\n return crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(formattedExpectedSignature));\n }\n\n /**\n * Decrypt a flow request\n */\n public decryptRequest(body: any): {\n decryptedBody: FlowEndpointRequest;\n aesKeyBuffer: Buffer;\n initialVectorBuffer: Buffer;\n } {\n LOGGER.log('Received body for decryption:', JSON.stringify(body, null, 2));\n\n const { encrypted_aes_key, encrypted_flow_data, initial_vector } = body;\n\n if (!encrypted_aes_key) {\n throw new Error('Missing required property: encrypted_aes_key');\n }\n if (!encrypted_flow_data) {\n throw new Error('Missing required property: encrypted_flow_data');\n }\n if (!initial_vector) {\n throw new Error('Missing required property: initial_vector');\n }\n\n LOGGER.log('Received body for privatePem:', JSON.stringify(this.config.FLOW_API_PRIVATE_PEM, null, 2));\n LOGGER.log('Received body for passphrase:', JSON.stringify(this.config.FLOW_API_PASSPHRASE, null, 2));\n\n const privatePem = this.config.FLOW_API_PRIVATE_PEM.replace(/\\\\n/g, '\\n');\n const passphrase = this.config.FLOW_API_PASSPHRASE;\n\n const privateKey = crypto.createPrivateKey({ key: privatePem, passphrase });\n let decryptedAesKey = null;\n try {\n decryptedAesKey = crypto.privateDecrypt(\n {\n key: privateKey,\n padding: crypto.constants.RSA_PKCS1_OAEP_PADDING,\n oaepHash: 'sha256',\n },\n Buffer.from(encrypted_aes_key, 'base64'),\n );\n } catch (error) {\n LOGGER.error(error);\n /*\n Failed to decrypt. Please verify your private key.\n If you change your public key. You need to return HTTP status code 421 to refresh the public key on the client\n */\n throw new Error('Failed to decrypt the request. Please verify your private key.');\n }\n\n // decrypt flow data\n const flowDataBuffer = Buffer.from(encrypted_flow_data, 'base64');\n const initialVectorBuffer = Buffer.from(initial_vector, 'base64');\n\n const TAG_LENGTH = 16;\n const encrypted_flow_data_body = flowDataBuffer.subarray(0, -TAG_LENGTH);\n const encrypted_flow_data_tag = flowDataBuffer.subarray(-TAG_LENGTH);\n\n const decipher = crypto.createDecipheriv('aes-128-gcm', decryptedAesKey, initialVectorBuffer);\n decipher.setAuthTag(encrypted_flow_data_tag);\n\n const decryptedJSONString = Buffer.concat([\n decipher.update(encrypted_flow_data_body),\n decipher.final(),\n ]).toString('utf-8');\n\n return {\n decryptedBody: JSON.parse(decryptedJSONString),\n aesKeyBuffer: decryptedAesKey,\n initialVectorBuffer,\n };\n }\n\n /**\n * Encrypt a flow response\n */\n private encryptResponse(response: any, aesKeyBuffer: Buffer, initialVectorBuffer: Buffer) {\n const flipped_iv: number[] = [];\n for (const pair of Array.from(initialVectorBuffer.entries())) {\n flipped_iv.push(~pair[1]);\n }\n\n try {\n // encrypt response data\n const cipher = crypto.createCipheriv('aes-128-gcm', aesKeyBuffer, Buffer.from(flipped_iv));\n return Buffer.concat([\n cipher.update(JSON.stringify(response || {}), 'utf-8'),\n cipher.final(),\n cipher.getAuthTag(),\n ]).toString('base64');\n } catch (error) {\n LOGGER.error('Response encryption error:', error);\n throw new Error('Failed to encrypt response. Internal server error.');\n }\n }\n\n /**\n * Register a flow handler for a specific flow type\n */\n public onFlow(\n type: FlowTypeEnum,\n handler: (whatsapp: WhatsApp, request: FlowEndpointRequest) => any | Promise<any>,\n ): void {\n this.flowHandlers.set(type, handler);\n LOGGER.log(`Registered flow handler for ${type}`);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/core/webhook/types.ts","../src/shared/utils/flowTypeGuards.ts","../src/core/webhook/WebhookHandler.ts"],"names":["MessageStatus","EventField","isObject","value","isString","DATA_EXCHANGE_ACTIONS","ERROR_ACTIONS","isFlowDataExchangeRequest","request","action","version","screen","data","hasValidVersion","hasValidAction","hasValidScreen","hasValidData","isFlowErrorRequest","isFlowPingRequest","LIB_NAME","LOG_LOCAL","LOGGER","Logger","WebhookHandler","config","configuration","importConfig","WhatsApp","req","res","mode","token","challenge","body","errors","errorMsg","entry","changes","change","error","metadata","displayPhoneNumber","phoneNumberId","profileName","messages","message","messageType","processedMessage","handler","field","event","type","decryptedBody","response","result","encryptedResponse","errorResponse","signature","formattedExpectedSignature","crypto","encrypted_aes_key","encrypted_flow_data","initial_vector","privatePem","passphrase","privateKey","decryptedAesKey","flowDataBuffer","initialVectorBuffer","TAG_LENGTH","encrypted_flow_data_body","encrypted_flow_data_tag","decipher","decryptedJSONString","aesKeyBuffer","flipped_iv","pair","cipher"],"mappings":"uGAwgBO,IAAKA,CACRA,CAAAA,CAAAA,CAAAA,GAAAA,CAAAA,CAAA,SAAY,CAAA,WAAA,CACZA,EAAA,IAAO,CAAA,MAAA,CACPA,CAAA,CAAA,IAAA,CAAO,OAHCA,CAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA,CASAC,CACRA,CAAAA,CAAAA,CAAAA,GAAAA,CAAAA,CAAA,SAAW,UACXA,CAAAA,CAAAA,CAAA,QAAW,CAAA,UAAA,CACXA,CAAA,CAAA,8BAAA,CAAiC,gCACjCA,CAAAA,CAAAA,CAAA,4BAA8B,6BAC9BA,CAAAA,CAAAA,CAAA,wBAA2B,CAAA,0BAAA,CAC3BA,EAAA,OAAU,CAAA,SAAA,CANFA,CAAA,CAAA,EAAA,CAAA,EAAA,EAAA,ECpgBZ,SAASC,CAASC,CAAAA,CAAAA,CAAkD,CAChE,OAAO,OAAOA,CAAAA,EAAU,QAAYA,EAAAA,CAAAA,GAAU,IAClD,CAOA,SAASC,CAASD,CAAAA,CAAAA,CAAiC,CAC/C,OAAO,OAAOA,CAAU,EAAA,QAC5B,CAGA,IAAME,CAAAA,CAAwB,CAAuE,eAAA,CAAA,MAAA,CAAA,MAAA,CAAA,CAG/FC,EAAgB,CAAkD,eAAA,CAAA,MAAA,CAAA,CASjE,SAASC,CAAAA,CAA0BC,EAKxC,CAEE,GAAI,EAAE,YAAA,GAAgBA,GAAWJ,CAASI,CAAAA,CAAAA,CAAQ,UAAU,CAAA,EAAK,WAAYA,CACzE,CAAA,CAAA,OAAO,MAGX,CAAA,GAAM,CAAE,MAAA,CAAAC,CAAQ,CAAA,OAAA,CAAAC,EAAS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AAA,MAAStC,CAAO,CAAA,CACZ,MAAAlB,CAAAA,CAAO,MAAM,4BAA8BkB,CAAAA,CAAK,CAC1C,CAAA,IAAI,KAAM,CAAA,oDAAoD,CACxE,CACJ,CAKO,MACHY,CAAAA,CAAAA,CACAH,CACI,CAAA,CACJ,KAAK,YAAa,CAAA,GAAA,CAAIG,CAAMH,CAAAA,CAAO,CACnC3B,CAAAA,CAAAA,CAAO,IAAI,CAA+B8B,4BAAAA,EAAAA,CAAI,CAAE,CAAA,EACpD,CACJ","file":"chunk-2QZCD34C.js","sourcesContent":["import { MessageTypesEnum } from '@shared/types/enums';\n\nexport interface WebhookContact {\n /**\n * WhatsApp ID of the contact. Business can respond to this contact using this ID.\n */\n wa_id: string;\n /**\n * Additional unique, alphanumeric identifier for a WhatsApp user\n */\n user_id?: string;\n /**\n * Profile of Whatsapp user\n */\n profile: {\n /**\n * The display name of the contact\n */\n name: string;\n };\n}\n\n/**\n * Represents a message received through the webhook\n * Based on Meta's documentation: https://developers.facebook.com/docs/whatsapp/cloud-api/webhooks/components#messages-object\n */\nexport interface WebhookMessage {\n /**\n * The message ID\n */\n id: string;\n\n /**\n * The sender's phone number\n */\n from: string;\n\n /**\n * The timestamp of the message\n */\n timestamp: string;\n\n /**\n * The type of message (text, image, etc.)\n */\n type: MessageTypesEnum;\n\n /**\n * The phone number ID that received the message\n */\n phoneNumberId: string;\n\n /**\n * The display phone number that received the message\n */\n displayPhoneNumber: string;\n\n /**\n * The profile name of the sender\n */\n profileName: string;\n\n /**\n * Text object for text messages\n */\n text?: {\n /**\n * The text content of the message\n */\n body: string;\n };\n\n /**\n * Image object for image messages\n */\n image?: {\n /**\n * The image caption (if provided)\n */\n caption?: string;\n /**\n * The SHA256 hash of the image\n */\n sha256?: string;\n /**\n * The ID for the image\n */\n id: string;\n /**\n * The MIME type of the image\n */\n mime_type: string;\n };\n\n /**\n * Video object for video messages\n */\n video?: {\n /**\n * The video caption (if provided)\n */\n caption?: string;\n /**\n * The SHA256 hash of the video\n */\n sha256?: string;\n /**\n * The ID for the video\n */\n id: string;\n /**\n * The MIME type of the video\n */\n mime_type: string;\n };\n\n /**\n * Audio object for audio messages\n */\n audio?: {\n /**\n * The ID for the audio file\n */\n id: string;\n /**\n * The MIME type of the audio file\n */\n mime_type: string;\n /**\n * Whether the audio is a voice message\n */\n voice?: boolean;\n };\n\n /**\n * Document object for document messages\n */\n document?: {\n /**\n * The document caption (if provided)\n */\n caption?: string;\n /**\n * The document filename\n */\n filename: string;\n /**\n * The SHA256 hash of the document\n */\n sha256?: string;\n /**\n * The ID for the document\n */\n id: string;\n /**\n * The MIME type of the document\n */\n mime_type: string;\n };\n\n /**\n * Sticker object for sticker messages\n */\n sticker?: {\n /**\n * The ID for the sticker\n */\n id: string;\n /**\n * Whether this is an animated sticker\n */\n animated: boolean;\n /**\n * The MIME type of the sticker\n */\n mime_type: string;\n };\n\n /**\n * Reaction object for reaction messages\n */\n reaction?: {\n /**\n * The ID of the message being reacted to\n */\n message_id: string;\n /**\n * Emoji used for the reaction\n */\n emoji: string;\n };\n\n /**\n * Contacts object for contact messages\n */\n contacts?: Array<{\n /**\n * The contact's name\n */\n name: {\n /**\n * The formatted name\n */\n formatted_name: string;\n /**\n * The first name\n */\n first_name?: string;\n /**\n * The last name\n */\n last_name?: string;\n /**\n * The middle name\n */\n middle_name?: string;\n /**\n * The suffix\n */\n suffix?: string;\n /**\n * The prefix\n */\n prefix?: string;\n };\n /**\n * The contact's phone numbers\n */\n phones?: Array<{\n phone: string;\n type?: string;\n wa_id?: string;\n }>;\n /**\n * The contact's emails\n */\n emails?: Array<{\n email: string;\n type?: string;\n }>;\n /**\n * The contact's addresses\n */\n addresses?: Array<{\n street?: string;\n city?: string;\n state?: string;\n zip?: string;\n country?: string;\n country_code?: string;\n type?: string;\n }>;\n /**\n * The contact's organizations\n */\n org?: {\n company?: string;\n department?: string;\n title?: string;\n };\n /**\n * The contact's URLs\n */\n urls?: Array<{\n url: string;\n type?: string;\n }>;\n /**\n * The contact's birthday (YYYY-MM-DD format)\n */\n birthday?: string;\n }>;\n\n /**\n * Location object for location messages\n */\n location?: {\n /**\n * Latitude of the location\n */\n latitude: number;\n /**\n * Longitude of the location\n */\n longitude: number;\n /**\n * Name of the location\n */\n name?: string;\n /**\n * Address of the location\n */\n address?: string;\n };\n\n /**\n * Interactive object for interactive messages\n */\n interactive?: {\n /**\n * Type of the interactive message\n * Can be: button_reply, list_reply, flow, nfm_reply, etc.\n */\n type: string;\n /**\n * ID for the button that was clicked\n */\n button_reply?: {\n id: string;\n title: string;\n };\n /**\n * ID for the list item that was selected\n */\n list_reply?: {\n id: string;\n title: string;\n description?: string;\n };\n\n /**\n * NFM (No-Code Flow Message) reply data\n */\n nfm_reply?: {\n /**\n * Response data in JSON format\n */\n response_json: string;\n /**\n * Body text of the reply\n */\n body: string;\n /**\n * Name of the flow\n */\n name: string;\n };\n };\n\n /**\n * System object for system messages (like user phone number changes)\n */\n system?: {\n /**\n * The type of system update\n */\n type: string;\n /**\n * User's identity if the update is a customer identity change\n */\n identity?: string;\n /**\n * Old and new phone numbers if the update is a phone number change\n */\n customer?: {\n /**\n * The previous phone number\n */\n previous_wa_id: string;\n /**\n * The new phone number\n */\n wa_id: string;\n };\n };\n\n /**\n * Order object for order messages\n */\n order?: {\n /**\n * Catalog ID\n */\n catalog_id: string;\n /**\n * Product items in the order\n */\n product_items: Array<{\n /**\n * Product ID\n */\n product_retailer_id: string;\n /**\n * Quantity of the product\n */\n quantity: number;\n /**\n * Item price\n */\n item_price: number;\n /**\n * Currency code\n */\n currency: string;\n }>;\n /**\n * Text message included with the order\n */\n text?: string;\n };\n\n /**\n * Context object, included when a user replies or interacts\n */\n context?: {\n /**\n * ID of the message\n */\n id?: string;\n /**\n * ID of the sender\n */\n from?: string;\n /**\n * ID of the message being replied to or interacted with\n */\n message_id: string;\n /**\n * ID of the forwarded message, if applicable\n */\n forwarded?: boolean;\n /**\n * Frequently forwarded status\n */\n frequently_forwarded?: boolean;\n /**\n * Original message information if the message was referred\n */\n referred_product?: {\n /**\n * Catalog ID\n */\n catalog_id: string;\n /**\n * Product ID\n */\n product_retailer_id: string;\n };\n };\n\n /**\n * Errors array, if the message had errors\n */\n errors?: Array<{\n /**\n * Error code\n */\n code: number;\n /**\n * Error title\n */\n title: string;\n /**\n * Error message\n */\n message: string;\n /**\n * Error details object\n */\n error_data?: {\n /**\n * Describes the error details\n */\n details: string;\n };\n }>;\n\n /**\n * Button object for button messages\n */\n button?: {\n /**\n * The payload for the button\n */\n payload: string;\n /**\n * Button text\n */\n text: string;\n };\n\n /**\n * The original message data as received from the webhook\n */\n originalData: any;\n}\n\n/**\n * Webhook event received from WhatsApp\n */\nexport interface WebhookEvent {\n /**\n * The field type of the event\n */\n field: string;\n\n /**\n * The event data\n */\n value: any;\n\n /**\n * The timestamp when the event was received\n */\n timestamp: number;\n}\n\n/**\n * Message handler function type\n */\nexport type MessageHandler = (message: WebhookMessage) => void | Promise<void>;\n\n/**\n * Event handler function type\n */\nexport type EventHandler = (event: WebhookEvent) => void | Promise<void>;\n\n/**\n * Message status enum\n */\nexport enum MessageStatus {\n DELIVERED = 'delivered',\n READ = 'read',\n SENT = 'sent',\n}\n\n/**\n * Event field enum for webhook events\n */\nexport enum EventField {\n MESSAGES = 'messages',\n STATUSES = 'statuses',\n MESSAGE_TEMPLATE_STATUS_UPDATE = 'message_template_status_update',\n PHONE_NUMBER_QUALITY_UPDATE = 'phone_number_quality_update',\n PHONE_NUMBER_NAME_UPDATE = 'phone_number_name_update',\n UNKNOWN = 'unknown',\n}\n","import {\n FlowActionEnum,\n FlowDataExchangeRequest,\n FlowEndpointRequest,\n FlowErrorNotificationRequest,\n FlowHealthCheckRequest,\n} from '@features/flow/types';\n\n/**\n * Helper function to check if a value is an object\n * @param value The value to check\n * @returns True if the value is a non-null object\n */\nfunction isObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n\n/**\n * Helper function to check if a value is a string\n * @param value The value to check\n * @returns True if the value is a string\n */\nfunction isString(value: unknown): value is string {\n return typeof value === 'string';\n}\n\n// Array of allowed action types for data exchange requests\nconst DATA_EXCHANGE_ACTIONS = [FlowActionEnum.DATA_EXCHANGE, FlowActionEnum.INIT, FlowActionEnum.BACK] as const;\n\n// Array of allowed action types for error notification requests\nconst ERROR_ACTIONS = [FlowActionEnum.DATA_EXCHANGE, FlowActionEnum.INIT] as const;\n\n/**\n * Type guard to check if a request is a Data Exchange request\n * Validates the request structure according to the Flow API specifications\n *\n * @param request The Flow endpoint request to check\n * @returns True if the request is a valid Data Exchange request, false otherwise\n */\nexport function isFlowDataExchangeRequest(request: FlowEndpointRequest): request is FlowDataExchangeRequest & {\n action: (typeof DATA_EXCHANGE_ACTIONS)[number];\n screen?: string;\n flow_token: string;\n data?: Record<string, any>;\n} {\n // Check for basic required fields\n if (!('flow_token' in request && isString(request.flow_token) && 'action' in request)) {\n return false;\n }\n\n const { action, version, screen, data } = request;\n\n // Validate API version\n const hasValidVersion = version === '3.0';\n\n // Check if the action is one of the allowed actions for data exchange\n const hasValidAction = DATA_EXCHANGE_ACTIONS.includes(action as any);\n\n // Screen is optional, but when present must be a string and not 'SUCCESS'\n const hasValidScreen = typeof screen === 'undefined' || (isString(screen) && screen !== 'SUCCESS');\n\n // Data is required except for DATA_EXCHANGE action\n const hasValidData = action === FlowActionEnum.DATA_EXCHANGE || isObject(data);\n\n // All conditions must be met for a valid data exchange request\n return hasValidVersion && hasValidAction && hasValidScreen && hasValidData;\n}\n\n/**\n * Type guard to check if a request is an Error Notification request\n * Validates the request structure according to the Flow API error specifications\n *\n * @param request The Flow endpoint request to check\n * @returns True if the request is a valid Error Notification request, false otherwise\n */\nexport function isFlowErrorRequest(request: FlowEndpointRequest): request is FlowErrorNotificationRequest & {\n action: (typeof ERROR_ACTIONS)[number];\n screen: string;\n flow_token: string;\n data: {\n error: string;\n error_message: string;\n };\n} {\n // Check for basic required fields\n if (!('flow_token' in request && isString(request.flow_token) && 'action' in request)) {\n return false;\n }\n\n const { action, screen, data } = request;\n\n // Check if the action is one of the allowed actions for error notifications\n const hasValidAction = ERROR_ACTIONS.includes(action as any);\n\n // Screen is required for error notifications\n const hasValidScreen = isString(screen);\n\n // Validate error data structure\n const hasValidData =\n isObject(data) &&\n 'error_key' in data &&\n isString(data.error) &&\n 'error_message' in data &&\n isString(data.error_message);\n\n // All conditions must be met for a valid error notification request\n return hasValidAction && hasValidScreen && hasValidData;\n}\n\n/**\n * Type guard to check if a request is a Ping (health check) request\n * Simple validation for health check endpoints in the Flow API\n *\n * @param request The Flow endpoint request to check\n * @returns True if the request is a Ping request, false otherwise\n */\nexport function isFlowPingRequest(request: FlowEndpointRequest): request is FlowHealthCheckRequest {\n // A ping request only requires the 'action' field with value 'ping'\n return 'action' in request && request.action === 'ping';\n}\n","import { MessageTypesEnum } from '@shared/types';\nimport { WabaConfigType, WhatsAppConfig } from '@shared/types/config';\nimport { IncomingMessage } from 'http';\n\nimport { FlowEndpointRequest } from '@features/flow';\nimport { isFlowDataExchangeRequest, isFlowErrorRequest, isFlowPingRequest } from '@shared/utils/flowTypeGuards';\nimport Logger from '@shared/utils/logger';\nimport crypto from 'crypto';\nimport { WhatsApp } from '../whatsapp';\n\nimport { FlowTypeEnum } from '@features/flow/types';\nimport { importConfig } from '@shared/config/importConfig';\nimport { EventField, WebhookEvent, WebhookMessage } from './types';\nconst LIB_NAME = 'WEBHOOK';\nconst LOG_LOCAL = false;\nconst LOGGER = new Logger(LIB_NAME, process.env.DEBUG === 'true' || LOG_LOCAL);\n\nexport interface IRequest extends IncomingMessage {\n body: any;\n query: Record<string, any>;\n method?: string;\n}\nexport interface IResponse {\n status: (code: number) => IResponse;\n send: (body: any) => IResponse | void;\n json: (body: any) => IResponse | void;\n end: () => void;\n}\n\n/**\n * Webhook handler for WhatsApp Cloud API\n */\nexport default class WebhookHandler {\n private config: WabaConfigType;\n private client: WhatsApp;\n private messageHandlers: Map<\n MessageTypesEnum,\n (whatsapp: WhatsApp, message: WebhookMessage) => void | Promise<void>\n > = new Map();\n private eventHandlers: Map<string, (event: WebhookEvent) => void | Promise<void>> = new Map();\n private preProcessHandler: ((whatsapp: WhatsApp, message: WebhookMessage) => void | Promise<void>) | null = null;\n private postProcessHandler: ((whatsapp: WhatsApp, message: WebhookMessage) => void | Promise<void>) | null = null;\n private flowHandlers: Map<FlowTypeEnum, (whatsapp: WhatsApp, request: FlowEndpointRequest) => any | Promise<any>> =\n new Map();\n\n /**\n * Create a new WebhookHandler\n * @param config The WhatsApp configuration\n */\n constructor(config: WhatsAppConfig) {\n const configuration = importConfig(config);\n this.config = configuration;\n this.client = new WhatsApp(config);\n LOGGER.log('WebhookHandler instantiated!');\n }\n\n /**\n * Handle a GET request for webhook verification\n */\n public handleVerificationRequest<Req extends IRequest, Res extends IResponse>(req: Req, res: Res): void;\n public handleVerificationRequest<Req extends IRequest>(req: Req): string;\n public handleVerificationRequest<Req extends IRequest, Res extends IResponse>(req: Req, res?: Res): void | string {\n const mode = req.query['hub.mode'];\n const token = req.query['hub.verify_token'];\n const challenge = req.query['hub.challenge'];\n\n const VERIFICATION_SUCCESS = mode === 'subscribe' && token === this.config.WEBHOOK_VERIFICATION_TOKEN;\n\n if (VERIFICATION_SUCCESS) {\n LOGGER.log('Webhook verified successfully');\n if (res) {\n res.status(200).send(challenge);\n return;\n } else {\n LOGGER.log('Returning challenge for manual handling');\n return challenge;\n }\n } else {\n LOGGER.log('Webhook verification failed');\n if (res) {\n res.status(403).end();\n return;\n } else {\n LOGGER.log('Verification failed - throwing error for manual handling');\n throw new Error('Webhook verification failed');\n }\n }\n }\n\n /**\n * Handle a POST request for webhook events\n */\n public async handleWebhookRequest<Req extends IRequest, Res extends IResponse>(req: Req, res: Res): Promise<void>;\n public async handleWebhookRequest<Req extends IRequest>(req: Req): Promise<{ success: boolean; errors?: string[] }>;\n public async handleWebhookRequest<Req extends IRequest, Res extends IResponse>(\n req: Req,\n res?: Res,\n ): Promise<void | { success: boolean; errors?: string[] }> {\n const body = req.body;\n const errors: string[] = [];\n\n // Check this is a WhatsApp Business Account webhook\n if (body.object !== 'whatsapp_business_account') {\n const errorMsg = 'Received webhook for non-WhatsApp event';\n LOGGER.log(errorMsg);\n\n if (res) {\n res.status(404).end();\n return;\n } else {\n errors.push(errorMsg);\n return { success: false, errors };\n }\n }\n\n // Process each entry\n for (const entry of body.entry) {\n try {\n const changes = entry.changes;\n for (const change of changes) {\n if (change.field === EventField.MESSAGES) {\n await this.processMessages(change.value);\n } else {\n // Handle other event types\n await this.processEvent(change.field, change.value);\n }\n }\n } catch (error) {\n const errorMsg = `Error processing webhook: ${error}`;\n LOGGER.log(errorMsg);\n errors.push(errorMsg);\n }\n }\n\n if (res) {\n // Always respond with 200 to acknowledge receipt\n res.status(200).end();\n return;\n } else {\n // Return processing result\n return { success: errors.length === 0, errors: errors.length > 0 ? errors : undefined };\n }\n }\n\n /**\n * Handle webhook requests (both verification and events)\n */\n public handleRequest<Req extends IRequest, Res extends IResponse>(req: Req, res: Res): void | Promise<void>;\n public handleRequest<Req extends IRequest>(req: Req): string | Promise<{ success: boolean; errors?: string[] }>;\n public handleRequest<Req extends IRequest, Res extends IResponse>(\n req: Req,\n res?: Res,\n ): void | string | Promise<void | { success: boolean; errors?: string[] }> {\n if (req.method === 'GET') {\n if (res) {\n return this.handleVerificationRequest(req, res);\n } else {\n return this.handleVerificationRequest(req);\n }\n } else if (req.method === 'POST') {\n if (res) {\n return this.handleWebhookRequest(req, res);\n } else {\n return this.handleWebhookRequest(req);\n }\n } else {\n if (res) {\n res.status(405).end(); // Method not allowed\n return;\n } else {\n throw new Error('Method not allowed');\n }\n }\n }\n\n /**\n * Process incoming messages\n */\n private async processMessages(value: any): Promise<void> {\n // Extract metadata\n const metadata = value.metadata;\n const displayPhoneNumber = metadata.display_phone_number;\n const phoneNumberId = metadata.phone_number_id;\n const profileName = value.contacts[0].profile.name;\n const messages = value.messages as WebhookMessage[];\n\n // Process messages if present\n if (messages && messages.length > 0) {\n for (const message of messages) {\n const messageType = message.type;\n\n // Create the base message object\n const processedMessage: WebhookMessage = {\n id: message.id,\n from: message.from,\n timestamp: message.timestamp,\n type: message.type,\n phoneNumberId,\n displayPhoneNumber,\n profileName,\n originalData: message,\n };\n\n // Add type-specific data based on the message type\n switch (message.type) {\n case MessageTypesEnum.Text:\n processedMessage.text = message.text;\n break;\n case MessageTypesEnum.Image:\n processedMessage.image = message.image;\n break;\n case MessageTypesEnum.Video:\n processedMessage.video = message.video;\n break;\n case MessageTypesEnum.Audio:\n processedMessage.audio = message.audio;\n break;\n case MessageTypesEnum.Document:\n processedMessage.document = message.document;\n break;\n case MessageTypesEnum.Sticker:\n processedMessage.sticker = message.sticker;\n break;\n case MessageTypesEnum.Location:\n processedMessage.location = message.location;\n break;\n case MessageTypesEnum.Contacts:\n processedMessage.contacts = message.contacts;\n break;\n case MessageTypesEnum.Interactive:\n processedMessage.interactive = message.interactive;\n break;\n case MessageTypesEnum.Button:\n processedMessage.button = message.button;\n break;\n case MessageTypesEnum.Order:\n processedMessage.order = message.order;\n break;\n case MessageTypesEnum.System:\n processedMessage.system = message.system;\n break;\n default:\n // Unknown message type\n break;\n }\n\n // Add context if available\n if (message.context) {\n processedMessage.context = message.context;\n }\n\n // Add errors if available\n if (message.errors) {\n processedMessage.errors = message.errors;\n }\n\n // 1. Execute pre-processing handler if exists\n if (this.preProcessHandler) {\n try {\n await this.preProcessHandler(this.client, processedMessage);\n } catch (error) {\n LOGGER.log(`Error in pre-process handler: ${error}`);\n }\n }\n\n // 2. Execute type-specific message handler if registered\n const handler = this.messageHandlers.get(messageType);\n if (handler) {\n try {\n await handler(this.client, processedMessage);\n } catch (error) {\n LOGGER.log(`Error in message handler for ${messageType}: ${error}`);\n }\n }\n\n // 3. Execute post-processing handler if exists\n if (this.postProcessHandler) {\n try {\n await this.postProcessHandler(this.client, processedMessage);\n } catch (error) {\n LOGGER.log(`Error in post-process handler: ${error}`);\n }\n }\n }\n }\n }\n\n /**\n * Process other webhook events\n */\n private async processEvent(field: string, value: any): Promise<void> {\n const event: WebhookEvent = {\n field,\n value,\n timestamp: Date.now(),\n };\n\n const handler = this.eventHandlers.get(field);\n if (handler) {\n try {\n await handler(event);\n } catch (error) {\n LOGGER.log(`Error in event handler for ${field}: ${error}`);\n }\n }\n }\n\n /**\n * Register a message handler for a specific message type\n */\n public onMessage(\n type: MessageTypesEnum,\n handler: (whatsapp: WhatsApp, message: WebhookMessage) => void | Promise<void>,\n ): void {\n this.messageHandlers.set(type, handler);\n LOGGER.log(`Registered message handler for ${type}`);\n }\n\n /**\n * Register an event handler for a specific field\n */\n public onEvent(field: string, handler: (event: WebhookEvent) => void | Promise<void>): void {\n this.eventHandlers.set(field, handler);\n LOGGER.log(`Registered event handler for ${field}`);\n }\n\n /**\n * Register a pre-process handler that runs before all message handlers\n */\n public onMessagePreProcess(handler: (whatsapp: WhatsApp, message: WebhookMessage) => void | Promise<void>): void {\n this.preProcessHandler = handler;\n LOGGER.log('Registered pre-process handler');\n }\n\n /**\n * Register a post-process handler that runs after all message handlers\n */\n public onMessagePostProcess(handler: (whatsapp: WhatsApp, message: WebhookMessage) => void | Promise<void>): void {\n this.postProcessHandler = handler;\n LOGGER.log('Registered post-process handler');\n }\n\n public async handleFlowRequest<Req extends IRequest & { rawBody: string }, Res extends IResponse>(\n req: Req,\n res: Res,\n ): Promise<void>;\n public async handleFlowRequest<Req extends IRequest & { rawBody: string }>(\n req: Req,\n ): Promise<{ statusCode: number; body: any; headers?: Record<string, string> }>;\n public async handleFlowRequest<Req extends IRequest & { rawBody: string }, Res extends IResponse>(\n req: Req,\n res?: Res,\n ): Promise<void | { statusCode: number; body: any; headers?: Record<string, string> }> {\n try {\n // Validate request signature\n if (!this.isRequestSignatureValid(req)) {\n const error = { error: 'Unauthorized' };\n LOGGER.log('Invalid request signature');\n\n if (res) {\n res.status(401).json(error);\n return;\n } else {\n return { statusCode: 401, body: error };\n }\n }\n\n const body = JSON.parse(req.rawBody);\n\n // Decrypt the request\n const { decryptedBody } = this.decryptRequest(body);\n\n // Get the flow handler\n const handler = this.flowHandlers.get(FlowTypeEnum.All);\n if (!handler) {\n const error = { error: 'Handler not found' };\n LOGGER.log(`No handler registered for flow action: ${decryptedBody.action}`);\n\n if (res) {\n res.status(404).json(error);\n return;\n } else {\n return { statusCode: 404, body: error };\n }\n }\n\n // Handle different flow types\n if (isFlowPingRequest(decryptedBody)) {\n // For ping requests, just respond with version\n const response = {\n version: '3.0',\n data: {\n status: 'active',\n },\n };\n\n if (res) {\n res.status(200).json(response);\n return;\n } else {\n return { statusCode: 200, body: response };\n }\n }\n\n if (isFlowErrorRequest(decryptedBody)) {\n LOGGER.log(`Flow error: ${JSON.stringify(decryptedBody)}`);\n const response = {};\n\n if (res) {\n res.status(200).json(response);\n return;\n } else {\n return { statusCode: 200, body: response };\n }\n }\n\n if (isFlowDataExchangeRequest(decryptedBody)) {\n // Process data exchange request\n const result = await handler(this.client, decryptedBody);\n\n // Encrypt and send response\n const encryptedResponse = this.encryptResponse(\n result,\n Buffer.from(body.aes_key, 'base64'),\n Buffer.from(body.initial_vector, 'base64'),\n );\n\n if (res) {\n res.status(200).json(encryptedResponse);\n return;\n } else {\n return { statusCode: 200, body: encryptedResponse };\n }\n }\n\n // Unknown flow type\n const error = { error: 'Unknown request type' };\n LOGGER.log(`Unknown flow request type: ${JSON.stringify(decryptedBody)}`);\n\n if (res) {\n res.status(400).json(error);\n return;\n } else {\n return { statusCode: 400, body: error };\n }\n } catch (error) {\n const errorResponse = { error: 'Internal server error' };\n LOGGER.log(`Error handling flow request: ${error}`);\n\n if (res) {\n res.status(500).json(errorResponse);\n return;\n } else {\n return { statusCode: 500, body: errorResponse };\n }\n }\n }\n\n /**\n * Validate the request signature\n */\n public isRequestSignatureValid(req: IRequest & { rawBody: string }): boolean {\n const signature = req.headers['x-hub-signature-256'] as string;\n if (!signature) {\n return false;\n }\n\n const expectedSignature = crypto\n .createHmac('sha256', this.config.WEBHOOK_VERIFICATION_TOKEN || '')\n .update(req.rawBody, 'utf8')\n .digest('hex');\n\n const formattedExpectedSignature = `sha256=${expectedSignature}`;\n\n return crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(formattedExpectedSignature));\n }\n\n /**\n * Decrypt a flow request\n */\n public decryptRequest(body: any): {\n decryptedBody: FlowEndpointRequest;\n aesKeyBuffer: Buffer;\n initialVectorBuffer: Buffer;\n } {\n LOGGER.log('Received body for decryption:', JSON.stringify(body, null, 2));\n\n const { encrypted_aes_key, encrypted_flow_data, initial_vector } = body;\n\n if (!encrypted_aes_key) {\n throw new Error('Missing required property: encrypted_aes_key');\n }\n if (!encrypted_flow_data) {\n throw new Error('Missing required property: encrypted_flow_data');\n }\n if (!initial_vector) {\n throw new Error('Missing required property: initial_vector');\n }\n\n LOGGER.log('Received body for privatePem:', JSON.stringify(this.config.FLOW_API_PRIVATE_PEM, null, 2));\n LOGGER.log('Received body for passphrase:', JSON.stringify(this.config.FLOW_API_PASSPHRASE, null, 2));\n\n const privatePem = this.config.FLOW_API_PRIVATE_PEM.replace(/\\\\n/g, '\\n');\n const passphrase = this.config.FLOW_API_PASSPHRASE;\n\n const privateKey = crypto.createPrivateKey({ key: privatePem, passphrase });\n let decryptedAesKey = null;\n try {\n decryptedAesKey = crypto.privateDecrypt(\n {\n key: privateKey,\n padding: crypto.constants.RSA_PKCS1_OAEP_PADDING,\n oaepHash: 'sha256',\n },\n Buffer.from(encrypted_aes_key, 'base64'),\n );\n } catch (error) {\n LOGGER.error(error);\n /*\n Failed to decrypt. Please verify your private key.\n If you change your public key. You need to return HTTP status code 421 to refresh the public key on the client\n */\n throw new Error('Failed to decrypt the request. Please verify your private key.');\n }\n\n // decrypt flow data\n const flowDataBuffer = Buffer.from(encrypted_flow_data, 'base64');\n const initialVectorBuffer = Buffer.from(initial_vector, 'base64');\n\n const TAG_LENGTH = 16;\n const encrypted_flow_data_body = flowDataBuffer.subarray(0, -TAG_LENGTH);\n const encrypted_flow_data_tag = flowDataBuffer.subarray(-TAG_LENGTH);\n\n const decipher = crypto.createDecipheriv('aes-128-gcm', decryptedAesKey, initialVectorBuffer);\n decipher.setAuthTag(encrypted_flow_data_tag);\n\n const decryptedJSONString = Buffer.concat([\n decipher.update(encrypted_flow_data_body),\n decipher.final(),\n ]).toString('utf-8');\n\n return {\n decryptedBody: JSON.parse(decryptedJSONString),\n aesKeyBuffer: decryptedAesKey,\n initialVectorBuffer,\n };\n }\n\n /**\n * Encrypt a flow response\n */\n private encryptResponse(response: any, aesKeyBuffer: Buffer, initialVectorBuffer: Buffer) {\n const flipped_iv: number[] = [];\n for (const pair of Array.from(initialVectorBuffer.entries())) {\n flipped_iv.push(~pair[1]);\n }\n\n try {\n // encrypt response data\n const cipher = crypto.createCipheriv('aes-128-gcm', aesKeyBuffer, Buffer.from(flipped_iv));\n return Buffer.concat([\n cipher.update(JSON.stringify(response || {}), 'utf-8'),\n cipher.final(),\n cipher.getAuthTag(),\n ]).toString('base64');\n } catch (error) {\n LOGGER.error('Response encryption error:', error);\n throw new Error('Failed to encrypt response. Internal server error.');\n }\n }\n\n /**\n * Register a flow handler for a specific flow type\n */\n public onFlow(\n type: FlowTypeEnum,\n handler: (whatsapp: WhatsApp, request: FlowEndpointRequest) => any | Promise<any>,\n ): void {\n this.flowHandlers.set(type, handler);\n LOGGER.log(`Registered flow handler for ${type}`);\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-W2U7MN7M.js"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { M as MessageTypesEnum } from '../../enums-
|
|
1
|
+
import { M as MessageTypesEnum } from '../../enums-CI7vzKhn.js';
|
|
2
2
|
import { WhatsAppConfig } from '../../shared/types/config.js';
|
|
3
3
|
import { IncomingMessage } from 'http';
|
|
4
|
-
import {
|
|
4
|
+
import { c as FlowEndpointRequest, m as FlowTypeEnum } from '../../FlowApi-BhpWbli2.js';
|
|
5
5
|
import { WhatsApp } from '../whatsapp/index.js';
|
|
6
|
-
import '../../base
|
|
7
|
-
import '../../MessageApi-
|
|
8
|
-
import '../../MediaApi-
|
|
9
|
-
import '../../BusinessProfileApi-
|
|
10
|
-
import '../../EncryptionApi-
|
|
11
|
-
import '../../PhoneNumberApi-
|
|
12
|
-
import '../../RegistrationApi-
|
|
13
|
-
import '../../TemplateApi-
|
|
14
|
-
import '../../QrCodeApi-
|
|
15
|
-
import '../../TwoStepVerificationApi-
|
|
16
|
-
import '../../WabaApi-
|
|
6
|
+
import '../../base--LmzWHx3.js';
|
|
7
|
+
import '../../MessageApi-Cr3Q6qg4.js';
|
|
8
|
+
import '../../MediaApi-DM3WohTN.js';
|
|
9
|
+
import '../../BusinessProfileApi-CNU7GpJK.js';
|
|
10
|
+
import '../../EncryptionApi-r6_0rWwx.js';
|
|
11
|
+
import '../../PhoneNumberApi-Dc2KKn0M.js';
|
|
12
|
+
import '../../RegistrationApi-CYrP_F0R.js';
|
|
13
|
+
import '../../TemplateApi-Bjc2IfNX.js';
|
|
14
|
+
import '../../QrCodeApi-z9XTnlcP.js';
|
|
15
|
+
import '../../TwoStepVerificationApi-nJ12648J.js';
|
|
16
|
+
import '../../WabaApi-BIP6G4pB.js';
|
|
17
17
|
import 'https';
|
|
18
18
|
|
|
19
19
|
interface WebhookContact {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{b as EventField,a as MessageStatus,c as WebhookHandler}from'../../chunk-
|
|
1
|
+
export{b as EventField,a as MessageStatus,c as WebhookHandler}from'../../chunk-2QZCD34C.js';import'../../chunk-BSNA6RYF.js';import'../../chunk-3MO3BTBC.js';import'../../chunk-R36L2XYO.js';import'../../chunk-GT3XQN7Y.js';import'../../chunk-O2OTHNWM.js';import'../../chunk-7NQLQPLH.js';import'../../chunk-UQPD6GIF.js';import'../../chunk-5JGM556C.js';import'../../chunk-2NJVBJUN.js';import'../../chunk-XPPDOFBN.js';import'../../chunk-KFPOVYEJ.js';import'../../chunk-7GL74SXM.js';import'../../chunk-A264MT4Q.js';import'../../chunk-GIQLIMOD.js';import'../../chunk-BZ5QDXNR.js';import'../../chunk-VW3LGHTJ.js';import'../../chunk-EYGUX4EA.js';import'../../chunk-4C666HHU.js';//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { M as MessagesApi } from '../../MessageApi-
|
|
1
|
+
import { M as MessagesApi } from '../../MessageApi-Cr3Q6qg4.js';
|
|
2
2
|
import { WhatsAppConfig, WabaConfigType } from '../../shared/types/config.js';
|
|
3
|
-
import {
|
|
4
|
-
import { B as BusinessProfileApi } from '../../BusinessProfileApi-
|
|
5
|
-
import { E as EncryptionApi } from '../../EncryptionApi-
|
|
6
|
-
import { F as FlowApi } from '../../FlowApi-
|
|
7
|
-
import { P as PhoneNumberApi } from '../../PhoneNumberApi-
|
|
8
|
-
import { R as RegistrationApi } from '../../RegistrationApi-
|
|
9
|
-
import { T as TemplateApi } from '../../TemplateApi-
|
|
10
|
-
import { Q as QrCodeApi } from '../../QrCodeApi-
|
|
11
|
-
import { T as TwoStepVerificationApi } from '../../TwoStepVerificationApi-
|
|
12
|
-
import { W as WabaApi } from '../../WabaApi-
|
|
13
|
-
import { H as HttpMethodsEnum,
|
|
3
|
+
import { c as MediaApi } from '../../MediaApi-DM3WohTN.js';
|
|
4
|
+
import { B as BusinessProfileApi } from '../../BusinessProfileApi-CNU7GpJK.js';
|
|
5
|
+
import { E as EncryptionApi } from '../../EncryptionApi-r6_0rWwx.js';
|
|
6
|
+
import { F as FlowApi } from '../../FlowApi-BhpWbli2.js';
|
|
7
|
+
import { P as PhoneNumberApi } from '../../PhoneNumberApi-Dc2KKn0M.js';
|
|
8
|
+
import { R as RegistrationApi } from '../../RegistrationApi-CYrP_F0R.js';
|
|
9
|
+
import { T as TemplateApi } from '../../TemplateApi-Bjc2IfNX.js';
|
|
10
|
+
import { Q as QrCodeApi } from '../../QrCodeApi-z9XTnlcP.js';
|
|
11
|
+
import { T as TwoStepVerificationApi } from '../../TwoStepVerificationApi-nJ12648J.js';
|
|
12
|
+
import { W as WabaApi } from '../../WabaApi-BIP6G4pB.js';
|
|
13
|
+
import { H as HttpMethodsEnum, l as SDKEnums } from '../../enums-CI7vzKhn.js';
|
|
14
|
+
import { a as RequesterClass } from '../../base--LmzWHx3.js';
|
|
14
15
|
import { Agent } from 'https';
|
|
15
|
-
import { a as RequesterClass } from '../../base-B4QLc9vb.js';
|
|
16
16
|
|
|
17
17
|
type ResponseHeaderValue = string | string[] | undefined;
|
|
18
18
|
type ResponseHeaders = Record<string, ResponseHeaderValue>;
|
|
@@ -684,4 +684,4 @@ declare namespace SDKEnums {
|
|
|
684
684
|
export { SDKEnums_AudioMediaTypesEnum as AudioMediaTypesEnum, SDKEnums_BusinessVerticalEnum as BusinessVerticalEnum, SDKEnums_ButtonPositionEnum as ButtonPositionEnum, SDKEnums_ButtonTypesEnum as ButtonTypesEnum, SDKEnums_CategoryEnum as CategoryEnum, SDKEnums_ComponentTypesEnum as ComponentTypesEnum, SDKEnums_ConversationTypesEnum as ConversationTypesEnum, SDKEnums_CurrencyCodesEnum as CurrencyCodesEnum, SDKEnums_DataLocalizationRegionEnum as DataLocalizationRegionEnum, SDKEnums_DocumentMediaTypesEnum as DocumentMediaTypesEnum, SDKEnums_HttpMethodsEnum as HttpMethodsEnum, SDKEnums_ImageMediaTypesEnum as ImageMediaTypesEnum, SDKEnums_InteractiveTypesEnum as InteractiveTypesEnum, SDKEnums_LanguagesEnum as LanguagesEnum, SDKEnums_MessageTypesEnum as MessageTypesEnum, SDKEnums_ParametersTypesEnum as ParametersTypesEnum, SDKEnums_ReferralSourceTypesEnum as ReferralSourceTypesEnum, SDKEnums_RequestCodeMethodsEnum as RequestCodeMethodsEnum, SDKEnums_StatusEnum as StatusEnum, SDKEnums_StickerMediaTypesEnum as StickerMediaTypesEnum, SDKEnums_SystemChangeTypesEnum as SystemChangeTypesEnum, SDKEnums_TemplateStatusEnum as TemplateStatusEnum, SDKEnums_VideoMediaTypesEnum as VideoMediaTypesEnum, SDKEnums_WabaConfigEnum as WabaConfigEnum, SDKEnums_WebhookTypesEnum as WebhookTypesEnum };
|
|
685
685
|
}
|
|
686
686
|
|
|
687
|
-
export { AudioMediaTypesEnum as A,
|
|
687
|
+
export { AudioMediaTypesEnum as A, ButtonTypesEnum as B, CategoryEnum as C, DocumentMediaTypesEnum as D, HttpMethodsEnum as H, InteractiveTypesEnum as I, LanguagesEnum as L, MessageTypesEnum as M, ParametersTypesEnum as P, ReferralSourceTypesEnum as R, StatusEnum as S, TemplateStatusEnum as T, VideoMediaTypesEnum as V, WabaConfigEnum as W, ButtonPositionEnum as a, ComponentTypesEnum as b, ConversationTypesEnum as c, StickerMediaTypesEnum as d, ImageMediaTypesEnum as e, WebhookTypesEnum as f, SystemChangeTypesEnum as g, RequestCodeMethodsEnum as h, CurrencyCodesEnum as i, DataLocalizationRegionEnum as j, BusinessVerticalEnum as k, SDKEnums as l };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { E as EncryptionApi } from '../../EncryptionApi-
|
|
2
|
-
export { a as EncryptionClass, b as EncryptionPublicKeyResponse } from '../../EncryptionApi-
|
|
3
|
-
import '../../base
|
|
1
|
+
import { E as EncryptionApi } from '../../EncryptionApi-r6_0rWwx.js';
|
|
2
|
+
export { a as EncryptionClass, b as EncryptionPublicKeyResponse } from '../../EncryptionApi-r6_0rWwx.js';
|
|
3
|
+
import '../../base--LmzWHx3.js';
|
|
4
4
|
import '../../shared/types/config.js';
|
|
5
|
-
import '../../enums-
|
|
5
|
+
import '../../enums-CI7vzKhn.js';
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { F as FlowApi } from '../../FlowApi-
|
|
2
|
-
export { C as CreateFlowResponse, a as Flow,
|
|
3
|
-
import '../../base
|
|
1
|
+
import { F as FlowApi } from '../../FlowApi-BhpWbli2.js';
|
|
2
|
+
export { C as CreateFlowResponse, a as Flow, e as FlowActionEnum, f as FlowAssetsResponse, g as FlowCategoryEnum, b as FlowClass, c as FlowEndpointRequest, d as FlowEndpointResponse, h as FlowMigrationResponse, i as FlowPreviewResponse, k as FlowStatusEnum, l as FlowValidationError, j as FlowsListResponse, U as UpdateFlowResponse, V as ValidateFlowJsonResponse } from '../../FlowApi-BhpWbli2.js';
|
|
3
|
+
import '../../base--LmzWHx3.js';
|
|
4
4
|
import '../../shared/types/config.js';
|
|
5
|
-
import '../../enums-
|
|
5
|
+
import '../../enums-CI7vzKhn.js';
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
import '../../base
|
|
1
|
+
import { c as MediaApi } from '../../MediaApi-DM3WohTN.js';
|
|
2
|
+
export { M as MediaClass, a as MediaResponse, b as MediasResponse, U as UploadMediaResponse } from '../../MediaApi-DM3WohTN.js';
|
|
3
|
+
import '../../base--LmzWHx3.js';
|
|
4
4
|
import '../../shared/types/config.js';
|
|
5
|
-
import '../../enums-
|
|
5
|
+
import '../../enums-CI7vzKhn.js';
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { M as MessagesApi } from '../../MessageApi-
|
|
2
|
-
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, c as MessagesResponse, R as ReactionParams, S as StatusParams, e as StickerMediaObject, T as TextMessageParams, f as TextObject, V as VideoMediaObject } from '../../MessageApi-
|
|
3
|
-
import '../../base
|
|
1
|
+
import { M as MessagesApi } from '../../MessageApi-Cr3Q6qg4.js';
|
|
2
|
+
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, c as MessagesResponse, R as ReactionParams, S as StatusParams, e as StickerMediaObject, T as TextMessageParams, f as TextObject, V as VideoMediaObject } from '../../MessageApi-Cr3Q6qg4.js';
|
|
3
|
+
import '../../base--LmzWHx3.js';
|
|
4
4
|
import '../../shared/types/config.js';
|
|
5
|
-
import '../../enums-
|
|
5
|
+
import '../../enums-CI7vzKhn.js';
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { P as PhoneNumberApi } from '../../PhoneNumberApi-
|
|
2
|
-
export { A as AccountMode, C as CodeVerificationStatus,
|
|
3
|
-
import '../../base
|
|
1
|
+
import { P as PhoneNumberApi } from '../../PhoneNumberApi-Dc2KKn0M.js';
|
|
2
|
+
export { A as AccountMode, C as CodeVerificationStatus, c as Cursors, H as HealthStatus, d as HealthStatusEntity, M as MessagingLimitTier, a as PhoneNumberClass, b 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-Dc2KKn0M.js';
|
|
3
|
+
import '../../base--LmzWHx3.js';
|
|
4
4
|
import '../../shared/types/config.js';
|
|
5
|
-
import '../../enums-
|
|
5
|
+
import '../../enums-CI7vzKhn.js';
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { B as BusinessProfileApi } from '../../BusinessProfileApi-
|
|
2
|
-
export { a as BusinessProfileClass,
|
|
3
|
-
import '../../base
|
|
1
|
+
import { B as BusinessProfileApi } from '../../BusinessProfileApi-CNU7GpJK.js';
|
|
2
|
+
export { a as BusinessProfileClass, c as BusinessProfileData, d as BusinessProfileField, e as BusinessProfileFieldsParam, b 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-CNU7GpJK.js';
|
|
3
|
+
import '../../base--LmzWHx3.js';
|
|
4
4
|
import '../../shared/types/config.js';
|
|
5
|
-
import '../../enums-
|
|
5
|
+
import '../../enums-CI7vzKhn.js';
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Q as QrCodeApi } from '../../QrCodeApi-
|
|
2
|
-
export { C as CreateQrCodeRequest, a as QrCodeClass, b as QrCodeResponse, c as QrCodesResponse, U as UpdateQrCodeRequest } from '../../QrCodeApi-
|
|
3
|
-
import '../../base
|
|
1
|
+
import { Q as QrCodeApi } from '../../QrCodeApi-z9XTnlcP.js';
|
|
2
|
+
export { C as CreateQrCodeRequest, a as QrCodeClass, b as QrCodeResponse, c as QrCodesResponse, U as UpdateQrCodeRequest } from '../../QrCodeApi-z9XTnlcP.js';
|
|
3
|
+
import '../../base--LmzWHx3.js';
|
|
4
4
|
import '../../shared/types/config.js';
|
|
5
|
-
import '../../enums-
|
|
5
|
+
import '../../enums-CI7vzKhn.js';
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { R as RegistrationApi } from '../../RegistrationApi-
|
|
2
|
-
export { a as RegistrationClass, b as RegistrationRequest } from '../../RegistrationApi-
|
|
3
|
-
import '../../base
|
|
1
|
+
import { R as RegistrationApi } from '../../RegistrationApi-CYrP_F0R.js';
|
|
2
|
+
export { a as RegistrationClass, b as RegistrationRequest } from '../../RegistrationApi-CYrP_F0R.js';
|
|
3
|
+
import '../../base--LmzWHx3.js';
|
|
4
4
|
import '../../shared/types/config.js';
|
|
5
|
-
import '../../enums-
|
|
5
|
+
import '../../enums-CI7vzKhn.js';
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { T as TemplateApi } from '../../TemplateApi-
|
|
2
|
-
export { a as TemplateClass,
|
|
3
|
-
import '../../base
|
|
1
|
+
import { T as TemplateApi } from '../../TemplateApi-Bjc2IfNX.js';
|
|
2
|
+
export { a as TemplateClass, c as TemplateDeleteParams, d as TemplateGetParams, e as TemplateRequestBody, b as TemplateResponse } from '../../TemplateApi-Bjc2IfNX.js';
|
|
3
|
+
import '../../base--LmzWHx3.js';
|
|
4
4
|
import '../../shared/types/config.js';
|
|
5
|
-
import '../../enums-
|
|
5
|
+
import '../../enums-CI7vzKhn.js';
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { T as TwoStepVerificationApi } from '../../TwoStepVerificationApi-
|
|
2
|
-
export { a as TwoStepVerificationClass, b as TwoStepVerificationRequest } from '../../TwoStepVerificationApi-
|
|
3
|
-
import '../../base
|
|
1
|
+
import { T as TwoStepVerificationApi } from '../../TwoStepVerificationApi-nJ12648J.js';
|
|
2
|
+
export { a as TwoStepVerificationClass, b as TwoStepVerificationRequest } from '../../TwoStepVerificationApi-nJ12648J.js';
|
|
3
|
+
import '../../base--LmzWHx3.js';
|
|
4
4
|
import '../../shared/types/config.js';
|
|
5
|
-
import '../../enums-
|
|
5
|
+
import '../../enums-CI7vzKhn.js';
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { W as WabaApi } from '../../WabaApi-
|
|
2
|
-
export { U as UpdateWabaSubscription, b as WABAClass, a as WabaAccount, c as WabaSubscriptions } from '../../WabaApi-
|
|
3
|
-
import '../../base
|
|
1
|
+
import { W as WabaApi } from '../../WabaApi-BIP6G4pB.js';
|
|
2
|
+
export { U as UpdateWabaSubscription, b as WABAClass, a as WabaAccount, c as WabaSubscriptions } from '../../WabaApi-BIP6G4pB.js';
|
|
3
|
+
import '../../base--LmzWHx3.js';
|
|
4
4
|
import '../../shared/types/config.js';
|
|
5
|
-
import '../../enums-
|
|
5
|
+
import '../../enums-CI7vzKhn.js';
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
export { EventField, EventHandler,
|
|
2
|
-
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-
|
|
3
|
-
|
|
4
|
-
export { H as HttpMethodsEnum, M as MessageTypesEnum, S as StatusEnum,
|
|
5
|
-
export {
|
|
6
|
-
export { B as BusinessProfileApi, a as BusinessProfileClass,
|
|
7
|
-
export { E as EncryptionApi } from './EncryptionApi-
|
|
8
|
-
export { a as Flow, F as FlowApi,
|
|
9
|
-
export { P as PhoneNumberApi,
|
|
10
|
-
export { R as RegistrationApi, a as RegistrationClass } from './RegistrationApi-
|
|
11
|
-
export { T as TemplateApi, a as TemplateClass,
|
|
12
|
-
export { Q as QrCodeApi, a as QrCodeClass, b as QrCodeResponse } from './QrCodeApi-
|
|
13
|
-
export { T as TwoStepVerificationApi } from './TwoStepVerificationApi-
|
|
14
|
-
export { b as WABAClass, a as WabaAccount, W as WabaApi } from './WabaApi-
|
|
1
|
+
export { EventField, EventHandler, MessageHandler, MessageStatus, WebhookContact, WebhookEvent, WebhookHandler, WebhookMessage } from './core/webhook/index.js';
|
|
2
|
+
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-Cr3Q6qg4.js';
|
|
3
|
+
export { WabaConfigType, WhatsAppConfig } from './shared/types/config.js';
|
|
4
|
+
export { A as AudioMediaTypesEnum, k as BusinessVerticalEnum, a as ButtonPositionEnum, B as ButtonTypesEnum, C as CategoryEnum, b as ComponentTypesEnum, c as ConversationTypesEnum, i as CurrencyCodesEnum, j as DataLocalizationRegionEnum, D as DocumentMediaTypesEnum, H as HttpMethodsEnum, e as ImageMediaTypesEnum, I as InteractiveTypesEnum, L as LanguagesEnum, M as MessageTypesEnum, P as ParametersTypesEnum, R as ReferralSourceTypesEnum, h as RequestCodeMethodsEnum, S as StatusEnum, d as StickerMediaTypesEnum, g as SystemChangeTypesEnum, T as TemplateStatusEnum, V as VideoMediaTypesEnum, W as WabaConfigEnum, f as WebhookTypesEnum } from './enums-CI7vzKhn.js';
|
|
5
|
+
export { M as MediaClass, a as MediaResponse, b as MediasResponse, U as UploadMediaResponse } from './MediaApi-DM3WohTN.js';
|
|
6
|
+
export { B as BusinessProfileApi, a as BusinessProfileClass, b as BusinessProfileResponse } from './BusinessProfileApi-CNU7GpJK.js';
|
|
7
|
+
export { E as EncryptionApi } from './EncryptionApi-r6_0rWwx.js';
|
|
8
|
+
export { a as Flow, F as FlowApi, b as FlowClass, c as FlowEndpointRequest, d as FlowEndpointResponse } from './FlowApi-BhpWbli2.js';
|
|
9
|
+
export { P as PhoneNumberApi, a as PhoneNumberClass, b as PhoneNumberResponse } from './PhoneNumberApi-Dc2KKn0M.js';
|
|
10
|
+
export { R as RegistrationApi, a as RegistrationClass } from './RegistrationApi-CYrP_F0R.js';
|
|
11
|
+
export { T as TemplateApi, a as TemplateClass, b as TemplateResponse } from './TemplateApi-Bjc2IfNX.js';
|
|
12
|
+
export { Q as QrCodeApi, a as QrCodeClass, b as QrCodeResponse } from './QrCodeApi-z9XTnlcP.js';
|
|
13
|
+
export { T as TwoStepVerificationApi } from './TwoStepVerificationApi-nJ12648J.js';
|
|
14
|
+
export { b as WABAClass, a as WabaAccount, W as WabaApi } from './WabaApi-BIP6G4pB.js';
|
|
15
15
|
import { WhatsApp } from './core/whatsapp/index.js';
|
|
16
|
-
export { MetaError, isMetaError } from './shared/utils/isMetaError.js';
|
|
17
16
|
import 'http';
|
|
18
|
-
import './base
|
|
17
|
+
import './base--LmzWHx3.js';
|
|
19
18
|
import 'https';
|
|
20
19
|
|
|
21
|
-
declare const importConfig: (inputConfig?: WhatsAppConfig) => WabaConfigType;
|
|
22
20
|
|
|
23
|
-
|
|
21
|
+
|
|
22
|
+
export { WhatsApp as default };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{a as TemplateApi}from'./chunk-H55VIWDI.js';export{a as QrCodeApi}from'./chunk-I222VSWK.js';export{
|
|
1
|
+
export{a as TemplateApi}from'./chunk-H55VIWDI.js';export{a as QrCodeApi}from'./chunk-I222VSWK.js';import'./chunk-W2U7MN7M.js';export{c as WebhookHandler}from'./chunk-2QZCD34C.js';import {b}from'./chunk-BSNA6RYF.js';import'./chunk-3MO3BTBC.js';import'./chunk-R36L2XYO.js';import'./chunk-GT3XQN7Y.js';export{b as RegistrationApi}from'./chunk-O2OTHNWM.js';export{b as EncryptionApi}from'./chunk-7NQLQPLH.js';export{b as TwoStepVerificationApi}from'./chunk-UQPD6GIF.js';export{b as WabaApi}from'./chunk-5JGM556C.js';export{b as MessagesApi}from'./chunk-2NJVBJUN.js';import'./chunk-XPPDOFBN.js';export{b as BusinessProfileApi}from'./chunk-KFPOVYEJ.js';import'./chunk-7GL74SXM.js';export{b as FlowApi}from'./chunk-A264MT4Q.js';export{b as PhoneNumberApi}from'./chunk-GIQLIMOD.js';import'./chunk-BZ5QDXNR.js';import'./chunk-VW3LGHTJ.js';export{q as AudioMediaTypesEnum,y as BusinessVerticalEnum,h as ButtonPositionEnum,g as ButtonTypesEnum,a as CategoryEnum,i as ComponentTypesEnum,k as ConversationTypesEnum,w as CurrencyCodesEnum,x as DataLocalizationRegionEnum,p as DocumentMediaTypesEnum,c as HttpMethodsEnum,o as ImageMediaTypesEnum,f as InteractiveTypesEnum,v as LanguagesEnum,d as MessageTypesEnum,e as ParametersTypesEnum,t as ReferralSourceTypesEnum,u as RequestCodeMethodsEnum,l as StatusEnum,n as StickerMediaTypesEnum,s as SystemChangeTypesEnum,b as TemplateStatusEnum,m as VideoMediaTypesEnum,j as WabaConfigEnum,r as WebhookTypesEnum}from'./chunk-EYGUX4EA.js';import'./chunk-4C666HHU.js';var Y=b;export{Y as default};//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":["src_default","WhatsApp"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":["src_default","WhatsApp"],"mappings":"u9CAGA,IAAOA,CAAQC,CAAAA","file":"index.js","sourcesContent":["import { WebhookHandler } from './core/webhook';\nimport { WhatsApp } from './core/whatsapp';\n\nexport default WhatsApp;\n\nexport type {\n EventField,\n EventHandler,\n MessageHandler,\n MessageStatus,\n WebhookContact,\n WebhookEvent,\n WebhookMessage,\n} from './core/webhook/types';\n\nexport { WebhookHandler };\n\nexport {\n BusinessProfileApi,\n EncryptionApi,\n FlowApi,\n MessagesApi,\n PhoneNumberApi,\n QrCodeApi,\n RegistrationApi,\n TemplateApi,\n TwoStepVerificationApi,\n WabaApi,\n} from './features';\n\nexport type {\n AudioMediaObject,\n BusinessProfileClass,\n BusinessProfileResponse,\n ContactObject,\n DocumentMediaObject,\n Flow,\n FlowClass,\n FlowEndpointRequest,\n FlowEndpointResponse,\n ImageMediaObject,\n InteractiveObject,\n LocationObject,\n MediaClass,\n MediaResponse,\n MediasResponse,\n MessageRequestParams,\n MessagesResponse,\n MessageTemplateObject,\n PhoneNumberClass,\n PhoneNumberResponse,\n QrCodeClass,\n QrCodeResponse,\n ReactionParams,\n RegistrationClass,\n StatusParams,\n StickerMediaObject,\n TemplateClass,\n TemplateResponse,\n TextMessageParams,\n TextObject,\n UploadMediaResponse,\n VideoMediaObject,\n WabaAccount,\n WABAClass,\n} from './features';\n\nexport * from './shared/types/config';\nexport * from './shared/types/enums';\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import'../../chunk-W2U7MN7M.js';//# sourceMappingURL=config.js.map
|
|
2
2
|
//# sourceMappingURL=config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as AudioMediaTypesEnum,
|
|
1
|
+
export { A as AudioMediaTypesEnum, k as BusinessVerticalEnum, a as ButtonPositionEnum, B as ButtonTypesEnum, C as CategoryEnum, b as ComponentTypesEnum, c as ConversationTypesEnum, i as CurrencyCodesEnum, j as DataLocalizationRegionEnum, D as DocumentMediaTypesEnum, H as HttpMethodsEnum, e as ImageMediaTypesEnum, I as InteractiveTypesEnum, L as LanguagesEnum, M as MessageTypesEnum, P as ParametersTypesEnum, R as ReferralSourceTypesEnum, h as RequestCodeMethodsEnum, S as StatusEnum, d as StickerMediaTypesEnum, g as SystemChangeTypesEnum, T as TemplateStatusEnum, V as VideoMediaTypesEnum, W as WabaConfigEnum, f as WebhookTypesEnum } from '../../enums-CI7vzKhn.js';
|