Hierarchy

  • BusinessLayer
    • Whatsapp

Blocklist

Chat

Community

Contact

Group

Host

Labels

Newsletter

Order

Other

Profile

Status

UI

Blocklist

  • Receive all blocked contacts

    Returns Promise<string[]>

    array of [0,1,2,3....]

Chat

  • Archive and unarchive chat messages with true or false

    Parameters

    • chatId: string

      {string} id '000000000000@c.us'

    • option: boolean = true

      {boolean} true or false

    Returns Promise<{
        archive: boolean;
        wid: WAJS.whatsapp.Wid;
    }>

    boolean

  • Deletes all messages of given chat

    Parameters

    • chatId: string
    • keepStarred: boolean = true

      Keep starred messages

    Returns Promise<boolean>

    boolean

  • Deletes message of given message id

    Parameters

    • chatId: string

      The chat id from which to delete the message.

    • messageId: string | string[]

      The specific message id of the message to be deleted

    • onlyLocal: boolean = false

      If it should only delete locally (message remains on the other recipienct's phone). Defaults to false.

    • deleteMediaInDevice: boolean = true

    Returns Promise<boolean>

  • Edits message of given message id

    Parameters

    • msgId: string | MsgKey

      The specific message id of the message to be edited

    • newText: string

      New content of specified message

    • options: EditMessageOptions = {}

      Common message options

    Returns Promise<Message>

    Example

    // Simple message
    client.editMessage('true_<number>@c.us_messageId', 'new Text For Simple Message');
  • Forwards array of messages (could be ids or message objects)

    Parameters

    Returns Promise<boolean>

    array of messages ID

  • Retrieves all chats Deprecated in favor of listChats

    Parameters

    • withNewMessageOnly: boolean = false

    Returns Promise<Chat[]>

    array of [Chat]

    Deprecated

    Deprecated in favor of listChats.

  • Retrieves all chats with messages Deprecated in favor of listChats

    Parameters

    • withNewMessageOnly: boolean = false

    Returns Promise<Chat[]>

    array of [Chat]

    Deprecated

    Deprecated in favor of listChats.

  • Retrieves all messages already loaded in a chat For loading every message use loadAndGetAllMessagesInChat Depreciado em favor de getMessages

    Parameters

    • chatId: string
    • includeMe: boolean
    • includeNotifications: boolean

    Returns Promise<Message[]>

    any

    Deprecated

    Depreciado em favor de getMessages

  • Retrieves all new messages (where isNewMsg is true)

    Returns Promise<Message[]>

    List of messages

    Deprecated

    Use getAllUnreadMessages

  • Retrieves chat object of given contact id

    Parameters

    • contactId: string

    Returns Promise<Chat>

    contact detial as promise

    Deprecated

  • Retrieves chat object of given contact id

    Parameters

    • contactId: string

    Returns Promise<Chat>

    contact detial as promise

  • Checks if a CHAT contact is online.

    Parameters

    Returns Promise<boolean>

  • Retrieves the last seen of a CHAT.

    Parameters

    Returns Promise<number | boolean>

  • Returns a list of mute and non-mute users

    Parameters

    • Optional type: string

      return type: all, toMute and noMute.

    Returns Promise<object>

    obj

  • Get the platform message from message ID

    The platform can be: android iphone web unknown

    Parameters

    • msgId: string

    Returns Promise<string>

  • Get the reactions of a message

    Parameters

    • msgId: string

    Returns Promise<{
        reactionByMe: {
            id: any;
            msgId: any;
            orphan: number;
            reactionText: string;
            read: boolean;
            senderUserJid: string;
            timestamp: number;
        };
        reactions: {
            aggregateEmoji: string;
            hasReactionByMe: boolean;
            senders: {
                id: any;
                msgId: any;
                orphan: number;
                reactionText: string;
                read: boolean;
                senderUserJid: string;
                timestamp: number;
            }[];
        }[];
    }>

  • Retrieves all undread Messages

    Parameters

    • includeMe: boolean
    • includeNotifications: boolean
    • useUnreadCount: boolean

    Returns Promise<any>

    any

    Deprecated

  • Get the votes of a poll message

    Parameters

    • msgId: string

    Returns Promise<{
        chatId: Wid;
        msgId: any;
        votes: {
            selectedOptions: number[];
            sender: Wid;
            timestamp: number;
        }[];
    }>

  • Return list of chats *

    Parameters

    Returns Promise<Chat[]>

    array of [Chat]

    Example

    // All chats
    const chats = await client.listChats();

    // Some chats
    const chats = client.listChats({count: 20});

    // 20 chats before specific chat
    const chats = client.listChats({count: 20, direction: 'before', id: '[number]@c.us'});

    // Only users chats
    const chats = await client.listChats({onlyUsers: true});

    // Only groups chats
    const chats = await client.listChats({onlyGroups: true});

    // Only with label Text
    const chats = await client.listChats({withLabels: ['Test']});

    // Only with label id
    const chats = await client.listChats({withLabels: ['1']});

    // Only with label with one of text or id
    const chats = await client.listChats({withLabels: ['Alfa','5']});
  • Loads and Retrieves all Messages in a chat Depreciado em favor de getMessages

    Parameters

    • chatId: string
    • includeMe: boolean = false
    • includeNotifications: boolean = false

    Returns Promise<Message[]>

    any

    Deprecated

    Depreciado em favor de getMessages

  • Load more messages in chat object from server. Use this in a while loop Depreciado em favor de getMessages

    Parameters

    • contactId: string

    Returns Promise<Message[]>

    contact detial as promise

    Deprecated

    Depreciado em favor de getMessages

  • Sets a audio or image view once. Marks message as played

    Parameters

    Returns Promise<any>

  • Pin and Unpin chat messages with true or false

    Parameters

    • chatId: string

      {string} id '000000000000@c.us'

    • option: boolean

      {boolean} true or false

    • Optional nonExistent: boolean

      {boolean} Pin chat, non-existent (optional)

    Returns Promise<{
        pin: boolean;
        wid: WAJS.whatsapp.Wid;
    }>

    object

  • Replies to given mesage id of given chat id

    Deprecated: Please, use sendText with quotedMsg option

    Parameters

    • to: string

      Chat id

    • content: string

      Message body

    • quotedMsg: string

      Message id to reply to.

    Returns Promise<Message>

    Deprecated

  • Sends file from path or base64

    Parameters

    Returns any

    Example

    // Simple message
    client.sendFile('<number>@c.us', 'data:text/plain;base64,V1BQQ29ubmVjdA==');

    // With buttons
    client.sendFile('<number>@c.us', 'data:text/plain;base64,V1BQQ29ubmVjdA==', {
    useTemplateButtons: true, // False for legacy
    buttons: [
    {
    url: 'https://wppconnect.io/',
    text: 'WPPConnect Site'
    },
    {
    phoneNumber: '+55 11 22334455',
    text: 'Call me'
    },
    {
    id: 'your custom id 1',
    text: 'Some text'
    },
    {
    id: 'another id 2',
    text: 'Another text'
    }
    ],
    title: 'Title text' // Optional
    footer: 'Footer text' // Optional
    });
  • Sends file from path or base64

    Deprecated: please use sendFile with options: sendFile(to, content, options)

    Parameters

    • to: string

      Chat id

    • pathOrBase64: string

      File path or base64

    • Optional filename: string

      The file name

    • Optional caption: string

      Caption for the filename

    Returns any

    Deprecated

  • Sends file base64 parameter should have mime type already defined

    Deprecated: please use sendFile with options: sendFile(to, content, options)

    Parameters

    • chatId: string

      Chat id

    • base64: string

      base64 data

    • filename: string
    • Optional caption: string

    Returns Promise<any>

    Deprecated

  • Sends a video to given chat as a gif, with caption or not, using base64

    Parameters

    • to: string

      Chat id

    • filePath: string

      File path

    • Optional filename: string
    • Optional caption: string

    Returns Promise<{
        ack: number;
        id: string;
        sendMsgResult: SendMsgResult;
    }>

  • Sends a video to given chat as a gif, with caption or not, using base64

    Parameters

    • to: string

      chat id xxxxx@us.c

    • base64: string

      base64 data:video/xxx;base64,xxx

    • filename: string

      string xxxxx

    • Optional caption: string

      string xxxxx

    Returns Promise<{
        ack: number;
        id: string;
        sendMsgResult: SendMsgResult;
    }>

  • Sends image message

    Parameters

    • to: string

      Chat id

    • filePath: string

      File path or http link

    • Optional filename: string
    • Optional caption: string
    • Optional quotedMessageId: string

      Quoted message id

    • Optional isViewOnce: boolean

      Enable single view

    Returns Promise<{
        ack: number;
        id: string;
        sendMsgResult: SendMsgResult;
    }>

  • Sends image message

    Parameters

    • to: string

      Chat id

    • base64: string

      File path, http link or base64Encoded

    • filename: string
    • Optional caption: string
    • Optional quotedMessageId: string

      Quoted message id

    • Optional isViewOnce: boolean

      Enable single view

    Returns Promise<{
        ack: number;
        id: string;
        sendMsgResult: SendMsgResult;
    }>

  • Sends a list message

      // Example
    client.sendListMessage('<number>@c.us', {
    buttonText: 'Click here',
    description: 'Choose one option',
    sections: [
    {
    title: 'Section 1',
    rows: [
    {
    rowId: 'my_custom_id',
    title: 'Test 1',
    description: 'Description 1',
    },
    {
    rowId: '2',
    title: 'Test 2',
    description: 'Description 2',
    },
    ],
    },
    ],
    });

    Parameters

    Returns Promise<Message>

  • Sends location to given chat id

    Parameters

    Returns any

  • Sends location to given chat id

    Parameters

    • to: string

      Chat id

    • latitude: string

      Latitude

    • longitude: string

      Longitude

    • title: string

      Text caption

    Returns any

  • Sends message with thumbnail

    @deprecated: please use sendText with options

    Parameters

    • pathOrBase64: string
    • url: string
    • title: string
    • description: string
    • chatId: string

    Returns Promise<SendMessageReturn>

    Deprecated

  • Parameters

    • id: string
    • time: number

      duration of silence

    • type: string

      kind of silence "hours" "minutes" "year" To remove the silence, just enter the contact parameter

    Returns Promise<object>

  • Send a order message To send (prices, tax, shipping or discount), for example: USD 12.90, send them without dots or commas, like: 12900

    Parameters

    Returns Promise<Message>

    Example

    // Send Order with a product
    client.sendOrderMessage('[number]@c.us', [
    { type: 'product', id: '67689897878', qnt: 2 },
    { type: 'product', id: '37878774457', qnt: 1 },
    ]

    // Send Order with a custom item
    client.sendOrderMessage('[number]@c.us', [
    { type: 'custom', name: 'Item de cost test', price: 120000, qnt: 2 },
    ]

    // Send Order with custom options
    client.sendOrderMessage('[number]@c.us', [
    { type: 'product', id: '37878774457', qnt: 1 },
    { type: 'custom', name: 'Item de cost test', price: 120000, qnt: 2 },
    ],
    { tax: 10000, shipping: 4000, discount: 10000 }
  • Send a create poll message

    Parameters

    Returns Promise<Message>

    Example

    // Single pool
    client.sendPollMessage(
    '[number]@g.us',
    'A poll name',
    ['Option 1', 'Option 2', 'Option 3']
    );

    // Selectable Count

    // Single pool
    client.sendPollMessage(
    '[number]@g.us',
    'A poll name',
    ['Option 1', 'Option 2', 'Option 3'],
    {
    selectableCount: 1,
    }
    );
  • Sends ptt audio from path

    Parameters

    • to: string

      Chat id

    • filePath: string

      File path

    • Optional filename: string
    • Optional caption: string
    • Optional quotedMessageId: string

      Quoted message id

    • Optional messageId: string

      Set the id for this message

    Returns Promise<unknown>

  • Sends ptt audio base64 parameter should have mime type already defined

    Parameters

    • to: string

      Chat id

    • base64: string

      base64 data

    • filename: string
    • Optional caption: string
    • Optional quotedMessageId: string

      Quoted message id

    • Optional messageId: string

      Set the id for this message

    Returns Promise<{
        ack: number;
        id: string;
        sendMsgResult: SendMsgResult;
    }>

  • Send reaction to message

    Parameters

    • msgId: string
    • reaction: string | false

    Returns Promise<{
        sendMsgResult: string;
    }>

    Example

    // For send Reaction, just to send emoji
    await client.sendReactionToMessage('[number]@c.us', '🤯');

    // to remove reacition
    await client.startRecording('[number]@c.us', false);
  • Sends a text message to given chat

    Parameters

    Returns Promise<Message>

    Example

    // Simple message
    client.sendText('<number>@c.us', 'A simple message');

    // With buttons
    client.sendText('<number>@c.us', 'WPPConnect message with buttons', {
    useTemplateButtons: true, // False for legacy
    buttons: [
    {
    url: 'https://wppconnect.io/',
    text: 'WPPConnect Site'
    },
    {
    phoneNumber: '+55 11 22334455',
    text: 'Call me'
    },
    {
    id: 'your custom id 1',
    text: 'Some text'
    },
    {
    id: 'another id 2',
    text: 'Another text'
    }
    ],
    title: 'Title text' // Optional
    footer: 'Footer text' // Optional
    });
  • Sends a video to given chat as a gif, with caption or not

    Parameters

    • to: string

      Chat id

    • filePath: string

      File path

    • Optional filename: string
    • Optional caption: string

    Returns Promise<{
        ack: number;
        id: string;
        sendMsgResult: SendMsgResult;
    }>

  • Sends a video to given chat as a gif, with caption or not, using base64

    Parameters

    • to: string

      chat id xxxxx@us.c

    • base64: string

      base64 data:video/xxx;base64,xxx

    • filename: string

      string xxxxx

    • Optional caption: string

      string xxxxx

    • Optional quotedMessageId: string

    Returns Promise<{
        ack: number;
        id: string;
        sendMsgResult: SendMsgResult;
    }>

  • Sets the chat state Deprecated in favor of Use startTyping or startRecording functions

    Parameters

    Returns Promise<void>

    Deprecated

    Deprecated in favor of Use startTyping or startRecording functions

  • Change limits of whatsapp web *

    Parameters

    • key: "maxMediaSize" | "maxFileSize" | "maxShare" | "statusVideoMaxDuration" | "unlimitedPin"
    • value: number | boolean

    Returns Promise<number>

    Example

     //Change the maximum size (bytes) for uploading media (max 70MB)
    WPP.conn.setLimit('maxMediaSize',16777216);

    //Change the maximum size (bytes) for uploading files (max 1GB)
    WPP.conn.setLimit('maxFileSize',104857600);

    //Change the maximum number of contacts that can be selected when sharing (Default 5)
    WPP.conn.setLimit('maxShare',100);

    //Change the maximum time (seconds) of a video status
    WPP.conn.setLimit('statusVideoMaxDuration',120);

    //Remove pinned conversation limit (only whatsapp web) (Default 3)
    WPP.conn.setLimit('unlimitedPin',true);
  • Update your online presence

    Parameters

    • online: boolean = true

      true for available presence and false for unavailable

    Returns Promise<boolean>

  • Stars message of given message id

    Parameters

    • messagesId: string | string[]

      The specific message id of the message to be starred

    • star: boolean = true

      Add or remove star of the message. Defaults to true.

    Returns Promise<number>

  • Starts recording ('Recording...' state)

    Parameters

    • to: string

      Chat Id

    • Optional duration: number

      Duration um miliseconds

    Returns Promise<void>

    Example

    // Keep sending recording state, use stopRecoring to finish
    await client.startRecording('[number]@c.us');

    // Keep sending typing state for 5 seconds
    await client.startRecording('[number]@c.us', 5000);
  • Starts typing ('Typing...' state)

    Parameters

    • to: string

      Chat Id

    • Optional duration: number

      Duration um miliseconds

    Returns Promise<void>

    Example

    // Keep sending typing state, use stopTyping to finish
    await client.startTyping('[number]@c.us');

    // Keep sending typing state for 5 seconds
    await client.startTyping('[number]@c.us', 5000);
  • Stops recording ('Recording...' state)

    Parameters

    • to: string

      Chat Id

    Returns Promise<void>

  • Stops typing ('Typing...' state)

    Parameters

    • to: string

      Chat Id

    Returns Promise<void>

Community

  • Add groups to community

    Parameters

    • communityId: string | Wid

      id

    • groupsIds: string[]

    Returns Promise<any>

  • Create a community

    Parameters

    • name: string
    • description: string
    • groupIds: string[] | Wid[]

      Array with groups id

    Returns Promise<any>

  • Deactivate a community

    Parameters

    • communityId: string | Wid

      id

    Returns Promise<any>

  • Remove admin of community participant

    Parameters

    • communityId: string | Wid

      id

    • participantId: string | string[]

    Returns Promise<any>

  • Get all participants of a community

    Parameters

    • communityId: string | Wid

      id

    Returns Promise<any>

  • Promote participant of community to admin

    Parameters

    • communityId: string | Wid

      id

    • participantId: string | string[]

    Returns Promise<any>

  • Remove groups of community

    Parameters

    • communityId: string | Wid

      id

    • groupsIds: string[]

    Returns Promise<any>

Contact

  • Retrieves contact detail object of given contact id

    Parameters

    • contactId: string

    Returns Promise<Contact>

    contact detial as promise

  • Checks if a number is a valid whatsapp number

    Deprecated in favor of checkNumberStatus

    Parameters

    • contactId: string

    Returns Promise<WhatsappProfile>

    contact detial as promise

    Deprecated

    Deprecated in favor of checkNumberStatus

Group

  • Adds participant to Group

    Parameters

    Returns Promise<{
        [key: `${number}@c.us`]: {
            code: number;
            invite_code: string | null;
            invite_code_exp: number | null;
            message: string;
            wid: string;
        };
    }>

  • Approve a membership request to group

    Parameters

    Returns Promise<{
        error: any;
        wid: Wid;
    }[]>

    Promise

  • Creates a new chat group

    Parameters

    • groupName: string

      Group name

    • contacts: string | string[]

      Contacts that should be added.

    Returns Promise<{
        gid: WAJS.whatsapp.Wid;
        participants: {
            [key: `${number}@c.us`]: {
                code: number;
                invite_code: string | null;
                invite_code_exp: number | null;
                wid: string;
            };
        };
    }>

  • Retrieve all groups Deprecated in favor of listChats

    Parameters

    • withNewMessagesOnly: boolean = false

    Returns Promise<Chat[]>

    array of groups

    Deprecated

    Deprecated in favor of listChats.

  • Generates group-invite link

    Parameters

    • inviteCode: string

    Returns Promise<{
        announce: boolean;
        creation: number;
        desc: string;
        descId: string;
        descOwner: string;
        descTime: number;
        id: string;
        noFrequentlyForwarded: boolean;
        owner: string;
        parent: boolean;
        participants: {
            id: string;
            isAdmin: boolean;
            isSuperAdmin: boolean;
        }[];
        pvId?: string;
        restrict: boolean;
        size: number;
        status: number;
        subject: string;
        subjectOwner: string;
        subjectTime: number;
        support: boolean;
        suspended: boolean;
    }>

    Invite code from group link. Example: CMJYfPFqRyE2GxrnkldYED

  • Generates group-invite link

    Parameters

    • chatId: string

    Returns Promise<string>

    Invitation link

  • Retrieves group members as [Id] objects

    Parameters

    • groupId: string

      group id

    Returns Promise<Id[]>

  • Retrieve a list of a membership approval requests

    Parameters

    Returns Promise<{
        addedBy: Wid;
        id: Wid;
        parentGroupId?: Wid;
        requestMethod: "InviteLink" | "LinkedGroupJoin" | "NonAdminAdd";
        t: number;
    }[]>

    Promise

  • Get the max number of participants for a group

    Returns Promise<number>

    number

  • Join a group with invite code

    Parameters

    • inviteCode: string

    Returns Promise<{
        id: string;
    }>

  • Removes the host device from the group

    Parameters

    • groupId: string

      group id

    Returns Promise<void>

  • Reject a membership request to group

    Parameters

    Returns Promise<{
        error: any;
        wid: Wid;
    }[]>

    Promise

  • Set group subject (if allowed)

    Parameters

    Returns Promise<boolean>

    empty object

  • Revokes group-invite link and generate new one.

    Parameters

    • chatId: string

    Returns Promise<string>

    Invitation link

  • Set group description (if allowed)

    Parameters

    Returns Promise<boolean>

    empty object

  • Set group icon

    Parameters

    Returns Promise<{
        _duplicate: boolean;
        eurl: string;
        status: number;
        tag: string;
        token: string;
    }>

    empty object

  • Set group subject (if allowed)

    Parameters

    Returns Promise<boolean>

    empty object

  • Allow only admin to send messages with true or false

    Parameters

    • chatId: string

      {string} id '000000000000@c.us'

    • option: boolean

      {boolean} true or false

    Returns Promise<boolean>

    boolean

Host

  • Retrieves Battery Level

    Returns Promise<number>

  • Retrieves WA-JS version

    Returns Promise<string>

  • Retrieve if is authenticated

    Returns Promise<boolean>

  • Retrieves if the phone is online. Please note that this may not be real time.

    Returns Promise<boolean>

  • Retrieves if the phone is online. Please note that this may not be real time.

    Returns Promise<boolean>

  • Retrieve if main interface is initializing

    Returns Promise<boolean>

  • Retrieve if main interface is authenticated and loaded, bot not synced

    Returns Promise<boolean>

  • Retrieve main interface is authenticated, loaded and synced

    Returns Promise<boolean>

  • Check the current session is an MultiDevice session

    Returns Promise<boolean>

  • Join or leave of WhatsApp Web beta program. Will return the value seted

    Parameters

    • value: boolean

    Returns Promise<boolean>

  • Change the theme

    Parameters

    • type: string

    Returns Promise<boolean>

  • Start phone Watchdog, forcing the phone connection verification.

    Parameters

    • interval: number = 15000

      interval number in miliseconds

    Returns Promise<void>

Labels

  • Create New Label

    Parameters

    • name: string

      Name of label

    • Optional options: string

      options of label

    Returns Promise<void>

    Example

    client.addNewLabel(`Name of label`);
    //or
    client.addNewLabel(`Name of label`, { labelColor: '#dfaef0' });
    //or
    client.addNewLabel(`Name of label`, { labelColor: 4292849392 });
  • Add or delete label of chatId

    Parameters

    • chatIds: string

      ChatIds

    • options: string

      options to remove or add

    Returns Promise<void>

    Example

    client.addOrRemoveLabels(['[number]@c.us','[number]@c.us'],
    [{labelId:'76', type:'add'},{labelId:'75', type:'remove'}]);
    //or
  • Delete all Labels

    Returns Promise<void>

    Example

    client.deleteAllLabels();
    
  • Add or delete label of chatId

    Parameters

    • id: string | string[]

      Id or string to labels to delete

    Returns Promise<void>

    Example

    client.deleteLabel();
    
  • Get Label by id

    Parameters

    • id: string

      Id of label

    Returns Promise<void>

    Example

    client.getLabelById('1');
    

Newsletter

  • Create Newsletter

    Parameters

    • name: string

      Name Newsletter

    • Optional options: {
          description?: string;
          picture?: string;
      }

      options Newsletter, description and picture

      • Optional description?: string
      • Optional picture?: string

    Returns Promise<ResultCreateNewsletter>

    Example

    client.createNewsletter('Name for your newsletter', {description: 'Description for that', picture: '<base64_string',});
    
  • Destroy a Newsletter

    Parameters

    • id: string

    Returns Promise<boolean>

    Example

    client.destroyNewsletter('[newsletter-id]@newsletter');
    
  • Edit a Newsletter

    Parameters

    • id: string
    • Optional opts: {
          description?: string;
          name?: string;
          picture?: string;
      }
      • Optional description?: string
      • Optional name?: string
      • Optional picture?: string

    Returns Promise<ResultCreateNewsletter>

    Example

    client.editNewsletter('[newsletter-id]@newsletter', {
    description: 'new description';
    name: 'new name';
    picture: '<new pic base64>';
    });

Order

  • Get info of your sended order

    Parameters

    • msgId: string

    Returns Promise<boolean>

    Your order

    Example

    const orderInfo = await client.getOrder('<orderId>');
    

Other

catchLinkCode?: LinkByCodeCallback = null
catchQR?: CatchQRCallback = null
logger: Logger
onLoadingScreen?: LoadingScreenCallback = null
options: CreateConfig
page: Page
session: string
statusFind?: StatusFindCallback = null
  • Add image on product This function include additional images on product for change main image use client.changeProductImage

    Parameters

    • productId: string

      Product ID

    • image: string

      Image in base64

    Returns Promise<any>

    Example

    client.addProductImage('56989897878', 'base64/string');
    
  • Add image on product This function change main image of product, for change additional images use client.addImage

    Parameters

    • productId: string

      Product ID

    • image: string

      Image in base64

    Returns Promise<any>

    Example

    client.changeProductImage('56989897878', 'base64/string');
    
  • Internal

    Closes page and browser

    Returns Promise<boolean>

  • Create new collection

    Parameters

    • collectionName: string

      Product ID

    • productsId: string

      Index array of additional imagens

    Returns Promise<any>

    Example

    client.createCollection('Name of collection', ['655632565','5689859898']);
    
  • Create a product on catalog

    Parameters

    • name: string

      Product name

    • image: string

      Product image

    • description: string

      Product description

    • price: number

      Product price

    • isHidden: boolean

      Product visibility

    • url: string

      Product url

    • retailerId: string

      Product own ID system

    • currency: string

      Product currency

    Returns Promise<ProductModel>

    Example

    client.createtProduct(
    'Product name',
    'image in base64',
    'product description',
    '89.90',
    true,
    'https://wppconnect.io',
    'AKA001',
    );
  • Decrypts message file

    Parameters

    Returns Promise<Buffer>

    Decrypted file buffer (null otherwise)

  • Delete product(s) on catalog

    Parameters

    • productsId: string[]

      Products ID

    Returns Promise<any>

    Example

    //Delete one product
    client.delProducts(['56989897878']);

    // Delete various products
    client.delProducts(['56989897878','565657878']);
  • Delete a collection

    Parameters

    • collectionId: string

      Collection id

    Returns Promise<any>

    Example

    client.deleteCollection('65666565898');
    
  • Decrypts message file

    Parameters

    • data: string

      Message object

    Returns Promise<string | boolean>

    Decrypted file buffer (null otherwise)

  • Download and returns the media content in base64 format

    Parameters

    • messageId: string | Message

      Message ou id

    Returns Promise<string>

    Base64 of media

  • Update your business profile

    Parameters

    • options: any

    Returns Promise<any>

    Example

    await client.editBusinessProfile({description: 'New description for profile'});
    
    await client.editBusinessProfile({categories: {
    id: "133436743388217",
    localized_display_name: "Artes e entretenimento",
    not_a_biz: false,
    }});
    await client.editBusinessProfile({address: 'Street 01, New York'});
    
    await client.editBusinessProfile({email: 'test@test.com.br'});
    

    Change website of profile (max 2 sites)

    await client.editBusinessProfile({website: [
    "https://www.wppconnect.io",
    "https://www.teste2.com.br",
    ]});

    Change businessHours for Specific Hours

    await client.editBusinessProfile({ businessHours: {
    {
    tue: {
    mode: "specific_hours",
    hours: [
    [
    540,
    1080,
    ],
    ],
    },
    wed: {
    mode: "specific_hours",
    hours: [
    [
    540,
    1080,
    ],
    ],
    },
    thu: {
    mode: "specific_hours",
    hours: [
    [
    540,
    1080,
    ],
    ],
    },
    fri: {
    mode: "specific_hours",
    hours: [
    [
    540,
    1080,
    ],
    ],
    },
    sat: {
    mode: "specific_hours",
    hours: [
    [
    540,
    1080,
    ],
    ],
    },
    sun: {
    mode: "specific_hours",
    hours: [
    [
    540,
    1080,
    ],
    ],
    },
    }
    },
    timezone: "America/Sao_Paulo"
    });

    Change businessHours for Always Opened
    ```javascript
    await client.editBusinessProfile({ businessHours: {
    {
    mon: {
    mode: "open_24h",
    },
    tue: {
    mode: "open_24h",
    },
    wed: {
    mode: "open_24h",
    },
    thu: {
    mode: "open_24h",
    },
    fri: {
    mode: "open_24h",
    },
    sat: {
    mode: "open_24h",
    },
    sun: {
    mode: "open_24h",
    },
    }
    timezone: "America/Sao_Paulo"
    });

    Change businessHours for Appointment Only
    ```javascript
    await client.editBusinessProfile({ businessHours: { {
    mon: {
    mode: "appointment_only",
    },
    tue: {
    mode: "appointment_only",
    },
    wed: {
    mode: "appointment_only",
    },
    thu: {
    mode: "appointment_only",
    },
    fri: {
    mode: "appointment_only",
    },
    sat: {
    mode: "appointment_only",
    },
    sun: {
    mode: "appointment_only",
    },
    }
    timezone: "America/Sao_Paulo"
    });

  • Edit a collection

    Parameters

    • collectionId: string

      Collection id

    • options: string

      Options arguments

    Returns Promise<any>

    Example

    client.editCollection('656565898', {
    collectionName: 'New Name for collection',
    productsToAdd: ['5656523223'],
    productsToRemove: ['5656523232']
    });
  • Edit product on catalog

    Parameters

    • productId: string

      Product ID

    • options: string

      Object with options

    Returns Promise<ProductModel>

    Example

    client.editProduct('56989897878' {
    name: 'Product name',
    description: 'product description',
    price: '89.90',
    isHidden: true,
    url: 'https://wppconnect.io',
    retailerId: 'AKA001',
    });
  • Get Business Profile

    Parameters

    Returns Promise<any>

  • Querys product catalog

    Parameters

    Returns Promise<any>

  • Query all collections

    Parameters

    • id: string

      Product ID

    • qnt: string

      Max qnt collections - Default 10

    • maxProducts: string

      Max products in array products of collection - Default 10

    Returns Promise<ProductCollModel[]>

    Example

    client.getCollections('5521988556558@c.us', '10','20');
    
  • Retorna uma lista de mensagens de um chat

    Parameters

    • chatId: string

      string ID da conversa ou do grupo

    • params: GetMessagesParam = {}

      GetMessagesParam Opções de filtragem de resultados (count, id, direction) veja GetMessagesParam.

    Returns Promise<Message[]>

    Message object

  • Querys order catalog

    Parameters

    • messageId: string

      string

    Returns Promise<any>

    Message object

  • Querys all products

    Parameters

    • id: string

      Buisness profile id ('00000@c.us')

    • qnt: number

      limit to load products - Default: 10

    Returns Promise<any[]>

  • Listens to messages acknowledgement Changes

    Parameters

    • callback: ((ack) => void)
        • (ack): void
        • Parameters

          Returns void

    Returns {
        dispose: (() => void);
    }

    Disposable object to stop the listening

    • dispose: (() => void)
        • (): void
        • Returns void

  • Fires callback with Chat object every time the host phone is added to a group.

    Parameters

    • callback: ((chat) => any)
        • (chat): any
        • Parameters

          Returns any

    Returns {
        dispose: (() => void);
    }

    Disposable object to stop the listening

    • dispose: (() => void)
        • (): void
        • Returns void

  • Listens to all new messages, sent and received.

    Parameters

    • callback: ((message) => void)
        • (message): void
        • Parameters

          Returns void

    Returns {
        dispose: (() => void);
    }

    Disposable object to stop the listening

    • dispose: (() => void)
        • (): void
        • Returns void

    Fires

    Message

  • Escuta por ligações recebidas, seja de áudio ou vídeo.

    Para recusar a ligação, basta chamar o rejectCall rejectCall

    Parameters

    • callback: ((call) => any)
        • (call): any
        • Parameters

          • call: any

          Returns any

    Returns {
        dispose: (() => void);
    }

    Objeto descartável para parar de ouvir

    • dispose: (() => void)
        • (): void
        • Returns void

  • Escuta os eventos de Localização em tempo real de todos os chats Eventos de Localização em tempo real

    Parameters

    • callback: ((liveLocationEvent) => void)

      Função para ser executada quando houver alterações

        • (liveLocationEvent): void
        • Parameters

          Returns void

    Returns {
        dispose: (() => void);
    }

    Objeto descartável para parar de ouvir

    • dispose: (() => void)
        • (): void
        • Returns void

  • Escuta os eventos de Localização em tempo real Eventos de Localização em tempo real

    Parameters

    • id: string | string[]

      Único ID ou lista de IDs de contatos para acompanhar a localização

    • callback: ((liveLocationEvent) => void)

      Função para ser executada quando houver alterações

        • (liveLocationEvent): void
        • Parameters

          Returns void

    Returns {
        dispose: (() => void);
    }

    Objeto descartável para parar de ouvir

    • dispose: (() => void)
        • (): void
        • Returns void

  • Listens to all new messages received only.

    Parameters

    • callback: ((message) => void)
        • (message): void
        • Parameters

          Returns void

    Returns {
        dispose: (() => void);
    }

    Disposable object to stop the listening

    • dispose: (() => void)
        • (): void
        • Returns void

  • Listens to all notification messages, like group changes, join, leave

    Parameters

    • callback: ((message) => void)
        • (message): void
        • Parameters

          Returns void

    Returns {
        dispose: (() => void);
    }

    Disposable object to stop the listening

    • dispose: (() => void)
        • (): void
        • Returns void

    Fires

    Message

  • Listens to update order status

    Parameters

    • callback: ((data) => any)
        • (data): any
        • Parameters

          • data: {
                method: string;
                msgId: MsgKey;
                reference_id: string;
                timestamp: number;
            }
            • method: string
            • msgId: MsgKey
            • reference_id: string
            • timestamp: number

          Returns any

    Returns {
        dispose: (() => void);
    }

    Disposable object to stop the listening

    • dispose: (() => void)
        • (): void
        • Returns void

  • Listens to participants changed

    Parameters

    • callback: ((evData) => void)

    Returns {
        dispose: (() => void);
    }

    Stream of ParticipantEvent

    • dispose: (() => void)
        • (): void
        • Returns void

  • Listens to participants changed

    Parameters

    • groupId: string
    • callback: ((evData) => void)

    Returns {
        dispose: (() => void);
    }

    Stream of ParticipantEvent

    • dispose: (() => void)
        • (): void
        • Returns void

  • Listens to poll response messages

    Parameters

    • callback: ((data) => any)
        • (data): any
        • Parameters

          • data: {
                chatId: Wid;
                msgId: string;
                selectedOptions: any;
                sender: Wid;
                timestamp: number;
            }
            • chatId: Wid
            • msgId: string
            • selectedOptions: any
            • sender: Wid
            • timestamp: number

          Returns any

    Returns {
        dispose: (() => void);
    }

    Disposable object to stop the listening

    • dispose: (() => void)
        • (): void
        • Returns void

  • Listens to presence changed, by default, it will triggered for active chats only or contacts subscribed (see subscribePresence) Listens to presence changed

    Parameters

    • callback: ((presenceChangedEvent) => void)

      Callback of on presence changed

        • (presenceChangedEvent): void
        • Parameters

          Returns void

    Returns {
        dispose: (() => void);
    }

    Disposable object to stop the listening

    • dispose: (() => void)
        • (): void
        • Returns void

  • Listens to presence changed, the callback will triggered only for passed IDs Listens to presence changed

    Parameters

    • id: string | string[]

      contact id (xxxxx@c.us) or group id: xxxxx-yyyy@g.us

    • callback: ((presenceChangedEvent) => void)

      Callback of on presence changed

        • (presenceChangedEvent): void
        • Parameters

          Returns void

    Returns {
        dispose: (() => void);
    }

    Disposable object to stop the listening

    • dispose: (() => void)
        • (): void
        • Returns void

  • Listens to reaction messages

    Parameters

    • callback: ((data) => any)
        • (data): any
        • Parameters

          • data: {
                id: string;
                msgId: string;
                orphan: number;
                orphanReason: any;
                reactionText: string;
                read: boolean;
                timestamp: number;
            }
            • id: string
            • msgId: string
            • orphan: number
            • orphanReason: any
            • reactionText: string
            • read: boolean
            • timestamp: number

          Returns any

    Returns {
        dispose: (() => void);
    }

    Disposable object to stop the listening

    • dispose: (() => void)
        • (): void
        • Returns void

  • Listens to revoked messages

    Parameters

    • callback: ((data) => any)
        • (data): any
        • Parameters

          • data: {
                author?: string;
                from: string;
                id: string;
                refId: String;
                to: string;
            }
            • Optional author?: string
            • from: string
            • id: string
            • refId: String
            • to: string

          Returns any

    Returns {
        dispose: (() => void);
    }

    Disposable object to stop the listening

    • dispose: (() => void)
        • (): void
        • Returns void

  • Listens List of mobile states

    Parameters

    • callback: ((state) => void)

    Returns {
        dispose: (() => void);
    }

    Disposable object to stop the listening

    • dispose: (() => void)
        • (): void
        • Returns void

  • Returns the current state of the connection

    Parameters

    • callback: ((state) => void)

    Returns {
        dispose: (() => void);
    }

    Disposable object to stop the listening

    • dispose: (() => void)
        • (): void
        • Returns void

  • Listens to update label

    Parameters

    • callback: ((data) => any)
        • (data): any
        • Parameters

          • data: {
                chat: Chat;
                ids: string[];
                labels: Label[];
                type: "add" | "remove";
            }
            • chat: Chat
            • ids: string[]
            • labels: Label[]
            • type: "add" | "remove"

          Returns any

    Returns {
        dispose: (() => void);
    }

    Disposable object to stop the listening

    • dispose: (() => void)
        • (): void
        • Returns void

  • Rejeita uma ligação recebida pelo WhatsApp

    Parameters

    • Optional callId: string

      string ID da ligação, caso não passado, todas ligações serão rejeitadas

    Returns Promise<boolean>

    Número de ligações rejeitadas

  • Remove image on product This function remove additional images of product for change main image use client.changeProductImage

    Parameters

    • productId: string

      Product ID

    • index: string

      Index array of additional imagens

    Returns Promise<ProductModel>

    Example

    client.removeProductImage('56989897878', '1');
    
  • Sends product with product image to given chat id

    Parameters

    • to: string

      Chat id

    • base64: string

      Base64 image data

    • caption: string

      Message body

    • businessId: string

      Business id number that owns the product ('0000@c.us')

    • productId: string

      Product id, see method getBusinessProfilesProducts for more info

    Returns Promise<void>

  • Set product visibility

    Parameters

    • productId: string

      Product id

    • value: boolean

      True for visibility, false for non visible

    Returns Promise<any>

    Example

    client.setProductVisibility('65666565898', false);
    
  • Subscribe presence of a contact or group to use in onPresenceChanged (see onPresenceChanged)

    // subcribe all contacts
    const contacts = await client.getAllContacts();
    await client.subscribePresence(contacts.map((c) => c.id._serialized));

    // subcribe all groups participants
    const chats = await client.getAllGroups(false);
    for (const c of chats) {
    const ids = c.groupMetadata.participants.map((p) => p.id._serialized);
    await client.subscribePresence(ids);
    }

    Parameters

    Returns Promise<number>

    number of subscribed

  • Get the puppeteer page screenshot

    Returns Promise<string>

    The Whatsapp page screenshot encoded in base64

  • Update options to customer cart your products

    Parameters

    • value: boolean

      True for enabled, false for non enabled

    Returns Promise<any>

    Example

    client.updateCartEnabled(false);
    
  • Clicks on 'use here' button (When it get unlaunched) This method tracks the class of the button Whatsapp web might change this class name over the time Dont rely on this method

    Returns Promise<boolean>

Profile

  • Remove your profile picture

    Returns Promise<boolean>

  • Sets current user profile name

    Parameters

    • name: string

    Returns Promise<boolean>

  • Sets the user's current profile photo

    Parameters

    • pathOrBase64: string
    • Optional to: string

    Returns Promise<boolean>

  • Sets current user profile status

    Parameters

    • status: string

    Returns Promise<void>

Status

  • Send a image message to status stories

    Parameters

    • pathOrBase64: string

      Path or base 64 image

    • Optional options: SendStatusOptions & {
          caption?: string;
      }

    Returns Promise<void>

    Example

    client.sendImageStatus('data:image/jpeg;base64,<a long base64 file...>');
    

    Example

    // Send with caption
    client.sendImageStatus('data:image/jpeg;base64,<a long base64 file...>', { caption: 'example test' } );
  • Mark status as read/seen

    Parameters

    • chatId: string

      Chat ID of contact

    • statusId: string

      ID of status msg

    Returns Promise<void>

    Example

    client.sendReadStatus('[phone_number]@c.us', 'false_status@broadcast_3A169E0FD4BC6E92212F_[]@c.us');
    
  • Send a text to status stories

    Parameters

    • text: string
    • options: string

    Returns Promise<void>

    Example

    client.sendTextStatus(`Bootstrap primary color: #0275d8`, { backgroundColor: '#0275d8', font: 2});
    
  • Send a video message to status stories

    Parameters

    • pathOrBase64: string

      Path or base 64 image

    • Optional options: SendStatusOptions & {
          caption?: string;
      }

    Returns Promise<void>

    Example

    client.sendVideoStatus('data:video/mp4;base64,<a long base64 file...>');
    

    Example

    // Send with caption
    client.sendVideoStatus('data:video/mp4;base64,<a long base64 file...>', { caption: 'example test' } );

UI

  • Opens given chat at last message (bottom) Will fire natural workflow events of whatsapp web

    Parameters

    • chatId: string

    Returns Promise<boolean>

  • Opens chat at given message position

    Parameters

    • chatId: string

      Chat id

    • messageId: string

      Message id (For example: '06D3AB3D0EEB9D077A3F9A3EFF4DD030')

    Returns Promise<boolean>

Generated using TypeDoc