### Start WPPConnect Client Source: https://wppconnect.io/wppconnect/classes/Whatsapp Initializes and starts the WPPConnect client. This function should be called to begin the connection and interaction with WhatsApp. ```typescript client.start(); ``` -------------------------------- ### startRecording Source: https://wppconnect.io/wppconnect/classes/Whatsapp Starts the 'Recording...' state for a given chat. Optionally specifies a duration. ```APIDOC ## POST /startRecording ### Description Starts recording ('Recording...' state) for a given chat. ### Method POST ### Endpoint /startRecording ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **to** (string) - Required - The chat ID. - **duration** (number) - Optional - The duration of the recording in milliseconds. ### Request Example ```json { "to": "xxxxxx@us.c", "duration": 5000 } ``` ### Response #### Success Response (200) Returns an empty object or a success indicator. #### Response Example ```json {} ``` ``` -------------------------------- ### Start Phone Watchdog Source: https://wppconnect.io/wppconnect/classes/Whatsapp Starts the phone watchdog to force verification of the phone connection. An optional interval in milliseconds can be provided. Returns a Promise that resolves to void. ```typescript /** * Start phone Watchdog, forcing the phone connection verification. * @param interval - number in miliseconds (default: 15000) * @returns Promise */ startPhoneWatchdog(interval?: number): Promise ``` -------------------------------- ### Install WPPConnect npm Package Source: https://wppconnect.io/wppconnect/index This command installs the WPPConnect npm package as a dependency for your project. Ensure you have Node.js and npm installed. ```bash npm i --save @wppconnect-team/wppconnect ``` -------------------------------- ### Create WhatsApp Session (Recommended) Source: https://wppconnect.io/wppconnect/functions/create This is the recommended way to start the WhatsApp bot using the `create` function. It accepts a `CreateOptions` object, which encapsulates all configuration and callback parameters. ```APIDOC ## POST /create ### Description Starts the WhatsApp bot using a `CreateOptions` object. This is the recommended method for initiating a bot session. ### Method POST ### Endpoint /create ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **createOption** (CreateOptions) - Required - An object containing configuration and callback options for the bot. * **sessionName** (string) - Optional - The name of the client's session. Defaults to 'session' if not provided. * **catchQR** (CatchQRCallback) - Optional - Callback function to handle QR code generation. * **statusFind** (StatusFindCallback) - Optional - Callback function to handle status updates. * **onLoadingScreen** (LoadingScreenCallback) - Optional - Callback function to handle loading screen events. * **catchLinkCode** (LinkByCodeCallback) - Optional - Callback function to handle link code generation. * **options** (CreateConfig) - Optional - Configuration options for creating the bot. * **browserSessionToken** (SessionToken) - Optional - Token for browser session persistence. ### Request Example ```json { "createOption": { "sessionName": "mySession", "options": { "useChrome": true }, "catchQR": "(base64Image) => { console.log(base64Image); }" } } ``` ### Response #### Success Response (200) * **Whatsapp** (object) - A Whatsapp page object with functions to access bot functionalities. #### Response Example ```json { "success": true, "message": "Bot started successfully" } ``` ``` -------------------------------- ### Create Product Source: https://wppconnect.io/wppconnect/classes/Whatsapp Creates a new product in the catalog with specified details including name, image (base64), description, price, visibility, URL, retailer ID, and currency. ```javascript client.createtProduct( 'Product name', 'image in base64', 'product description', '89.90', true, 'https://wppconnect.io', 'AKA001', ); ``` -------------------------------- ### Get a StickerPackModel by Stringable identifier (get) Source: https://wppconnect.io/wppconnect/classes/WAJS.whatsapp.StickerPackCollection The 'get' method retrieves a StickerPackModel using a Stringable identifier. It takes one parameter, 'e' of type Stringable, and returns a StickerPackModel. ```typescript get(e: Stringable): StickerPackModel ``` -------------------------------- ### Get a specific model by stringable identifier (get) Source: https://wppconnect.io/wppconnect/classes/WAJS.whatsapp.ProductMessageListCollection The 'get' method retrieves a specific ProductMessageListModel using a Stringable identifier. It takes one parameter, 'e' of type Stringable, and returns a ProductMessageListModel. ```typescript get(e: Stringable): ProductMessageListModel; ``` -------------------------------- ### initialize Source: https://wppconnect.io/wppconnect/classes/WAJS.whatsapp.MsgModel Initializes the component or service. ```APIDOC ## initialize ### Description Initializes the component or service. ### Method (Implicitly a method call, no specific HTTP verb) ### Endpoint N/A (Client-side method) ### Parameters None ### Request Example ```javascript instance.initialize(); ``` ### Response #### Success Response (void) Returns void. ### Response Example (No return value) ``` -------------------------------- ### Initialization and Listening Methods in wppconnect_io_wppconnect Source: https://wppconnect.io/wppconnect/classes/WAJS.whatsapp.ProductModel Provides methods for initializing the application and checking if it is currently listening for events. These are fundamental for application startup and event handling. ```typescript /** * Initializes the application. */ initialize(): void /** * Checks if the application is currently listening for a specific event. * @param eventName The name of the event to check. * @returns True if listening, false otherwise. */ isListening(eventName: Event): boolean ``` -------------------------------- ### BotProfileModel Constructor Source: https://wppconnect.io/wppconnect/classes/WAJS.whatsapp.BotProfileModel Initializes a new instance of the BotProfileModel. ```APIDOC ## Constructors ### constructor * new BotProfileModel( proterties?: ModelPropertiesContructor, options?: ModelOptions, ): BotProfileModel #### Parameters * `Optional`proterties: ModelPropertiesContructor * `Optional`options: ModelOptions #### Returns BotProfileModel ``` -------------------------------- ### Start Phone Watchdog API Source: https://wppconnect.io/wppconnect/classes/Whatsapp Starts the phone watchdog to force connection verification. An optional interval can be specified. ```APIDOC ## POST /startPhoneWatchdog ### Description Start phone Watchdog, forcing the phone connection verification. ### Method POST ### Endpoint /startPhoneWatchdog ### Parameters #### Query Parameters - **interval** (number) - Optional - Interval in milliseconds for verification (default: 15000). ### Request Example None ### Response #### Success Response (200) - **message** (string) - A success message indicating the watchdog has started. #### Response Example ```json { "example": "Phone watchdog started successfully." } ``` ``` -------------------------------- ### MsgInfoStore Initialization and WhatsApp Version Check Source: https://wppconnect.io/wppconnect/variables/WAJS.whatsapp.MsgInfoStore Demonstrates the initialization of MsgInfoStore and a conditional check for WhatsApp version compatibility. This snippet is relevant for integrating WPPConnect with specific WhatsApp versions. ```javascript const MsgInfoStore = new MsgInfoCollection(); // Example of a version check (hypothetical based on input) if (whatsappVersion >= '2.2222.8') { console.log('WhatsApp version is compatible.'); } ``` -------------------------------- ### Retrieve Cart Information using get Function Source: https://wppconnect.io/wppconnect/functions/WAJS.cart.get The 'get' function retrieves cart information associated with a specific wid (WhatsApp ID). It takes a string 'wid' as input and returns a CartModel object. This function is part of the WPPConnect library. ```typescript import { CartModel } from '@wppconnect-team/wppconnect'; // Assuming 'client' is an initialized WPPConnect client instance async function getCart(wid: string): Promise { try { const cartInfo: CartModel = await client.get(wid); return cartInfo; } catch (error) { console.error('Error retrieving cart information:', error); return null; } } ``` -------------------------------- ### Get Build Constants Source: https://wppconnect.io/wppconnect/functions/WAJS.conn.getBuildConstants Retrieves the internal WAWebBuildConstants module from WhatsApp source to get build version information. ```APIDOC ## GET /conn/getBuildConstants ### Description Retrieves the internal WAWebBuildConstants module from WhatsApp source. This function provides access to various build version constants used by WhatsApp Web. ### Method GET ### Endpoint /conn/getBuildConstants ### Parameters None ### Request Example None ### Response #### Success Response (200) - **BuildConstants** (object) - An object containing version constants or null if not available. - **VERSION_STR** (string) - Full version string (e.g., "2.3000.1234567"). - **VERSION_BASE** (string) - Base version (e.g., "2.3000.1234567"). - **VERSION_PRIMARY** (string) - Primary version number. - **VERSION_SECONDARY** (string) - Secondary version number. - **VERSION_TERTIARY** (string) - Tertiary version number. - **WINDOWS_BUILD** (string) - Windows build number (if applicable). - Other build-related constants may also be present. #### Response Example ```json { "VERSION_STR": "2.3000.1234567", "VERSION_BASE": "2.3000.1234567", "VERSION_PRIMARY": "2", "VERSION_SECONDARY": "3000", "VERSION_TERTIARY": "1234567", "WINDOWS_BUILD": "1234567" } ``` #### Error Response (e.g., 404, 500) - If the constants are not available, the function might return null or an empty object, depending on the internal implementation. #### Example Usage ```javascript const buildConstants = WPP.conn.getBuildConstants(); if (buildConstants) { console.log('Version:', buildConstants.VERSION_STR); console.log('Base Version:', buildConstants.VERSION_BASE); console.log('Windows Build:', buildConstants.WINDOWS_BUILD); } else { console.log('Build constants not available.'); } ``` ``` -------------------------------- ### Instantiate BusinessProfileModel Source: https://wppconnect.io/wppconnect/classes/WAJS.whatsapp.BusinessProfileModel Demonstrates how to create a new instance of the BusinessProfileModel. This constructor accepts optional properties and options for initialization. ```typescript import { BusinessProfileModel } from '@wppconnect-team/wppconnect'; // Example of creating a new BusinessProfileModel instance const businessProfile = new BusinessProfileModel({ // Optional properties can be passed here description: 'This is a sample business profile.' }, { // Optional options can be passed here }); console.log(businessProfile); ``` -------------------------------- ### Order API - Get Order Info Source: https://wppconnect.io/wppconnect/functions/WAJS.order.get Retrieves information about a specific order using its message ID. ```APIDOC ## POST /order/get ### Description Retrieves information about a specific order using its message ID. ### Method POST ### Endpoint /order/get ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **msgId** (string | MsgKey) - Required - The message ID of the order to retrieve. ### Request Example ```json { "msgId": "some_message_id" } ``` ### Response #### Success Response (200) - **OrderModel** (object) - An object containing the order details. #### Response Example ```json { "orderId": "12345", "status": "completed", "items": [ { "name": "Product A", "quantity": 2, "price": 10.50 } ] } ``` ``` -------------------------------- ### Get a ReplyButtonModel by ID (TypeScript) Source: https://wppconnect.io/wppconnect/classes/WAJS.whatsapp.ButtonCollection The 'get' method retrieves a specific ReplyButtonModel using its Stringable ID. It returns the found ReplyButtonModel. ```typescript get(e: Stringable): ReplyButtonModel ``` -------------------------------- ### Initialize MsgInfoParticipantModel Source: https://wppconnect.io/wppconnect/classes/WAJS.whatsapp.MsgInfoParticipantModel Demonstrates how to create a new instance of MsgInfoParticipantModel. It accepts optional properties and options for configuration. ```typescript import { MsgInfoParticipantModel } from "@wppconnect-team/wppconnect"; // Example usage: const participant = new MsgInfoParticipantModel({ // properties if needed }, { // options if needed }); ``` -------------------------------- ### startWebComms Function Source: https://wppconnect.io/wppconnect/functions/WAJS.whatsapp.websocket.startWebComms The startWebComms function initiates the WebSocket connection for WhatsApp communication. It returns a Promise that resolves when the connection is established. ```APIDOC ## startWebComms() ### Description Initiates WebSocket communications for WhatsApp. ### Method `startWebComms` ### Endpoint N/A (This is a function call, not an HTTP endpoint) ### Parameters None ### Request Example ```javascript startWebComms(); ``` ### Response #### Success Response - **Promise** - Resolves when the WebSocket connection is successfully established. #### Response Example ```javascript // No direct response body, the promise resolves upon successful connection. ``` ``` -------------------------------- ### Get a message by stringable ID (TypeScript) Source: https://wppconnect.io/wppconnect/classes/WAJS.whatsapp.MsgCollection The 'get' method retrieves a message using a stringable identifier. It returns the message object. ```typescript /** * Retrieves a message by its stringable ID. * @param e The stringable ID of the message. * @returns MsgModel The retrieved message. */ public get(e: Stringable): MsgModel; ``` -------------------------------- ### Retrieve a StatusV3Model by ID using get in TypeScript Source: https://wppconnect.io/wppconnect/classes/WAJS.whatsapp.StatusV3Collection The `get` method retrieves a `StatusV3Model` using its stringable ID. It returns the `StatusV3Model` object. ```typescript /** * Retrieves a StatusV3Model by its stringable ID. * @param e The stringable ID of the status model to retrieve. * @returns StatusV3Model The retrieved StatusV3Model. */ get(e: Stringable): StatusV3Model; ``` -------------------------------- ### ProductModel Constructor Source: https://wppconnect.io/wppconnect/classes/WAJS.whatsapp.ProductModel Initializes a new instance of the ProductModel class. It accepts optional properties and options for configuration. ```APIDOC ## Constructor ProductModel ### Description Initializes a new instance of the ProductModel class. ### Method Constructor ### Parameters - **proterties** (ModelPropertiesContructor) - Optional - Properties for the model constructor. - **options** (ModelOptions) - Optional - Options for the model constructor. ### Returns ProductModel - The newly created ProductModel instance. ``` -------------------------------- ### Retrieve User Status Information using get() Source: https://wppconnect.io/wppconnect/functions/WAJS.privacy.get The get() function retrieves detailed status information for a WhatsApp user. It returns a Promise that resolves to an object containing properties such as 'about', 'callAdd', 'groupAdd', 'lastSeen', 'online', 'profilePicture', 'readReceipts', and 'status'. This function is useful for monitoring user activity and profile details. ```typescript /** * Retrieves user status information. * @returns {Promise<{ * about: string; * callAdd: string; * groupAdd: string; * lastSeen: string; * online: string; * profilePicture: string; * readReceipts: string; * status: string; * }>} */ async function getUserStatus() { // Assuming 'client' is an initialized WPPConnect client instance const statusInfo = await client.get(); console.log(statusInfo); return statusInfo; } ``` -------------------------------- ### ServerPropsModel Constructors Source: https://wppconnect.io/wppconnect/classes/WAJS.whatsapp.ServerPropsModel Provides details on how to instantiate the ServerPropsModel class. ```APIDOC ## Constructors ### constructor * `new ServerPropsModel(proterties?: ModelPropertiesContructor, options?: ModelOptions): ServerPropsModel` #### Parameters * `Optional`proterties: ModelPropertiesContructor * `Optional`options: ModelOptions #### Returns ServerPropsModel ``` -------------------------------- ### Get a QuickReplyModel by Stringable (TypeScript) Source: https://wppconnect.io/wppconnect/classes/WAJS.whatsapp.QuickReplyCollection The `get` method retrieves a `QuickReplyModel` using a `Stringable` identifier. It takes one parameter, `e`, which is of type `Stringable`, and returns a `QuickReplyModel`. ```typescript get(e: Stringable): QuickReplyModel ``` -------------------------------- ### Start Recording State - JavaScript Source: https://wppconnect.io/wppconnect/classes/Whatsapp Initiates the 'Recording...' status for a given chat. An optional duration in milliseconds can be specified. ```javascript client.startRecording('chat_id'); client.startRecording('chat_id', 5000); // Start recording for 5 seconds ``` -------------------------------- ### Get Specific Product Model (TypeScript) Source: https://wppconnect.io/wppconnect/classes/WAJS.whatsapp.ProductCollection The get method retrieves a specific ProductModel. It requires a Stringable parameter 'e' to identify the model and returns the corresponding ProductModel. ```typescript get(e: Stringable): ProductModel ``` -------------------------------- ### listenToAndRun Source: https://wppconnect.io/wppconnect/classes/WAJS.whatsapp.MsgInfoCollection Listens for an event and immediately runs the listener. ```APIDOC ## listenToAndRun ### Description Listens for an event and immediately runs the listener. ### Method POST ### Endpoint /listenToAndRun ### Parameters #### Request Body - **context** (any) - Required - The value of `this` provided for the call to `listener`. - **eventName** (Event) - Required - The name of the event. - **listener** (Listener) - Optional - The callback function. ### Response #### Success Response (200) - **this** - Returns a reference to the `EventEmitter`, so that calls can be chained. #### Response Example ```json { "status": "listening and running" } ``` ``` -------------------------------- ### Get a specific participant model (TypeScript) Source: https://wppconnect.io/wppconnect/classes/WAJS.whatsapp.MsgInfoParticipantCollection The `get` method retrieves a `MsgInfoParticipantModel` based on a `Stringable` input. This is useful for accessing specific participant data within the Wppconnect environment. ```typescript /** * Retrieves a participant model. * @param e The stringable identifier for the participant. * @returns MsgInfoParticipantModel */ export declare function get(e: Stringable): MsgInfoParticipantModel; ``` -------------------------------- ### Create WhatsApp Session (Deprecated Overload) Source: https://wppconnect.io/wppconnect/functions/create This overload of the `create` function starts the bot using individual parameters for session name, callbacks, and configuration. It is deprecated in favor of the `create` function that accepts a `CreateOptions` object. ```APIDOC ## POST /create (Deprecated) ### Description Starts the WhatsApp bot using individual parameters. This method is deprecated and users should prefer the `create` function that accepts a `CreateOptions` object. ### Method POST ### Endpoint /create ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **sessionName** (string) - Required - The name of the client's session. If not passed, the session name will be 'session'. * **catchQR** (CatchQRCallback) - Optional - Callback function to handle QR code generation. * **statusFind** (StatusFindCallback) - Optional - Callback function to handle status updates. * **onLoadingScreen** (LoadingScreenCallback) - Optional - Callback function to handle loading screen events. * **catchLinkCode** (LinkByCodeCallback) - Optional - Callback function to handle link code generation. * **options** (CreateConfig) - Optional - Configuration options for creating the bot. * **browserSessionToken** (SessionToken) - Optional - Token for browser session persistence. ### Request Example ```json { "sessionName": "mySession", "catchQR": "(base64Image) => { console.log(base64Image); }", "statusFind": "(status) => { console.log(status); }" } ``` ### Response #### Success Response (200) * **Whatsapp** (object) - A Whatsapp page object with functions to access bot functionalities. #### Response Example ```json { "success": true, "message": "Bot started successfully" } ``` ``` -------------------------------- ### Get an EmojiVariantModel by Stringable (TypeScript) Source: https://wppconnect.io/wppconnect/classes/WAJS.whatsapp.EmojiVariantCollection The 'get' method retrieves an EmojiVariantModel based on a Stringable input. It takes a single parameter 'e' of type Stringable and returns an EmojiVariantModel. ```typescript get(e: Stringable): EmojiVariantModel ``` -------------------------------- ### Create WhatsApp Instance Source: https://wppconnect.io/wppconnect/modules This function is used to create a new instance of the Whatsapp class, which is the main entry point for interacting with WhatsApp. ```APIDOC ## POST /create ### Description Creates a new instance of the Whatsapp class to interact with WhatsApp. ### Method POST ### Endpoint /create ### Parameters #### Query Parameters - **session** (string) - Optional - The session name for the WhatsApp instance. - **options** (CreateOptions) - Optional - Configuration options for creating the WhatsApp instance. ### Request Body (No request body is typically sent for this function, configuration is usually via query parameters or options object) ### Response #### Success Response (200) - **instance** (Whatsapp) - The created Whatsapp instance. #### Response Example (Response is the Whatsapp instance object, not a JSON payload) ``` -------------------------------- ### Get a label by ID (TypeScript) Source: https://wppconnect.io/wppconnect/classes/WAJS.whatsapp.LabelCollection The `get` method retrieves a label using its Stringable identifier. It returns the corresponding LabelModel. This is a direct way to access a specific label. ```typescript get(e: Stringable): LabelModel ``` -------------------------------- ### NoteModel Constructors Source: https://wppconnect.io/wppconnect/classes/WAJS.whatsapp.NoteModel Details on how to instantiate a NoteModel object. ```APIDOC ## Constructors ### constructor * new NoteModel( proterties?: ModelPropertiesContructor, options?: ModelOptions, ): NoteModel #### Parameters * `Optional`proterties: ModelPropertiesContructor * `Optional`options: ModelOptions #### Returns NoteModel ``` -------------------------------- ### Get Model by Stringable Identifier Source: https://wppconnect.io/wppconnect/classes/WAJS.whatsapp.RecentEmojiCollection The get method retrieves a RecentEmojiModel based on a Stringable identifier. It takes a single argument, 'e' of type Stringable, and returns the corresponding RecentEmojiModel. ```typescript get(e: Stringable): RecentEmojiModel ``` -------------------------------- ### Get Products Source: https://wppconnect.io/wppconnect/classes/Whatsapp Queries all products for a given business profile, with an optional quantity limit. Takes a business profile ID string and a quantity number. Returns a promise with an array of product objects. ```javascript client.getProducts(id: string, qnt: number): Promise ``` -------------------------------- ### Listen to Events with MsgInfoParticipantModel Source: https://wppconnect.io/wppconnect/classes/WAJS.whatsapp.MsgInfoParticipantModel Shows how to set up listeners for events using `listenTo`, `listenToAndRun`, and `listenToOnce`. These methods allow observing events from a context or the model itself. ```typescript import { MsgInfoParticipantModel } from "@wppconnect-team/wppconnect"; // Assuming 'participant' is an instance of MsgInfoParticipantModel const context = {}; const listener = () => console.log('Heard event!'); participant.listenTo(context, 'someEvent', listener); participant.listenToAndRun(context, 'anotherEvent', listener); participant.listenToOnce(context, 'onceEvent', listener); ``` -------------------------------- ### Get a message model by stringable ID (TypeScript) Source: https://wppconnect.io/wppconnect/classes/WAJS.whatsapp.MsgLoad The `get` method retrieves a message model using a stringable identifier. It takes the identifier `e` and returns the corresponding `MsgModel`. ```typescript get(e: Stringable): MsgModel ``` -------------------------------- ### System and Initialization Functions Source: https://wppconnect.io/wppconnect/classes/WAJS.whatsapp.CmdClass Functions related to the initialization, synchronization, and overall state management of the WPPConnect client. ```APIDOC ## criticalSyncDone ### Description Indicates that a critical synchronization process has been completed. ### Method N/A (Method is not specified, likely a direct function call) ### Endpoint N/A ### Parameters None ### Request Example ```javascript criticalSyncDone(); ``` ### Response #### Success Response (void) Returns void. #### Response Example N/A ``` ```APIDOC ## downgradeWebclient ### Description Initiates the process to downgrade the web client. ### Method N/A (Method is not specified, likely a direct function call) ### Endpoint N/A ### Parameters None ### Request Example ```javascript downgradeWebclient(); ``` ### Response #### Success Response (void) Returns void. #### Response Example N/A ``` ```APIDOC ## handleFatalError ### Description Handles a fatal error condition within the client. ### Method N/A (Method is not specified, likely a direct function call) ### Endpoint N/A ### Parameters None ### Request Example ```javascript handleFatalError(); ``` ### Response #### Success Response (void) Returns void. #### Response Example N/A ``` ```APIDOC ## handleOfflineProgressUpdate ### Description Handles updates related to offline progress. ### Method N/A (Method is not specified, likely a direct function call) ### Endpoint N/A ### Parameters None ### Request Example ```javascript handleOfflineProgressUpdate(); ``` ### Response #### Success Response (void) Returns void. #### Response Example N/A ``` ```APIDOC ## incrementProgress ### Description Increments a progress indicator. ### Method N/A (Method is not specified, likely a direct function call) ### Endpoint N/A ### Parameters None ### Request Example ```javascript incrementProgress(); ``` ### Response #### Success Response (void) Returns void. #### Response Example N/A ``` ```APIDOC ## initialLoadReady ### Description Indicates that the initial load of the client is ready. ### Method N/A (Method is not specified, likely a direct function call) ### Endpoint N/A ### Parameters None ### Request Example ```javascript initialLoadReady(); ``` ### Response #### Success Response (void) Returns void. #### Response Example N/A ``` ```APIDOC ## login ### Description Initiates the login process, optionally with an event object. ### Method N/A (Method is not specified, likely a direct function call) ### Endpoint N/A ### Parameters #### Query Parameters - **e** (any) - Optional - An optional event object. ### Request Example ```javascript login(); // or with an event object login(event); ``` ### Response #### Success Response (void) Returns void. #### Response Example N/A ``` ```APIDOC ## logout ### Description Logs the user out of the client. ### Method N/A (Method is not specified, likely a direct function call) ### Endpoint N/A ### Parameters None ### Request Example ```javascript logout(); ``` ### Response #### Success Response (void) Returns void. #### Response Example N/A ``` ```APIDOC ## logSocketSummary ### Description Logs a summary of the socket connection status. ### Method N/A (Method is not specified, likely a direct function call) ### Endpoint N/A ### Parameters None ### Request Example ```javascript logSocketSummary(); ``` ### Response #### Success Response (void) Returns void. #### Response Example N/A ``` ```APIDOC ## mainLoaded ### Description Indicates that the main part of the client has finished loading. ### Method N/A (Method is not specified, likely a direct function call) ### Endpoint N/A ### Parameters None ### Request Example ```javascript mainLoaded(); ``` ### Response #### Success Response (void) Returns void. #### Response Example N/A ``` -------------------------------- ### Get a specific CallModel by Stringable (TypeScript) Source: https://wppconnect.io/wppconnect/classes/WAJS.whatsapp.CallCollection The 'get' method retrieves a CallModel based on a provided Stringable input. It takes one argument, 'e' of type Stringable, and returns a CallModel. ```typescript /** * Retrieves a CallModel based on a Stringable input. * @param e The Stringable input to search for. * @returns CallModel */ get(e: Stringable): CallModel; ``` -------------------------------- ### Instantiate LabelItemModel Source: https://wppconnect.io/wppconnect/classes/WAJS.whatsapp.LabelItemModel Demonstrates how to create a new instance of the LabelItemModel class. This constructor accepts optional properties and options for initialization. ```typescript import { LabelItemModel } from "@wppconnect-team/wppconnect"; // Example usage: const labelModel = new LabelItemModel(); // With properties and options (example): const customProperties = { id: 'custom-id', labelId: 'label-123' }; const customOptions = { session: {} }; const labelModelWithOptions = new LabelItemModel(customProperties, customOptions); ``` -------------------------------- ### Get a specific collection model by ID (TypeScript) Source: https://wppconnect.io/wppconnect/classes/WAJS.whatsapp.ProductCollCollection The 'get' method retrieves a ProductCollModel using a Stringable identifier. It takes one parameter, 'e' of type Stringable, and returns a ProductCollModel. ```typescript get(e: Stringable): ProductCollModel ``` -------------------------------- ### OrderItemModel Constructor Source: https://wppconnect.io/wppconnect/classes/WAJS.whatsapp.OrderItemModel Initializes a new instance of the OrderItemModel class. It accepts optional properties and options for configuration. ```APIDOC ## Constructors ### constructor * new OrderItemModel( proterties?: ModelPropertiesContructor, options?: ModelOptions, ): OrderItemModel #### Parameters * `Optional`proterties: ModelPropertiesContructor * `Optional`options: ModelOptions #### Returns OrderItemModel ``` -------------------------------- ### Get a specific model by stringable identifier (TypeScript) Source: https://wppconnect.io/wppconnect/classes/WAJS.whatsapp.BusinessCategoriesResultCollection The 'get' method retrieves a 'BusinessCategoriesResultModel' based on a provided 'Stringable' identifier. This function is useful for accessing specific data entries within the collection. ```typescript get(e: Stringable): BusinessCategoriesResultModel ``` -------------------------------- ### Get a StatusModel by ID (TypeScript) Source: https://wppconnect.io/wppconnect/classes/WAJS.whatsapp.StatusCollection The 'get' method retrieves a specific StatusModel using its stringable ID. It returns the StatusModel object if found. This is a direct way to access a status model by its unique identifier. ```typescript get(e: Stringable): StatusModel ``` -------------------------------- ### NoteCollection Constructors Source: https://wppconnect.io/wppconnect/classes/WAJS.whatsapp.NoteCollection Provides details on how to instantiate a new NoteCollection. ```APIDOC ## Constructors ### constructor * `new NoteCollection(e?: any, t?: { parent: any }): NoteCollection` #### Parameters * `Optional`e: any * `Optional`t: { parent: any } #### Returns NoteCollection ``` -------------------------------- ### Get Business Profiles Products Source: https://wppconnect.io/wppconnect/classes/Whatsapp Queries the product catalog for a specific business profile. It takes a business profile ID as a string and returns a promise with product information. ```javascript client.getBusinessProfilesProducts(id: string): Promise ``` -------------------------------- ### SessionToken Interface and Example Source: https://wppconnect.io/wppconnect/interfaces/tokenStore.SessionToken Defines the SessionToken interface for WhatsApp web authentication and provides a JSON example of a session token. This interface includes properties like WABrowserId, WASecretBundle, WAToken1, and WAToken2, all of which are strings. ```json // Example of SessionToken { WABrowserId: '"UnXjH....."', WASecretBundle: '{"key":"+i/nRgWJ....","encKey":"kGdMR5t....","macKey":"+i/nRgW...."}', WAToken1: '"0i8...."', WAToken2: '"1@lPpzwC...."', } ``` ```typescript interface SessionToken { WABrowserId: string; WASecretBundle: string; WAToken1: string; WAToken2: string; } ``` -------------------------------- ### Initialize MemoryTokenStore and Use with WPPConnect (TypeScript) Source: https://wppconnect.io/wppconnect/classes/tokenStore.MemoryTokenStore Demonstrates how to create an instance of MemoryTokenStore and use it to manage session tokens for multiple WPPConnect sessions. This approach is suitable for development or scenarios where in-memory storage is sufficient. ```typescript import * as wppconnect from '@wppconnect-team/wppconnect'; const myTokenStore = new wppconnect.tokenStore.MemoryTokenStore(); wppconnect.create({ session: 'mySession', tokenStore: myTokenStore, }); wppconnect.create({ session: 'otherSession', tokenStore: myTokenStore, }); ``` -------------------------------- ### Get a specific participant by Stringable (TypeScript) Source: https://wppconnect.io/wppconnect/classes/WAJS.whatsapp.ParticipantCollection The `get` method retrieves a specific participant model based on a provided `Stringable` identifier. It takes one argument, `e` of type `Stringable`, and returns a `ParticipantModel`. ```typescript get(e: Stringable): ParticipantModel ``` -------------------------------- ### CartModel Constructor Source: https://wppconnect.io/wppconnect/classes/WAJS.whatsapp.CartModel Initializes a new instance of the CartModel. ```APIDOC ## Constructors ### constructor * new CartModel( proterties?: ModelPropertiesContructor, options?: ModelOptions, ): CartModel #### Parameters * `Optional`proterties: ModelPropertiesContructor * `Optional`options: ModelOptions #### Returns CartModel ``` -------------------------------- ### GET /mutes Source: https://wppconnect.io/wppconnect/classes/Whatsapp Returns a list of muted and non-muted users. ```APIDOC ## GET /mutes ### Description Returns a list of mute and non-mute users. ### Method GET ### Endpoint /mutes ### Parameters #### Query Parameters - **type** (string) - Optional - Specifies the return type: 'all', 'toMute', or 'noMute'. ### Response #### Success Response (200) - **object** (object) - An object containing lists of muted and non-muted users. #### Response Example ```json { "toMute": [ "user1@c.us" ], "noMute": [ "user2@c.us" ] } ``` ``` -------------------------------- ### GET /messages/unread Source: https://wppconnect.io/wppconnect/classes/Whatsapp Retrieves all unread messages where ack is -1. ```APIDOC ## GET /messages/unread ### Description Retrieves all unread messages (where ack is -1). ### Method GET ### Endpoint /messages/unread ### Response #### Success Response (200) - **PartialMessage[]** (array) - A list of unread message objects. #### Response Example ```json [ { "id": "messageId", "ack": -1, "body": "Unread message" } ] ``` ``` -------------------------------- ### Initialize OrderItemModel Source: https://wppconnect.io/wppconnect/classes/WAJS.whatsapp.OrderItemModel Constructs a new instance of OrderItemModel. It accepts optional properties and options to configure the new order item. ```typescript new OrderItemModel( proterties?: ModelPropertiesContructor, options?: ModelOptions ): OrderItemModel ``` -------------------------------- ### ProductImageCollection Constructor Source: https://wppconnect.io/wppconnect/classes/WAJS.whatsapp.ProductImageCollection Initializes a new instance of the ProductImageCollection class. ```APIDOC ## constructor ProductImageCollection ### Description Initializes a new instance of the ProductImageCollection class. ### Method constructor ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "example": "new ProductImageCollection(e?: any, t?: { parent: any })" } ``` ### Response #### Success Response (200) - **ProductImageCollection** (ProductImageCollection) - A new instance of ProductImageCollection. #### Response Example ```json { "example": "ProductImageCollection instance" } ``` ``` -------------------------------- ### GET /chats Source: https://wppconnect.io/wppconnect/classes/Whatsapp Retrieves all chats. Deprecated in favor of listChats. ```APIDOC ## GET /chats ### Description Retrieves all chats. ### Method GET ### Endpoint /chats ### Parameters #### Query Parameters - **withNewMessageOnly** (boolean) - Optional - Filters chats to include only those with new messages. Defaults to false. ### Response #### Success Response (200) - **Chat[]** (array) - An array of chat objects. #### Response Example ```json [ { "id": "000000000000@c.us", "name": "Contact Name" } ] ``` ### Deprecated Deprecated in favor of listChats. ``` -------------------------------- ### MsgInfoParticipantCollection Constructor Source: https://wppconnect.io/wppconnect/classes/WAJS.whatsapp.MsgInfoParticipantCollection Initializes a new instance of the MsgInfoParticipantCollection class. ```APIDOC ## Constructor MsgInfoParticipantCollection ### Description Initializes a new instance of the MsgInfoParticipantCollection class. ### Method CONSTRUCTOR ### Parameters * `Optional` e: any * `Optional` t: { parent: any } ### Returns MsgInfoParticipantCollection ``` -------------------------------- ### displayName Source: https://wppconnect.io/wppconnect/classes/WAJS.whatsapp.MsgModel Gets or sets the display name. ```APIDOC ## displayName ### Description Gets or sets the display name. ### Method (Implicitly a method call, no specific HTTP verb) ### Endpoint N/A (Client-side method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```javascript // To get display name const name = instance.displayName(); // To set display name (example with hypothetical parameters) instance.displayName(value1, value2); ``` ### Response #### Success Response (any) Returns any type, likely the display name or a status indicator. #### Response Example ```json { "example": "someDisplayName" } ``` ``` -------------------------------- ### Initialize LabelCollection Constructor Source: https://wppconnect.io/wppconnect/classes/WAJS.whatsapp.LabelCollection Demonstrates how to instantiate the LabelCollection class. It accepts optional parameters for initial data and a parent context, useful for managing collections within a larger structure. ```typescript new LabelCollection(e?: any, t?: { parent: any }): LabelCollection ``` -------------------------------- ### Get Order Information using WPPConnect Source: https://wppconnect.io/wppconnect/functions/WAJS.order.get Retrieves detailed information about a specific order using its unique message ID. This function is asynchronous and returns a Promise that resolves to an OrderModel object. Ensure WPPConnect is initialized before calling this function. ```javascript const orderInfo = await WPP.order.get(); ``` -------------------------------- ### createBusinessCatalog Source: https://wppconnect.io/wppconnect/functions/WAJS.whatsapp.functions.createBusinessCatalog This function is used to create a business catalog on WhatsApp. It returns a Promise that resolves with the result of the operation. ```APIDOC ## POST /createBusinessCatalog ### Description Creates a business catalog on WhatsApp. ### Method POST ### Endpoint /createBusinessCatalog ### Parameters #### Query Parameters - **session** (string) - Required - The session identifier for the WPPConnect instance. ### Request Body This endpoint does not require a request body. ### Response #### Success Response (200) - **any** - The result of the catalog creation operation. #### Response Example ```json { "success": true, "message": "Catalog created successfully" } ``` ``` -------------------------------- ### GET /chat/is-online/{chatId} Source: https://wppconnect.io/wppconnect/classes/Whatsapp Checks if a contact in a given chat is currently online. ```APIDOC ## GET /chat/is-online/{chatId} ### Description Checks if a CHAT contact is online. ### Method GET ### Endpoint /chat/is-online/{chatId} ### Parameters #### Path Parameters - **chatId** (string) - Required - The chat ID (e.g., 'xxxxx@c.us'). ### Response #### Success Response (200) - **boolean** (boolean) - True if the contact is online, false otherwise. #### Response Example ```json { "isOnline": true } ``` ``` -------------------------------- ### Instantiate MsgKey Constructor Source: https://wppconnect.io/wppconnect/classes/WAJS.whatsapp.MsgKey Demonstrates how to instantiate the MsgKey class using its constructor. It accepts an options object which can be defined in two ways, specifying sender and receiver or message origin details. This is crucial for uniquely identifying messages within WhatsApp. ```typescript new MsgKey({ from: WAJS.whatsapp.Wid; id: string; participant?: any; selfDir: "in" | "out"; to: WAJS.whatsapp.Wid; }); new MsgKey({ fromMe: boolean; id: string; participant?: any; remote: WAJS.whatsapp.Wid; }); ``` -------------------------------- ### GET /chat/by-id/{contactId} Source: https://wppconnect.io/wppconnect/classes/Whatsapp Retrieves the chat object for a given contact ID. ```APIDOC ## GET /chat/by-id/{contactId} ### Description Retrieves chat object of given contact id. ### Method GET ### Endpoint /chat/by-id/{contactId} ### Parameters #### Path Parameters - **contactId** (string | Wid) - Required - The contact ID for which to retrieve the chat object. ### Response #### Success Response (200) - **Chat** (object) - The chat details. #### Response Example ```json { "id": "000000000000@c.us", "name": "Contact Name" } ``` ``` -------------------------------- ### listenToAndRun Source: https://wppconnect.io/wppconnect/classes/WAJS.whatsapp.TemplateButtonCollection Listens for an event and executes a callback function with a provided context. This listener will continue to be active until explicitly removed. ```APIDOC ## POST /listenToAndRun ### Description Listens for an event and executes a callback function with a provided context. This listener will continue to be active until explicitly removed. ### Method POST ### Endpoint /listenToAndRun ### Parameters #### Request Body - **context** (any) - Required - The value of `this` provided for the call to `listener` - **eventName** (Event) - Required - The name of the event. - **listener** (Listener) - Optional - The callback function. ### Response #### Success Response (200) - **this** (this) - Returns a reference to the EventEmitter, allowing for method chaining. ``` -------------------------------- ### GET /chats/with-messages Source: https://wppconnect.io/wppconnect/classes/Whatsapp Retrieves all chats along with their messages. Deprecated in favor of listChats. ```APIDOC ## GET /chats/with-messages ### Description Retrieves all chats with messages. ### Method GET ### Endpoint /chats/with-messages ### Parameters #### Query Parameters - **withNewMessageOnly** (boolean) - Optional - Filters chats to include only those with new messages. Defaults to false. ### Response #### Success Response (200) - **Chat[]** (array) - An array of chat objects, each potentially containing messages. #### Response Example ```json [ { "id": "000000000000@c.us", "name": "Contact Name", "messages": [] } ] ``` ### Deprecated Deprecated in favor of listChats. ``` -------------------------------- ### StatusV3Collection Constructor Source: https://wppconnect.io/wppconnect/classes/WAJS.whatsapp.StatusV3Collection Initializes a new instance of the StatusV3Collection class. ```APIDOC ## Constructor ### `new StatusV3Collection(e?: any, t?: { parent: any })` Initializes a new instance of the `StatusV3Collection` class. #### Parameters * `Optional` **e**: any * `Optional` **t**: { parent: any } #### Returns * `StatusV3Collection` ``` -------------------------------- ### getForwardingScoreWhenForwarded Source: https://wppconnect.io/wppconnect/classes/WAJS.whatsapp.MsgModel Gets the forwarding score when a message is forwarded. ```APIDOC ## getForwardingScoreWhenForwarded ### Description Gets the forwarding score when a message is forwarded. ### Method (Implicitly a method call, no specific HTTP verb) ### Endpoint N/A (Client-side method) ### Parameters None ### Request Example ```javascript const score = instance.getForwardingScoreWhenForwarded(); ``` ### Response #### Success Response (any) Returns any type, likely a number representing the forwarding score. #### Response Example ```json { "example": 5 } ``` ```