meta-cloud-api 0.0.17 → 0.0.18

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/logger.ts","../../src/api/base.ts","../../src/utils/objectToQueryString.ts","../../src/api/businessProfile.ts","../../src/api/encryption.ts","../../src/api/flow.ts","../../src/api/media.ts","../../src/api/messages.ts","../../src/api/phoneNumber.ts","../../src/api/qrCode.ts","../../src/api/registration.ts","../../src/api/template.ts","../../src/api/twoStepVerification.ts","../../src/api/waba.ts"],"sourcesContent":["// @ts-nocheck\nimport type { LoggerInterface } from '../types/logger';\n\nexport default class Logger implements LoggerInterface {\n private name: string;\n private debug: boolean;\n\n constructor(name: string, debug: boolean = false) {\n this.name = name;\n this.debug = debug;\n }\n\n log(...data: any[]) {\n if (this.debug) {\n let prefix = `[ ${Date.now()} ]`;\n if (this.name) {\n prefix += ` - ${this.name}`;\n }\n console.log.apply(console, [prefix, ': ', ...data]);\n }\n }\n\n error(...data: any[]) {\n let prefix = `[ ${Date.now()} ] - ERROR`;\n if (this.name) {\n prefix += ` - ${this.name}`;\n }\n console.error.apply(console, [prefix, ': ', ...data]);\n }\n\n warn(...data: any[]) {\n let prefix = `[ ${Date.now()} ] - WARN`;\n if (this.name) {\n prefix += ` - ${this.name}`;\n }\n console.warn.apply(console, [prefix, ': ', ...data]);\n }\n\n info(...data: any[]) {\n let prefix = `[ ${Date.now()} ] - INFO`;\n if (this.name) {\n prefix += ` - ${this.name}`;\n }\n console.info.apply(console, [prefix, ': ', ...data]);\n }\n}\n","import Logger from '../utils/logger';\nimport type { BaseClass } from '../types/base';\nimport type { WabaConfigType } from '../types/config';\nimport type { RequesterClass } from '../types/request';\n\nconst LIB_NAME = 'BaseAPI';\nconst LOG_LOCAL = false;\nconst LOGGER = new Logger(LIB_NAME, process.env.DEBUG === 'true' || LOG_LOCAL);\n\nexport default class BaseAPI implements BaseClass {\n protected config: WabaConfigType;\n protected client: RequesterClass;\n\n constructor(config: WabaConfigType, client: RequesterClass) {\n this.config = config;\n this.client = client;\n LOGGER.log('Initialized with HTTPSClient');\n }\n}\n","export const objectToQueryString = (params: Record<string, any>): string => {\n if (!params || Object.keys(params).length === 0) {\n return '';\n }\n\n const searchParams = new URLSearchParams();\n\n for (const [key, value] of Object.entries(params)) {\n if (value !== undefined) {\n searchParams.append(key, String(value));\n }\n }\n\n const queryString = searchParams.toString();\n return queryString ? `?${queryString}` : '';\n};\n","import {\n BusinessProfileClass,\n BusinessProfileResponse,\n UpdateBusinessProfileRequest,\n UploadBusinessProfileResponse,\n UploadHandle,\n UploadSessionResponse,\n} from '../types/businessProfile';\nimport type { WabaConfigType } from '../types/config';\nimport { HttpMethodsEnum, WabaConfigEnum } from '../types/enums';\nimport type { RequesterClass, RequesterResponseInterface, ResponseSuccess } from '../types/request';\nimport { objectToQueryString } from '../utils/objectToQueryString';\nimport BaseAPI from './base';\n\n/**\n * API for managing WhatsApp Business Profiles and profile pictures.\n *\n * This API allows you to:\n * - Get business profile information\n * - Update business profile details\n * - Upload profile pictures using a three-step process:\n * 1. Create an upload session\n * 2. Upload the image binary data\n * 3. Get the upload handle to use when updating the profile\n */\nexport default class BusinessProfileAPI extends BaseAPI implements BusinessProfileClass {\n private readonly endpoint = 'whatsapp_business_profile';\n\n constructor(config: WabaConfigType, client: RequesterClass) {\n super(config, client);\n }\n\n /**\n * Get your business profile information.\n *\n * Use this method to retrieve details about your WhatsApp business profile, including\n * about text, address, description, email, profile picture URL, websites, and vertical.\n *\n * @param fields Fields to be returned in the response. If not specified, all fields will be returned.\n * Possible values: about, address, description, email, profile_picture_url, websites, vertical\n * @returns The business profile information.\n *\n * @example\n * // Get all business profile fields\n * const profile = await whatsappClient.businessProfile.getBusinessProfile();\n *\n * // Get specific business profile fields\n * const profile = await whatsappClient.businessProfile.getBusinessProfile('about,address,email');\n */\n async getBusinessProfile(fields?: string): Promise<RequesterResponseInterface<BusinessProfileResponse>> {\n const queryParams = fields ? objectToQueryString({ fields }) : '';\n return this.client.sendRequest(\n HttpMethodsEnum.Get,\n `${this.config[WabaConfigEnum.PhoneNumberId]}/${this.endpoint}${queryParams}`,\n this.config[WabaConfigEnum.RequestTimeout],\n null,\n );\n }\n\n /**\n * Update your business profile.\n *\n * Use this method to update one or more fields of your WhatsApp business profile.\n *\n * @param updateRequest The request object containing the fields to update.\n * - messaging_product: Required. Always set to \"whatsapp\".\n * - about: Optional. Business's About text (1-139 characters).\n * - address: Optional. Business address (max 256 characters).\n * - description: Optional. Business description (max 512 characters).\n * - vertical: Optional. Business category (use BusinessVerticalEnum for type safety).\n * - email: Optional. Contact email (valid format, max 128 characters).\n * - websites: Optional. Up to 2 URLs (max 256 characters each).\n * - profile_picture_handle: Optional. Handle from upload process.\n * @returns Response indicating success or failure.\n *\n * @example\n * // Update business profile with multiple fields including vertical using enum\n * await whatsappClient.businessProfile.updateBusinessProfile({\n * messaging_product: 'whatsapp',\n * about: 'We provide excellent service',\n * email: 'contact@example.com',\n * websites: ['https://example.com'],\n * vertical: BusinessVerticalEnum.RETAIL\n * });\n */\n async updateBusinessProfile(\n updateRequest: UpdateBusinessProfileRequest,\n ): Promise<RequesterResponseInterface<ResponseSuccess>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Post,\n `${this.config[WabaConfigEnum.PhoneNumberId]}/${this.endpoint}`,\n this.config[WabaConfigEnum.RequestTimeout],\n JSON.stringify(updateRequest),\n );\n }\n\n /**\n * Create an upload session for a profile picture.\n *\n * This is the first step in the profile picture upload process.\n *\n * @param fileLength Length of the file to be uploaded in bytes.\n * @param fileType MIME type of the file (e.g., 'image/jpeg').\n * @param fileName Name of the file with extension.\n * @returns Response containing the upload session ID needed for the next step.\n *\n * @example\n * // Create upload session for profile picture\n * const session = await whatsappClient.businessProfile.createUploadSession(\n * fileBuffer.length,\n * 'image/jpeg',\n * 'profile.jpg'\n * );\n * const uploadSessionId = session.upload_session_id;\n */\n async createUploadSession(\n fileLength: number,\n fileType: string,\n fileName: string,\n ): Promise<RequesterResponseInterface<UploadSessionResponse>> {\n const queryParams = objectToQueryString({\n file_length: fileLength,\n file_type: fileType,\n file_name: fileName,\n });\n\n return this.client.sendRequest(\n HttpMethodsEnum.Post,\n `app/uploads/${queryParams}`,\n this.config[WabaConfigEnum.RequestTimeout],\n null,\n );\n }\n\n /**\n * Upload media file to the upload session.\n *\n * This is the second step in the profile picture upload process.\n * Upload the binary content of the file to the previously created upload session.\n *\n * @param uploadId The upload session ID from createUploadSession response.\n * @param file The binary data of the file (Buffer).\n * @returns Response indicating success or failure.\n *\n * @example\n * // Upload the actual file content\n * await whatsappClient.businessProfile.uploadMedia(\n * uploadSessionId,\n * fileBuffer\n * );\n */\n async uploadMedia(\n uploadId: string,\n file: Buffer,\n ): Promise<RequesterResponseInterface<UploadBusinessProfileResponse>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Post,\n `${uploadId}`,\n this.config[WabaConfigEnum.RequestTimeout],\n file,\n );\n }\n\n /**\n * Get the upload handle information.\n *\n * This is the third step in the profile picture upload process.\n * After uploading the file, get the handle to use when updating the profile.\n *\n * @param uploadId The upload session ID from createUploadSession response.\n * @returns Response containing the upload handle information.\n *\n * @example\n * // Complete profile picture update process\n * // 1. Create upload session\n * const session = await whatsappClient.businessProfile.createUploadSession(\n * fileBuffer.length, 'image/jpeg', 'profile.jpg'\n * );\n *\n * // 2. Upload the image data\n * await whatsappClient.businessProfile.uploadMedia(\n * session.upload_session_id, fileBuffer\n * );\n *\n * // 3. Get the handle for the uploaded file\n * const handleInfo = await whatsappClient.businessProfile.getUploadHandle(\n * session.upload_session_id\n * );\n *\n * // 4. Update profile with new picture and business information\n * await whatsappClient.businessProfile.updateBusinessProfile({\n * messaging_product: 'whatsapp',\n * profile_picture_handle: handleInfo.handle,\n * vertical: BusinessVerticalEnum.RESTAURANT,\n * about: 'Delicious food served daily'\n * });\n */\n async getUploadHandle(uploadId: string): Promise<RequesterResponseInterface<UploadHandle>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Get,\n `${uploadId}`,\n this.config[WabaConfigEnum.RequestTimeout],\n null,\n );\n }\n}\n","import { HttpMethodsEnum, WabaConfigEnum } from '../types/enums';\nimport type { WabaConfigType } from '../types/config';\nimport type { RequesterClass, RequesterResponseInterface, ResponseSuccess } from '../types/request';\nimport BaseAPI from './base';\nimport type { EncryptionClass, EncryptionPublicKeyResponse } from '../types/encryption';\n\nexport default class EncryptionAPI extends BaseAPI implements EncryptionClass {\n private readonly endpoint = 'whatsapp_business_encryption';\n\n constructor(config: WabaConfigType, client: RequesterClass) {\n super(config, client);\n }\n\n async getEncryptionPublicKey(): Promise<RequesterResponseInterface<EncryptionPublicKeyResponse>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Get,\n `${this.config[WabaConfigEnum.PhoneNumberId]}/${this.endpoint}`,\n this.config[WabaConfigEnum.RequestTimeout],\n null,\n );\n }\n\n async setEncryptionPublicKey(businessPublicKey: string): Promise<RequesterResponseInterface<ResponseSuccess>> {\n const formData = new FormData();\n formData.append('business_public_key', businessPublicKey);\n\n return this.client.sendRequest(\n HttpMethodsEnum.Post,\n `${this.config[WabaConfigEnum.PhoneNumberId]}/${this.endpoint}`,\n this.config[WabaConfigEnum.RequestTimeout],\n formData,\n );\n }\n}\n","import BaseAPI from './base';\nimport { WabaConfigType } from '../types/config';\nimport { HttpMethodsEnum, WabaConfigEnum } from '../types/enums';\nimport { RequesterClass, RequesterResponseInterface, ResponseSuccess } from '../types/request';\nimport {\n FlowClass,\n FlowsListResponse,\n FlowCategoryEnum,\n Flow,\n FlowPreviewResponse,\n FlowAssetsResponse,\n FlowValidationError,\n FlowMigrationResponse,\n} from '../types/flow';\nimport Logger from '../utils/logger';\n\nconst LIB_NAME = 'FlowAPI';\nconst LOG_LOCAL = false;\nconst LOGGER = new Logger(LIB_NAME, process.env.DEBUG === 'true' || LOG_LOCAL);\n\nexport default class FlowAPI extends BaseAPI implements FlowClass {\n constructor(config: WabaConfigType, client: RequesterClass) {\n super(config, client);\n LOGGER.log('FlowAPI initialized');\n }\n\n /**\n * List Flows\n *\n * @param wabaId - The WABA ID\n * @returns Promise with the list of flows\n */\n async listFlows(wabaId: string): Promise<RequesterResponseInterface<FlowsListResponse>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Get,\n `/${wabaId}/flows`,\n this.config[WabaConfigEnum.RequestTimeout],\n null,\n );\n }\n\n /**\n * Create Flow\n *\n * @param wabaId - The WABA ID\n * @param data - The flow data including name, categories, endpoint_uri, and optional clone_flow_id\n * @returns Promise with the created flow ID\n */\n async createFlow(\n wabaId: string,\n data: {\n name: string;\n categories?: FlowCategoryEnum[];\n endpoint_uri?: string;\n clone_flow_id?: string;\n flow_json?: string;\n publish?: boolean;\n },\n ): Promise<\n RequesterResponseInterface<{ id: string; success: boolean; validation_errors?: FlowValidationError[] }>\n > {\n const formData = new FormData();\n\n if (data.name) formData.append('name', data.name);\n if (data.categories) formData.append('categories', JSON.stringify(data.categories));\n if (data.endpoint_uri) formData.append('endpoint_uri', data.endpoint_uri);\n if (data.clone_flow_id) formData.append('clone_flow_id', data.clone_flow_id);\n if (data.flow_json) formData.append('flow_json', data.flow_json);\n if (data.publish !== undefined) formData.append('publish', String(data.publish));\n\n return this.client.sendRequest(\n HttpMethodsEnum.Post,\n `/${wabaId}/flows`,\n this.config[WabaConfigEnum.RequestTimeout],\n formData,\n );\n }\n\n /**\n * Get Flow\n *\n * @param flowId - The flow ID\n * @param fields - Optional fields to return\n * @param dateFormat - Optional date format\n * @returns Promise with the flow details\n */\n async getFlow(\n flowId: string,\n fields?: string,\n dateFormat?: string,\n ): Promise<RequesterResponseInterface<Flow | FlowPreviewResponse>> {\n const params = new URLSearchParams();\n if (fields) params.append('fields', fields);\n if (dateFormat) params.append('date_format', dateFormat);\n\n const queryString = params.toString() ? `?${params.toString()}` : '';\n return this.client.sendRequest(\n HttpMethodsEnum.Get,\n `/${flowId}${queryString}`,\n this.config[WabaConfigEnum.RequestTimeout],\n null,\n );\n }\n\n /**\n * Update Flow Metadata\n *\n * @param flowId - The flow ID\n * @param data - The flow metadata to update\n * @returns Promise with the success status\n */\n async updateFlowMetadata(\n flowId: string,\n data: {\n name?: string;\n categories?: FlowCategoryEnum[];\n endpoint_uri?: string;\n application_id?: string;\n },\n ): Promise<RequesterResponseInterface<ResponseSuccess>> {\n const formData = new FormData();\n\n if (data.name) formData.append('name', data.name);\n if (data.categories) formData.append('categories', JSON.stringify(data.categories));\n if (data.endpoint_uri) formData.append('endpoint_uri', data.endpoint_uri);\n if (data.application_id) formData.append('application_id', data.application_id);\n\n return this.client.sendRequest(\n HttpMethodsEnum.Post,\n `/${flowId}`,\n this.config[WabaConfigEnum.RequestTimeout],\n formData,\n );\n }\n\n /**\n * Delete Flow\n *\n * @param flowId - The flow ID\n * @returns Promise with the success status\n */\n async deleteFlow(flowId: string): Promise<RequesterResponseInterface<ResponseSuccess>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Delete,\n `/${flowId}`,\n this.config[WabaConfigEnum.RequestTimeout],\n null,\n );\n }\n\n /**\n * List Assets (Get Flow JSON URL)\n *\n * @param flowId - The flow ID\n * @returns Promise with the list of assets\n */\n async listAssets(flowId: string): Promise<RequesterResponseInterface<FlowAssetsResponse>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Get,\n `/${flowId}/assets`,\n this.config[WabaConfigEnum.RequestTimeout],\n null,\n );\n }\n\n /**\n * Update Flow JSON\n *\n * @param flowId - The flow ID\n * @param data - The asset data including asset_type, file, and name\n * @returns Promise with the success status and validation errors\n */\n async updateFlowJson(\n flowId: string,\n data: {\n asset_type: 'FLOW_JSON';\n file: Blob;\n name: string;\n },\n ): Promise<RequesterResponseInterface<{ success: boolean; validation_errors?: FlowValidationError[] }>> {\n const formData = new FormData();\n\n formData.append('asset_type', data.asset_type);\n formData.append('file', data.file);\n formData.append('name', data.name);\n\n return this.client.sendRequest(\n HttpMethodsEnum.Post,\n `/${flowId}/assets`,\n this.config[WabaConfigEnum.RequestTimeout],\n formData,\n );\n }\n\n /**\n * Publish Flow\n *\n * @param flowId - The flow ID\n * @returns Promise with the success status\n */\n async publishFlow(flowId: string): Promise<RequesterResponseInterface<ResponseSuccess>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Post,\n `/${flowId}/publish`,\n this.config[WabaConfigEnum.RequestTimeout],\n JSON.stringify({}),\n );\n }\n\n /**\n * Deprecate Flow\n *\n * @param flowId - The flow ID\n * @returns Promise with the success status\n */\n async deprecateFlow(flowId: string): Promise<RequesterResponseInterface<ResponseSuccess>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Post,\n `/${flowId}/deprecate`,\n this.config[WabaConfigEnum.RequestTimeout],\n JSON.stringify({}),\n );\n }\n\n /**\n * Migrate Flows\n *\n * @param wabaId - The destination WABA ID\n * @param data - The migration data including source_waba_id and optional source_flow_names\n * @returns Promise with migration results\n */\n async migrateFlows(\n wabaId: string,\n data: {\n source_waba_id: string;\n source_flow_names?: string[];\n },\n ): Promise<RequesterResponseInterface<FlowMigrationResponse>> {\n const formData = new FormData();\n\n formData.append('source_waba_id', data.source_waba_id);\n if (data.source_flow_names) {\n formData.append('source_flow_names', JSON.stringify(data.source_flow_names));\n }\n\n return this.client.sendRequest(\n HttpMethodsEnum.Post,\n `/${wabaId}/migrate_flows`,\n this.config[WabaConfigEnum.RequestTimeout],\n formData,\n );\n }\n}\n","import { HttpMethodsEnum, WabaConfigEnum } from '../types/enums';\nimport type { RequesterClass, RequesterResponseInterface, ResponseSuccess } from '../types/request';\nimport type { WabaConfigType } from '../types/config';\nimport type { MediaClass, MediaResponse, MediasResponse, UploadMediaResponse } from '../types/media';\nimport BaseAPI from './base';\n\nexport default class MediaAPI extends BaseAPI implements MediaClass {\n private readonly endpoint = 'media';\n\n constructor(config: WabaConfigType, client: RequesterClass) {\n super(config, client);\n }\n\n async getMediaById(mediaId: string): Promise<RequesterResponseInterface<MediaResponse>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Get,\n `${mediaId}`,\n this.config[WabaConfigEnum.RequestTimeout],\n null,\n );\n }\n\n async uploadMedia(\n file: File,\n messagingProduct: string = 'whatsapp',\n ): Promise<RequesterResponseInterface<UploadMediaResponse>> {\n const formData = new FormData();\n formData.append('file', file);\n formData.append('messaging_product', messagingProduct);\n formData.append('type', file.type);\n\n return this.client.sendRequest(\n HttpMethodsEnum.Post,\n `${this.config[WabaConfigEnum.PhoneNumberId]}/${this.endpoint}`,\n this.config[WabaConfigEnum.RequestTimeout],\n formData,\n );\n }\n\n async deleteMedia(mediaId: string): Promise<RequesterResponseInterface<ResponseSuccess>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Delete,\n `${mediaId}`,\n this.config[WabaConfigEnum.RequestTimeout],\n null,\n );\n }\n\n async downloadMedia(mediaUrl: string): Promise<RequesterResponseInterface<Blob>> {\n return this.client.sendRequest(HttpMethodsEnum.Get, mediaUrl, this.config[WabaConfigEnum.RequestTimeout], null);\n }\n}\n","import type { WabaConfigType } from '../types/config';\nimport {\n ComponentTypesEnum,\n HttpMethodsEnum,\n MessageTypesEnum,\n WabaConfigEnum,\n InteractiveTypesEnum,\n} from '../types/enums';\n\nimport * as m from '../types/messages';\nimport type { RequesterClass, RequesterResponseInterface } from '../types/request';\nimport BaseAPI from './base';\n\n/**\n * Maps each message type to its appropriate payload type\n */\nexport type MessagePayloadType<T extends MessageTypesEnum> = T extends MessageTypesEnum.Audio\n ? m.AudioMediaObject\n : T extends MessageTypesEnum.Contacts\n ? [m.ContactObject]\n : T extends MessageTypesEnum.Document\n ? m.DocumentMediaObject\n : T extends MessageTypesEnum.Image\n ? m.ImageMediaObject\n : T extends MessageTypesEnum.Interactive\n ? m.InteractiveObject\n : T extends MessageTypesEnum.Location\n ? m.LocationObject\n : T extends MessageTypesEnum.Template\n ? m.MessageTemplateObject<ComponentTypesEnum>\n : T extends MessageTypesEnum.Sticker\n ? m.StickerMediaObject\n : T extends MessageTypesEnum.Text\n ? m.TextObject\n : T extends MessageTypesEnum.Video\n ? m.VideoMediaObject\n : T extends MessageTypesEnum.Reaction\n ? { message_id: string; emoji: string }\n : never;\n\nexport default class MessagesApi extends BaseAPI implements m.MessagesClass {\n private readonly commonMethod = HttpMethodsEnum.Post;\n private readonly commonEndpoint = 'messages';\n\n constructor(config: WabaConfigType, client: RequesterClass) {\n super(config, client);\n }\n\n /**\n * Builds the request body for WhatsApp API messages\n * @param type The type of message to send\n * @param payload The message payload object\n * @param toNumber The recipient's phone number\n * @param replyMessageId Optional message ID to reply to\n * @returns The formatted request body\n */\n bodyBuilder<T extends MessageTypesEnum>(\n type: T,\n payload: MessagePayloadType<T>,\n toNumber: string,\n replyMessageId?: string,\n ) {\n const body: m.MessageRequestBody<T> = {\n messaging_product: 'whatsapp',\n recipient_type: 'individual',\n to: toNumber,\n type: type,\n [type]: payload,\n };\n\n if (replyMessageId) body['context'] = { message_id: replyMessageId };\n\n return body;\n }\n\n /**\n * Sends a request to the WhatsApp API\n * @param body The request body to send\n * @returns Promise with the API response\n */\n private send(body: BodyInit | null): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n return this.client.sendRequest(\n this.commonMethod,\n `${this.config[WabaConfigEnum.PhoneNumberId]}/${this.commonEndpoint}`,\n this.config[WabaConfigEnum.RequestTimeout],\n body,\n );\n }\n\n /**\n * Sends an audio message via WhatsApp\n * @param body The audio media object\n * @param recipient Recipient's phone number\n * @param replyMessageId Optional message ID to reply to\n * @returns Promise with the message response\n */\n async audio(\n body: m.AudioMediaObject,\n recipient: number,\n replyMessageId?: string,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n return this.send(\n JSON.stringify(this.bodyBuilder(MessageTypesEnum.Audio, body, recipient.toString(), replyMessageId)),\n );\n }\n\n /**\n * Sends a contact card via WhatsApp\n * @param body The contact object\n * @param recipient Recipient's phone number\n * @param replyMessageId Optional message ID to reply to\n * @returns Promise with the message response\n */\n async contacts(\n body: [m.ContactObject],\n recipient: number,\n replyMessageId?: string,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n return this.send(\n JSON.stringify(this.bodyBuilder(MessageTypesEnum.Contacts, body, recipient.toString(), replyMessageId)),\n );\n }\n\n /**\n * Sends a document via WhatsApp\n * @param body The document media object\n * @param recipient Recipient's phone number\n * @param replyMessageId Optional message ID to reply to\n * @returns Promise with the message response\n */\n async document(\n body: m.DocumentMediaObject,\n recipient: number,\n replyMessageId?: string,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n return this.send(\n JSON.stringify(this.bodyBuilder(MessageTypesEnum.Document, body, recipient.toString(), replyMessageId)),\n );\n }\n\n /**\n * Sends an image via WhatsApp\n * @param body The image media object\n * @param recipient Recipient's phone number\n * @param replyMessageId Optional message ID to reply to\n * @returns Promise with the message response\n */\n async image(\n body: m.ImageMediaObject,\n recipient: number,\n replyMessageId?: string,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n return this.send(\n JSON.stringify(this.bodyBuilder(MessageTypesEnum.Image, body, recipient.toString(), replyMessageId)),\n );\n }\n\n /**\n * Sends an interactive message via WhatsApp\n * @param body The interactive object (buttons, lists, etc.)\n * @param recipient Recipient's phone number\n * @param replyMessageId Optional message ID to reply to\n * @returns Promise with the message response\n */\n async interactive(\n body: m.InteractiveObject,\n recipient: number,\n replyMessageId?: string,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n return this.send(\n JSON.stringify(this.bodyBuilder(MessageTypesEnum.Interactive, body, recipient.toString(), replyMessageId)),\n );\n }\n\n /**\n * Sends a location via WhatsApp\n * @param body The location object with coordinates\n * @param recipient Recipient's phone number\n * @param replyMessageId Optional message ID to reply to\n * @returns Promise with the message response\n */\n async location(\n body: m.LocationObject,\n recipient: number,\n replyMessageId?: string,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n return this.send(\n JSON.stringify(this.bodyBuilder(MessageTypesEnum.Location, body, recipient.toString(), replyMessageId)),\n );\n }\n\n /**\n * Sends a sticker via WhatsApp\n * @param body The sticker media object\n * @param recipient Recipient's phone number\n * @param replyMessageId Optional message ID to reply to\n * @returns Promise with the message response\n */\n async sticker(\n body: m.StickerMediaObject,\n recipient: number,\n replyMessageId?: string,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n return this.send(\n JSON.stringify(this.bodyBuilder(MessageTypesEnum.Sticker, body, recipient.toString(), replyMessageId)),\n );\n }\n\n /**\n * Sends a template message via WhatsApp\n * @param body The message template object\n * @param recipient Recipient's phone number\n * @param replyMessageId Optional message ID to reply to\n * @returns Promise with the message response\n */\n async template(\n body: m.MessageTemplateObject<ComponentTypesEnum>,\n recipient: number,\n replyMessageId?: string,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n return this.send(\n JSON.stringify(this.bodyBuilder(MessageTypesEnum.Template, body, recipient.toString(), replyMessageId)),\n );\n }\n\n /**\n * Sends a text message via WhatsApp\n * @param body The text object containing the message\n * @param recipient Recipient's phone number\n * @param replyMessageId Optional message ID to reply to\n * @returns Promise with the message response\n */\n async text(\n body: m.TextObject,\n recipient: number,\n replyMessageId?: string,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n return this.send(\n JSON.stringify(this.bodyBuilder(MessageTypesEnum.Text, body, recipient.toString(), replyMessageId)),\n );\n }\n\n /**\n * Sends a video via WhatsApp\n * @param body The video media object\n * @param recipient Recipient's phone number\n * @param replyMessageId Optional message ID to reply to\n * @returns Promise with the message response\n */\n async video(\n body: m.VideoMediaObject,\n recipient: number,\n replyMessageId?: string,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n return this.send(\n JSON.stringify(this.bodyBuilder(MessageTypesEnum.Video, body, recipient.toString(), replyMessageId)),\n );\n }\n\n /**\n * Updates message status (used for read receipts and typing indicators)\n * @param body The status object\n * @returns Promise with the response\n */\n async status(body: m.StatusObject): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n const bodyToSend = {\n messaging_product: 'whatsapp',\n ...body,\n };\n\n return this.send(JSON.stringify(bodyToSend));\n }\n\n /**\n * Marks a message as read in WhatsApp\n * @param messageId ID of the message to mark as read\n * @returns Promise with the response\n */\n async markAsRead(messageId: string): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n return this.status({\n status: 'read',\n message_id: messageId,\n });\n }\n\n /**\n * Marks a message as read and shows a typing indicator in WhatsApp\n * @param messageId ID of the message to mark as read\n * @returns Promise with the response\n */\n async showTypingIndicator(messageId: string): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n return this.status({\n status: 'read',\n message_id: messageId,\n typing_indicator: {\n type: 'text',\n },\n });\n }\n\n /**\n * Sends an interactive list message\n * @param body The list message content\n * @param recipient Recipient phone number\n * @param replyMessageId Optional message ID to reply to\n * @returns Promise with the response\n */\n async interactiveList(\n body: m.InteractiveObject & { type: InteractiveTypesEnum.List },\n recipient: number,\n replyMessageId?: string,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n return this.send(\n JSON.stringify(this.bodyBuilder(MessageTypesEnum.Interactive, body, recipient.toString(), replyMessageId)),\n );\n }\n\n /**\n * Sends an interactive CTA URL message\n * @param body The CTA URL message content\n * @param recipient Recipient phone number\n * @param replyMessageId Optional message ID to reply to\n * @returns Promise with the response\n */\n async interactiveCtaUrl(\n body: m.InteractiveObject & { type: InteractiveTypesEnum.CtaUrl },\n recipient: number,\n replyMessageId?: string,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n return this.send(\n JSON.stringify(this.bodyBuilder(MessageTypesEnum.Interactive, body, recipient.toString(), replyMessageId)),\n );\n }\n\n /**\n * Sends a location request message\n * @param body The location request message content\n * @param recipient Recipient phone number\n * @param replyMessageId Optional message ID to reply to\n * @returns Promise with the response\n */\n async interactiveLocationRequest(\n body: m.InteractiveObject & { type: InteractiveTypesEnum.LocationRequest },\n recipient: number,\n replyMessageId?: string,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n return this.send(\n JSON.stringify(this.bodyBuilder(MessageTypesEnum.Interactive, body, recipient.toString(), replyMessageId)),\n );\n }\n\n /**\n * Sends an address message to request shipping address from the user\n * Note: This feature is only available for businesses based in India and their India customers\n * @param body The address message content\n * @param recipient Recipient phone number\n * @param replyMessageId Optional message ID to reply to\n * @returns Promise with the response\n */\n async interactiveAddressMessage(\n body: m.InteractiveObject & { type: InteractiveTypesEnum.AddressMessage },\n recipient: number,\n replyMessageId?: string,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n return this.send(\n JSON.stringify(this.bodyBuilder(MessageTypesEnum.Interactive, body, recipient.toString(), replyMessageId)),\n );\n }\n\n /**\n * Sends an interactive reply buttons message\n * @param body The reply buttons message content\n * @param recipient Recipient phone number\n * @param replyMessageId Optional message ID to reply to\n * @returns Promise with the response\n */\n async interactiveReplyButtons(\n body: m.InteractiveObject & { type: InteractiveTypesEnum.Button },\n recipient: number,\n replyMessageId?: string,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n return this.send(\n JSON.stringify(this.bodyBuilder(MessageTypesEnum.Interactive, body, recipient.toString(), replyMessageId)),\n );\n }\n\n /**\n * Sends an interactive Flow message\n * @param body The Flow message content\n * @param recipient Recipient phone number\n * @param replyMessageId Optional message ID to reply to\n * @returns Promise with the response\n */\n async interactiveFlow(\n body: m.InteractiveObject & { type: InteractiveTypesEnum.Flow },\n recipient: number,\n replyMessageId?: string,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n return this.send(\n JSON.stringify(this.bodyBuilder(MessageTypesEnum.Interactive, body, recipient.toString(), replyMessageId)),\n );\n }\n\n /**\n * Sends a reaction to a message (emoji response)\n * @param messageId ID of the message to react to\n * @param emoji The emoji to send as reaction (e.g. \"😀\", \"❤️\", \"👍\")\n * @param recipient Recipient phone number\n * @returns Promise with the response\n */\n async reaction(\n messageId: string,\n emoji: string,\n recipient: number,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n const body = {\n messaging_product: 'whatsapp',\n recipient_type: 'individual',\n to: recipient.toString(),\n type: 'reaction',\n reaction: {\n message_id: messageId,\n emoji: emoji,\n },\n };\n\n return this.send(JSON.stringify(body));\n }\n}\n","import {\n PhoneNumberClass,\n PhoneNumberResponse,\n PhoneNumbersResponse,\n RequestVerificationCodeRequest,\n VerifyCodeRequest,\n} from 'src/types/phoneNumber';\nimport { objectToQueryString } from 'src/utils/objectToQueryString';\nimport type { WabaConfigType } from '../types/config';\nimport { HttpMethodsEnum, WabaConfigEnum } from '../types/enums';\nimport type { RequesterClass, RequesterResponseInterface, ResponseSuccess } from '../types/request';\nimport BaseAPI from './base';\n\nexport default class PhoneNumberApi extends BaseAPI implements PhoneNumberClass {\n private readonly endpoint = 'phone_numbers';\n\n constructor(config: WabaConfigType, client: RequesterClass) {\n super(config, client);\n }\n\n async getPhoneNumberById(fields?: string): Promise<RequesterResponseInterface<PhoneNumberResponse>> {\n const queryParams = fields ? objectToQueryString({ fields }) : '';\n return this.client.sendRequest(\n HttpMethodsEnum.Get,\n `${this.config[WabaConfigEnum.PhoneNumberId]}${queryParams}`,\n this.config[WabaConfigEnum.RequestTimeout],\n null,\n );\n }\n\n async getPhoneNumbers(): Promise<RequesterResponseInterface<PhoneNumbersResponse>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Get,\n `${this.config[WabaConfigEnum.BusinessAcctId]}/${this.endpoint}`,\n this.config[WabaConfigEnum.RequestTimeout],\n null,\n );\n }\n\n async requestVerificationCode(\n requestVerificationCodeRequest: RequestVerificationCodeRequest,\n ): Promise<RequesterResponseInterface<ResponseSuccess>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Post,\n `${this.config[WabaConfigEnum.PhoneNumberId]}/request_code`,\n this.config[WabaConfigEnum.RequestTimeout],\n JSON.stringify(requestVerificationCodeRequest),\n );\n }\n\n async verifyCode(verifyCodeRequest: VerifyCodeRequest): Promise<RequesterResponseInterface<ResponseSuccess>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Post,\n `${this.config[WabaConfigEnum.PhoneNumberId]}/verify_code`,\n this.config[WabaConfigEnum.RequestTimeout],\n JSON.stringify(verifyCodeRequest),\n );\n }\n}\n","import { HttpMethodsEnum, WabaConfigEnum } from '../types/enums';\nimport type { WabaConfigType } from '../types/config';\nimport type { RequesterClass, RequesterResponseInterface, ResponseSuccess } from '../types/request';\nimport BaseAPI from './base';\nimport {\n CreateQrCodeRequest,\n QrCodeClass,\n QrCodeResponse,\n QrCodesResponse,\n UpdateQrCodeRequest,\n} from '../types/qrCode';\n\nexport default class QrCodeAPI extends BaseAPI implements QrCodeClass {\n private readonly endpoint = 'message_qrdls';\n\n constructor(config: WabaConfigType, client: RequesterClass) {\n super(config, client);\n }\n\n async createQrCode(request: CreateQrCodeRequest): Promise<RequesterResponseInterface<QrCodeResponse>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Post,\n `${this.config[WabaConfigEnum.PhoneNumberId]}/${this.endpoint}`,\n this.config[WabaConfigEnum.RequestTimeout],\n JSON.stringify(request),\n );\n }\n\n async getQrCodes(): Promise<RequesterResponseInterface<QrCodesResponse>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Get,\n `${this.config[WabaConfigEnum.PhoneNumberId]}/${this.endpoint}`,\n this.config[WabaConfigEnum.RequestTimeout],\n null,\n );\n }\n\n async getQrCode(qrCodeId: string): Promise<RequesterResponseInterface<QrCodeResponse>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Get,\n `${this.config[WabaConfigEnum.PhoneNumberId]}/${this.endpoint}/${qrCodeId}`,\n this.config[WabaConfigEnum.RequestTimeout],\n null,\n );\n }\n\n async updateQrCode(request: UpdateQrCodeRequest): Promise<RequesterResponseInterface<QrCodeResponse>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Post,\n `${this.config[WabaConfigEnum.PhoneNumberId]}/${this.endpoint}`,\n this.config[WabaConfigEnum.RequestTimeout],\n JSON.stringify(request),\n );\n }\n\n async deleteQrCode(qrCodeId: string): Promise<RequesterResponseInterface<ResponseSuccess>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Delete,\n `${this.config[WabaConfigEnum.PhoneNumberId]}/${this.endpoint}/${qrCodeId}`,\n this.config[WabaConfigEnum.RequestTimeout],\n null,\n );\n }\n}\n","import { RegistrationClass } from '../types/registration';\nimport type { WabaConfigType } from '../types/config';\nimport { HttpMethodsEnum, WabaConfigEnum, DataLocalizationRegionEnum } from '../types/enums';\nimport type { RequesterClass, RequesterResponseInterface, ResponseSuccess } from '../types/request';\nimport BaseAPI from './base';\n\nexport default class RegistrationAPI extends BaseAPI implements RegistrationClass {\n constructor(config: WabaConfigType, client: RequesterClass) {\n super(config, client);\n }\n\n async register(\n pin: string,\n dataLocalizationRegion?: DataLocalizationRegionEnum,\n ): Promise<RequesterResponseInterface<ResponseSuccess>> {\n const body = {\n messaging_product: 'whatsapp',\n pin,\n ...(dataLocalizationRegion && { data_localization_region: dataLocalizationRegion }),\n };\n\n return this.client.sendRequest(\n HttpMethodsEnum.Post,\n `${this.config[WabaConfigEnum.PhoneNumberId]}/register`,\n this.config[WabaConfigEnum.RequestTimeout],\n JSON.stringify(body),\n );\n }\n\n async deregister(): Promise<RequesterResponseInterface<ResponseSuccess>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Post,\n `${this.config[WabaConfigEnum.PhoneNumberId]}/deregister`,\n this.config[WabaConfigEnum.RequestTimeout],\n null,\n );\n }\n}\n","import { objectToQueryString } from 'src/utils/objectToQueryString';\nimport type { WabaConfigType } from '../types/config';\nimport { HttpMethodsEnum, WabaConfigEnum } from '../types/enums';\nimport type { RequesterClass, RequesterResponseInterface, ResponsePagination, ResponseSuccess } from '../types/request';\nimport type {\n TemplateClass,\n TemplateDeleteParams,\n TemplateGetParams,\n TemplateRequestBody,\n TemplateResponse,\n} from '../types/template';\nimport BaseAPI from './base';\n\nexport default class TemplateApi extends BaseAPI implements TemplateClass {\n private readonly endpoint = 'message_templates';\n\n constructor(config: WabaConfigType, client: RequesterClass) {\n super(config, client);\n }\n\n async getTemplate(templateId: string): Promise<RequesterResponseInterface<TemplateResponse>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Get,\n `${templateId}`,\n this.config[WabaConfigEnum.RequestTimeout],\n null,\n );\n }\n\n async updateTemplate(\n templateId: string,\n template: Partial<TemplateRequestBody>,\n ): Promise<RequesterResponseInterface<ResponseSuccess>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Post,\n `${templateId}`,\n this.config[WabaConfigEnum.RequestTimeout],\n JSON.stringify(template),\n );\n }\n\n async getTemplates(\n params: TemplateGetParams,\n ): Promise<RequesterResponseInterface<ResponsePagination<TemplateResponse>>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Get,\n `${this.config[WabaConfigEnum.BusinessAcctId]}/${this.endpoint}${objectToQueryString(params)}`,\n this.config[WabaConfigEnum.RequestTimeout],\n null,\n );\n }\n\n async createTemplate(template: TemplateRequestBody): Promise<RequesterResponseInterface<TemplateResponse>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Post,\n `${this.config[WabaConfigEnum.BusinessAcctId]}/${this.endpoint}`,\n this.config[WabaConfigEnum.RequestTimeout],\n JSON.stringify(template),\n );\n }\n\n async deleteTemplate(params: TemplateDeleteParams): Promise<RequesterResponseInterface<ResponseSuccess>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Delete,\n `${this.config[WabaConfigEnum.BusinessAcctId]}/${this.endpoint}${objectToQueryString(params)}`,\n this.config[WabaConfigEnum.RequestTimeout],\n null,\n );\n }\n}\n","import { TwoStepVerificationClass } from '../types/twoStepVerification';\nimport type { WabaConfigType } from '../types/config';\nimport { HttpMethodsEnum, WabaConfigEnum } from '../types/enums';\nimport type { RequesterClass, RequesterResponseInterface, ResponseSuccess } from '../types/request';\nimport BaseAPI from './base';\n\nexport default class TwoStepVerificationAPI extends BaseAPI implements TwoStepVerificationClass {\n constructor(config: WabaConfigType, client: RequesterClass) {\n super(config, client);\n }\n\n async setTwoStepVerificationCode(pin: string): Promise<RequesterResponseInterface<ResponseSuccess>> {\n const body = {\n pin,\n };\n\n return this.client.sendRequest(\n HttpMethodsEnum.Post,\n `${this.config[WabaConfigEnum.PhoneNumberId]}`,\n this.config[WabaConfigEnum.RequestTimeout],\n JSON.stringify(body),\n );\n }\n}\n","import type { WabaConfigType } from '../types/config';\nimport { HttpMethodsEnum, WabaConfigEnum } from '../types/enums';\nimport type { RequesterClass, RequesterResponseInterface, ResponseSuccess } from '../types/request';\nimport { UpdateWabaSubscription, WABAClass, WabaSubscriptions } from '../types/waba';\nimport BaseAPI from './base';\n\nexport default class WabaAPI extends BaseAPI implements WABAClass {\n constructor(config: WabaConfigType, client: RequesterClass) {\n super(config, client);\n }\n\n async getAllWabaSubscriptions(): Promise<RequesterResponseInterface<WabaSubscriptions>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Get,\n `${this.config[WabaConfigEnum.BusinessAcctId]}/subscribed_apps`,\n this.config[WabaConfigEnum.RequestTimeout],\n null,\n );\n }\n\n async updateWabaSubscription({\n override_callback_uri,\n verify_token,\n }: UpdateWabaSubscription): Promise<RequesterResponseInterface<ResponseSuccess>> {\n const body = {\n override_callback_uri,\n verify_token,\n };\n return this.client.sendRequest(\n HttpMethodsEnum.Post,\n `${this.config[WabaConfigEnum.BusinessAcctId]}/subscribed_apps`,\n this.config[WabaConfigEnum.RequestTimeout],\n JSON.stringify(body),\n );\n }\n\n async unsubscribeFromWaba(): Promise<RequesterResponseInterface<ResponseSuccess>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Delete,\n `${this.config[WabaConfigEnum.BusinessAcctId]}/subscribed_apps`,\n this.config[WabaConfigEnum.RequestTimeout],\n null,\n );\n }\n}\n"],"mappings":"AAGA,IAAqBA,EAArB,KAAuD,CAC3C,KACA,MAER,YAAYC,EAAcC,EAAiB,GAAO,CAC9C,KAAK,KAAOD,EACZ,KAAK,MAAQC,CACjB,CAEA,OAAOC,EAAa,CAChB,GAAI,KAAK,MAAO,CACZ,IAAIC,EAAS,KAAK,KAAK,IAAI,CAAC,KACxB,KAAK,OACLA,GAAU,MAAM,KAAK,IAAI,IAE7B,QAAQ,IAAI,MAAM,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CAAM,CACxB,CAEA,MAAM,yBAAkF,CACpF,OAAO,KAAK,OAAO,kBAEf,GAAG,KAAK,OAAO,sBAA8B,mBAC7C,KAAK,OAAO,gBACZ,IACJ,CACJ,CAEA,MAAM,uBAAuB,CACzB,sBAAAC,EACA,aAAAC,CACJ,EAAiF,CAC7E,IAAMC,EAAO,CACT,sBAAAF,EACA,aAAAC,CACJ,EACA,OAAO,KAAK,OAAO,mBAEf,GAAG,KAAK,OAAO,sBAA8B,mBAC7C,KAAK,OAAO,gBACZ,KAAK,UAAUC,CAAI,CACvB,CACJ,CAEA,MAAM,qBAA4E,CAC9E,OAAO,KAAK,OAAO,qBAEf,GAAG,KAAK,OAAO,sBAA8B,mBAC7C,KAAK,OAAO,gBACZ,IACJ,CACJ,CACJ","names":["Logger","name","debug","data","prefix","LIB_NAME","LOG_LOCAL","LOGGER","Logger","BaseAPI","config","client","objectToQueryString","params","searchParams","key","value","queryString","BusinessProfileAPI","BaseAPI","config","client","fields","queryParams","objectToQueryString","updateRequest","fileLength","fileType","fileName","uploadId","file","EncryptionAPI","BaseAPI","config","client","businessPublicKey","formData","LIB_NAME","LOG_LOCAL","LOGGER","Logger","FlowAPI","BaseAPI","config","client","wabaId","data","formData","flowId","fields","dateFormat","params","queryString","MediaAPI","BaseAPI","config","client","mediaId","file","messagingProduct","formData","mediaUrl","MessagesApi","BaseAPI","config","client","type","payload","toNumber","replyMessageId","body","recipient","bodyToSend","messageId","emoji","PhoneNumberApi","BaseAPI","config","client","fields","queryParams","objectToQueryString","requestVerificationCodeRequest","verifyCodeRequest","QrCodeAPI","BaseAPI","config","client","request","qrCodeId","RegistrationAPI","BaseAPI","config","client","pin","dataLocalizationRegion","body","TemplateApi","BaseAPI","config","client","templateId","template","params","objectToQueryString","TwoStepVerificationAPI","BaseAPI","config","client","pin","body","WabaAPI","BaseAPI","config","client","override_callback_uri","verify_token","body"]}
1
+ {"version":3,"sources":["../../src/utils/logger.ts","../../src/api/base.ts","../../src/utils/objectToQueryString.ts","../../src/api/businessProfile.ts","../../src/api/encryption.ts","../../src/api/flow.ts","../../src/api/media.ts","../../src/api/messages.ts","../../src/api/phoneNumber.ts","../../src/api/qrCode.ts","../../src/api/registration.ts","../../src/api/template.ts","../../src/api/twoStepVerification.ts","../../src/api/waba.ts"],"sourcesContent":["// @ts-nocheck\nimport type { LoggerInterface } from '../types/logger';\n\nexport default class Logger implements LoggerInterface {\n private name: string;\n private debug: boolean;\n\n constructor(name: string, debug: boolean = false) {\n this.name = name;\n this.debug = debug;\n }\n\n log(...data: any[]) {\n if (this.debug) {\n let prefix = `[ ${Date.now()} ]`;\n if (this.name) {\n prefix += ` - ${this.name}`;\n }\n console.log.apply(console, [prefix, ': ', ...data]);\n }\n }\n\n error(...data: any[]) {\n let prefix = `[ ${Date.now()} ] - ERROR`;\n if (this.name) {\n prefix += ` - ${this.name}`;\n }\n console.error.apply(console, [prefix, ': ', ...data]);\n }\n\n warn(...data: any[]) {\n let prefix = `[ ${Date.now()} ] - WARN`;\n if (this.name) {\n prefix += ` - ${this.name}`;\n }\n console.warn.apply(console, [prefix, ': ', ...data]);\n }\n\n info(...data: any[]) {\n let prefix = `[ ${Date.now()} ] - INFO`;\n if (this.name) {\n prefix += ` - ${this.name}`;\n }\n console.info.apply(console, [prefix, ': ', ...data]);\n }\n}\n","import Logger from '../utils/logger';\nimport type { BaseClass } from '../types/base';\nimport type { WabaConfigType } from '../types/config';\nimport type { RequesterClass } from '../types/request';\n\nconst LIB_NAME = 'BaseAPI';\nconst LOG_LOCAL = false;\nconst LOGGER = new Logger(LIB_NAME, process.env.DEBUG === 'true' || LOG_LOCAL);\n\nexport default class BaseAPI implements BaseClass {\n protected config: WabaConfigType;\n protected client: RequesterClass;\n\n constructor(config: WabaConfigType, client: RequesterClass) {\n this.config = config;\n this.client = client;\n LOGGER.log('Initialized with HTTPSClient');\n }\n}\n","export const objectToQueryString = (params: Record<string, any>): string => {\n if (!params || Object.keys(params).length === 0) {\n return '';\n }\n\n const searchParams = new URLSearchParams();\n\n for (const [key, value] of Object.entries(params)) {\n if (value !== undefined) {\n searchParams.append(key, String(value));\n }\n }\n\n const queryString = searchParams.toString();\n return queryString ? `?${queryString}` : '';\n};\n","import {\n BusinessProfileClass,\n BusinessProfileResponse,\n UpdateBusinessProfileRequest,\n UploadBusinessProfileResponse,\n UploadHandle,\n UploadSessionResponse,\n} from '../types/businessProfile';\nimport type { WabaConfigType } from '../types/config';\nimport { HttpMethodsEnum, WabaConfigEnum } from '../types/enums';\nimport type { RequesterClass, RequesterResponseInterface, ResponseSuccess } from '../types/request';\nimport { objectToQueryString } from '../utils/objectToQueryString';\nimport BaseAPI from './base';\n\n/**\n * API for managing WhatsApp Business Profiles and profile pictures.\n *\n * This API allows you to:\n * - Get business profile information\n * - Update business profile details\n * - Upload profile pictures using a three-step process:\n * 1. Create an upload session\n * 2. Upload the image binary data\n * 3. Get the upload handle to use when updating the profile\n */\nexport default class BusinessProfileAPI extends BaseAPI implements BusinessProfileClass {\n private readonly endpoint = 'whatsapp_business_profile';\n\n constructor(config: WabaConfigType, client: RequesterClass) {\n super(config, client);\n }\n\n /**\n * Get your business profile information.\n *\n * Use this method to retrieve details about your WhatsApp business profile, including\n * about text, address, description, email, profile picture URL, websites, and vertical.\n *\n * @param fields Fields to be returned in the response. If not specified, all fields will be returned.\n * Possible values: about, address, description, email, profile_picture_url, websites, vertical\n * @returns The business profile information.\n *\n * @example\n * // Get all business profile fields\n * const profile = await whatsappClient.businessProfile.getBusinessProfile();\n *\n * // Get specific business profile fields\n * const profile = await whatsappClient.businessProfile.getBusinessProfile('about,address,email');\n */\n async getBusinessProfile(fields?: string): Promise<RequesterResponseInterface<BusinessProfileResponse>> {\n const queryParams = fields ? objectToQueryString({ fields }) : '';\n return this.client.sendRequest(\n HttpMethodsEnum.Get,\n `${this.config[WabaConfigEnum.PhoneNumberId]}/${this.endpoint}${queryParams}`,\n this.config[WabaConfigEnum.RequestTimeout],\n null,\n );\n }\n\n /**\n * Update your business profile.\n *\n * Use this method to update one or more fields of your WhatsApp business profile.\n *\n * @param updateRequest The request object containing the fields to update.\n * - messaging_product: Required. Always set to \"whatsapp\".\n * - about: Optional. Business's About text (1-139 characters).\n * - address: Optional. Business address (max 256 characters).\n * - description: Optional. Business description (max 512 characters).\n * - vertical: Optional. Business category (use BusinessVerticalEnum for type safety).\n * - email: Optional. Contact email (valid format, max 128 characters).\n * - websites: Optional. Up to 2 URLs (max 256 characters each).\n * - profile_picture_handle: Optional. Handle from upload process.\n * @returns Response indicating success or failure.\n *\n * @example\n * // Update business profile with multiple fields including vertical using enum\n * await whatsappClient.businessProfile.updateBusinessProfile({\n * messaging_product: 'whatsapp',\n * about: 'We provide excellent service',\n * email: 'contact@example.com',\n * websites: ['https://example.com'],\n * vertical: BusinessVerticalEnum.RETAIL\n * });\n */\n async updateBusinessProfile(\n updateRequest: UpdateBusinessProfileRequest,\n ): Promise<RequesterResponseInterface<ResponseSuccess>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Post,\n `${this.config[WabaConfigEnum.PhoneNumberId]}/${this.endpoint}`,\n this.config[WabaConfigEnum.RequestTimeout],\n JSON.stringify(updateRequest),\n );\n }\n\n /**\n * Create an upload session for a profile picture.\n *\n * This is the first step in the profile picture upload process.\n *\n * @param fileLength Length of the file to be uploaded in bytes.\n * @param fileType MIME type of the file (e.g., 'image/jpeg').\n * @param fileName Name of the file with extension.\n * @returns Response containing the upload session ID needed for the next step.\n *\n * @example\n * // Create upload session for profile picture\n * const session = await whatsappClient.businessProfile.createUploadSession(\n * fileBuffer.length,\n * 'image/jpeg',\n * 'profile.jpg'\n * );\n * const uploadSessionId = session.upload_session_id;\n */\n async createUploadSession(\n fileLength: number,\n fileType: string,\n fileName: string,\n ): Promise<RequesterResponseInterface<UploadSessionResponse>> {\n const queryParams = objectToQueryString({\n file_length: fileLength,\n file_type: fileType,\n file_name: fileName,\n });\n\n return this.client.sendRequest(\n HttpMethodsEnum.Post,\n `app/uploads/${queryParams}`,\n this.config[WabaConfigEnum.RequestTimeout],\n null,\n );\n }\n\n /**\n * Upload media file to the upload session.\n *\n * This is the second step in the profile picture upload process.\n * Upload the binary content of the file to the previously created upload session.\n *\n * @param uploadId The upload session ID from createUploadSession response.\n * @param file The binary data of the file (Buffer).\n * @returns Response indicating success or failure.\n *\n * @example\n * // Upload the actual file content\n * await whatsappClient.businessProfile.uploadMedia(\n * uploadSessionId,\n * fileBuffer\n * );\n */\n async uploadMedia(\n uploadId: string,\n file: Buffer,\n ): Promise<RequesterResponseInterface<UploadBusinessProfileResponse>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Post,\n `${uploadId}`,\n this.config[WabaConfigEnum.RequestTimeout],\n file,\n );\n }\n\n /**\n * Get the upload handle information.\n *\n * This is the third step in the profile picture upload process.\n * After uploading the file, get the handle to use when updating the profile.\n *\n * @param uploadId The upload session ID from createUploadSession response.\n * @returns Response containing the upload handle information.\n *\n * @example\n * // Complete profile picture update process\n * // 1. Create upload session\n * const session = await whatsappClient.businessProfile.createUploadSession(\n * fileBuffer.length, 'image/jpeg', 'profile.jpg'\n * );\n *\n * // 2. Upload the image data\n * await whatsappClient.businessProfile.uploadMedia(\n * session.upload_session_id, fileBuffer\n * );\n *\n * // 3. Get the handle for the uploaded file\n * const handleInfo = await whatsappClient.businessProfile.getUploadHandle(\n * session.upload_session_id\n * );\n *\n * // 4. Update profile with new picture and business information\n * await whatsappClient.businessProfile.updateBusinessProfile({\n * messaging_product: 'whatsapp',\n * profile_picture_handle: handleInfo.handle,\n * vertical: BusinessVerticalEnum.RESTAURANT,\n * about: 'Delicious food served daily'\n * });\n */\n async getUploadHandle(uploadId: string): Promise<RequesterResponseInterface<UploadHandle>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Get,\n `${uploadId}`,\n this.config[WabaConfigEnum.RequestTimeout],\n null,\n );\n }\n}\n","import { HttpMethodsEnum, WabaConfigEnum } from '../types/enums';\nimport type { WabaConfigType } from '../types/config';\nimport type { RequesterClass, RequesterResponseInterface, ResponseSuccess } from '../types/request';\nimport BaseAPI from './base';\nimport type { EncryptionClass, EncryptionPublicKeyResponse } from '../types/encryption';\n\nexport default class EncryptionAPI extends BaseAPI implements EncryptionClass {\n private readonly endpoint = 'whatsapp_business_encryption';\n\n constructor(config: WabaConfigType, client: RequesterClass) {\n super(config, client);\n }\n\n async getEncryptionPublicKey(): Promise<RequesterResponseInterface<EncryptionPublicKeyResponse>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Get,\n `${this.config[WabaConfigEnum.PhoneNumberId]}/${this.endpoint}`,\n this.config[WabaConfigEnum.RequestTimeout],\n null,\n );\n }\n\n async setEncryptionPublicKey(businessPublicKey: string): Promise<RequesterResponseInterface<ResponseSuccess>> {\n const formData = new FormData();\n formData.append('business_public_key', businessPublicKey);\n\n return this.client.sendRequest(\n HttpMethodsEnum.Post,\n `${this.config[WabaConfigEnum.PhoneNumberId]}/${this.endpoint}`,\n this.config[WabaConfigEnum.RequestTimeout],\n formData,\n );\n }\n}\n","import BaseAPI from './base';\nimport { WabaConfigType } from '../types/config';\nimport { HttpMethodsEnum, WabaConfigEnum } from '../types/enums';\nimport { RequesterClass, RequesterResponseInterface, ResponseSuccess } from '../types/request';\nimport {\n FlowClass,\n FlowsListResponse,\n FlowCategoryEnum,\n Flow,\n FlowPreviewResponse,\n FlowAssetsResponse,\n FlowValidationError,\n FlowMigrationResponse,\n} from '../types/flow';\nimport Logger from '../utils/logger';\n\nconst LIB_NAME = 'FlowAPI';\nconst LOG_LOCAL = false;\nconst LOGGER = new Logger(LIB_NAME, process.env.DEBUG === 'true' || LOG_LOCAL);\n\nexport default class FlowAPI extends BaseAPI implements FlowClass {\n constructor(config: WabaConfigType, client: RequesterClass) {\n super(config, client);\n LOGGER.log('FlowAPI initialized');\n }\n\n /**\n * List Flows\n *\n * @param wabaId - The WABA ID\n * @returns Promise with the list of flows\n */\n async listFlows(wabaId: string): Promise<RequesterResponseInterface<FlowsListResponse>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Get,\n `/${wabaId}/flows`,\n this.config[WabaConfigEnum.RequestTimeout],\n null,\n );\n }\n\n /**\n * Create Flow\n *\n * @param wabaId - The WABA ID\n * @param data - The flow data including name, categories, endpoint_uri, and optional clone_flow_id\n * @returns Promise with the created flow ID\n */\n async createFlow(\n wabaId: string,\n data: {\n name: string;\n categories?: FlowCategoryEnum[];\n endpoint_uri?: string;\n clone_flow_id?: string;\n flow_json?: string;\n publish?: boolean;\n },\n ): Promise<\n RequesterResponseInterface<{ id: string; success: boolean; validation_errors?: FlowValidationError[] }>\n > {\n const formData = new FormData();\n\n if (data.name) formData.append('name', data.name);\n if (data.categories) formData.append('categories', JSON.stringify(data.categories));\n if (data.endpoint_uri) formData.append('endpoint_uri', data.endpoint_uri);\n if (data.clone_flow_id) formData.append('clone_flow_id', data.clone_flow_id);\n if (data.flow_json) formData.append('flow_json', data.flow_json);\n if (data.publish !== undefined) formData.append('publish', String(data.publish));\n\n return this.client.sendRequest(\n HttpMethodsEnum.Post,\n `/${wabaId}/flows`,\n this.config[WabaConfigEnum.RequestTimeout],\n formData,\n );\n }\n\n /**\n * Get Flow\n *\n * @param flowId - The flow ID\n * @param fields - Optional fields to return\n * @param dateFormat - Optional date format\n * @returns Promise with the flow details\n */\n async getFlow(\n flowId: string,\n fields?: string,\n dateFormat?: string,\n ): Promise<RequesterResponseInterface<Flow | FlowPreviewResponse>> {\n const params = new URLSearchParams();\n if (fields) params.append('fields', fields);\n if (dateFormat) params.append('date_format', dateFormat);\n\n const queryString = params.toString() ? `?${params.toString()}` : '';\n return this.client.sendRequest(\n HttpMethodsEnum.Get,\n `/${flowId}${queryString}`,\n this.config[WabaConfigEnum.RequestTimeout],\n null,\n );\n }\n\n /**\n * Update Flow Metadata\n *\n * @param flowId - The flow ID\n * @param data - The flow metadata to update\n * @returns Promise with the success status\n */\n async updateFlowMetadata(\n flowId: string,\n data: {\n name?: string;\n categories?: FlowCategoryEnum[];\n endpoint_uri?: string;\n application_id?: string;\n },\n ): Promise<RequesterResponseInterface<ResponseSuccess>> {\n const formData = new FormData();\n\n if (data.name) formData.append('name', data.name);\n if (data.categories) formData.append('categories', JSON.stringify(data.categories));\n if (data.endpoint_uri) formData.append('endpoint_uri', data.endpoint_uri);\n if (data.application_id) formData.append('application_id', data.application_id);\n\n return this.client.sendRequest(\n HttpMethodsEnum.Post,\n `/${flowId}`,\n this.config[WabaConfigEnum.RequestTimeout],\n formData,\n );\n }\n\n /**\n * Delete Flow\n *\n * @param flowId - The flow ID\n * @returns Promise with the success status\n */\n async deleteFlow(flowId: string): Promise<RequesterResponseInterface<ResponseSuccess>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Delete,\n `/${flowId}`,\n this.config[WabaConfigEnum.RequestTimeout],\n null,\n );\n }\n\n /**\n * List Assets (Get Flow JSON URL)\n *\n * @param flowId - The flow ID\n * @returns Promise with the list of assets\n */\n async listAssets(flowId: string): Promise<RequesterResponseInterface<FlowAssetsResponse>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Get,\n `/${flowId}/assets`,\n this.config[WabaConfigEnum.RequestTimeout],\n null,\n );\n }\n\n /**\n * Update Flow JSON\n *\n * @param flowId - The flow ID\n * @param data - The asset data including asset_type, file, and name\n * @returns Promise with the success status and validation errors\n */\n async updateFlowJson(\n flowId: string,\n data: {\n asset_type: 'FLOW_JSON';\n file: Blob;\n name: string;\n },\n ): Promise<RequesterResponseInterface<{ success: boolean; validation_errors?: FlowValidationError[] }>> {\n const formData = new FormData();\n\n formData.append('asset_type', data.asset_type);\n formData.append('file', data.file);\n formData.append('name', data.name);\n\n return this.client.sendRequest(\n HttpMethodsEnum.Post,\n `/${flowId}/assets`,\n this.config[WabaConfigEnum.RequestTimeout],\n formData,\n );\n }\n\n /**\n * Publish Flow\n *\n * @param flowId - The flow ID\n * @returns Promise with the success status\n */\n async publishFlow(flowId: string): Promise<RequesterResponseInterface<ResponseSuccess>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Post,\n `/${flowId}/publish`,\n this.config[WabaConfigEnum.RequestTimeout],\n JSON.stringify({}),\n );\n }\n\n /**\n * Deprecate Flow\n *\n * @param flowId - The flow ID\n * @returns Promise with the success status\n */\n async deprecateFlow(flowId: string): Promise<RequesterResponseInterface<ResponseSuccess>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Post,\n `/${flowId}/deprecate`,\n this.config[WabaConfigEnum.RequestTimeout],\n JSON.stringify({}),\n );\n }\n\n /**\n * Migrate Flows\n *\n * @param wabaId - The destination WABA ID\n * @param data - The migration data including source_waba_id and optional source_flow_names\n * @returns Promise with migration results\n */\n async migrateFlows(\n wabaId: string,\n data: {\n source_waba_id: string;\n source_flow_names?: string[];\n },\n ): Promise<RequesterResponseInterface<FlowMigrationResponse>> {\n const formData = new FormData();\n\n formData.append('source_waba_id', data.source_waba_id);\n if (data.source_flow_names) {\n formData.append('source_flow_names', JSON.stringify(data.source_flow_names));\n }\n\n return this.client.sendRequest(\n HttpMethodsEnum.Post,\n `/${wabaId}/migrate_flows`,\n this.config[WabaConfigEnum.RequestTimeout],\n formData,\n );\n }\n}\n","import { HttpMethodsEnum, WabaConfigEnum } from '../types/enums';\nimport type { RequesterClass, RequesterResponseInterface, ResponseSuccess } from '../types/request';\nimport type { WabaConfigType } from '../types/config';\nimport type { MediaClass, MediaResponse, MediasResponse, UploadMediaResponse } from '../types/media';\nimport BaseAPI from './base';\n\nexport default class MediaAPI extends BaseAPI implements MediaClass {\n private readonly endpoint = 'media';\n\n constructor(config: WabaConfigType, client: RequesterClass) {\n super(config, client);\n }\n\n async getMediaById(mediaId: string): Promise<RequesterResponseInterface<MediaResponse>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Get,\n `${mediaId}`,\n this.config[WabaConfigEnum.RequestTimeout],\n null,\n );\n }\n\n async uploadMedia(\n file: File,\n messagingProduct: string = 'whatsapp',\n ): Promise<RequesterResponseInterface<UploadMediaResponse>> {\n const formData = new FormData();\n formData.append('file', file);\n formData.append('messaging_product', messagingProduct);\n formData.append('type', file.type);\n\n return this.client.sendRequest(\n HttpMethodsEnum.Post,\n `${this.config[WabaConfigEnum.PhoneNumberId]}/${this.endpoint}`,\n this.config[WabaConfigEnum.RequestTimeout],\n formData,\n );\n }\n\n async deleteMedia(mediaId: string): Promise<RequesterResponseInterface<ResponseSuccess>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Delete,\n `${mediaId}`,\n this.config[WabaConfigEnum.RequestTimeout],\n null,\n );\n }\n\n async downloadMedia(mediaUrl: string): Promise<RequesterResponseInterface<Blob>> {\n return this.client.sendRequest(HttpMethodsEnum.Get, mediaUrl, this.config[WabaConfigEnum.RequestTimeout], null);\n }\n}\n","import type { WabaConfigType } from '../types/config';\nimport {\n ComponentTypesEnum,\n HttpMethodsEnum,\n InteractiveTypesEnum,\n MessageTypesEnum,\n WabaConfigEnum,\n} from '../types/enums';\n\nimport * as m from '../types/messages';\nimport type { RequesterClass, RequesterResponseInterface } from '../types/request';\nimport BaseAPI from './base';\n\n/**\n * Maps each message type to its appropriate payload type\n */\nexport type MessagePayloadType<T extends MessageTypesEnum> = T extends MessageTypesEnum.Audio\n ? m.AudioMediaObject\n : T extends MessageTypesEnum.Contacts\n ? [m.ContactObject]\n : T extends MessageTypesEnum.Document\n ? m.DocumentMediaObject\n : T extends MessageTypesEnum.Image\n ? m.ImageMediaObject\n : T extends MessageTypesEnum.Interactive\n ? m.InteractiveObject\n : T extends MessageTypesEnum.Location\n ? m.LocationObject\n : T extends MessageTypesEnum.Template\n ? m.MessageTemplateObject<ComponentTypesEnum>\n : T extends MessageTypesEnum.Sticker\n ? m.StickerMediaObject\n : T extends MessageTypesEnum.Text\n ? m.TextObject\n : T extends MessageTypesEnum.Video\n ? m.VideoMediaObject\n : T extends MessageTypesEnum.Reaction\n ? { message_id: string; emoji: string }\n : never;\n\nexport default class MessagesApi extends BaseAPI implements m.MessagesClass {\n private readonly commonMethod = HttpMethodsEnum.Post;\n private readonly commonEndpoint = 'messages';\n\n constructor(config: WabaConfigType, client: RequesterClass) {\n super(config, client);\n }\n\n /**\n * Builds the request body for WhatsApp API messages\n * @param type The type of message to send\n * @param payload The message payload object\n * @param toNumber The recipient's phone number\n * @param replyMessageId Optional message ID to reply to\n * @returns The formatted request body\n */\n bodyBuilder<T extends MessageTypesEnum>(\n type: T,\n payload: MessagePayloadType<T>,\n to: string,\n replyMessageId?: string,\n ) {\n const body: m.MessageRequestBody<T> = {\n messaging_product: 'whatsapp',\n recipient_type: 'individual',\n to,\n type,\n [type]: payload,\n };\n\n if (replyMessageId) body['context'] = { message_id: replyMessageId };\n\n return body;\n }\n\n /**\n * Sends a request to the WhatsApp API\n * @param body The request body to send\n * @returns Promise with the API response\n */\n private send(body: BodyInit | null): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n return this.client.sendRequest(\n this.commonMethod,\n `${this.config[WabaConfigEnum.PhoneNumberId]}/${this.commonEndpoint}`,\n this.config[WabaConfigEnum.RequestTimeout],\n body,\n );\n }\n\n /**\n * Sends an audio message via WhatsApp\n * @param body The audio media object\n * @param to Recipient's phone number\n * @param replyMessageId Optional message ID to reply to\n * @returns Promise with the message response\n */\n async audio(\n body: m.AudioMediaObject,\n to: string,\n replyMessageId?: string,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n return this.send(JSON.stringify(this.bodyBuilder(MessageTypesEnum.Audio, body, to, replyMessageId)));\n }\n\n /**\n * Sends a contact card via WhatsApp\n * @param body The contact object\n * @param to Recipient's phone number\n * @param replyMessageId Optional message ID to reply to\n * @returns Promise with the message response\n */\n async contacts(\n body: [m.ContactObject],\n to: string,\n replyMessageId?: string,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n return this.send(JSON.stringify(this.bodyBuilder(MessageTypesEnum.Contacts, body, to, replyMessageId)));\n }\n\n /**\n * Sends a document via WhatsApp\n * @param body The document media object\n * @param to Recipient's phone number\n * @param replyMessageId Optional message ID to reply to\n * @returns Promise with the message response\n */\n async document(\n body: m.DocumentMediaObject,\n to: string,\n replyMessageId?: string,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n return this.send(JSON.stringify(this.bodyBuilder(MessageTypesEnum.Document, body, to, replyMessageId)));\n }\n\n /**\n * Sends an image via WhatsApp\n * @param body The image media object\n * @param to Recipient's phone number\n * @param replyMessageId Optional message ID to reply to\n * @returns Promise with the message response\n */\n async image(\n body: m.ImageMediaObject,\n to: string,\n replyMessageId?: string,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n return this.send(JSON.stringify(this.bodyBuilder(MessageTypesEnum.Image, body, to, replyMessageId)));\n }\n\n /**\n * Sends an interactive message via WhatsApp\n * @param body The interactive object (buttons, lists, etc.)\n * @param to Recipient's phone number\n * @param replyMessageId Optional message ID to reply to\n * @returns Promise with the message response\n */\n async interactive(\n body: m.InteractiveObject,\n to: string,\n replyMessageId?: string,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n return this.send(JSON.stringify(this.bodyBuilder(MessageTypesEnum.Interactive, body, to, replyMessageId)));\n }\n\n /**\n * Sends a location via WhatsApp\n * @param body The location object with coordinates\n * @param to Recipient's phone number\n * @param replyMessageId Optional message ID to reply to\n * @returns Promise with the message response\n */\n async location(\n body: m.LocationObject,\n to: string,\n replyMessageId?: string,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n return this.send(JSON.stringify(this.bodyBuilder(MessageTypesEnum.Location, body, to, replyMessageId)));\n }\n\n /**\n * Sends a sticker via WhatsApp\n * @param body The sticker media object\n * @param to Recipient's phone number\n * @param replyMessageId Optional message ID to reply to\n * @returns Promise with the message response\n */\n async sticker(\n body: m.StickerMediaObject,\n to: string,\n replyMessageId?: string,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n return this.send(JSON.stringify(this.bodyBuilder(MessageTypesEnum.Sticker, body, to, replyMessageId)));\n }\n\n /**\n * Sends a template message via WhatsApp\n * @param body The message template object\n * @param to Recipient's phone number\n * @param replyMessageId Optional message ID to reply to\n * @returns Promise with the message response\n */\n async template(\n body: m.MessageTemplateObject<ComponentTypesEnum>,\n to: string,\n replyMessageId?: string,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n return this.send(JSON.stringify(this.bodyBuilder(MessageTypesEnum.Template, body, to, replyMessageId)));\n }\n\n /**\n * Sends a text message via WhatsApp\n * @param body The text object containing the message\n * @param to Recipient's phone number\n * @param replyMessageId Optional message ID to reply to\n * @returns Promise with the message response\n */\n async text(\n body: m.TextObject,\n to: string,\n replyMessageId?: string,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n return this.send(JSON.stringify(this.bodyBuilder(MessageTypesEnum.Text, body, to, replyMessageId)));\n }\n\n /**\n * Sends a video via WhatsApp\n * @param body The video media object\n * @param to Recipient's phone number\n * @param replyMessageId Optional message ID to reply to\n * @returns Promise with the message response\n */\n async video(\n body: m.VideoMediaObject,\n to: string,\n replyMessageId?: string,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n return this.send(JSON.stringify(this.bodyBuilder(MessageTypesEnum.Video, body, to, replyMessageId)));\n }\n\n /**\n * Updates message status (used for read receipts and typing indicators)\n * @param body The status object\n * @returns Promise with the response\n */\n async status(body: m.StatusObject): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n const bodyToSend = {\n messaging_product: 'whatsapp',\n ...body,\n };\n\n return this.send(JSON.stringify(bodyToSend));\n }\n\n /**\n * Marks a message as read in WhatsApp\n * @param messageId ID of the message to mark as read\n * @returns Promise with the response\n */\n async markAsRead(messageId: string): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n return this.status({\n status: 'read',\n message_id: messageId,\n });\n }\n\n /**\n * Marks a message as read and shows a typing indicator in WhatsApp\n * @param messageId ID of the message to mark as read\n * @returns Promise with the response\n */\n async showTypingIndicator(messageId: string): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n return this.status({\n status: 'read',\n message_id: messageId,\n typing_indicator: {\n type: 'text',\n },\n });\n }\n\n /**\n * Sends an interactive list message\n * @param body The list message content\n * @param to Recipient phone number\n * @param replyMessageId Optional message ID to reply to\n * @returns Promise with the response\n */\n async interactiveList(\n body: m.InteractiveObject & { type: InteractiveTypesEnum.List },\n to: string,\n replyMessageId?: string,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n return this.send(JSON.stringify(this.bodyBuilder(MessageTypesEnum.Interactive, body, to, replyMessageId)));\n }\n\n /**\n * Sends an interactive CTA URL message\n * @param body The CTA URL message content\n * @param to Recipient phone number\n * @param replyMessageId Optional message ID to reply to\n * @returns Promise with the response\n */\n async interactiveCtaUrl(\n body: m.InteractiveObject & { type: InteractiveTypesEnum.CtaUrl },\n to: string,\n replyMessageId?: string,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n return this.send(JSON.stringify(this.bodyBuilder(MessageTypesEnum.Interactive, body, to, replyMessageId)));\n }\n\n /**\n * Sends a location request message\n * @param body The location request message content\n * @param to Recipient phone number\n * @param replyMessageId Optional message ID to reply to\n * @returns Promise with the response\n */\n async interactiveLocationRequest(\n body: m.InteractiveObject & { type: InteractiveTypesEnum.LocationRequest },\n to: string,\n replyMessageId?: string,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n return this.send(JSON.stringify(this.bodyBuilder(MessageTypesEnum.Interactive, body, to, replyMessageId)));\n }\n\n /**\n * Sends an address message to request shipping address from the user\n * Note: This feature is only available for businesses based in India and their India customers\n * @param body The address message content\n * @param to Recipient phone number\n * @param replyMessageId Optional message ID to reply to\n * @returns Promise with the response\n */\n async interactiveAddressMessage(\n body: m.InteractiveObject & { type: InteractiveTypesEnum.AddressMessage },\n to: string,\n replyMessageId?: string,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n return this.send(JSON.stringify(this.bodyBuilder(MessageTypesEnum.Interactive, body, to, replyMessageId)));\n }\n\n /**\n * Sends an interactive reply buttons message\n * @param body The reply buttons message content\n * @param to Recipient phone number\n * @param replyMessageId Optional message ID to reply to\n * @returns Promise with the response\n */\n async interactiveReplyButtons(\n body: m.InteractiveObject & { type: InteractiveTypesEnum.Button },\n to: string,\n replyMessageId?: string,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n return this.send(JSON.stringify(this.bodyBuilder(MessageTypesEnum.Interactive, body, to, replyMessageId)));\n }\n\n /**\n * Sends an interactive Flow message\n * @param body The Flow message content\n * @param to Recipient phone number\n * @param replyMessageId Optional message ID to reply to\n * @returns Promise with the response\n */\n async interactiveFlow(\n body: m.InteractiveObject & { type: InteractiveTypesEnum.Flow },\n to: string,\n replyMessageId?: string,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n return this.send(JSON.stringify(this.bodyBuilder(MessageTypesEnum.Interactive, body, to, replyMessageId)));\n }\n\n /**\n * Sends a reaction to a message (emoji response)\n * @param messageId ID of the message to react to\n * @param emoji The emoji to send as reaction (e.g. \"😀\", \"❤️\", \"👍\")\n * @param to Recipient phone number\n * @returns Promise with the response\n */\n async reaction(\n messageId: string,\n emoji: string,\n to: string,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n const body = {\n messaging_product: 'whatsapp',\n recipient_type: 'individual',\n to: to,\n type: 'reaction',\n reaction: {\n message_id: messageId,\n emoji: emoji,\n },\n };\n\n return this.send(JSON.stringify(body));\n }\n}\n","import {\n PhoneNumberClass,\n PhoneNumberResponse,\n PhoneNumbersResponse,\n RequestVerificationCodeRequest,\n VerifyCodeRequest,\n} from 'src/types/phoneNumber';\nimport { objectToQueryString } from 'src/utils/objectToQueryString';\nimport type { WabaConfigType } from '../types/config';\nimport { HttpMethodsEnum, WabaConfigEnum } from '../types/enums';\nimport type { RequesterClass, RequesterResponseInterface, ResponseSuccess } from '../types/request';\nimport BaseAPI from './base';\n\nexport default class PhoneNumberApi extends BaseAPI implements PhoneNumberClass {\n private readonly endpoint = 'phone_numbers';\n\n constructor(config: WabaConfigType, client: RequesterClass) {\n super(config, client);\n }\n\n async getPhoneNumberById(fields?: string): Promise<RequesterResponseInterface<PhoneNumberResponse>> {\n const queryParams = fields ? objectToQueryString({ fields }) : '';\n return this.client.sendRequest(\n HttpMethodsEnum.Get,\n `${this.config[WabaConfigEnum.PhoneNumberId]}${queryParams}`,\n this.config[WabaConfigEnum.RequestTimeout],\n null,\n );\n }\n\n async getPhoneNumbers(): Promise<RequesterResponseInterface<PhoneNumbersResponse>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Get,\n `${this.config[WabaConfigEnum.BusinessAcctId]}/${this.endpoint}`,\n this.config[WabaConfigEnum.RequestTimeout],\n null,\n );\n }\n\n async requestVerificationCode(\n requestVerificationCodeRequest: RequestVerificationCodeRequest,\n ): Promise<RequesterResponseInterface<ResponseSuccess>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Post,\n `${this.config[WabaConfigEnum.PhoneNumberId]}/request_code`,\n this.config[WabaConfigEnum.RequestTimeout],\n JSON.stringify(requestVerificationCodeRequest),\n );\n }\n\n async verifyCode(verifyCodeRequest: VerifyCodeRequest): Promise<RequesterResponseInterface<ResponseSuccess>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Post,\n `${this.config[WabaConfigEnum.PhoneNumberId]}/verify_code`,\n this.config[WabaConfigEnum.RequestTimeout],\n JSON.stringify(verifyCodeRequest),\n );\n }\n}\n","import { HttpMethodsEnum, WabaConfigEnum } from '../types/enums';\nimport type { WabaConfigType } from '../types/config';\nimport type { RequesterClass, RequesterResponseInterface, ResponseSuccess } from '../types/request';\nimport BaseAPI from './base';\nimport {\n CreateQrCodeRequest,\n QrCodeClass,\n QrCodeResponse,\n QrCodesResponse,\n UpdateQrCodeRequest,\n} from '../types/qrCode';\n\nexport default class QrCodeAPI extends BaseAPI implements QrCodeClass {\n private readonly endpoint = 'message_qrdls';\n\n constructor(config: WabaConfigType, client: RequesterClass) {\n super(config, client);\n }\n\n async createQrCode(request: CreateQrCodeRequest): Promise<RequesterResponseInterface<QrCodeResponse>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Post,\n `${this.config[WabaConfigEnum.PhoneNumberId]}/${this.endpoint}`,\n this.config[WabaConfigEnum.RequestTimeout],\n JSON.stringify(request),\n );\n }\n\n async getQrCodes(): Promise<RequesterResponseInterface<QrCodesResponse>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Get,\n `${this.config[WabaConfigEnum.PhoneNumberId]}/${this.endpoint}`,\n this.config[WabaConfigEnum.RequestTimeout],\n null,\n );\n }\n\n async getQrCode(qrCodeId: string): Promise<RequesterResponseInterface<QrCodeResponse>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Get,\n `${this.config[WabaConfigEnum.PhoneNumberId]}/${this.endpoint}/${qrCodeId}`,\n this.config[WabaConfigEnum.RequestTimeout],\n null,\n );\n }\n\n async updateQrCode(request: UpdateQrCodeRequest): Promise<RequesterResponseInterface<QrCodeResponse>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Post,\n `${this.config[WabaConfigEnum.PhoneNumberId]}/${this.endpoint}`,\n this.config[WabaConfigEnum.RequestTimeout],\n JSON.stringify(request),\n );\n }\n\n async deleteQrCode(qrCodeId: string): Promise<RequesterResponseInterface<ResponseSuccess>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Delete,\n `${this.config[WabaConfigEnum.PhoneNumberId]}/${this.endpoint}/${qrCodeId}`,\n this.config[WabaConfigEnum.RequestTimeout],\n null,\n );\n }\n}\n","import { RegistrationClass } from '../types/registration';\nimport type { WabaConfigType } from '../types/config';\nimport { HttpMethodsEnum, WabaConfigEnum, DataLocalizationRegionEnum } from '../types/enums';\nimport type { RequesterClass, RequesterResponseInterface, ResponseSuccess } from '../types/request';\nimport BaseAPI from './base';\n\nexport default class RegistrationAPI extends BaseAPI implements RegistrationClass {\n constructor(config: WabaConfigType, client: RequesterClass) {\n super(config, client);\n }\n\n async register(\n pin: string,\n dataLocalizationRegion?: DataLocalizationRegionEnum,\n ): Promise<RequesterResponseInterface<ResponseSuccess>> {\n const body = {\n messaging_product: 'whatsapp',\n pin,\n ...(dataLocalizationRegion && { data_localization_region: dataLocalizationRegion }),\n };\n\n return this.client.sendRequest(\n HttpMethodsEnum.Post,\n `${this.config[WabaConfigEnum.PhoneNumberId]}/register`,\n this.config[WabaConfigEnum.RequestTimeout],\n JSON.stringify(body),\n );\n }\n\n async deregister(): Promise<RequesterResponseInterface<ResponseSuccess>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Post,\n `${this.config[WabaConfigEnum.PhoneNumberId]}/deregister`,\n this.config[WabaConfigEnum.RequestTimeout],\n null,\n );\n }\n}\n","import { objectToQueryString } from 'src/utils/objectToQueryString';\nimport type { WabaConfigType } from '../types/config';\nimport { HttpMethodsEnum, WabaConfigEnum } from '../types/enums';\nimport type { RequesterClass, RequesterResponseInterface, ResponsePagination, ResponseSuccess } from '../types/request';\nimport type {\n TemplateClass,\n TemplateDeleteParams,\n TemplateGetParams,\n TemplateRequestBody,\n TemplateResponse,\n} from '../types/template';\nimport BaseAPI from './base';\n\nexport default class TemplateApi extends BaseAPI implements TemplateClass {\n private readonly endpoint = 'message_templates';\n\n constructor(config: WabaConfigType, client: RequesterClass) {\n super(config, client);\n }\n\n async getTemplate(templateId: string): Promise<RequesterResponseInterface<TemplateResponse>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Get,\n `${templateId}`,\n this.config[WabaConfigEnum.RequestTimeout],\n null,\n );\n }\n\n async updateTemplate(\n templateId: string,\n template: Partial<TemplateRequestBody>,\n ): Promise<RequesterResponseInterface<ResponseSuccess>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Post,\n `${templateId}`,\n this.config[WabaConfigEnum.RequestTimeout],\n JSON.stringify(template),\n );\n }\n\n async getTemplates(\n params: TemplateGetParams,\n ): Promise<RequesterResponseInterface<ResponsePagination<TemplateResponse>>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Get,\n `${this.config[WabaConfigEnum.BusinessAcctId]}/${this.endpoint}${objectToQueryString(params)}`,\n this.config[WabaConfigEnum.RequestTimeout],\n null,\n );\n }\n\n async createTemplate(template: TemplateRequestBody): Promise<RequesterResponseInterface<TemplateResponse>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Post,\n `${this.config[WabaConfigEnum.BusinessAcctId]}/${this.endpoint}`,\n this.config[WabaConfigEnum.RequestTimeout],\n JSON.stringify(template),\n );\n }\n\n async deleteTemplate(params: TemplateDeleteParams): Promise<RequesterResponseInterface<ResponseSuccess>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Delete,\n `${this.config[WabaConfigEnum.BusinessAcctId]}/${this.endpoint}${objectToQueryString(params)}`,\n this.config[WabaConfigEnum.RequestTimeout],\n null,\n );\n }\n}\n","import { TwoStepVerificationClass } from '../types/twoStepVerification';\nimport type { WabaConfigType } from '../types/config';\nimport { HttpMethodsEnum, WabaConfigEnum } from '../types/enums';\nimport type { RequesterClass, RequesterResponseInterface, ResponseSuccess } from '../types/request';\nimport BaseAPI from './base';\n\nexport default class TwoStepVerificationAPI extends BaseAPI implements TwoStepVerificationClass {\n constructor(config: WabaConfigType, client: RequesterClass) {\n super(config, client);\n }\n\n async setTwoStepVerificationCode(pin: string): Promise<RequesterResponseInterface<ResponseSuccess>> {\n const body = {\n pin,\n };\n\n return this.client.sendRequest(\n HttpMethodsEnum.Post,\n `${this.config[WabaConfigEnum.PhoneNumberId]}`,\n this.config[WabaConfigEnum.RequestTimeout],\n JSON.stringify(body),\n );\n }\n}\n","import type { WabaConfigType } from '../types/config';\nimport { HttpMethodsEnum, WabaConfigEnum } from '../types/enums';\nimport type { RequesterClass, RequesterResponseInterface, ResponseSuccess } from '../types/request';\nimport { UpdateWabaSubscription, WABAClass, WabaSubscriptions } from '../types/waba';\nimport BaseAPI from './base';\n\nexport default class WabaAPI extends BaseAPI implements WABAClass {\n constructor(config: WabaConfigType, client: RequesterClass) {\n super(config, client);\n }\n\n async getAllWabaSubscriptions(): Promise<RequesterResponseInterface<WabaSubscriptions>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Get,\n `${this.config[WabaConfigEnum.BusinessAcctId]}/subscribed_apps`,\n this.config[WabaConfigEnum.RequestTimeout],\n null,\n );\n }\n\n async updateWabaSubscription({\n override_callback_uri,\n verify_token,\n }: UpdateWabaSubscription): Promise<RequesterResponseInterface<ResponseSuccess>> {\n const body = {\n override_callback_uri,\n verify_token,\n };\n return this.client.sendRequest(\n HttpMethodsEnum.Post,\n `${this.config[WabaConfigEnum.BusinessAcctId]}/subscribed_apps`,\n this.config[WabaConfigEnum.RequestTimeout],\n JSON.stringify(body),\n );\n }\n\n async unsubscribeFromWaba(): Promise<RequesterResponseInterface<ResponseSuccess>> {\n return this.client.sendRequest(\n HttpMethodsEnum.Delete,\n `${this.config[WabaConfigEnum.BusinessAcctId]}/subscribed_apps`,\n this.config[WabaConfigEnum.RequestTimeout],\n null,\n );\n }\n}\n"],"mappings":"AAGA,IAAqBA,EAArB,KAAuD,CAC3C,KACA,MAER,YAAYC,EAAcC,EAAiB,GAAO,CAC9C,KAAK,KAAOD,EACZ,KAAK,MAAQC,CACjB,CAEA,OAAOC,EAAa,CAChB,GAAI,KAAK,MAAO,CACZ,IAAIC,EAAS,KAAK,KAAK,IAAI,CAAC,KACxB,KAAK,OACLA,GAAU,MAAM,KAAK,IAAI,IAE7B,QAAQ,IAAI,MAAM,QAAS,CAACA,EAAQ,KAAM,GAAGD,CAAI,CAAC,CACtD,CACJ,CAEA,SAASA,EAAa,CAClB,IAAIC,EAAS,KAAK,KAAK,IAAI,CAAC,aACxB,KAAK,OACLA,GAAU,MAAM,KAAK,IAAI,IAE7B,QAAQ,MAAM,MAAM,QAAS,CAACA,EAAQ,KAAM,GAAGD,CAAI,CAAC,CACxD,CAEA,QAAQA,EAAa,CACjB,IAAIC,EAAS,KAAK,KAAK,IAAI,CAAC,YACxB,KAAK,OACLA,GAAU,MAAM,KAAK,IAAI,IAE7B,QAAQ,KAAK,MAAM,QAAS,CAACA,EAAQ,KAAM,GAAGD,CAAI,CAAC,CACvD,CAEA,QAAQA,EAAa,CACjB,IAAIC,EAAS,KAAK,KAAK,IAAI,CAAC,YACxB,KAAK,OACLA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MAAM,eAAeC,EAAoF,CACrG,OAAO,KAAK,OAAO,qBAEf,GAAG,KAAK,OAAO,sBAA8B,IAAI,KAAK,QAAQ,GAAGC,EAAoBD,CAAM,CAAC,GAC5F,KAAK,OAAO,gBACZ,IACJ,CACJ,CACJ,EC/DA,IAAqBE,EAArB,cAAoDC,CAA4C,CAC5F,YAAYC,EAAwBC,EAAwB,CACxD,MAAMD,EAAQC,CAAM,CACxB,CAEA,MAAM,2BAA2BC,EAAmE,CAChG,IAAMC,EAAO,CACT,IAAAD,CACJ,EAEA,OAAO,KAAK,OAAO,mBAEf,GAAG,KAAK,OAAO,kBAA6B,GAC5C,KAAK,OAAO,gBACZ,KAAK,UAAUC,CAAI,CACvB,CACJ,CACJ,ECjBA,IAAqBC,EAArB,cAAqCC,CAA6B,CAC9D,YAAYC,EAAwBC,EAAwB,CACxD,MAAMD,EAAQC,CAAM,CACxB,CAEA,MAAM,yBAAkF,CACpF,OAAO,KAAK,OAAO,kBAEf,GAAG,KAAK,OAAO,sBAA8B,mBAC7C,KAAK,OAAO,gBACZ,IACJ,CACJ,CAEA,MAAM,uBAAuB,CACzB,sBAAAC,EACA,aAAAC,CACJ,EAAiF,CAC7E,IAAMC,EAAO,CACT,sBAAAF,EACA,aAAAC,CACJ,EACA,OAAO,KAAK,OAAO,mBAEf,GAAG,KAAK,OAAO,sBAA8B,mBAC7C,KAAK,OAAO,gBACZ,KAAK,UAAUC,CAAI,CACvB,CACJ,CAEA,MAAM,qBAA4E,CAC9E,OAAO,KAAK,OAAO,qBAEf,GAAG,KAAK,OAAO,sBAA8B,mBAC7C,KAAK,OAAO,gBACZ,IACJ,CACJ,CACJ","names":["Logger","name","debug","data","prefix","LIB_NAME","LOG_LOCAL","LOGGER","Logger","BaseAPI","config","client","objectToQueryString","params","searchParams","key","value","queryString","BusinessProfileAPI","BaseAPI","config","client","fields","queryParams","objectToQueryString","updateRequest","fileLength","fileType","fileName","uploadId","file","EncryptionAPI","BaseAPI","config","client","businessPublicKey","formData","LIB_NAME","LOG_LOCAL","LOGGER","Logger","FlowAPI","BaseAPI","config","client","wabaId","data","formData","flowId","fields","dateFormat","params","queryString","MediaAPI","BaseAPI","config","client","mediaId","file","messagingProduct","formData","mediaUrl","MessagesApi","BaseAPI","config","client","type","payload","to","replyMessageId","body","bodyToSend","messageId","emoji","PhoneNumberApi","BaseAPI","config","client","fields","queryParams","objectToQueryString","requestVerificationCodeRequest","verifyCodeRequest","QrCodeAPI","BaseAPI","config","client","request","qrCodeId","RegistrationAPI","BaseAPI","config","client","pin","dataLocalizationRegion","body","TemplateApi","BaseAPI","config","client","templateId","template","params","objectToQueryString","TwoStepVerificationAPI","BaseAPI","config","client","pin","body","WabaAPI","BaseAPI","config","client","override_callback_uri","verify_token","body"]}
@@ -24,7 +24,7 @@ declare class MessagesApi extends BaseAPI implements MessagesClass {
24
24
  * @param replyMessageId Optional message ID to reply to
25
25
  * @returns The formatted request body
26
26
  */
27
- bodyBuilder<T extends MessageTypesEnum>(type: T, payload: MessagePayloadType<T>, toNumber: string, replyMessageId?: string): MessageRequestBody<T>;
27
+ bodyBuilder<T extends MessageTypesEnum>(type: T, payload: MessagePayloadType<T>, to: string, replyMessageId?: string): MessageRequestBody<T>;
28
28
  /**
29
29
  * Sends a request to the WhatsApp API
30
30
  * @param body The request body to send
@@ -34,83 +34,83 @@ declare class MessagesApi extends BaseAPI implements MessagesClass {
34
34
  /**
35
35
  * Sends an audio message via WhatsApp
36
36
  * @param body The audio media object
37
- * @param recipient Recipient's phone number
37
+ * @param to Recipient's phone number
38
38
  * @param replyMessageId Optional message ID to reply to
39
39
  * @returns Promise with the message response
40
40
  */
41
- audio(body: AudioMediaObject, recipient: number, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
41
+ audio(body: AudioMediaObject, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
42
42
  /**
43
43
  * Sends a contact card via WhatsApp
44
44
  * @param body The contact object
45
- * @param recipient Recipient's phone number
45
+ * @param to Recipient's phone number
46
46
  * @param replyMessageId Optional message ID to reply to
47
47
  * @returns Promise with the message response
48
48
  */
49
- contacts(body: [ContactObject], recipient: number, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
49
+ contacts(body: [ContactObject], to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
50
50
  /**
51
51
  * Sends a document via WhatsApp
52
52
  * @param body The document media object
53
- * @param recipient Recipient's phone number
53
+ * @param to Recipient's phone number
54
54
  * @param replyMessageId Optional message ID to reply to
55
55
  * @returns Promise with the message response
56
56
  */
57
- document(body: DocumentMediaObject, recipient: number, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
57
+ document(body: DocumentMediaObject, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
58
58
  /**
59
59
  * Sends an image via WhatsApp
60
60
  * @param body The image media object
61
- * @param recipient Recipient's phone number
61
+ * @param to Recipient's phone number
62
62
  * @param replyMessageId Optional message ID to reply to
63
63
  * @returns Promise with the message response
64
64
  */
65
- image(body: ImageMediaObject, recipient: number, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
65
+ image(body: ImageMediaObject, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
66
66
  /**
67
67
  * Sends an interactive message via WhatsApp
68
68
  * @param body The interactive object (buttons, lists, etc.)
69
- * @param recipient Recipient's phone number
69
+ * @param to Recipient's phone number
70
70
  * @param replyMessageId Optional message ID to reply to
71
71
  * @returns Promise with the message response
72
72
  */
73
- interactive(body: InteractiveObject, recipient: number, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
73
+ interactive(body: InteractiveObject, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
74
74
  /**
75
75
  * Sends a location via WhatsApp
76
76
  * @param body The location object with coordinates
77
- * @param recipient Recipient's phone number
77
+ * @param to Recipient's phone number
78
78
  * @param replyMessageId Optional message ID to reply to
79
79
  * @returns Promise with the message response
80
80
  */
81
- location(body: LocationObject, recipient: number, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
81
+ location(body: LocationObject, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
82
82
  /**
83
83
  * Sends a sticker via WhatsApp
84
84
  * @param body The sticker media object
85
- * @param recipient Recipient's phone number
85
+ * @param to Recipient's phone number
86
86
  * @param replyMessageId Optional message ID to reply to
87
87
  * @returns Promise with the message response
88
88
  */
89
- sticker(body: StickerMediaObject, recipient: number, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
89
+ sticker(body: StickerMediaObject, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
90
90
  /**
91
91
  * Sends a template message via WhatsApp
92
92
  * @param body The message template object
93
- * @param recipient Recipient's phone number
93
+ * @param to Recipient's phone number
94
94
  * @param replyMessageId Optional message ID to reply to
95
95
  * @returns Promise with the message response
96
96
  */
97
- template(body: MessageTemplateObject<ComponentTypesEnum>, recipient: number, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
97
+ template(body: MessageTemplateObject<ComponentTypesEnum>, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
98
98
  /**
99
99
  * Sends a text message via WhatsApp
100
100
  * @param body The text object containing the message
101
- * @param recipient Recipient's phone number
101
+ * @param to Recipient's phone number
102
102
  * @param replyMessageId Optional message ID to reply to
103
103
  * @returns Promise with the message response
104
104
  */
105
- text(body: TextObject, recipient: number, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
105
+ text(body: TextObject, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
106
106
  /**
107
107
  * Sends a video via WhatsApp
108
108
  * @param body The video media object
109
- * @param recipient Recipient's phone number
109
+ * @param to Recipient's phone number
110
110
  * @param replyMessageId Optional message ID to reply to
111
111
  * @returns Promise with the message response
112
112
  */
113
- video(body: VideoMediaObject, recipient: number, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
113
+ video(body: VideoMediaObject, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
114
114
  /**
115
115
  * Updates message status (used for read receipts and typing indicators)
116
116
  * @param body The status object
@@ -132,72 +132,72 @@ declare class MessagesApi extends BaseAPI implements MessagesClass {
132
132
  /**
133
133
  * Sends an interactive list message
134
134
  * @param body The list message content
135
- * @param recipient Recipient phone number
135
+ * @param to Recipient phone number
136
136
  * @param replyMessageId Optional message ID to reply to
137
137
  * @returns Promise with the response
138
138
  */
139
139
  interactiveList(body: InteractiveObject & {
140
140
  type: InteractiveTypesEnum.List;
141
- }, recipient: number, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
141
+ }, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
142
142
  /**
143
143
  * Sends an interactive CTA URL message
144
144
  * @param body The CTA URL message content
145
- * @param recipient Recipient phone number
145
+ * @param to Recipient phone number
146
146
  * @param replyMessageId Optional message ID to reply to
147
147
  * @returns Promise with the response
148
148
  */
149
149
  interactiveCtaUrl(body: InteractiveObject & {
150
150
  type: InteractiveTypesEnum.CtaUrl;
151
- }, recipient: number, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
151
+ }, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
152
152
  /**
153
153
  * Sends a location request message
154
154
  * @param body The location request message content
155
- * @param recipient Recipient phone number
155
+ * @param to Recipient phone number
156
156
  * @param replyMessageId Optional message ID to reply to
157
157
  * @returns Promise with the response
158
158
  */
159
159
  interactiveLocationRequest(body: InteractiveObject & {
160
160
  type: InteractiveTypesEnum.LocationRequest;
161
- }, recipient: number, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
161
+ }, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
162
162
  /**
163
163
  * Sends an address message to request shipping address from the user
164
164
  * Note: This feature is only available for businesses based in India and their India customers
165
165
  * @param body The address message content
166
- * @param recipient Recipient phone number
166
+ * @param to Recipient phone number
167
167
  * @param replyMessageId Optional message ID to reply to
168
168
  * @returns Promise with the response
169
169
  */
170
170
  interactiveAddressMessage(body: InteractiveObject & {
171
171
  type: InteractiveTypesEnum.AddressMessage;
172
- }, recipient: number, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
172
+ }, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
173
173
  /**
174
174
  * Sends an interactive reply buttons message
175
175
  * @param body The reply buttons message content
176
- * @param recipient Recipient phone number
176
+ * @param to Recipient phone number
177
177
  * @param replyMessageId Optional message ID to reply to
178
178
  * @returns Promise with the response
179
179
  */
180
180
  interactiveReplyButtons(body: InteractiveObject & {
181
181
  type: InteractiveTypesEnum.Button;
182
- }, recipient: number, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
182
+ }, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
183
183
  /**
184
184
  * Sends an interactive Flow message
185
185
  * @param body The Flow message content
186
- * @param recipient Recipient phone number
186
+ * @param to Recipient phone number
187
187
  * @param replyMessageId Optional message ID to reply to
188
188
  * @returns Promise with the response
189
189
  */
190
190
  interactiveFlow(body: InteractiveObject & {
191
191
  type: InteractiveTypesEnum.Flow;
192
- }, recipient: number, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
192
+ }, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
193
193
  /**
194
194
  * Sends a reaction to a message (emoji response)
195
195
  * @param messageId ID of the message to react to
196
196
  * @param emoji The emoji to send as reaction (e.g. "😀", "❤️", "👍")
197
- * @param recipient Recipient phone number
197
+ * @param to Recipient phone number
198
198
  * @returns Promise with the response
199
199
  */
200
- reaction(messageId: string, emoji: string, recipient: number): Promise<RequesterResponseInterface<MessagesResponse>>;
200
+ reaction(messageId: string, emoji: string, to: string): Promise<RequesterResponseInterface<MessagesResponse>>;
201
201
  }
202
202
 
203
203
  export { type MessagePayloadType, MessagesApi as default };