@wppconnect-team/wppconnect - v1.36.3
    Preparing search index...

    Class Whatsapp

    Hierarchy

    • BusinessLayer
      • Whatsapp
    Index

    Blocklist

    Chat

    Community

    Contact

    Group

    Host

    Labels

    Newsletter

    Order

    Other

    Profile

    Status

    UI

    Blocklist

    • Block contact

      Parameters

      • contactId: string

        {string} id '000000000000@c.us'

      Returns Promise<boolean>

      boolean

    • Receive all blocked contacts

      Returns Promise<string[]>

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

    • Unblock contact

      Parameters

      • contactId: string

        {string} id '000000000000@c.us'

      Returns Promise<boolean>

      boolean

    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 the given chat

      Parameters

      • chatId: string

        {string} id '000000000000@c.us'

      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>

      // 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 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 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

      Depreciado em favor de getMessages

    • Retrieves all new messages (where isNewMsg is true)

      Returns Promise<Message[]>

      List of messages

      Use getAllUnreadMessages

    • Retrieves chat object of given contact id

      Parameters

      • contactId: string | Wid

      Returns Promise<Chat>

      chat details as promise

    • Retrieves chat object of given contact id

      Parameters

      • contactId: string | Wid

      Returns Promise<Chat>

      chat details 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

      • Optionaltype: 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

    • 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]

      // 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

      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 details as promise

      Depreciado em favor de getMessages

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

      Parameters

      • msgId: string

        Message id: xxxxx@us.c

      Returns Promise<any>

    • puts the chat as unread

      Parameters

      • contactId: string

        {string} id '000000000000@c.us'

      Returns Promise<boolean>

      boolean

    • Pin and Unpin chat messages with true or false

      Parameters

      • chatId: string

        {string} id '000000000000@c.us'

      • option: boolean

        {boolean} true or false

      • OptionalnonExistent: 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>

    • Send a list of contact cards

      Parameters

      • to: string

        Chat id

      • contacts: (string | { id: string; name: string })[]

        Example: | ['000@c.us', '1111@c.us', {id: '2222@c.us', name: 'Test'}]

      Returns Promise<SendMessageReturn>

    • Sends file from path or base64

      Parameters

      Returns any

      // File message from a path
      client.sendFile('<number>@c.us', './someFile.txt');
      // Simple message from base64

      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

      • Optionalfilename: string

        The file name

      • Optionalcaption: string

        Caption for the filename

      Returns any

    • 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
      • Optionalcaption: string

      Returns Promise<any>

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

      Parameters

      • to: string

        Chat id

      • filePath: string

        File path

      • Optionalfilename: string
      • Optionalcaption: 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

      • Optionalcaption: 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

      • Optionalfilename: string
      • Optionalcaption: string
      • OptionalquotedMessageId: string

        Quoted message id

      • OptionalisViewOnce: boolean

        Enable single view

      • Optionaloptions: { mentionedList?: string[]; msgId?: string }

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

    • Generates sticker from given image and sends it (Send Image As Sticker)

      Parameters

      Returns Promise<SendMessageReturn>

      client.sendImageAsSticker('000000000000@c.us', 'base64....');
      

      Send Sticker with reply

      client.sendImageAsSticker('000000000000@c.us', 'base64....', {
      quotedMsg: 'msgId',
      });
    • Generates sticker from the provided animated gif image and sends it (Send image as animated sticker)

      Parameters

      Returns Promise<SendMessageReturn>

      client.sendImageAsStickerGif('000000000000@c.us', 'base64....');
      

      Send Sticker with reply

      client.sendImageAsStickerGif('000000000000@c.us', 'base64....', {
      quotedMsg: 'msgId',
      });
    • Sends image message

      Parameters

      • to: string

        ID of the chat to send the image to

      • base64: string

        A base64-encoded data URI (with mime type)

      • filename: string
      • Optionalcaption: string
      • OptionalquotedMessageId: string

        Quoted message id

      • OptionalisViewOnce: boolean

        Enable single view

      • OptionalmentionedList: any
      • Optionaloptions: { msgId?: string }

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

      const base64picture = "/9j/4AA[...]VZoCn9Lp//Z"
      await client.sendImageFromBase64("120[...]381@g.us'", "data:image/png;base64," + base64picture, "picture.png")
    • 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

    • Parameters

      • chat: any
      • content: any
      • Optionaloptions: any

      Returns Promise<Message>

    • Sends message with thumbnail

      @deprecated: please use sendText with options

      Parameters

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

      Returns Promise<SendMessageReturn>

    • 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>

      // 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>

      // 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

      • Optionalfilename: string
      • Optionalcaption: string
      • OptionalquotedMessageId: string

        Quoted message id

      • OptionalmessageId: 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
      • Optionalcaption: string
      • OptionalquotedMessageId: string

        Quoted message id

      • OptionalmessageId: 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 }>

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

      // to remove reacition
      await client.startRecording('[number]@c.us', false);
    • Sets a chat status to seen. Marks all messages as ack: 3

      Parameters

      • chatId: string

        chat id: xxxxx@us.c

      Returns Promise<{ unreadCount: number; wid: WAJS.whatsapp.Wid }>

    • Sends a text message to given chat

      Parameters

      • to: string

        chat id: xxxxx@us.c

      • content: string

        text message

      • Optionaloptions: TextMessageOptions

      Returns Promise<Message>

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

      // A message with reply
      client.sendText('<number>@c.us', 'A simple message', {
      quotedMsg: 'true_...@c.us_3EB01DE65ACC6_out'
      });

      // 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

      • Optionalfilename: string
      • Optionalcaption: 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

      • Optionalcaption: string

        string xxxxx

      • OptionalquotedMessageId: 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 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>

       //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>

    • Enable or disable temporary messages with true or false

      Parameters

      • chatOrGroupId: string

        id '000000000000@c.us' or '000000-000000@g.us'

      • value: boolean

        true or false

      Returns Promise<boolean>

      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

      • Optionalduration: number

        Duration um miliseconds

      Returns Promise<void>

      // 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

      • Optionalduration: number

        Duration um miliseconds

      Returns Promise<void>

      // 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 details as promise

    • Checks if a number is a valid whatsapp number

      Deprecated in favor of checkNumberStatus

      Parameters

      • contactId: string

      Returns Promise<WhatsappProfile>

      contact details as promise

      Deprecated in favor of checkNumberStatus

    Group

    • Adds participant to Group

      Parameters

      • groupId: string

        Chat id ('0000000000-00000000@g.us')

      • participantId: string | string[]

        Participant id'000000000000@c.us'

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

    • Approve a membership request to group

      Parameters

      • groupId: string

        Group ID ('000000-000000@g.us')

      • membershipIds: string | string[]

      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;
                      invite_code_exp: number;
                      wid: string;
                  };
              };
          },
      >

    • Demotes admin privileges of participant

      Parameters

      • groupId: string

        Chat id ('0000000000-00000000@g.us')

      • participantId: string | string[]

        Participant id'000000000000@c.us'

      Returns Promise<true | void>

    • Retrieve all groups Deprecated in favor of listChats

      Parameters

      • withNewMessagesOnly: boolean = false

      Returns Promise<Chat[]>

      array of groups

      Deprecated in favor of listChats.

    • Displays group info from an invitation link (or invitation ID)

      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 or group link. Example: CMJYfPFqRyE2GxrnkldYED

      getGroupInfoFromInviteLink('https://chat.whatsapp.com/invite/CMJYfPFqRyE2GxrnkldYED')
      
      getGroupInfoFromInviteLink('CMJYfPFqRyE2GxrnkldYED')
      
    • Generates group-invite link

      Parameters

      • chatId: string

      Returns Promise<string>

      Invitation link

    • Returns current group members as [Contact] objects For previous members, see groupMetadata.pastParticipants.

      Parameters

      • groupId: string

      Returns Promise<Contact[]>

    • Retrieve a list of a membership approval requests

      Parameters

      • groupId: string

        Group ID ('000000-000000@g.us')

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

      Promise

    • Retrieves group members as [Id] objects

      Parameters

      • groupId: string

        group id

      Returns Promise<Id[]>

    • Get the max number of participants for a group

      Returns Promise<number>

      number

    • Join a group with an invite code or link

      Parameters

      • inviteCode: string

      Returns Promise<{ id: string }>

      joinGroup('https://chat.whatsapp.com/invite/CMJYfPFqRyE2GxrnkldYED')
      
      joinGroup('CMJYfPFqRyE2GxrnkldYED')
      
    • Removes the host device from the group

      Parameters

      • groupId: string

        group id

      Returns Promise<void>

    • Promotes participant as Admin in given group

      Parameters

      • groupId: string

        Chat id ('0000000000-00000000@g.us')

      • participantId: string | string[]

        Participant id'000000000000@c.us'

      Returns Promise<boolean>

    • Reject a membership request to group

      Parameters

      • groupId: string

        Group ID ('000000-000000@g.us')

      • membershipIds: string | string[]

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

      Promise

    • Set group subject (if allowed)

      Parameters

      • groupId: string

        Group ID ('0000000000@g.us')

      Returns Promise<boolean>

      empty object

    • Removes participant from group

      Parameters

      • groupId: string

        Chat id ('0000000000-00000000@g.us')

      • participantId: string | string[]

        Participant id'000000000000@c.us'

      Returns Promise<void>

    • Revokes group-invite link and generates a new one.

      Parameters

      • chatId: string

      Returns Promise<string>

      Invitation link

    • Set group description (if allowed)

      Parameters

      • groupId: string

        Group ID ('000000-000000@g.us')

      • description: string

        New group description

      Returns Promise<boolean>

      empty object

    • Set group icon

      Parameters

      • groupId: string

        Group ID ('000000-000000@g.us')

      • pathOrBase64: string

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

      empty object

    • Enable or disable group properties, see for details

      Parameters

      • groupId: string

        Group ID ('000000-000000@g.us')

      • property: GroupProperty
      • value: boolean

        true or false

      Returns Promise<boolean>

      empty object

    • Set group subject (if allowed)

      Parameters

      • groupId: string

        Group ID ('000000-000000@g.us')

      • title: string

        New group subject

      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

      • Optionaloptions: string

        options of label

      Returns Promise<void>

      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: { labelId: string; type: "add" | "remove" }[]

        options to remove or add

      Returns Promise<void>

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

      Returns Promise<void>

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

      Parameters

      • id: string | string[]

        Id or string to labels to delete

      Returns Promise<void>

      client.deleteLabel();
      
    • Get Label by id

      Parameters

      • id: string

        Id of label

      Returns Promise<void>

      client.getLabelById('1');
      

    Newsletter

    • Create Newsletter

      Parameters

      • name: string

        Name Newsletter

      • Optionaloptions: { description?: string; picture?: string }

        options Newsletter, description and picture

      Returns Promise<ResultCreateNewsletter>

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

      Parameters

      • id: string

      Returns Promise<boolean>

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

      Parameters

      • id: string
      • Optionalopts: { description?: string; name?: string; picture?: string }

      Returns Promise<ResultCreateNewsletter>

      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<OrderModel>

      Your order

      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>

      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>

      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>

      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>

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

      Parameters

      Returns Promise<Buffer<ArrayBufferLike>>

      Decrypted file buffer (null otherwise)

    • Delete a collection

      Parameters

      • collectionId: string

        Collection id

      Returns Promise<any>

      client.deleteCollection('65666565898');
      
    • Delete product(s) on catalog

      Parameters

      • productsId: string[]

        Products ID

      Returns Promise<any>

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

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

      • url: string
      • outputPath: string
      • retries: number = 3

      Returns Promise<void>

    • 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 or id

      Returns Promise<string>

      Base64 of media

    • Update your business profile

      Parameters

      • options: any

      Returns Promise<any>

      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>

      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>

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

      Parameters

      • id: string

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

      Returns Promise<any>

    • Querys product catalog

      Parameters

      • id: string

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

      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[]>

      client.getCollections('5521988556558@c.us', '10','20');
      
    • Querys order catalog

      Parameters

      • messageId: string

        string

      Returns Promise<any>

      Message object

    • Create a new product on catalog

      Parameters

      • id: string

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

      • productId: string

        ID of Product

      Returns Promise<
          {
              additional_image_cdn_urls: any[];
              availability: string;
              capability_to_review_status: { key: "WHATSAPP"; value: "APPROVED" }[];
              checkmark: boolean;
              currency: string;
              description: string;
              id: string;
              image_cdn_urls: { key: "requested" | "full"; value: string }[];
              image_hashes_for_whatsapp: string[];
              is_hidden: boolean;
              max_available: number;
              name: string;
              price: string;
              retailer_id: string;
              url: string;
              whatsapp_product_can_appeal: boolean;
          },
      >

    • 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 message acknowledgement changes

      Parameters

      • callback: (ack: Ack) => void

      Returns { dispose: () => void }

      Disposable object to stop the listening

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

      Parameters

      • callback: (chat: Chat) => any

      Returns { dispose: () => void }

      Disposable object to stop the listening

    • Listens to all new messages, sent and received.

      Parameters

      • callback: (message: Message) => void

      Returns { dispose: () => void }

      Disposable object to stop the listening

      Message

    • Listen for incoming calls, whether audio or video (pending a reaction). To reject the call, simply call rejectCall rejectCall

      Parameters

      Returns { dispose: () => void }

      Disposable object to stop listening

    • Listens to real-time location events of all chats Real-time location events

      Parameters

      • callback: (liveLocationEvent: LiveLocation) => void

        Function to be executed when changes are made

      Returns { dispose: () => void }

      Disposable object to stop listening

    • Listens to location events in real time Location events in real time

      Parameters

      • id: string | string[]

        Unique ID or list of contact IDs to track location

      • callback: (liveLocationEvent: LiveLocation) => void

        Function to be executed when changes are made

      Returns { dispose: () => void }

      Disposable object to stop listening

    • Listens to all new messages received only.

      Parameters

      • callback: (message: Message) => void

      Returns { dispose: () => void }

      Disposable object to stop the listening

    • Listens to message edited changes

      Parameters

      • callback: (chat: Wid, id: string, msg: Message) => void

      Returns { dispose: () => void }

      Disposable object to stop the listening

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

      Parameters

      • callback: (message: Message) => void

      Returns { dispose: () => void }

      Disposable object to stop the listening

      Message

    • Listens to update order status

      Parameters

      • callback: (
            data: {
                method: string;
                msgId: MsgKey;
                reference_id: string;
                timestamp: number;
            },
        ) => any

      Returns { dispose: () => void }

      Disposable object to stop the listening

    • Listens to participant changes

      Parameters

      • callback: (evData: ParticipantEvent) => void

        Function to be executed when participant changes occur

      Returns { dispose: () => void }

      Stream of ParticipantEvent

    • Listens to participant changes in a certain group

      Parameters

      • groupId: string

        xxxxx-yyyy@us.c

      • callback: (evData: ParticipantEvent) => void

        Function to be executed when participant changes occur

      Returns { dispose: () => void }

      Stream of ParticipantEvent

    • Listens to poll response messages

      Parameters

      • callback: (
            data: {
                chatId: Wid;
                msgId: string;
                selectedOptions: any;
                sender: Wid;
                timestamp: number;
            },
        ) => any

      Returns { dispose: () => void }

      Disposable object to stop the listening

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

      Parameters

      • callback: (presenceChangedEvent: PresenceEvent) => void

        Callback of on presence changed

      Returns { dispose: () => void }

      Disposable object to stop the listening

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

      Parameters

      Returns { dispose: () => void }

      Disposable object to stop the listening

    • Listens to message reactions

      Parameters

      • callback: (
            data: {
                id: string;
                msgId: string;
                orphan: number;
                orphanReason: any;
                reactionText: string;
                read: boolean;
                timestamp: number;
            },
        ) => any

      Returns { dispose: () => void }

      Disposable object to stop the listening

    • Listens to message revocation

      Parameters

      • callback: (
            data: {
                author?: string;
                from: string;
                id: string;
                refId: String;
                to: string;
            },
        ) => any

      Returns { dispose: () => void }

      Disposable object to stop the listening

    • Listens List of mobile states

      Parameters

      Returns { dispose: () => void }

      Disposable object to stop the listening

    • Returns the current state of the connection

      Parameters

      Returns { dispose: () => void }

      Disposable object to stop the listening

    • Listens to update label

      Parameters

      • callback: (
            data: {
                chat: Chat;
                ids: string[];
                labels: Label[];
                type: "add" | "remove";
            },
        ) => any

      Returns { dispose: () => void }

      Disposable object to stop the listening

    • Rejects a call received via WhatsApp

      Parameters

      • OptionalcallId: string

        string Call ID, if not passed, all calls will be rejected

      Returns Promise<boolean>

      Number of rejected calls

    • 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>

      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>

      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 as a PNG encoded in base64 (not the full data URI, just the base64 section)

    • Update options to customer cart your products

      Parameters

      • value: boolean

        True for enabled, false for non enabled

      Returns Promise<any>

      client.updateCartEnabled(false);
      
    • Clicks on 'use here' button (When it gets unlaunched) This method tracks the class of the button WhatsApp Web might change this class name over time Don't rely on this method

      Returns Promise<boolean>

    Profile

    • Gets the current user profile name

      Returns Promise<string>

    • Gets current user profile status

      Returns Promise<string>

    • 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
      • Optionalto: 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

      • Optionaloptions: SendStatusOptions & { caption?: string }

      Returns Promise<void>

      client.sendImageStatus('data:image/jpeg;base64,<a long base64 file...>');
      
      // 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>

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

      Parameters

      • text: string
      • options: { backgroundColor?: string; font?: number }

      Returns Promise<void>

      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

      • Optionaloptions: SendStatusOptions & { caption?: string }

      Returns Promise<void>

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

    UI

    • Closes the currently opened chat (if any). The boolean result reflects if there was any chat that got closed.

      Returns Promise<boolean>

    • 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>