meta-cloud-api 0.0.18 → 0.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/index.js +1 -1
- package/dist/api/index.js.map +1 -1
- package/dist/api/index.mjs +1 -1
- package/dist/api/index.mjs.map +1 -1
- package/dist/api/messages.d.mts +73 -83
- package/dist/api/messages.d.ts +73 -83
- package/dist/api/messages.js +1 -1
- package/dist/api/messages.js.map +1 -1
- package/dist/api/messages.mjs +1 -1
- package/dist/api/messages.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/messages.d.mts +87 -92
- package/dist/types/messages.d.ts +87 -92
- package/dist/types/messages.js +1 -1
- package/dist/types/messages.js.map +1 -1
- package/dist/whatsapp.js +1 -1
- package/dist/whatsapp.js.map +1 -1
- package/dist/whatsapp.mjs +1 -1
- package/dist/whatsapp.mjs.map +1 -1
- package/package.json +1 -1
package/dist/api/index.mjs.map
CHANGED
|
@@ -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 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.Business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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"]}
|
|
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\n// Request object interface type definitions\nexport interface MessageRequestParams<T> {\n body: T;\n to: string;\n replyMessageId?: string;\n}\n\nexport interface TextMessageParams extends MessageRequestParams<m.TextObject | string> {\n previewUrl?: boolean;\n}\n\nexport interface ReactionParams {\n messageId: string;\n emoji: string;\n to: string;\n}\n\nexport interface StatusParams {\n status: string;\n messageId: string;\n typingIndicator?: {\n type: string;\n };\n}\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 to 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 params The audio message parameter object\n * @returns Promise with the message response\n */\n async audio(\n params: m.MessageRequestParams<m.AudioMediaObject>,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n const { body, to, replyMessageId } = params;\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 params The contact message parameter object\n * @returns Promise with the message response\n */\n async contacts(\n params: m.MessageRequestParams<[m.ContactObject]>,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n const { body, to, replyMessageId } = params;\n return this.send(JSON.stringify(this.bodyBuilder(MessageTypesEnum.Contacts, body, to, replyMessageId)));\n }\n\n /**\n * Sends a document via WhatsApp\n * @param params The document message parameter object\n * @returns Promise with the message response\n */\n async document(\n params: m.MessageRequestParams<m.DocumentMediaObject>,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n const { body, to, replyMessageId } = params;\n return this.send(JSON.stringify(this.bodyBuilder(MessageTypesEnum.Document, body, to, replyMessageId)));\n }\n\n /**\n * Sends an image via WhatsApp\n * @param params The image message parameter object\n * @returns Promise with the message response\n */\n async image(\n params: m.MessageRequestParams<m.ImageMediaObject>,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n const { body, to, replyMessageId } = params;\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 params The interactive message parameter object\n * @returns Promise with the message response\n */\n async interactive(\n params: m.MessageRequestParams<m.InteractiveObject>,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n const { body, to, replyMessageId } = params;\n return this.send(JSON.stringify(this.bodyBuilder(MessageTypesEnum.Interactive, body, to, replyMessageId)));\n }\n\n /**\n * Sends a location via WhatsApp\n * @param params The location message parameter object\n * @returns Promise with the message response\n */\n async location(\n params: m.MessageRequestParams<m.LocationObject>,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n const { body, to, replyMessageId } = params;\n return this.send(JSON.stringify(this.bodyBuilder(MessageTypesEnum.Location, body, to, replyMessageId)));\n }\n\n /**\n * Sends a sticker via WhatsApp\n * @param params The sticker message parameter object\n * @returns Promise with the message response\n */\n async sticker(\n params: m.MessageRequestParams<m.StickerMediaObject>,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n const { body, to, replyMessageId } = params;\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 params The template message parameter object\n * @returns Promise with the message response\n */\n async template(\n params: m.MessageRequestParams<m.MessageTemplateObject<ComponentTypesEnum>>,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n const { body, to, replyMessageId } = params;\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 params The text message parameter object\n * @returns Promise with the message response\n */\n async text(params: m.TextMessageParams): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n const { body, previewUrl, to, replyMessageId } = params;\n\n let textObject: m.TextObject;\n if (typeof body === 'string') {\n textObject = {\n body: body,\n preview_url: previewUrl,\n };\n } else {\n textObject = body;\n }\n\n return this.send(JSON.stringify(this.bodyBuilder(MessageTypesEnum.Text, textObject, to, replyMessageId)));\n }\n\n /**\n * Sends a video via WhatsApp\n * @param params The video message parameter object\n * @returns Promise with the message response\n */\n async video(\n params: m.MessageRequestParams<m.VideoMediaObject>,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n const { body, to, replyMessageId } = params;\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 params The status update parameter object\n * @returns Promise with the response\n */\n async status(params: m.StatusParams): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n const { status, messageId, typingIndicator } = params;\n\n const bodyToSend = {\n messaging_product: 'whatsapp',\n status: status,\n message_id: messageId,\n ...(typingIndicator && { typing_indicator: typingIndicator }),\n };\n\n return this.send(JSON.stringify(bodyToSend));\n }\n\n /**\n * Marks a message as read in WhatsApp\n * @param params The parameter object to mark message as read\n * @returns Promise with the response\n */\n async markAsRead(params: { messageId: string }): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n return this.status({\n status: 'read',\n messageId: params.messageId,\n });\n }\n\n /**\n * Marks a message as read and shows a typing indicator in WhatsApp\n * @param params The typing indicator parameter object\n * @returns Promise with the response\n */\n async showTypingIndicator(params: { messageId: string }): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n return this.status({\n status: 'read',\n messageId: params.messageId,\n typingIndicator: {\n type: 'text',\n },\n });\n }\n\n /**\n * Sends an interactive list message\n * @param params The list message parameter object\n * @returns Promise with the response\n */\n async interactiveList(\n params: m.MessageRequestParams<m.InteractiveObject & { type: InteractiveTypesEnum.List }>,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n const { body, to, replyMessageId } = params;\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 params The CTA URL message parameter object\n * @returns Promise with the response\n */\n async interactiveCtaUrl(\n params: m.MessageRequestParams<m.InteractiveObject & { type: InteractiveTypesEnum.CtaUrl }>,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n const { body, to, replyMessageId } = params;\n return this.send(JSON.stringify(this.bodyBuilder(MessageTypesEnum.Interactive, body, to, replyMessageId)));\n }\n\n /**\n * Sends a location request message\n * @param params The location request message parameter object\n * @returns Promise with the response\n */\n async interactiveLocationRequest(\n params: m.MessageRequestParams<m.InteractiveObject & { type: InteractiveTypesEnum.LocationRequest }>,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n const { body, to, replyMessageId } = params;\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 params The address message parameter object\n * @returns Promise with the response\n */\n async interactiveAddressMessage(\n params: m.MessageRequestParams<m.InteractiveObject & { type: InteractiveTypesEnum.AddressMessage }>,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n const { body, to, replyMessageId } = params;\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 params The reply buttons message parameter object\n * @returns Promise with the response\n */\n async interactiveReplyButtons(\n params: m.MessageRequestParams<m.InteractiveObject & { type: InteractiveTypesEnum.Button }>,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n const { body, to, replyMessageId } = params;\n return this.send(JSON.stringify(this.bodyBuilder(MessageTypesEnum.Interactive, body, to, replyMessageId)));\n }\n\n /**\n * Sends an interactive Flow message\n * @param params The Flow message parameter object\n * @returns Promise with the response\n */\n async interactiveFlow(\n params: m.MessageRequestParams<m.InteractiveObject & { type: InteractiveTypesEnum.Flow }>,\n ): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n const { body, to, replyMessageId } = params;\n\n // Apply default values for FlowParameters\n if (body.action.parameters.flow_message_version === undefined) {\n body.action.parameters.flow_message_version = '3';\n }\n if (body.action.parameters.mode === undefined) {\n body.action.parameters.mode = 'published';\n }\n if (body.action.parameters.flow_action === undefined) {\n body.action.parameters.flow_action = 'navigate';\n }\n if (body.action.parameters.flow_action_payload?.screen === undefined) {\n body.action.parameters.flow_action_payload = {\n ...body.action.parameters.flow_action_payload,\n screen: 'FIRST_ENTRY_SCREEN',\n };\n }\n\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 params The reaction message parameter object\n * @returns Promise with the response\n */\n async reaction(params: m.ReactionParams): Promise<RequesterResponseInterface<m.MessagesResponse>> {\n const { messageId, emoji, to } = params;\n\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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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","params","previewUrl","textObject","status","messageId","typingIndicator","bodyToSend","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"]}
|
package/dist/api/messages.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { WabaConfigType } from '../types/config.mjs';
|
|
2
2
|
import { M as MessageTypesEnum, b as ComponentTypesEnum, I as InteractiveTypesEnum } from '../enums-DLut7LZL.mjs';
|
|
3
|
-
import { MessagesClass, AudioMediaObject, ContactObject, DocumentMediaObject, ImageMediaObject, InteractiveObject, LocationObject, MessageTemplateObject, StickerMediaObject, TextObject, VideoMediaObject, MessageRequestBody, MessagesResponse,
|
|
3
|
+
import { MessagesClass, AudioMediaObject, ContactObject, DocumentMediaObject, ImageMediaObject, InteractiveObject, LocationObject, MessageTemplateObject, StickerMediaObject, TextObject, VideoMediaObject, MessageRequestBody, MessageRequestParams as MessageRequestParams$1, MessagesResponse, TextMessageParams as TextMessageParams$1, StatusParams as StatusParams$1, ReactionParams as ReactionParams$1 } from '../types/messages.mjs';
|
|
4
4
|
import { RequesterClass, RequesterResponseInterface } from '../types/request.mjs';
|
|
5
5
|
import BaseAPI from './base.mjs';
|
|
6
6
|
import '../types/base.mjs';
|
|
@@ -12,6 +12,26 @@ type MessagePayloadType<T extends MessageTypesEnum> = T extends MessageTypesEnum
|
|
|
12
12
|
message_id: string;
|
|
13
13
|
emoji: string;
|
|
14
14
|
} : never;
|
|
15
|
+
interface MessageRequestParams<T> {
|
|
16
|
+
body: T;
|
|
17
|
+
to: string;
|
|
18
|
+
replyMessageId?: string;
|
|
19
|
+
}
|
|
20
|
+
interface TextMessageParams extends MessageRequestParams<TextObject | string> {
|
|
21
|
+
previewUrl?: boolean;
|
|
22
|
+
}
|
|
23
|
+
interface ReactionParams {
|
|
24
|
+
messageId: string;
|
|
25
|
+
emoji: string;
|
|
26
|
+
to: string;
|
|
27
|
+
}
|
|
28
|
+
interface StatusParams {
|
|
29
|
+
status: string;
|
|
30
|
+
messageId: string;
|
|
31
|
+
typingIndicator?: {
|
|
32
|
+
type: string;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
15
35
|
declare class MessagesApi extends BaseAPI implements MessagesClass {
|
|
16
36
|
private readonly commonMethod;
|
|
17
37
|
private readonly commonEndpoint;
|
|
@@ -20,7 +40,7 @@ declare class MessagesApi extends BaseAPI implements MessagesClass {
|
|
|
20
40
|
* Builds the request body for WhatsApp API messages
|
|
21
41
|
* @param type The type of message to send
|
|
22
42
|
* @param payload The message payload object
|
|
23
|
-
* @param
|
|
43
|
+
* @param to The recipient's phone number
|
|
24
44
|
* @param replyMessageId Optional message ID to reply to
|
|
25
45
|
* @returns The formatted request body
|
|
26
46
|
*/
|
|
@@ -33,171 +53,141 @@ declare class MessagesApi extends BaseAPI implements MessagesClass {
|
|
|
33
53
|
private send;
|
|
34
54
|
/**
|
|
35
55
|
* Sends an audio message via WhatsApp
|
|
36
|
-
* @param
|
|
37
|
-
* @param to Recipient's phone number
|
|
38
|
-
* @param replyMessageId Optional message ID to reply to
|
|
56
|
+
* @param params The audio message parameter object
|
|
39
57
|
* @returns Promise with the message response
|
|
40
58
|
*/
|
|
41
|
-
audio(
|
|
59
|
+
audio(params: MessageRequestParams$1<AudioMediaObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
42
60
|
/**
|
|
43
61
|
* Sends a contact card via WhatsApp
|
|
44
|
-
* @param
|
|
45
|
-
* @param to Recipient's phone number
|
|
46
|
-
* @param replyMessageId Optional message ID to reply to
|
|
62
|
+
* @param params The contact message parameter object
|
|
47
63
|
* @returns Promise with the message response
|
|
48
64
|
*/
|
|
49
|
-
contacts(
|
|
65
|
+
contacts(params: MessageRequestParams$1<[ContactObject]>): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
50
66
|
/**
|
|
51
67
|
* Sends a document via WhatsApp
|
|
52
|
-
* @param
|
|
53
|
-
* @param to Recipient's phone number
|
|
54
|
-
* @param replyMessageId Optional message ID to reply to
|
|
68
|
+
* @param params The document message parameter object
|
|
55
69
|
* @returns Promise with the message response
|
|
56
70
|
*/
|
|
57
|
-
document(
|
|
71
|
+
document(params: MessageRequestParams$1<DocumentMediaObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
58
72
|
/**
|
|
59
73
|
* Sends an image via WhatsApp
|
|
60
|
-
* @param
|
|
61
|
-
* @param to Recipient's phone number
|
|
62
|
-
* @param replyMessageId Optional message ID to reply to
|
|
74
|
+
* @param params The image message parameter object
|
|
63
75
|
* @returns Promise with the message response
|
|
64
76
|
*/
|
|
65
|
-
image(
|
|
77
|
+
image(params: MessageRequestParams$1<ImageMediaObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
66
78
|
/**
|
|
67
79
|
* Sends an interactive message via WhatsApp
|
|
68
|
-
* @param
|
|
69
|
-
* @param to Recipient's phone number
|
|
70
|
-
* @param replyMessageId Optional message ID to reply to
|
|
80
|
+
* @param params The interactive message parameter object
|
|
71
81
|
* @returns Promise with the message response
|
|
72
82
|
*/
|
|
73
|
-
interactive(
|
|
83
|
+
interactive(params: MessageRequestParams$1<InteractiveObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
74
84
|
/**
|
|
75
85
|
* Sends a location via WhatsApp
|
|
76
|
-
* @param
|
|
77
|
-
* @param to Recipient's phone number
|
|
78
|
-
* @param replyMessageId Optional message ID to reply to
|
|
86
|
+
* @param params The location message parameter object
|
|
79
87
|
* @returns Promise with the message response
|
|
80
88
|
*/
|
|
81
|
-
location(
|
|
89
|
+
location(params: MessageRequestParams$1<LocationObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
82
90
|
/**
|
|
83
91
|
* Sends a sticker via WhatsApp
|
|
84
|
-
* @param
|
|
85
|
-
* @param to Recipient's phone number
|
|
86
|
-
* @param replyMessageId Optional message ID to reply to
|
|
92
|
+
* @param params The sticker message parameter object
|
|
87
93
|
* @returns Promise with the message response
|
|
88
94
|
*/
|
|
89
|
-
sticker(
|
|
95
|
+
sticker(params: MessageRequestParams$1<StickerMediaObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
90
96
|
/**
|
|
91
97
|
* Sends a template message via WhatsApp
|
|
92
|
-
* @param
|
|
93
|
-
* @param to Recipient's phone number
|
|
94
|
-
* @param replyMessageId Optional message ID to reply to
|
|
98
|
+
* @param params The template message parameter object
|
|
95
99
|
* @returns Promise with the message response
|
|
96
100
|
*/
|
|
97
|
-
template(
|
|
101
|
+
template(params: MessageRequestParams$1<MessageTemplateObject<ComponentTypesEnum>>): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
98
102
|
/**
|
|
99
103
|
* Sends a text message via WhatsApp
|
|
100
|
-
* @param
|
|
101
|
-
* @param to Recipient's phone number
|
|
102
|
-
* @param replyMessageId Optional message ID to reply to
|
|
104
|
+
* @param params The text message parameter object
|
|
103
105
|
* @returns Promise with the message response
|
|
104
106
|
*/
|
|
105
|
-
text(
|
|
107
|
+
text(params: TextMessageParams$1): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
106
108
|
/**
|
|
107
109
|
* Sends a video via WhatsApp
|
|
108
|
-
* @param
|
|
109
|
-
* @param to Recipient's phone number
|
|
110
|
-
* @param replyMessageId Optional message ID to reply to
|
|
110
|
+
* @param params The video message parameter object
|
|
111
111
|
* @returns Promise with the message response
|
|
112
112
|
*/
|
|
113
|
-
video(
|
|
113
|
+
video(params: MessageRequestParams$1<VideoMediaObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
114
114
|
/**
|
|
115
115
|
* Updates message status (used for read receipts and typing indicators)
|
|
116
|
-
* @param
|
|
116
|
+
* @param params The status update parameter object
|
|
117
117
|
* @returns Promise with the response
|
|
118
118
|
*/
|
|
119
|
-
status(
|
|
119
|
+
status(params: StatusParams$1): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
120
120
|
/**
|
|
121
121
|
* Marks a message as read in WhatsApp
|
|
122
|
-
* @param
|
|
122
|
+
* @param params The parameter object to mark message as read
|
|
123
123
|
* @returns Promise with the response
|
|
124
124
|
*/
|
|
125
|
-
markAsRead(
|
|
125
|
+
markAsRead(params: {
|
|
126
|
+
messageId: string;
|
|
127
|
+
}): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
126
128
|
/**
|
|
127
129
|
* Marks a message as read and shows a typing indicator in WhatsApp
|
|
128
|
-
* @param
|
|
130
|
+
* @param params The typing indicator parameter object
|
|
129
131
|
* @returns Promise with the response
|
|
130
132
|
*/
|
|
131
|
-
showTypingIndicator(
|
|
133
|
+
showTypingIndicator(params: {
|
|
134
|
+
messageId: string;
|
|
135
|
+
}): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
132
136
|
/**
|
|
133
137
|
* Sends an interactive list message
|
|
134
|
-
* @param
|
|
135
|
-
* @param to Recipient phone number
|
|
136
|
-
* @param replyMessageId Optional message ID to reply to
|
|
138
|
+
* @param params The list message parameter object
|
|
137
139
|
* @returns Promise with the response
|
|
138
140
|
*/
|
|
139
|
-
interactiveList(
|
|
141
|
+
interactiveList(params: MessageRequestParams$1<InteractiveObject & {
|
|
140
142
|
type: InteractiveTypesEnum.List;
|
|
141
|
-
}
|
|
143
|
+
}>): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
142
144
|
/**
|
|
143
145
|
* Sends an interactive CTA URL message
|
|
144
|
-
* @param
|
|
145
|
-
* @param to Recipient phone number
|
|
146
|
-
* @param replyMessageId Optional message ID to reply to
|
|
146
|
+
* @param params The CTA URL message parameter object
|
|
147
147
|
* @returns Promise with the response
|
|
148
148
|
*/
|
|
149
|
-
interactiveCtaUrl(
|
|
149
|
+
interactiveCtaUrl(params: MessageRequestParams$1<InteractiveObject & {
|
|
150
150
|
type: InteractiveTypesEnum.CtaUrl;
|
|
151
|
-
}
|
|
151
|
+
}>): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
152
152
|
/**
|
|
153
153
|
* Sends a location request message
|
|
154
|
-
* @param
|
|
155
|
-
* @param to Recipient phone number
|
|
156
|
-
* @param replyMessageId Optional message ID to reply to
|
|
154
|
+
* @param params The location request message parameter object
|
|
157
155
|
* @returns Promise with the response
|
|
158
156
|
*/
|
|
159
|
-
interactiveLocationRequest(
|
|
157
|
+
interactiveLocationRequest(params: MessageRequestParams$1<InteractiveObject & {
|
|
160
158
|
type: InteractiveTypesEnum.LocationRequest;
|
|
161
|
-
}
|
|
159
|
+
}>): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
162
160
|
/**
|
|
163
161
|
* Sends an address message to request shipping address from the user
|
|
164
162
|
* Note: This feature is only available for businesses based in India and their India customers
|
|
165
|
-
* @param
|
|
166
|
-
* @param to Recipient phone number
|
|
167
|
-
* @param replyMessageId Optional message ID to reply to
|
|
163
|
+
* @param params The address message parameter object
|
|
168
164
|
* @returns Promise with the response
|
|
169
165
|
*/
|
|
170
|
-
interactiveAddressMessage(
|
|
166
|
+
interactiveAddressMessage(params: MessageRequestParams$1<InteractiveObject & {
|
|
171
167
|
type: InteractiveTypesEnum.AddressMessage;
|
|
172
|
-
}
|
|
168
|
+
}>): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
173
169
|
/**
|
|
174
170
|
* Sends an interactive reply buttons message
|
|
175
|
-
* @param
|
|
176
|
-
* @param to Recipient phone number
|
|
177
|
-
* @param replyMessageId Optional message ID to reply to
|
|
171
|
+
* @param params The reply buttons message parameter object
|
|
178
172
|
* @returns Promise with the response
|
|
179
173
|
*/
|
|
180
|
-
interactiveReplyButtons(
|
|
174
|
+
interactiveReplyButtons(params: MessageRequestParams$1<InteractiveObject & {
|
|
181
175
|
type: InteractiveTypesEnum.Button;
|
|
182
|
-
}
|
|
176
|
+
}>): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
183
177
|
/**
|
|
184
178
|
* Sends an interactive Flow message
|
|
185
|
-
* @param
|
|
186
|
-
* @param to Recipient phone number
|
|
187
|
-
* @param replyMessageId Optional message ID to reply to
|
|
179
|
+
* @param params The Flow message parameter object
|
|
188
180
|
* @returns Promise with the response
|
|
189
181
|
*/
|
|
190
|
-
interactiveFlow(
|
|
182
|
+
interactiveFlow(params: MessageRequestParams$1<InteractiveObject & {
|
|
191
183
|
type: InteractiveTypesEnum.Flow;
|
|
192
|
-
}
|
|
184
|
+
}>): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
193
185
|
/**
|
|
194
186
|
* Sends a reaction to a message (emoji response)
|
|
195
|
-
* @param
|
|
196
|
-
* @param emoji The emoji to send as reaction (e.g. "😀", "❤️", "👍")
|
|
197
|
-
* @param to Recipient phone number
|
|
187
|
+
* @param params The reaction message parameter object
|
|
198
188
|
* @returns Promise with the response
|
|
199
189
|
*/
|
|
200
|
-
reaction(
|
|
190
|
+
reaction(params: ReactionParams$1): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
201
191
|
}
|
|
202
192
|
|
|
203
|
-
export { type MessagePayloadType, MessagesApi as default };
|
|
193
|
+
export { type MessagePayloadType, type MessageRequestParams, type ReactionParams, type StatusParams, type TextMessageParams, MessagesApi as default };
|