meta-cloud-api 0.2.14 → 0.2.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/dist/BusinessProfileApi-DDkv2WQK.d.ts +352 -0
  2. package/dist/EncryptionApi-CwxQlC-2.d.ts +21 -0
  3. package/dist/FlowApi-BIBrWYEv.d.ts +471 -0
  4. package/dist/MediaApi-VqxndaBJ.d.ts +89 -0
  5. package/dist/MessageApi-CHc6bn3g.d.ts +591 -0
  6. package/dist/PhoneNumberApi-C-bs6YAe.d.ts +141 -0
  7. package/dist/QrCodeApi-BjlyPUXV.d.ts +97 -0
  8. package/dist/RegistrationApi-D7Bg8BUz.d.ts +46 -0
  9. package/dist/TemplateApi-dmZbvMkO.d.ts +117 -0
  10. package/dist/TwoStepVerificationApi-DaYWPjY_.d.ts +32 -0
  11. package/dist/WabaApi-CMoTCWiH.d.ts +174 -0
  12. package/dist/base-BG2gtoDs.d.ts +46 -0
  13. package/dist/chunk-2NJVBJUN.js +2 -0
  14. package/dist/chunk-2NJVBJUN.js.map +1 -0
  15. package/dist/chunk-3MO3BTBC.js +2 -0
  16. package/dist/chunk-3MO3BTBC.js.map +1 -0
  17. package/dist/chunk-4C666HHU.js +2 -0
  18. package/dist/chunk-4C666HHU.js.map +1 -0
  19. package/dist/chunk-5JGM556C.js +2 -0
  20. package/dist/chunk-5JGM556C.js.map +1 -0
  21. package/dist/chunk-7GL74SXM.js +2 -0
  22. package/dist/chunk-7GL74SXM.js.map +1 -0
  23. package/dist/chunk-7NQLQPLH.js +2 -0
  24. package/dist/chunk-7NQLQPLH.js.map +1 -0
  25. package/dist/chunk-A264MT4Q.js +2 -0
  26. package/dist/chunk-A264MT4Q.js.map +1 -0
  27. package/dist/chunk-BZ5QDXNR.js +2 -0
  28. package/dist/chunk-BZ5QDXNR.js.map +1 -0
  29. package/dist/chunk-EYGUX4EA.js +2 -0
  30. package/dist/chunk-EYGUX4EA.js.map +1 -0
  31. package/dist/chunk-FFOE5YKT.js +2 -0
  32. package/dist/chunk-FFOE5YKT.js.map +1 -0
  33. package/dist/chunk-GIQLIMOD.js +2 -0
  34. package/dist/chunk-GIQLIMOD.js.map +1 -0
  35. package/dist/chunk-KFPOVYEJ.js +2 -0
  36. package/dist/chunk-KFPOVYEJ.js.map +1 -0
  37. package/dist/chunk-O2OTHNWM.js +2 -0
  38. package/dist/chunk-O2OTHNWM.js.map +1 -0
  39. package/dist/chunk-UQPD6GIF.js +2 -0
  40. package/dist/chunk-UQPD6GIF.js.map +1 -0
  41. package/dist/chunk-VW3LGHTJ.js +2 -0
  42. package/dist/chunk-VW3LGHTJ.js.map +1 -0
  43. package/dist/chunk-XIIJD6SG.js +2 -0
  44. package/dist/chunk-XIIJD6SG.js.map +1 -0
  45. package/dist/chunk-XPPDOFBN.js +2 -0
  46. package/dist/chunk-XPPDOFBN.js.map +1 -0
  47. package/dist/enums-Z1f7QuVx.d.ts +687 -0
  48. package/dist/features/encryption/index.d.ts +9 -0
  49. package/dist/features/encryption/index.js +2 -0
  50. package/dist/{types/index.mjs.map → features/encryption/index.js.map} +1 -1
  51. package/dist/features/flow/index.d.ts +9 -0
  52. package/dist/features/flow/index.js +2 -0
  53. package/dist/{utils/index.mjs.map → features/flow/index.js.map} +1 -1
  54. package/dist/features/media/index.d.ts +9 -0
  55. package/dist/features/media/index.js +2 -0
  56. package/dist/{api/index.mjs.map → features/media/index.js.map} +1 -1
  57. package/dist/features/messages/index.d.ts +9 -0
  58. package/dist/features/messages/index.js +2 -0
  59. package/dist/features/messages/index.js.map +1 -0
  60. package/dist/features/phone/index.d.ts +9 -0
  61. package/dist/features/phone/index.js +2 -0
  62. package/dist/features/phone/index.js.map +1 -0
  63. package/dist/features/profile/index.d.ts +9 -0
  64. package/dist/features/profile/index.js +2 -0
  65. package/dist/features/profile/index.js.map +1 -0
  66. package/dist/features/qrCode/index.d.ts +9 -0
  67. package/dist/features/qrCode/index.js +2 -0
  68. package/dist/features/qrCode/index.js.map +1 -0
  69. package/dist/features/registration/index.d.ts +9 -0
  70. package/dist/features/registration/index.js +2 -0
  71. package/dist/features/registration/index.js.map +1 -0
  72. package/dist/features/template/index.d.ts +9 -0
  73. package/dist/features/template/index.js +2 -0
  74. package/dist/features/template/index.js.map +1 -0
  75. package/dist/features/twoStepVerification/index.d.ts +9 -0
  76. package/dist/features/twoStepVerification/index.js +2 -0
  77. package/dist/features/twoStepVerification/index.js.map +1 -0
  78. package/dist/features/waba/index.d.ts +9 -0
  79. package/dist/features/waba/index.js +2 -0
  80. package/dist/features/waba/index.js.map +1 -0
  81. package/dist/{types/index.d.mts → index.d.ts} +222 -72
  82. package/dist/index.js +3 -0
  83. package/dist/index.js.map +1 -0
  84. package/dist/shared/types/config.d.ts +78 -0
  85. package/dist/shared/types/config.js +2 -0
  86. package/dist/shared/types/config.js.map +1 -0
  87. package/dist/shared/types/enums.d.ts +1 -0
  88. package/dist/shared/types/enums.js +2 -0
  89. package/dist/shared/types/enums.js.map +1 -0
  90. package/dist/shared/utils/isMetaError.d.ts +21 -0
  91. package/dist/shared/utils/isMetaError.js +2 -0
  92. package/dist/shared/utils/isMetaError.js.map +1 -0
  93. package/package.json +81 -15
  94. package/dist/api/index.d.mts +0 -496
  95. package/dist/api/index.mjs +0 -2
  96. package/dist/chunk-KZQQJAPX.mjs +0 -2
  97. package/dist/chunk-KZQQJAPX.mjs.map +0 -1
  98. package/dist/chunk-N7A7DQDX.mjs +0 -2
  99. package/dist/chunk-N7A7DQDX.mjs.map +0 -1
  100. package/dist/chunk-QE4PKOSW.mjs +0 -2
  101. package/dist/chunk-QE4PKOSW.mjs.map +0 -1
  102. package/dist/chunk-R4CFE2XP.mjs +0 -2
  103. package/dist/chunk-R4CFE2XP.mjs.map +0 -1
  104. package/dist/chunk-XVYL7ZTG.mjs +0 -2
  105. package/dist/chunk-XVYL7ZTG.mjs.map +0 -1
  106. package/dist/index.d.mts +0 -145
  107. package/dist/index.mjs +0 -3
  108. package/dist/index.mjs.map +0 -1
  109. package/dist/types/index.mjs +0 -2
  110. package/dist/utils/index.d.mts +0 -71
  111. package/dist/utils/index.mjs +0 -2
  112. package/dist/waba-RRlZTQUG.d.mts +0 -2229
  113. package/dist/whatsapp-BNHXjrds.d.mts +0 -46
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/shared/utils/flowTypeGuards.ts","../src/shared/config/importConfig.ts","../src/shared/http/httpsClient.ts","../src/shared/http/request.ts","../src/core/whatsapp/WhatsApp.ts","../src/core/webhook/WebhookHandler.ts","../src/index.ts"],"names":["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","DEFAULT_LISTENER_PORT","DEFAULT_MAX_RETRIES_AFTER_WAIT","DEFAULT_REQUEST_TIMEOUT","emptyConfigChecker","config","importConfig","inputConfig","wabaConfig","HttpsClient","Agent","hostname","path","method","headers","timeout","body","url","controller","timeoutId","response","HttpsClientResponse","error","resp","err","Requester","apiVersion","phoneNumberId","accessToken","businessAcctId","userAgent","contentType","additionalHeaders","endpoint","effectiveContentType","errorData","isMetaError","formData","urlEncodedBody","headerPrefix","WhatsApp","enums_exports","messages_default","TemplateApi","phone_default","QrCodeApi","encryption_default","twoStepVerification_default","registration_default","media_default","waba_default","flow_default","profile_default","ms","wabaId","WebhookHandler","configuration","req","res","mode","token","challenge","entry","changes","change","metadata","displayPhoneNumber","profileName","messages","message","messageType","processedMessage","handler","field","event","type","decryptedBody","result","encryptedResponse","signature","formattedExpectedSignature","crypto","encrypted_aes_key","encrypted_flow_data","initial_vector","privatePem","passphrase","privateKey","decryptedAesKey","flowDataBuffer","initialVectorBuffer","encrypted_flow_data_body","encrypted_flow_data_tag","decipher","decryptedJSONString","aesKeyBuffer","flipped_iv","pair","cipher","src_default"],"mappings":"y3C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AA,CAAK,EAC1C,IAAI,KAAA,CAAM,oDAAoD,CACxE,CACJ,CAKO,OACHqD,CACAH,CAAAA,CAAAA,CACI,CACJ,IAAA,CAAK,YAAa,CAAA,GAAA,CAAIG,EAAMH,CAAO,CAAA,CACnCzE,CAAO,CAAA,GAAA,CAAI,CAA+B4E,4BAAAA,EAAAA,CAAI,EAAE,EACpD,CACJ,EC3dA,IAAOwB,EAAQ3D,CAAAA","file":"index.js","sourcesContent":["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 type { WabaConfigType, WhatsAppConfig } from '../types/config';\nimport { WabaConfigEnum } from '../types/enums';\nimport Logger from '../utils/logger';\n\nconst LIB_NAME = 'UTILS';\nconst LOG_LOCAL = false;\nconst LOGGER = new Logger(LIB_NAME, process.env.DEBUG === 'true' || LOG_LOCAL);\nconst DEFAULT_LISTENER_PORT = 3000;\nconst DEFAULT_MAX_RETRIES_AFTER_WAIT = 30;\nconst DEFAULT_REQUEST_TIMEOUT = 20000;\n\nconst emptyConfigChecker = (config: WhatsAppConfig | undefined) => {\n if (!process.env[WabaConfigEnum.AccessToken] && !config?.accessToken) {\n LOGGER.log(`Environmental variable: CLOUD_API_ACCESS_TOKEN and/or access token argument is undefined.`);\n throw new Error('Missing WhatsApp access token.');\n }\n};\n\nexport const importConfig = (inputConfig?: WhatsAppConfig) => {\n emptyConfigChecker(inputConfig);\n\n const wabaConfig: WabaConfigType = {\n [WabaConfigEnum.AppId]: inputConfig?.appId || process.env.M4D_APP_ID || '',\n [WabaConfigEnum.AppSecret]: inputConfig?.appSecret || process.env.M4D_APP_SECRET || '',\n [WabaConfigEnum.PhoneNumberId]: inputConfig?.phoneNumberId || Number(process.env.WA_PHONE_NUMBER_ID),\n [WabaConfigEnum.BusinessAcctId]: inputConfig?.businessAcctId || process.env.WA_BUSINESS_ACCOUNT_ID || '',\n [WabaConfigEnum.APIVersion]: inputConfig?.apiVersion || process.env.CLOUD_API_VERSION || '',\n [WabaConfigEnum.AccessToken]: inputConfig?.accessToken || process.env.CLOUD_API_ACCESS_TOKEN || '',\n [WabaConfigEnum.WebhookEndpoint]: inputConfig?.webhookEndpoint || process.env.WEBHOOK_ENDPOINT || '',\n [WabaConfigEnum.WebhookVerificationToken]:\n inputConfig?.webhookVerificationToken || process.env.WEBHOOK_VERIFICATION_TOKEN || '',\n [WabaConfigEnum.ListenerPort]:\n inputConfig?.listenerPort || parseInt(process.env.LISTENER_PORT || '') || DEFAULT_LISTENER_PORT,\n [WabaConfigEnum.MaxRetriesAfterWait]:\n inputConfig?.maxRetriesAfterWait ||\n parseInt(process.env.MAX_RETRIES_AFTER_WAIT || '') ||\n DEFAULT_MAX_RETRIES_AFTER_WAIT,\n [WabaConfigEnum.RequestTimeout]:\n inputConfig?.requestTimeout || parseInt(process.env.REQUEST_TIMEOUT || '') || DEFAULT_REQUEST_TIMEOUT,\n [WabaConfigEnum.Debug]: inputConfig?.debug || process.env.DEBUG === 'true',\n [WabaConfigEnum.PrivatePem]: inputConfig?.privatePem || process.env.FLOW_API_PRIVATE_PEM || '',\n [WabaConfigEnum.Passphrase]: inputConfig?.passphrase || process.env.FLOW_API_PASSPHRASE || '',\n };\n\n LOGGER.log(`Configuration loaded for App Id ${wabaConfig[WabaConfigEnum.AppId]}`);\n\n return wabaConfig;\n};\n","import { Agent } from 'https';\n\nimport { HttpMethodsEnum } from '../types/enums';\nimport { HttpsClientClass, HttpsClientResponseClass, ResponseHeaders, ResponseJSONBody } from '../types/httpsClient';\nimport Logger from '../utils/logger';\n\nconst LIB_NAME = 'HttpsClient';\nconst LOG_LOCAL = false;\nconst LOGGER = new Logger(LIB_NAME, process.env.DEBUG === 'true' || LOG_LOCAL);\n\nexport default class HttpsClient implements HttpsClientClass {\n agent: Agent;\n\n constructor() {\n this.agent = new Agent({ keepAlive: true });\n }\n\n clearSockets(): boolean {\n this.agent.destroy();\n return true;\n }\n\n async sendRequest(\n hostname: string,\n path: string,\n method: HttpMethodsEnum,\n headers: HeadersInit,\n timeout: number,\n body?: BodyInit | null,\n ): Promise<HttpsClientResponseClass> {\n const url = `https://${hostname}/${path}`;\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), timeout);\n\n try {\n const response = await fetch(url, {\n method,\n headers,\n body,\n signal: controller.signal,\n });\n LOGGER.log(`${method} : ${url} - ${JSON.stringify(response)}`);\n\n clearTimeout(timeoutId);\n return new HttpsClientResponse(response);\n } catch (error) {\n LOGGER.error(`${method} : ${url} - ${JSON.stringify(error)}`);\n throw error;\n }\n }\n}\n\nexport class HttpsClientResponse implements HttpsClientResponseClass {\n res: Response;\n respStatusCode: number;\n respHeaders: ResponseHeaders;\n\n constructor(resp: Response) {\n this.res = resp;\n this.respStatusCode = resp.status;\n this.respHeaders = Object.fromEntries(resp.headers.entries());\n }\n\n statusCode(): number {\n return this.respStatusCode;\n }\n\n headers(): ResponseHeaders {\n return this.respHeaders;\n }\n\n rawResponse(): Response {\n return this.res;\n }\n\n async json(): Promise<ResponseJSONBody> {\n try {\n return (await this.res.json()) as ResponseJSONBody;\n } catch (err) {\n // TODO Error Handling\n throw new Error('Failed to parse response body to JSON: ' + (err as Error).message);\n }\n }\n}\n","import type { HttpMethodsEnum } from '../types/enums';\nimport type { RequesterClass } from '../types/request';\nimport { isMetaError, MetaError } from '../utils/isMetaError';\nimport Logger from '../utils/logger';\nimport HttpsClient from './httpsClient';\n\nconst LIB_NAME = 'REQUESTER';\nconst LOG_LOCAL = false;\nconst LOGGER = new Logger(LIB_NAME, process.env.DEBUG === 'true' || LOG_LOCAL);\n\nexport default class Requester implements RequesterClass {\n client: Readonly<HttpsClient>;\n accessToken: Readonly<string>;\n phoneNumberId: Readonly<number>;\n businessAcctId: Readonly<string>;\n apiVersion: Readonly<string>;\n userAgent: Readonly<string>;\n host: Readonly<string>;\n protocol: Readonly<string> = 'https:';\n\n constructor(\n apiVersion: string,\n phoneNumberId: number,\n accessToken: string,\n businessAcctId: string,\n userAgent: string,\n ) {\n this.client = new HttpsClient();\n this.host = 'graph.facebook.com';\n this.apiVersion = apiVersion || '22';\n this.phoneNumberId = phoneNumberId;\n this.accessToken = accessToken;\n this.businessAcctId = businessAcctId;\n this.userAgent = userAgent;\n }\n\n buildHeader(contentType: string, additionalHeaders?: Record<string, string>): HeadersInit {\n const headers: HeadersInit = {\n Authorization: `Bearer ${this.accessToken}`,\n 'User-Agent': this.userAgent,\n };\n\n if (contentType !== 'multipart/form-data') {\n headers['Content-Type'] = contentType;\n }\n\n if (additionalHeaders) {\n Object.assign(headers, additionalHeaders);\n }\n\n return headers;\n }\n\n buildCAPIPath(endpoint: string): string {\n return `v${this.apiVersion}.0/${endpoint}`;\n }\n\n async sendRequest(\n method: HttpMethodsEnum,\n endpoint: string,\n timeout: number,\n body?: any,\n contentType: string = 'application/json',\n additionalHeaders?: Record<string, string>,\n ) {\n let effectiveContentType = contentType;\n\n if (body instanceof FormData) {\n effectiveContentType = 'multipart/form-data';\n } else if (typeof body === 'string' && body.startsWith('<?xml')) {\n effectiveContentType = 'application/xml';\n }\n\n const path = `${this.protocol.toLowerCase()}//${this.host}/${this.buildCAPIPath(endpoint)}`;\n\n LOGGER.log(`${method} : ${path} (${effectiveContentType})`);\n\n try {\n const response = await this.client.sendRequest(\n this.host,\n this.buildCAPIPath(endpoint),\n method,\n this.buildHeader(effectiveContentType, additionalHeaders),\n timeout,\n method === 'POST' || method === 'PUT' ? body : undefined,\n );\n\n if (!response.rawResponse().ok) {\n const errorData = await response.json();\n if (isMetaError(errorData)) {\n throw errorData;\n }\n // If the error doesn't match Meta's format, create a generic MetaError\n throw {\n name: 'MetaError',\n message: 'Unknown error occurred',\n error: {\n message: errorData.message || 'Unknown error occurred',\n type: 'UnknownError',\n code: response.statusCode(),\n fbtrace_id: '',\n },\n } as MetaError;\n }\n\n return response;\n } catch (error) {\n if (isMetaError(error)) {\n throw error;\n }\n // Handle network errors or other unexpected errors\n throw {\n name: 'MetaError',\n message: error instanceof Error ? error.message : 'Network error occurred',\n error: {\n message: error instanceof Error ? error.message : 'Network error occurred',\n type: 'NetworkError',\n code: 500,\n fbtrace_id: '',\n },\n } as MetaError;\n }\n }\n\n async getJson<T>(\n method: HttpMethodsEnum,\n endpoint: string,\n timeout: number,\n body?: any,\n additionalHeaders?: Record<string, string>,\n ): Promise<T> {\n const res = await this.sendRequest(method, endpoint, timeout, body, 'application/json', additionalHeaders);\n return (await res.json()) as T;\n }\n\n async sendFormData<T>(\n method: HttpMethodsEnum,\n endpoint: string,\n timeout: number,\n formData: FormData,\n additionalHeaders?: Record<string, string>,\n ): Promise<T> {\n const res = await this.sendRequest(\n method,\n endpoint,\n timeout,\n formData,\n 'multipart/form-data',\n additionalHeaders,\n );\n return (await res.json()) as T;\n }\n\n async sendUrlEncodedForm<T>(\n method: HttpMethodsEnum,\n endpoint: string,\n timeout: number,\n formData: Record<string, string>,\n additionalHeaders?: Record<string, string>,\n ): Promise<T> {\n const urlEncodedBody = new URLSearchParams(formData).toString();\n const res = await this.sendRequest(\n method,\n endpoint,\n timeout,\n urlEncodedBody,\n 'application/x-www-form-urlencoded',\n additionalHeaders,\n );\n return (await res.json()) as T;\n }\n}\n","import { WabaConfigType, WhatsAppConfig } from '@shared/types/config';\nimport * as SDKEnums from '@shared/types/enums';\nimport Logger from '@shared/utils/logger';\n\nimport EncryptionApi from '@features/encryption';\nimport FlowApi from '@features/flow';\nimport MediaApi from '@features/media';\nimport MessagesApi from '@features/messages';\nimport PhoneNumberApi from '@features/phone';\nimport BusinessProfileApi from '@features/profile';\nimport QrCodeApi from '@features/qrCode/QrCodeApi';\nimport RegistrationApi from '@features/registration';\nimport TemplateApi from '@features/template/TemplateApi';\nimport TwoStepVerificationApi from '@features/twoStepVerification';\nimport WabaApi from '@features/waba';\nimport { importConfig } from '@shared/config/importConfig';\nimport Requester from '@shared/http/request';\nimport { WhatsAppClass } from './types';\n\nconst LIB_NAME = 'WHATSAPP';\nconst LOG_LOCAL = false;\nconst LOGGER = new Logger(LIB_NAME, process.env.DEBUG === 'true' || LOG_LOCAL);\n\nconst headerPrefix = 'WA_SDK';\n\nexport default class WhatsApp implements WhatsAppClass {\n config: WabaConfigType;\n\n requester: Readonly<Requester>;\n\n readonly messages: MessagesApi;\n readonly templates: TemplateApi;\n readonly phoneNumber: PhoneNumberApi;\n readonly qrCode: QrCodeApi;\n readonly encryption: EncryptionApi;\n readonly twoStepVerification: TwoStepVerificationApi;\n readonly registration: RegistrationApi;\n readonly media: MediaApi;\n readonly waba: WabaApi;\n readonly flow: FlowApi;\n readonly businessProfile: BusinessProfileApi;\n static readonly Enums = SDKEnums;\n\n constructor(config?: WhatsAppConfig) {\n this.config = importConfig(config);\n this.requester = new Requester(\n this.config[SDKEnums.WabaConfigEnum.APIVersion],\n this.config[SDKEnums.WabaConfigEnum.PhoneNumberId],\n this.config[SDKEnums.WabaConfigEnum.AccessToken],\n this.config[SDKEnums.WabaConfigEnum.BusinessAcctId],\n this.userAgent(),\n );\n\n this.messages = new MessagesApi(this.config, this.requester);\n this.templates = new TemplateApi(this.config, this.requester);\n this.phoneNumber = new PhoneNumberApi(this.config, this.requester);\n this.qrCode = new QrCodeApi(this.config, this.requester);\n this.encryption = new EncryptionApi(this.config, this.requester);\n this.twoStepVerification = new TwoStepVerificationApi(this.config, this.requester);\n this.registration = new RegistrationApi(this.config, this.requester);\n this.media = new MediaApi(this.config, this.requester);\n this.waba = new WabaApi(this.config, this.requester);\n this.flow = new FlowApi(this.config, this.requester);\n this.businessProfile = new BusinessProfileApi(this.config, this.requester);\n LOGGER.log('WhatsApp Node.js SDK instantiated!');\n }\n\n private userAgent(): string {\n const userAgentString = `${headerPrefix}/${'0.0.1'} (Node.js ${process.version})`;\n return userAgentString;\n }\n\n updateTimeout(ms: number): boolean {\n this.config[SDKEnums.WabaConfigEnum.RequestTimeout] = ms;\n LOGGER.log(`Updated request timeout to ${ms}ms`);\n return true;\n }\n\n updatePhoneNumberId(phoneNumberId: number): boolean {\n this.config[SDKEnums.WabaConfigEnum.PhoneNumberId] = phoneNumberId;\n LOGGER.log(`Updated sender phone number id to ${phoneNumberId}`);\n return true;\n }\n\n updateAccessToken(accessToken: string): boolean {\n this.config[SDKEnums.WabaConfigEnum.AccessToken] = accessToken;\n LOGGER.log(`Updated access token`);\n return true;\n }\n\n updateWabaId(wabaId: string): boolean {\n this.config[SDKEnums.WabaConfigEnum.BusinessAcctId] = wabaId;\n LOGGER.log(`Updated business account id to ${wabaId}`);\n return true;\n }\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 const mode = req.query['hub.mode'];\n const token = req.query['hub.verify_token'];\n const challenge = req.query['hub.challenge'];\n\n if (mode === 'subscribe' && token === this.config.WEBHOOK_VERIFICATION_TOKEN) {\n LOGGER.log('Webhook verified successfully');\n res.status(200).send(challenge);\n } else {\n LOGGER.log('Webhook verification failed');\n res.status(403).end();\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 const body = req.body;\n\n // Check this is a WhatsApp Business Account webhook\n if (body.object !== 'whatsapp_business_account') {\n LOGGER.log('Received webhook for non-WhatsApp event');\n res.status(404).end();\n return;\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 LOGGER.log(`Error processing webhook: ${error}`);\n }\n }\n\n // Always respond with 200 to acknowledge receipt\n res.status(200).end();\n }\n\n /**\n * Handle webhook requests (both verification and events)\n */\n public handleRequest(req: IRequest, res: IResponse): void | Promise<void> {\n if (req.method === 'GET') {\n return this.handleVerificationRequest(req, res);\n } else if (req.method === 'POST') {\n return this.handleWebhookRequest(req, res);\n } else {\n res.status(405).end(); // Method not allowed\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 try {\n // Validate request signature\n if (!this.isRequestSignatureValid(req)) {\n LOGGER.log('Invalid request signature');\n res.status(401).json({ error: 'Unauthorized' });\n return;\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 LOGGER.log(`No handler registered for flow action: ${decryptedBody.action}`);\n res.status(404).json({ error: 'Handler not found' });\n return;\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 res.status(200).json(response);\n return;\n }\n\n if (isFlowErrorRequest(decryptedBody)) {\n LOGGER.log(`Flow error: ${JSON.stringify(decryptedBody)}`);\n res.status(200).json({});\n return;\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 res.status(200).json(encryptedResponse);\n return;\n }\n\n // Unknown flow type\n LOGGER.log(`Unknown flow request type: ${JSON.stringify(decryptedBody)}`);\n res.status(400).json({ error: 'Unknown request type' });\n } catch (error) {\n LOGGER.log(`Error handling flow request: ${error}`);\n res.status(500).json({ error: 'Internal server error' });\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","import { WebhookHandler } from './core/webhook';\nimport { WhatsApp } from './core/whatsapp';\n\nexport default WhatsApp;\n\nexport type { IRequest, IResponse } from './core/webhook';\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 { HttpMethodsEnum, importConfig, isMetaError, MessageTypesEnum, StatusEnum, WebhookTypesEnum } from './shared';\n\nexport type { MetaError, WabaConfigType } from './shared';\n"]}
@@ -0,0 +1,78 @@
1
+ import { f as WabaConfigEnum } from '../../enums-Z1f7QuVx.js';
2
+
3
+ type WhatsAppConfig = {
4
+ accessToken: string;
5
+ appId?: string;
6
+ appSecret?: string;
7
+ phoneNumberId?: number;
8
+ businessAcctId?: string;
9
+ apiVersion?: string;
10
+ webhookEndpoint?: string;
11
+ webhookVerificationToken?: string;
12
+ listenerPort?: number;
13
+ debug?: boolean;
14
+ maxRetriesAfterWait?: number;
15
+ requestTimeout?: number;
16
+ privatePem?: string;
17
+ passphrase?: string;
18
+ };
19
+ type WabaConfigType = {
20
+ /**
21
+ * The Meta for Developers business application Id for this registered application.
22
+ */
23
+ [WabaConfigEnum.AppId]: string;
24
+ /**
25
+ * The Meta for Developers business application secret for this registered application.
26
+ */
27
+ [WabaConfigEnum.AppSecret]: string;
28
+ /**
29
+ * The Meta for Developers phone number id used by the registered business.
30
+ */
31
+ [WabaConfigEnum.PhoneNumberId]: number;
32
+ /**
33
+ * The Meta for Developers business id for the registered business.
34
+ */
35
+ [WabaConfigEnum.BusinessAcctId]: string;
36
+ /**
37
+ * The version of the Cloud API being used. Starts with a "v" and follows the major number.
38
+ */
39
+ [WabaConfigEnum.APIVersion]: string;
40
+ /**
41
+ * The access token to make calls on behalf of the signed in Meta for Developers account or business.
42
+ */
43
+ [WabaConfigEnum.AccessToken]: string;
44
+ /**
45
+ * The endpoint path (e.g. if the value here is webhook, the webhook URL would look like http/https://{host}/webhook).
46
+ */
47
+ [WabaConfigEnum.WebhookEndpoint]: string;
48
+ /**
49
+ * The verification token that needs to match what is sent by the Cloud API webhook in order to subscribe.
50
+ */
51
+ [WabaConfigEnum.WebhookVerificationToken]: string;
52
+ /**
53
+ * The listener port for the webhook web server.
54
+ */
55
+ [WabaConfigEnum.ListenerPort]: number;
56
+ /**
57
+ * To turn on global debugging of the logger to print verbose output across the APIs.
58
+ */
59
+ [WabaConfigEnum.Debug]: boolean;
60
+ /**
61
+ * The total number of times a request should be retried after the wait period if it fails.
62
+ */
63
+ [WabaConfigEnum.MaxRetriesAfterWait]: number;
64
+ /**
65
+ * The timeout period for a request to quit and destroy the attempt in ms.
66
+ */
67
+ [WabaConfigEnum.RequestTimeout]: number;
68
+ /**
69
+ * The private key for the Meta for Developers business.
70
+ */
71
+ [WabaConfigEnum.PrivatePem]: string;
72
+ /**
73
+ * The passphrase for the Meta for Developers business.
74
+ */
75
+ [WabaConfigEnum.Passphrase]: string;
76
+ };
77
+
78
+ export type { WabaConfigType, WhatsAppConfig };
@@ -0,0 +1,2 @@
1
+ //# sourceMappingURL=config.js.map
2
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"config.js"}
@@ -0,0 +1 @@
1
+ export { A as AudioMediaTypesEnum, d as BusinessVerticalEnum, c as ButtonPositionEnum, B as ButtonTypesEnum, e as CategoryEnum, C as ComponentTypesEnum, g as ConversationTypesEnum, b as CurrencyCodesEnum, D as DataLocalizationRegionEnum, j as DocumentMediaTypesEnum, H as HttpMethodsEnum, i as ImageMediaTypesEnum, I as InteractiveTypesEnum, L as LanguagesEnum, M as MessageTypesEnum, P as ParametersTypesEnum, R as ReferralSourceTypesEnum, l as RequestCodeMethodsEnum, a as StatusEnum, h as StickerMediaTypesEnum, k as SystemChangeTypesEnum, T as TemplateStatusEnum, V as VideoMediaTypesEnum, f as WabaConfigEnum, W as WebhookTypesEnum } from '../../enums-Z1f7QuVx.js';
@@ -0,0 +1,2 @@
1
+ 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';//# sourceMappingURL=enums.js.map
2
+ //# sourceMappingURL=enums.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"enums.js"}
@@ -0,0 +1,21 @@
1
+ interface MetaError extends Error {
2
+ error: {
3
+ message: string;
4
+ type: string;
5
+ code: number;
6
+ error_data?: {
7
+ messaging_product: 'whatsapp';
8
+ details: string;
9
+ };
10
+ error_subcode?: number;
11
+ fbtrace_id: string;
12
+ };
13
+ }
14
+ /**
15
+ * Determines if the error is a Meta API error response
16
+ * @param error Any error object to check
17
+ * @returns Type guard indicating if error is a Meta API error
18
+ */
19
+ declare function isMetaError(error: any): error is MetaError;
20
+
21
+ export { type MetaError, isMetaError };
@@ -0,0 +1,2 @@
1
+ export{a as isMetaError}from'../../chunk-3MO3BTBC.js';import'../../chunk-4C666HHU.js';//# sourceMappingURL=isMetaError.js.map
2
+ //# sourceMappingURL=isMetaError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"isMetaError.js"}
package/package.json CHANGED
@@ -1,9 +1,11 @@
1
1
  {
2
2
  "name": "meta-cloud-api",
3
- "version": "0.2.14",
3
+ "version": "0.2.16",
4
4
  "description": "TypeScript wrapper for Meta's Cloud API",
5
+ "type": "module",
5
6
  "main": "./dist/index.js",
6
7
  "types": "./dist/index.d.ts",
8
+ "sideEffects": false,
7
9
  "scripts": {
8
10
  "prepare": "husky",
9
11
  "cz": "cz",
@@ -12,7 +14,9 @@
12
14
  "format": "prettier .",
13
15
  "lint": "eslint .",
14
16
  "clean": "rm -rf dist node_modules",
15
- "typecheck": "tsc --noEmit"
17
+ "typecheck": "tsc --noEmit",
18
+ "test": "vitest run",
19
+ "test:watch": "vitest --watch"
16
20
  },
17
21
  "publishConfig": {
18
22
  "access": "public"
@@ -23,20 +27,80 @@
23
27
  "import": "./dist/index.js",
24
28
  "default": "./dist/index.js"
25
29
  },
26
- "./api": {
27
- "types": "./dist/api/index.d.ts",
28
- "import": "./dist/api/index.js",
29
- "default": "./dist/api/index.js"
30
+ "./messages": {
31
+ "types": "./dist/features/messages/index.d.ts",
32
+ "import": "./dist/features/messages/index.js",
33
+ "default": "./dist/features/messages/index.js"
30
34
  },
31
- "./types": {
32
- "types": "./dist/types/index.d.ts",
33
- "import": "./dist/types/index.js",
34
- "default": "./dist/types/index.js"
35
+ "./media": {
36
+ "types": "./dist/features/media/index.d.ts",
37
+ "import": "./dist/features/media/index.js",
38
+ "default": "./dist/features/media/index.js"
35
39
  },
36
- "./utils": {
37
- "types": "./dist/utils/index.d.ts",
38
- "import": "./dist/utils/index.js",
39
- "default": "./dist/utils/index.js"
40
+ "./profile": {
41
+ "types": "./dist/features/profile/index.d.ts",
42
+ "import": "./dist/features/profile/index.js",
43
+ "default": "./dist/features/profile/index.js"
44
+ },
45
+ "./flow": {
46
+ "types": "./dist/features/flow/index.d.ts",
47
+ "import": "./dist/features/flow/index.js",
48
+ "default": "./dist/features/flow/index.js"
49
+ },
50
+ "./phone": {
51
+ "types": "./dist/features/phone/index.d.ts",
52
+ "import": "./dist/features/phone/index.js",
53
+ "default": "./dist/features/phone/index.js"
54
+ },
55
+ "./template": {
56
+ "types": "./dist/features/template/index.d.ts",
57
+ "import": "./dist/features/template/index.js",
58
+ "default": "./dist/features/template/index.js"
59
+ },
60
+ "./waba": {
61
+ "types": "./dist/features/waba/index.d.ts",
62
+ "import": "./dist/features/waba/index.js",
63
+ "default": "./dist/features/waba/index.js"
64
+ },
65
+ "./qrCode": {
66
+ "types": "./dist/features/qrCode/index.d.ts",
67
+ "import": "./dist/features/qrCode/index.js",
68
+ "default": "./dist/features/qrCode/index.js"
69
+ },
70
+ "./twoStepVerification": {
71
+ "types": "./dist/features/twoStepVerification/index.d.ts",
72
+ "import": "./dist/features/twoStepVerification/index.js",
73
+ "default": "./dist/features/twoStepVerification/index.js"
74
+ },
75
+ "./encryption": {
76
+ "types": "./dist/features/encryption/index.d.ts",
77
+ "import": "./dist/features/encryption/index.js",
78
+ "default": "./dist/features/encryption/index.js"
79
+ },
80
+ "./registration": {
81
+ "types": "./dist/features/registration/index.d.ts",
82
+ "import": "./dist/features/registration/index.js",
83
+ "default": "./dist/features/registration/index.js"
84
+ },
85
+ "./shared/types": {
86
+ "types": "./dist/shared/types/index.d.ts",
87
+ "import": "./dist/shared/types/index.js",
88
+ "default": "./dist/shared/types/index.js"
89
+ },
90
+ "./shared/utils": {
91
+ "types": "./dist/shared/utils/index.d.ts",
92
+ "import": "./dist/shared/utils/index.js",
93
+ "default": "./dist/shared/utils/index.js"
94
+ },
95
+ "./core/webhook": {
96
+ "types": "./dist/core/webhook/index.d.ts",
97
+ "import": "./dist/core/webhook/index.js",
98
+ "default": "./dist/core/webhook/index.js"
99
+ },
100
+ "./core/whatsapp": {
101
+ "types": "./dist/core/whatsapp/index.d.ts",
102
+ "import": "./dist/core/whatsapp/index.js",
103
+ "default": "./dist/core/whatsapp/index.js"
40
104
  },
41
105
  "./package.json": "./package.json"
42
106
  },
@@ -101,10 +165,12 @@
101
165
  "eslint-plugin-unused-imports": "^4.1.4",
102
166
  "husky": "^9.1.7",
103
167
  "lint-staged": "^15.3.0",
168
+ "msw": "^2.9.0",
104
169
  "prettier": "^3.5.0",
105
170
  "tsup": "^8.3.6",
106
171
  "typescript": "^5.7.3",
107
- "typescript-eslint": "^8.23.0"
172
+ "typescript-eslint": "^8.23.0",
173
+ "vitest": "^2.1.8"
108
174
  },
109
175
  "lint-staged": {
110
176
  "**/*.{ts,tsx}": [