Class Whatsapp

java.lang.Object
it.auties.whatsapp.api.Whatsapp

public class Whatsapp extends Object
A class used to interface a user to WhatsappWeb's WebSocket
  • Field Details

    • instances

      private static final Map<UUID,Whatsapp> instances
    • socketHandler

      private final it.auties.whatsapp.socket.SocketHandler socketHandler
  • Constructor Details

  • Method Details

    • getInstanceByUuid

      protected static Optional<Whatsapp> getInstanceByUuid(UUID uuid)
    • removeInstanceByUuid

      protected static void removeInstanceByUuid(UUID uuid)
    • isConnected

      public static boolean isConnected(UUID uuid)
      Checks if a connection exists
      Parameters:
      uuid - the non-null uuid
      Returns:
      a boolean
    • isConnected

      public static boolean isConnected(long phoneNumber)
      Checks if a connection exists
      Parameters:
      phoneNumber - the non-null phone number
      Returns:
      a boolean
    • isConnected

      public static boolean isConnected(String alias)
      Checks if a connection exists
      Parameters:
      alias - the non-null alias
      Returns:
      a boolean
    • webBuilder

      public static ConnectionBuilder<WebOptionsBuilder> webBuilder()
      Creates a new web api The web api is based around the WhatsappWeb client
      Returns:
      a web api builder
    • mobileBuilder

      public static ConnectionBuilder<MobileOptionsBuilder> mobileBuilder()
      Creates a new mobile api The mobile api is based around the Whatsapp App available on IOS and Android
      Returns:
      a web mobile builder
    • customBuilder

      public static WhatsappCustomBuilder customBuilder()
      Creates an advanced builder if you need more customization
      Returns:
      a custom builder
    • connect

      public CompletableFuture<Whatsapp> connect()
      Connects to Whatsapp
      Returns:
      a future
    • isConnected

      public boolean isConnected()
      Returns whether the connection is active or not
      Returns:
      a boolean
    • keys

      public Keys keys()
      Returns the keys associated with this session
      Returns:
      a non-null WhatsappKeys
    • store

      public Store store()
      Returns the store associated with this session
      Returns:
      a non-null WhatsappStore
    • disconnect

      public CompletableFuture<Void> disconnect()
      Disconnects from Whatsapp Web's WebSocket if a previous connection exists
      Returns:
      a future
    • reconnect

      public CompletableFuture<Void> reconnect()
      Disconnects and reconnects to Whatsapp Web's WebSocket if a previous connection exists
      Returns:
      a future
    • logout

      public CompletableFuture<Void> logout()
      Disconnects from Whatsapp Web's WebSocket and logs out of WhatsappWeb invalidating the previous saved credentials. The next time the API is used, the QR code will need to be scanned again.
      Returns:
      a future
    • changePrivacySetting

      public final CompletableFuture<Void> changePrivacySetting(PrivacySettingType type, PrivacySettingValue value, JidProvider... excluded)
      Changes a privacy setting in Whatsapp's settings. If the value is PrivacySettingValue.CONTACTS_EXCEPT, the excluded parameter should also be filled or an exception will be thrown, otherwise it will be ignored.
      Parameters:
      type - the non-null setting to change
      value - the non-null value to attribute to the setting
      excluded - the non-null excluded contacts if value is PrivacySettingValue.CONTACTS_EXCEPT
      Returns:
      the same instance wrapped in a completable future
    • onPrivacyFeatureChanged

      private void onPrivacyFeatureChanged(PrivacySettingType type, PrivacySettingValue value, List<Jid> excludedJids)
    • changeNewChatsEphemeralTimer

      public CompletableFuture<Void> changeNewChatsEphemeralTimer(ChatEphemeralTimer timer)
      Changes the default ephemeral timer of new chats.
      Parameters:
      timer - the new ephemeral timer
      Returns:
      the same instance wrapped in a completable future
    • createGdprAccountInfo

      public CompletableFuture<Void> createGdprAccountInfo()
      Creates a new request to get a document containing all the data that was collected by Whatsapp about this user. It takes three business days to receive it. To query the newsletters status, use getGdprAccountInfoStatus()
      Returns:
      the same instance wrapped in a completable future
    • getGdprAccountInfoStatus

      public CompletableFuture<GdprAccountReport> getGdprAccountInfoStatus()
      Queries the document containing all the data that was collected by Whatsapp about this user. To create a request for this document, use createGdprAccountInfo()
      Returns:
      the same instance wrapped in a completable future
    • changeName

      public CompletableFuture<Void> changeName(String newName)
      Changes the name of this user
      Parameters:
      newName - the non-null new name
      Returns:
      the same instance wrapped in a completable future
    • changeAbout

      public CompletableFuture<Void> changeAbout(String newAbout)
      Changes the about of this user
      Parameters:
      newAbout - the non-null new status
      Returns:
      the same instance wrapped in a completable future
    • subscribeToPresence

      public CompletableFuture<Void> subscribeToPresence(JidProvider jid)
      Sends a request to Whatsapp in order to receive updates when the status of a contact changes. These changes include the last known presence and the seconds the contact was last seen.
      Parameters:
      jid - the contact whose status the api should receive updates on
      Returns:
      a CompletableFuture
    • removeReaction

      public CompletableFuture<? extends MessageInfo> removeReaction(MessageInfo message)
      Remove a reaction from a message
      Parameters:
      message - the non-null message
      Returns:
      a CompletableFuture
    • sendReaction

      public CompletableFuture<? extends MessageInfo> sendReaction(MessageInfo message, Emoji reaction)
      Send a reaction to a message
      Parameters:
      message - the non-null message
      reaction - the reaction to send, null if you want to remove the reaction
      Returns:
      a CompletableFuture
    • sendReaction

      public CompletableFuture<? extends MessageInfo> sendReaction(MessageInfo message, String reaction)
      Send a reaction to a message
      Parameters:
      message - the non-null message
      reaction - the reaction to send, null if you want to remove the reaction. If a string that isn't an emoji supported by Whatsapp is used, it will not get displayed correctly. Use sendReaction(MessageInfo, Emoji) if you need a typed emoji enum.
      Returns:
      a CompletableFuture
    • sendMessage

      public CompletableFuture<? extends MessageInfo> sendMessage(JidProvider chat, String message)
      Builds and sends a message from a chat and a message
      Parameters:
      chat - the chat where the message should be sent
      message - the message to send
      Returns:
      a CompletableFuture
    • sendMessage

      public CompletableFuture<? extends MessageInfo> sendMessage(JidProvider chat, Message message)
      Builds and sends a message from a chat and a message
      Parameters:
      chat - the chat where the message should be sent
      message - the message to send
      Returns:
      a CompletableFuture
    • sendMessage

      public CompletableFuture<? extends MessageInfo> sendMessage(JidProvider recipient, MessageContainer message)
      Builds and sends a message from a recipient and a message
      Parameters:
      recipient - the recipient where the message should be sent
      message - the message to send
      Returns:
      a CompletableFuture
    • sendChatMessage

      public CompletableFuture<ChatMessageInfo> sendChatMessage(JidProvider recipient, MessageContainer message)
      Builds and sends a message from a recipient and a message
      Parameters:
      recipient - the recipient where the message should be sent
      message - the message to send
      Returns:
      a CompletableFuture
    • sendNewsletterMessage

      public CompletableFuture<NewsletterMessageInfo> sendNewsletterMessage(JidProvider recipient, MessageContainer message)
      Builds and sends a message from a recipient and a message
      Parameters:
      recipient - the recipient where the message should be sent
      message - the message to send
      Returns:
      a CompletableFuture
    • editMessage

      public <T extends MessageInfo> CompletableFuture<T> editMessage(T oldMessage, Message newMessage)
      Builds and sends an edited message
      Parameters:
      oldMessage - the message to edit
      newMessage - the new message's content
      Returns:
      a CompletableFuture
    • sendMessage

      Sends a message to a chat
      Parameters:
      info - the message to send
      Returns:
      a CompletableFuture
    • sendMessage

      Sends a message to a newsletter
      Parameters:
      info - the message to send
      Returns:
      a CompletableFuture
    • markChatRead

      public CompletableFuture<Void> markChatRead(JidProvider chat)
      Marks a chat as read.
      Parameters:
      chat - the target chat
      Returns:
      a CompletableFuture
    • markAllAsRead

      private CompletableFuture<Void> markAllAsRead(JidProvider chat)
    • markChatUnread

      public CompletableFuture<Void> markChatUnread(JidProvider chat)
      Marks a chat as unread
      Parameters:
      chat - the target chat
      Returns:
      a CompletableFuture
    • mark

      private CompletableFuture<Void> mark(JidProvider chat, boolean read)
    • createRange

      private ActionMessageRangeSync createRange(JidProvider chat, boolean allMessages)
    • markMessageRead

      public CompletableFuture<ChatMessageInfo> markMessageRead(ChatMessageInfo info)
      Marks a message as read
      Parameters:
      info - the target message
      Returns:
      a CompletableFuture
    • awaitMessageReply

      public CompletableFuture<ChatMessageInfo> awaitMessageReply(ChatMessageInfo info)
      Awaits for a single newsletters to a message
      Parameters:
      info - the non-null message whose newsletters is pending
      Returns:
      a non-null newsletters
    • awaitMessageReply

      public CompletableFuture<ChatMessageInfo> awaitMessageReply(String id)
      Awaits for a single newsletters to a message
      Parameters:
      id - the non-null id of message whose newsletters is pending
      Returns:
      a non-null newsletters
    • hasWhatsapp

      public CompletableFuture<HasWhatsappResponse> hasWhatsapp(JidProvider contact)
      Executes a query to determine whether a user has an account on Whatsapp
      Parameters:
      contact - the contact to check
      Returns:
      a CompletableFuture that wraps a non-null newsletters
    • hasWhatsapp

      public CompletableFuture<Map<Jid,HasWhatsappResponse>> hasWhatsapp(JidProvider... contacts)
      Executes a query to determine whether any number of users have an account on Whatsapp
      Parameters:
      contacts - the contacts to check
      Returns:
      a CompletableFuture that wraps a non-null map
    • parseHasWhatsappResponse

      private Map<Jid,HasWhatsappResponse> parseHasWhatsappResponse(List<Jid> contacts, List<Node> nodes)
    • parseHasWhatsappResponse

      private HasWhatsappResponse parseHasWhatsappResponse(Node node)
    • queryBlockList

      public CompletableFuture<List<Jid>> queryBlockList()
      Queries the block list
      Returns:
      a CompletableFuture
    • queryName

      public CompletableFuture<Optional<String>> queryName(JidProvider contactJid)
      Queries the display name of a contact
      Parameters:
      contactJid - the non-null contact
      Returns:
      a CompletableFuture
    • queryNameFromServer

      private CompletableFuture<Optional<String>> queryNameFromServer(JidProvider contactJid)
    • parseNameResponse

      private Optional<String> parseNameResponse(Node result)
    • queryAbout

      Queries the written whatsapp status of a Contact
      Parameters:
      chat - the target contact
      Returns:
      a CompletableFuture that wraps an optional contact status newsletters
    • queryPicture

      public CompletableFuture<Optional<URI>> queryPicture(JidProvider chat)
      Queries the profile picture
      Parameters:
      chat - the chat of the chat to query
      Returns:
      a CompletableFuture that wraps nullable jpg url hosted on Whatsapp's servers
    • queryGroupMetadata

      public CompletableFuture<GroupMetadata> queryGroupMetadata(JidProvider chat)
      Queries the metadata of a group
      Parameters:
      chat - the target group
      Returns:
      a CompletableFuture
    • queryBusinessProfile

      public CompletableFuture<Optional<BusinessProfile>> queryBusinessProfile(JidProvider contact)
      Queries a business profile, if available
      Parameters:
      contact - the target contact
      Returns:
      a CompletableFuture
    • getBusinessProfile

      private Optional<BusinessProfile> getBusinessProfile(Node result)
    • queryBusinessCategories

      public CompletableFuture<List<BusinessCategory>> queryBusinessCategories()
      Queries all the known business categories
      Returns:
      a CompletableFuture
    • queryGroupInviteCode

      public CompletableFuture<String> queryGroupInviteCode(JidProvider chat)
      Queries the invite code of a group
      Parameters:
      chat - the target group
      Returns:
      a CompletableFuture
    • parseInviteCode

      private String parseInviteCode(Node result)
    • revokeGroupInvite

      public CompletableFuture<Void> revokeGroupInvite(JidProvider chat)
      Revokes the invite code of a group
      Parameters:
      chat - the target group
      Returns:
      a CompletableFuture
    • acceptGroupInvite

      public CompletableFuture<Optional<Chat>> acceptGroupInvite(String inviteCode)
      Accepts the invite for a group
      Parameters:
      inviteCode - the invite countryCode
      Returns:
      a CompletableFuture
    • parseAcceptInvite

      private Optional<Chat> parseAcceptInvite(Node result)
    • changePresence

      public CompletableFuture<Boolean> changePresence(boolean available)
      Changes your presence for everyone on Whatsapp
      Parameters:
      available - whether you are online or not
      Returns:
      a CompletableFuture
    • updateSelfPresence

      private void updateSelfPresence(JidProvider chatJid, ContactStatus presence)
    • changePresence

      public CompletableFuture<Void> changePresence(JidProvider chatJid, ContactStatus presence)
      Changes your presence for a specific chat
      Parameters:
      chatJid - the target chat
      presence - the new status
      Returns:
      a CompletableFuture
    • promoteGroupParticipant

      public CompletableFuture<List<Jid>> promoteGroupParticipant(JidProvider group, JidProvider... contacts)
      Promotes any number of contacts to admin in a group
      Parameters:
      group - the target group
      contacts - the target contacts
      Returns:
      a CompletableFuture
    • demoteGroupParticipant

      public CompletableFuture<List<Jid>> demoteGroupParticipant(JidProvider group, JidProvider... contacts)
      Demotes any number of contacts to admin in a group
      Parameters:
      group - the target group
      contacts - the target contacts
      Returns:
      a CompletableFuture
    • addGroupParticipant

      public CompletableFuture<List<Jid>> addGroupParticipant(JidProvider group, JidProvider... contacts)
      Adds any number of contacts to a group
      Parameters:
      group - the target group
      contacts - the target contact/s
      Returns:
      a CompletableFuture
    • removeGroupParticipant

      public CompletableFuture<List<Jid>> removeGroupParticipant(JidProvider group, JidProvider... contacts)
      Removes any number of contacts from group
      Parameters:
      group - the target group
      contacts - the target contact/s
      Returns:
      a CompletableFuture
    • executeActionOnGroupParticipant

      private CompletableFuture<List<Jid>> executeActionOnGroupParticipant(JidProvider group, GroupAction action, JidProvider... jids)
    • checkGroupParticipantJid

      private Jid checkGroupParticipantJid(Jid jid, String errorMessage)
    • parseGroupActionResponse

      private List<Jid> parseGroupActionResponse(Node result, JidProvider groupJid, GroupAction action)
    • handleGroupAction

      private void handleGroupAction(GroupAction action, Chat chat, Jid entry)
    • changeGroupSubject

      public CompletableFuture<Void> changeGroupSubject(JidProvider group, String newName)
      Changes the name of a group
      Parameters:
      group - the target group
      newName - the new name for the group
      Returns:
      a CompletableFuture
      Throws:
      IllegalArgumentException - if the provided new name is empty or blank
    • changeGroupDescription

      public CompletableFuture<Void> changeGroupDescription(JidProvider group, String description)
      Changes the description of a group
      Parameters:
      group - the target group
      description - the new name for the group, can be null if you want to remove it
      Returns:
      a CompletableFuture
    • changeGroupDescription

      private CompletableFuture<Void> changeGroupDescription(JidProvider group, String description, String descriptionId)
    • onDescriptionSet

      private void onDescriptionSet(JidProvider groupJid, String description)
    • changeGroupSetting

      public CompletableFuture<Void> changeGroupSetting(JidProvider group, GroupSetting setting, ChatSettingPolicy policy)
      Changes a group setting
      Parameters:
      group - the non-null group affected by this change
      setting - the non-null setting
      policy - the non-null policy
      Returns:
      a future
    • changeProfilePicture

      public CompletableFuture<Void> changeProfilePicture(byte[] image)
      Changes the profile picture of yourself
      Parameters:
      image - the new image, can be null if you want to remove it
      Returns:
      a CompletableFuture
    • changeGroupPicture

      public CompletableFuture<Void> changeGroupPicture(JidProvider group, URI image)
      Changes the picture of a group
      Parameters:
      group - the target group
      image - the new image, can be null if you want to remove it
      Returns:
      a CompletableFuture
    • changeGroupPicture

      public CompletableFuture<Void> changeGroupPicture(JidProvider group, byte[] image)
      Changes the picture of a group
      Parameters:
      group - the target group
      image - the new image, can be null if you want to remove it
      Returns:
      a CompletableFuture
    • createGroup

      public CompletableFuture<Optional<GroupMetadata>> createGroup(String subject, JidProvider... contacts)
      Creates a new group
      Parameters:
      subject - the new group's name
      contacts - at least one contact to add to the group
      Returns:
      a CompletableFuture
    • createGroup

      public CompletableFuture<Optional<GroupMetadata>> createGroup(String subject, ChatEphemeralTimer timer, JidProvider... contacts)
      Creates a new group
      Parameters:
      subject - the new group's name
      timer - the default ephemeral timer for messages sent in this group
      contacts - at least one contact to add to the group
      Returns:
      a CompletableFuture
    • createGroup

      public CompletableFuture<Optional<GroupMetadata>> createGroup(String subject, ChatEphemeralTimer timer, JidProvider parentGroup)
      Creates a new group
      Parameters:
      subject - the new group's name
      timer - the default ephemeral timer for messages sent in this group
      parentGroup - the community to whom the new group will be linked
      Returns:
      a CompletableFuture
    • createGroup

      public CompletableFuture<Optional<GroupMetadata>> createGroup(String subject, ChatEphemeralTimer timer, JidProvider parentCommunity, JidProvider... contacts)
      Creates a new group
      Parameters:
      subject - the new group's name
      timer - the default ephemeral timer for messages sent in this group
      parentCommunity - the community to whom the new group will be linked
      contacts - at least one contact to add to the group, not enforced if part of a community
      Returns:
      a CompletableFuture
    • parseGroupResponse

      private Optional<GroupMetadata> parseGroupResponse(Node response)
    • addNewGroup

      private GroupMetadata addNewGroup(GroupMetadata result)
    • findErrorNode

      private String findErrorNode(Node result)
    • leaveGroup

      public CompletableFuture<Void> leaveGroup(JidProvider group)
      Leaves a group
      Parameters:
      group - the target group
      Throws:
      IllegalArgumentException - if the provided chat is not a group
    • handleLeaveGroup

      private void handleLeaveGroup(JidProvider group)
    • linkGroupsToCommunity

      public CompletableFuture<Map<Jid,Boolean>> linkGroupsToCommunity(JidProvider community, JidProvider... groups)
      Links any number of groups to a community
      Parameters:
      community - the non-null community where the groups will be added
      groups - the non-null groups to add
      Returns:
      a CompletableFuture that wraps a map guaranteed to contain every group that was provided as input paired to whether the request was successful
    • parseLinksResponse

      private Map<Jid,Boolean> parseLinksResponse(Node result, JidProvider[] groups)
    • unlinkGroupFromCommunity

      public CompletableFuture<Boolean> unlinkGroupFromCommunity(JidProvider community, JidProvider group)
      Unlinks a group from a community
      Parameters:
      community - the non-null parent community
      group - the non-null group to unlink
      Returns:
      a CompletableFuture that indicates whether the request was successful
    • parseUnlinkResponse

      private boolean parseUnlinkResponse(Node result, JidProvider group)
    • muteChat

      public CompletableFuture<Void> muteChat(JidProvider chat)
      Mutes a chat indefinitely
      Parameters:
      chat - the target chat
      Returns:
      a CompletableFuture
    • muteChat

      public CompletableFuture<Void> muteChat(JidProvider chat, ChatMute mute)
      Mutes a chat
      Parameters:
      chat - the target chat
      mute - the type of mute
      Returns:
      a CompletableFuture
    • unmuteChat

      public CompletableFuture<Void> unmuteChat(JidProvider chat)
      Unmutes a chat
      Parameters:
      chat - the target chat
      Returns:
      a CompletableFuture
    • blockContact

      public CompletableFuture<Void> blockContact(JidProvider contact)
      Blocks a contact
      Parameters:
      contact - the target chat
      Returns:
      a CompletableFuture
    • unblockContact

      public CompletableFuture<Void> unblockContact(JidProvider contact)
      Unblocks a contact
      Parameters:
      contact - the target chat
      Returns:
      a CompletableFuture
    • changeEphemeralTimer

      public CompletableFuture<Void> changeEphemeralTimer(JidProvider chat, ChatEphemeralTimer timer)
      Enables ephemeral messages in a chat, this means that messages will be automatically cancelled in said chat after a week
      Parameters:
      chat - the target chat
      Returns:
      a CompletableFuture
    • markMessagePlayed

      public CompletableFuture<ChatMessageInfo> markMessagePlayed(ChatMessageInfo info)
      Marks a message as played
      Parameters:
      info - the target message
      Returns:
      a CompletableFuture
    • pinChat

      public CompletableFuture<Void> pinChat(JidProvider chat)
      Pins a chat to the top. A maximum of three chats can be pinned to the top. This condition can be checked using;.
      Parameters:
      chat - the target chat
      Returns:
      a CompletableFuture
    • unpinChat

      public CompletableFuture<Void> unpinChat(JidProvider chat)
      Unpins a chat from the top
      Parameters:
      chat - the target chat
      Returns:
      a CompletableFuture
    • pinChat

      private CompletableFuture<Void> pinChat(JidProvider chat, boolean pin)
    • starMessage

      Stars a message
      Parameters:
      info - the target message
      Returns:
      a CompletableFuture
    • starMessage

      private CompletableFuture<ChatMessageInfo> starMessage(ChatMessageInfo info, boolean star)
    • fromMeToFlag

      private String fromMeToFlag(MessageInfo info)
    • participantToFlag

      private String participantToFlag(MessageInfo info)
    • booleanToInt

      private String booleanToInt(boolean keepStarredMessages)
    • unstarMessage

      public CompletableFuture<ChatMessageInfo> unstarMessage(ChatMessageInfo info)
      Removes star from a message
      Parameters:
      info - the target message
      Returns:
      a CompletableFuture
    • archiveChat

      public CompletableFuture<Void> archiveChat(JidProvider chat)
      Archives a chat. If said chat is pinned, it will be unpinned.
      Parameters:
      chat - the target chat
      Returns:
      a CompletableFuture
    • archiveChat

      private CompletableFuture<Void> archiveChat(JidProvider chat, boolean archive)
    • unarchive

      public CompletableFuture<Void> unarchive(JidProvider chat)
      Unarchives a chat
      Parameters:
      chat - the target chat
      Returns:
      a CompletableFuture
    • deleteMessage

      public CompletableFuture<Void> deleteMessage(NewsletterMessageInfo messageInfo)
      Deletes a message
      Parameters:
      messageInfo - the non-null message to delete
      Returns:
      a CompletableFuture
    • deleteMessage

      public CompletableFuture<Void> deleteMessage(ChatMessageInfo messageInfo, boolean everyone)
      Deletes a message
      Parameters:
      messageInfo - non-null message to delete
      everyone - whether the message should be deleted for everyone or only for this client and its companions
      Returns:
      a CompletableFuture
    • getEditBit

      private int getEditBit(MessageInfo info)
    • getDeleteBit

      private int getDeleteBit(MessageInfo info)
    • deleteChat

      public CompletableFuture<Void> deleteChat(JidProvider chat)
      Deletes a chat for this client and its companions using a modern version of Whatsapp Important: this message doesn't seem to work always as of now
      Parameters:
      chat - the non-null chat to delete
      Returns:
      a CompletableFuture
    • clearChat

      public CompletableFuture<Void> clearChat(JidProvider chat, boolean keepStarredMessages)
      Clears the content of a chat for this client and its companions using a modern version of Whatsapp Important: this message doesn't seem to work always as of now
      Parameters:
      chat - the non-null chat to clear
      keepStarredMessages - whether starred messages in this chat should be kept
      Returns:
      a CompletableFuture
    • changeBusinessDescription

      public CompletableFuture<String> changeBusinessDescription(String description)
      Change the description of this business profile
      Parameters:
      description - the new description, can be null
      Returns:
      a CompletableFuture
    • changeBusinessAttribute

      private CompletableFuture<String> changeBusinessAttribute(String key, String value)
    • checkBusinessAttributeConflict

      private void checkBusinessAttributeConflict(String key, String value, Node result)
    • changeBusinessAddress

      public CompletableFuture<String> changeBusinessAddress(String address)
      Change the address of this business profile
      Parameters:
      address - the new address, can be null
      Returns:
      a CompletableFuture
    • changeBusinessEmail

      public CompletableFuture<String> changeBusinessEmail(String email)
      Change the email of this business profile
      Parameters:
      email - the new email, can be null
      Returns:
      a CompletableFuture
    • isValidEmail

      private boolean isValidEmail(String email)
    • changeBusinessCategories

      public CompletableFuture<List<BusinessCategory>> changeBusinessCategories(List<BusinessCategory> categories)
      Change the categories of this business profile
      Parameters:
      categories - the new categories, can be null
      Returns:
      a CompletableFuture
    • createCategories

      private Collection<Node> createCategories(List<BusinessCategory> categories)
    • changeBusinessWebsites

      public CompletableFuture<List<URI>> changeBusinessWebsites(List<URI> websites)
      Change the websites of this business profile
      Parameters:
      websites - the new websites, can be null
      Returns:
      a CompletableFuture
    • createWebsites

      private List<Node> createWebsites(List<URI> websites)
    • queryBusinessCatalog

      public CompletableFuture<List<BusinessCatalogEntry>> queryBusinessCatalog()
      Query the catalog of this business
      Returns:
      a CompletableFuture
    • queryBusinessCatalog

      public CompletableFuture<List<BusinessCatalogEntry>> queryBusinessCatalog(int productsLimit)
      Query the catalog of this business
      Parameters:
      productsLimit - the maximum number of products to query
      Returns:
      a CompletableFuture
    • queryBusinessCatalog

      public CompletableFuture<List<BusinessCatalogEntry>> queryBusinessCatalog(JidProvider contact, int productsLimit)
      Query the catalog of a business
      Parameters:
      contact - the business
      productsLimit - the maximum number of products to query
      Returns:
      a CompletableFuture
    • parseCatalog

      private List<BusinessCatalogEntry> parseCatalog(Node result)
    • queryBusinessCatalog

      public CompletableFuture<List<BusinessCatalogEntry>> queryBusinessCatalog(JidProvider contact)
      Query the catalog of a business
      Parameters:
      contact - the business
      Returns:
      a CompletableFuture
    • queryBusinessCollections

      public CompletableFuture<?> queryBusinessCollections()
      Query the collections of this business
      Returns:
      a CompletableFuture
    • queryBusinessCollections

      public CompletableFuture<?> queryBusinessCollections(int collectionsLimit)
      Query the collections of this business
      Parameters:
      collectionsLimit - the maximum number of collections to query
      Returns:
      a CompletableFuture
    • queryBusinessCollections

      public CompletableFuture<List<BusinessCollectionEntry>> queryBusinessCollections(JidProvider contact, int collectionsLimit)
      Query the collections of a business
      Parameters:
      contact - the business
      collectionsLimit - the maximum number of collections to query
      Returns:
      a CompletableFuture
    • parseCollections

      private List<BusinessCollectionEntry> parseCollections(Node result)
    • queryBusinessCollections

      public CompletableFuture<?> queryBusinessCollections(JidProvider contact)
      Query the collections of a business
      Parameters:
      contact - the business
      Returns:
      a CompletableFuture
    • downloadMedia

      public CompletableFuture<Optional<byte[]>> downloadMedia(ChatMessageInfo info)
      Downloads a media from Whatsapp's servers. If the media was already downloaded, the cached version will be returned. If the download fails because the media is too old/invalid, a reupload request will be sent to Whatsapp. If the latter fails as well, an empty optional will be returned.
      Parameters:
      info - the non-null message info wrapping the media
      Returns:
      a CompletableFuture
    • downloadMedia

      public CompletableFuture<Optional<byte[]>> downloadMedia(NewsletterMessageInfo info)
      Downloads a media from Whatsapp's servers. If the media was already downloaded, the cached version will be returned. If the download fails because the media is too old/invalid, an empty optional will be returned.
      Parameters:
      info - the non-null message info wrapping the media
      Returns:
      a CompletableFuture
    • downloadMedia

      public CompletableFuture<Optional<byte[]>> downloadMedia(MediaMessage<?> mediaMessage)
      Downloads a media from Whatsapp's servers. If the media was already downloaded, the cached version will be returned. If the download fails because the media is too old/invalid, an empty optional will be returned.
      Parameters:
      mediaMessage - the non-null media
      Returns:
      a CompletableFuture
    • requireMediaReupload

      public CompletableFuture<Void> requireMediaReupload(ChatMessageInfo info)
      Asks Whatsapp for a media reupload for a specific media
      Parameters:
      info - the non-null message info wrapping the media
      Returns:
      a CompletableFuture
    • parseMediaReupload

      private void parseMediaReupload(ChatMessageInfo info, MediaMessage<?> mediaMessage, byte[] retryKey, byte[] retryIdData, Node node)
    • sendNode

      public CompletableFuture<Node> sendNode(Node node)
      Sends a custom node to Whatsapp
      Parameters:
      node - the non-null node to send
      Returns:
      the newsletters from Whatsapp
    • createCommunity

      public CompletableFuture<Optional<GroupMetadata>> createCommunity(String subject, String body)
      Creates a new community
      Parameters:
      subject - the non-null name of the new community
      body - the nullable description of the new community
      Returns:
      a CompletableFuture
    • changeCommunitySetting

      public CompletableFuture<Void> changeCommunitySetting(JidProvider community, CommunitySetting setting, ChatSettingPolicy policy)
      Changes a community setting
      Parameters:
      community - the non-null community affected by this change
      setting - the non-null setting
      policy - the non-null policy
      Returns:
      a future
    • unlinkDevices

      public CompletableFuture<Whatsapp> unlinkDevices()
      Unlinks all the companions of this device
      Returns:
      a future
    • unlinkDevice

      public CompletableFuture<Whatsapp> unlinkDevice(Jid companion)
      Unlinks a specific companion
      Parameters:
      companion - the non-null companion to unlink
      Returns:
      a future
    • linkDevice

      public CompletableFuture<CompanionLinkResult> linkDevice(byte[] qrCode)
      Links a companion to this device
      Parameters:
      qrCode - the non-null qr code as an image
      Returns:
      a future
    • linkDevice

      public CompletableFuture<CompanionLinkResult> linkDevice(String qrCodeData)
      Links a companion to this device Mobile api only
      Parameters:
      qrCodeData - the non-null qr code as a String
      Returns:
      a future
    • linkDevice

      private CompletableFuture<CompanionLinkResult> linkDevice(byte[] advIdentity, byte[] identityKey, String ref, byte[] publicKey)
    • getMaxLinkedDevices

      private int getMaxLinkedDevices()
    • handleCompanionPairing

      private CompletableFuture<CompanionLinkResult> handleCompanionPairing(Node result, int keyId)
    • awaitCompanionRegistration

      private CompletableFuture<Void> awaitCompanionRegistration(Jid device)
    • handleCompanionEncrypt

      private CompletableFuture<CompanionLinkResult> handleCompanionEncrypt(Node result, Jid companion, int keyId)
    • syncCompanionState

      private CompletableFuture<Void> syncCompanionState(Jid companion)
    • createRegularRequests

      private PatchRequest createRegularRequests()
    • createRegularLowRequests

      private PatchRequest createRegularLowRequests()
    • createCriticalBlockRequest

      private PatchRequest createCriticalBlockRequest()
    • createCriticalUnblockLowRequest

      private PatchRequest createCriticalUnblockLowRequest()
    • createContactEntries

      private List<PatchRequest.PatchEntry> createContactEntries()
    • createPushNameEntry

      private PatchRequest.PatchEntry createPushNameEntry()
    • createLocaleEntry

      private PatchRequest.PatchEntry createLocaleEntry()
    • createAndroidEntry

      private PatchRequest.PatchEntry createAndroidEntry()
    • createNuxRequest

      private PatchRequest.PatchEntry createNuxRequest()
    • createPrimaryVersionEntry

      private PatchRequest.PatchEntry createPrimaryVersionEntry(PrimaryVersionAction primaryVersion, String to)
    • createTimeFormatEntry

      private PatchRequest.PatchEntry createTimeFormatEntry()
    • createContactRequestEntry

      private PatchRequest.PatchEntry createContactRequestEntry(Contact contact)
    • sendRecentMessage

      private CompletableFuture<Void> sendRecentMessage(Jid jid)
    • sendPushNamesMessage

      private CompletableFuture<Void> sendPushNamesMessage(Jid jid)
    • sendInitialStatusMessage

      private CompletableFuture<Void> sendInitialStatusMessage(Jid jid)
    • sendInitialBootstrapMessage

      private CompletableFuture<Void> sendInitialBootstrapMessage(Jid jid)
    • sendInitialNullMessage

      private CompletableFuture<Void> sendInitialNullMessage(Jid jid)
    • getPastParticipants

      private GroupPastParticipants getPastParticipants(Chat chat)
    • sendAppStateKeysMessage

      private CompletableFuture<Void> sendAppStateKeysMessage(Jid companion)
    • createAppKey

      private AppStateSyncKey createAppKey(Jid jid, int index)
    • createAppKeyData

      private AppStateSyncKeyData createAppKeyData(Jid jid, int index)
    • createAppKeyFingerprint

      private AppStateSyncKeyFingerprint createAppKeyFingerprint(Jid jid, int index)
    • sendInitialSecurityMessage

      private CompletableFuture<Void> sendInitialSecurityMessage(Jid jid)
    • sendHistoryProtocolMessage

      private CompletableFuture<Void> sendHistoryProtocolMessage(Jid jid, HistorySync historySync, HistorySync.Type type)
    • createHistoryProtocolMessage

      private ProtocolMessage createHistoryProtocolMessage(MediaFile upload, HistorySync.Type type)
    • queryBusinessCertificate

      public CompletableFuture<Optional<BusinessVerifiedNameCertificate>> queryBusinessCertificate(JidProvider provider)
      Gets the verified name certificate
      Returns:
      a future
    • parseCertificate

      private Optional<BusinessVerifiedNameCertificate> parseCertificate(Node result)
    • enable2fa

      public CompletableFuture<?> enable2fa(String code)
      Enables two-factor authentication Mobile API only
      Parameters:
      code - the six digits non-null numeric code
      Returns:
      a future
    • enable2fa

      public CompletableFuture<Boolean> enable2fa(String code, String email)
      Enables two-factor authentication Mobile API only
      Parameters:
      code - the six digits non-null numeric code
      email - the nullable recovery email
      Returns:
      a future
    • disable2fa

      public CompletableFuture<Boolean> disable2fa()
      Disables two-factor authentication Mobile API only
      Returns:
      a future
    • set2fa

      private CompletableFuture<Boolean> set2fa(String code, String email)
    • startCall

      public CompletableFuture<Call> startCall(JidProvider contact)
      Starts a call with a contact Mobile API only
      Parameters:
      contact - the non-null contact
      Returns:
      a future
    • sendCallMessage

      private CompletableFuture<Call> sendCallMessage(JidProvider provider)
    • onCallSent

      private Call onCallSent(JidProvider provider, String callId, Node result)
    • createCallNode

      private Node createCallNode(JidProvider provider)
    • stopCall

      public CompletableFuture<Boolean> stopCall(String callId)
      Rejects an incoming call or stops an active call Mobile API only
      Parameters:
      callId - the non-null id of the call to reject
      Returns:
      a future
    • stopCall

      public CompletableFuture<Boolean> stopCall(Call call)
      Rejects an incoming call or stops an active call Mobile API only
      Parameters:
      call - the non-null call to reject
      Returns:
      a future
    • queryRecommendedNewsletters

      public CompletableFuture<Optional<RecommendedNewslettersResponse>> queryRecommendedNewsletters(String countryCode)
      Queries a list of fifty recommended newsletters by country
      Parameters:
      countryCode - the non-null country code
      Returns:
      a list of recommended newsletters, if the feature is available
    • queryRecommendedNewsletters

      public CompletableFuture<Optional<RecommendedNewslettersResponse>> queryRecommendedNewsletters(String countryCode, int limit)
      Queries a list of recommended newsletters by country
      Parameters:
      countryCode - the non-null country code
      limit - how many entries should be returned
      Returns:
      a list of recommended newsletters, if the feature is available
    • parseRecommendedNewsletters

      private Optional<RecommendedNewslettersResponse> parseRecommendedNewsletters(Node response)
    • queryNewsletterMessages

      public CompletableFuture<Void> queryNewsletterMessages(JidProvider newsletterJid, int count)
      Queries any number of messages from a newsletter
      Parameters:
      newsletterJid - the non-null jid of the newsletter
      count - how many messages should be queried
      Returns:
      a future
    • subscribeToNewsletterReactions

      public CompletableFuture<OptionalLong> subscribeToNewsletterReactions(JidProvider channel)
      Subscribes to a public newsletter's event stream of reactions
      Parameters:
      channel - the non-null channel
      Returns:
      the time, in minutes, during which updates will be sent
    • createNewsletter

      public CompletableFuture<Optional<Newsletter>> createNewsletter(String name)
      Creates a newsletter
      Parameters:
      name - the non-null name of the newsletter
      Returns:
      a future
    • createNewsletter

      public CompletableFuture<Optional<Newsletter>> createNewsletter(String name, String description)
      Creates newsletter channel
      Parameters:
      name - the non-null name of the newsletter
      description - the nullable description of the newsletter
      Returns:
      a future
    • createNewsletter

      public CompletableFuture<Optional<Newsletter>> createNewsletter(String name, String description, byte[] picture)
      Creates a newsletter
      Parameters:
      name - the non-null name of the newsletter
      description - the nullable description of the newsletter
      picture - the nullable profile picture of the newsletter
      Returns:
      a future
    • parseNewsletterCreation

      private Optional<Newsletter> parseNewsletterCreation(Node response)
    • onNewsletterCreation

      private CompletableFuture<Optional<Newsletter>> onNewsletterCreation(Optional<Newsletter> result)
    • changeNewsletterDescription

      public CompletableFuture<Void> changeNewsletterDescription(JidProvider newsletter, String description)
      Changes the description of a newsletter
      Parameters:
      newsletter - the non-null target newsletter
      description - the nullable new description
      Returns:
      a future
    • joinNewsletter

      public CompletableFuture<Void> joinNewsletter(JidProvider newsletter)
      Joins a newsletter
      Parameters:
      newsletter - a non-null newsletter
      Returns:
      a future
    • leaveNewsletter

      public CompletableFuture<Void> leaveNewsletter(JidProvider newsletter)
      Leaves a newsletter
      Parameters:
      newsletter - a non-null newsletter
      Returns:
      a future
    • queryNewsletterSubscribers

      public CompletableFuture<Long> queryNewsletterSubscribers(JidProvider newsletterJid)
      Queries the number of people subscribed to a newsletter
      Parameters:
      newsletterJid - the id of the newsletter
      Returns:
      a CompletableFuture
    • parseNewsletterSubscribers

      private long parseNewsletterSubscribers(Node response)
    • addListener

      public Whatsapp addListener(Listener listener)
      Registers a listener
      Parameters:
      listener - the listener to register
      Returns:
      the same instance
    • removeListener

      public Whatsapp removeListener(Listener listener)
      Unregisters a listener
      Parameters:
      listener - the listener to unregister
      Returns:
      the same instance
    • addActionListener

      public Whatsapp addActionListener(OnAction onAction)
      Registers an action listener
      Parameters:
      onAction - the listener to register
      Returns:
      the same instance
    • addChatMessagesSyncListener

      public Whatsapp addChatMessagesSyncListener(OnChatMessagesSync onChatRecentMessages)
      Registers a chat recent messages listener
      Parameters:
      onChatRecentMessages - the listener to register
      Returns:
      the same instance
    • addChatsListener

      public Whatsapp addChatsListener(OnChats onChats)
      Registers a chats listener
      Parameters:
      onChats - the listener to register
      Returns:
      the same instance
    • addChatsListener

      public Whatsapp addChatsListener(OnWhatsappChats onChats)
      Registers a chats listener
      Parameters:
      onChats - the listener to register
      Returns:
      the same instance
    • addNewslettersListener

      public Whatsapp addNewslettersListener(OnNewsletters onNewsletters)
      Registers a newsletters listener
      Parameters:
      onNewsletters - the listener to register
      Returns:
      the same instance
    • addNewslettersListener

      public Whatsapp addNewslettersListener(OnWhatsappNewsletters onNewsletters)
      Registers a newsletters listener
      Parameters:
      onNewsletters - the listener to register
      Returns:
      the same instance
    • addContactPresenceListener

      public Whatsapp addContactPresenceListener(OnContactPresence onContactPresence)
      Registers a contact presence listener
      Parameters:
      onContactPresence - the listener to register
      Returns:
      the same instance
    • addContactsListener

      public Whatsapp addContactsListener(OnContacts onContacts)
      Registers a contacts listener
      Parameters:
      onContacts - the listener to register
      Returns:
      the same instance
    • addMessageStatusListener

      public Whatsapp addMessageStatusListener(OnMessageStatus onAnyMessageStatus)
      Registers a message status listener
      Parameters:
      onAnyMessageStatus - the listener to register
      Returns:
      the same instance
    • addDisconnectedListener

      public Whatsapp addDisconnectedListener(OnDisconnected onDisconnected)
      Registers a disconnected listener
      Parameters:
      onDisconnected - the listener to register
      Returns:
      the same instance
    • addFeaturesListener

      public Whatsapp addFeaturesListener(OnFeatures onFeatures)
      Registers a features listener
      Parameters:
      onFeatures - the listener to register
      Returns:
      the same instance
    • addLoggedInListener

      public Whatsapp addLoggedInListener(OnLoggedIn onLoggedIn)
      Registers a logged in listener
      Parameters:
      onLoggedIn - the listener to register
      Returns:
      the same instance
    • addMessageDeletedListener

      public Whatsapp addMessageDeletedListener(OnMessageDeleted onMessageDeleted)
      Registers a message deleted listener
      Parameters:
      onMessageDeleted - the listener to register
      Returns:
      the same instance
    • addMetadataListener

      public Whatsapp addMetadataListener(OnMetadata onMetadata)
      Registers a metadata listener
      Parameters:
      onMetadata - the listener to register
      Returns:
      the same instance
    • addNewContactListener

      public Whatsapp addNewContactListener(OnNewContact onNewContact)
      Registers a new contact listener
      Parameters:
      onNewContact - the listener to register
      Returns:
      the same instance
    • addNewChatMessageListener

      public Whatsapp addNewChatMessageListener(OnNewMessage onNewMessage)
      Registers a new message listener
      Parameters:
      onNewMessage - the listener to register
      Returns:
      the same instance
    • addNewStatusListener

      public Whatsapp addNewStatusListener(OnNewStatus onNewMediaStatus)
      Registers a new status listener
      Parameters:
      onNewMediaStatus - the listener to register
      Returns:
      the same instance
    • addNodeReceivedListener

      public Whatsapp addNodeReceivedListener(OnNodeReceived onNodeReceived)
      Registers a received node listener
      Parameters:
      onNodeReceived - the listener to register
      Returns:
      the same instance
    • addNodeSentListener

      public Whatsapp addNodeSentListener(OnNodeSent onNodeSent)
      Registers a sent node listener
      Parameters:
      onNodeSent - the listener to register
      Returns:
      the same instance
    • addSettingListener

      public Whatsapp addSettingListener(OnSetting onSetting)
      Registers a setting listener
      Parameters:
      onSetting - the listener to register
      Returns:
      the same instance
    • addMediaStatusListener

      public Whatsapp addMediaStatusListener(OnStatus onMediaStatus)
      Registers a status listener
      Parameters:
      onMediaStatus - the listener to register
      Returns:
      the same instance
    • addSocketEventListener

      public Whatsapp addSocketEventListener(OnSocketEvent onSocketEvent)
      Registers an event listener
      Parameters:
      onSocketEvent - the listener to register
      Returns:
      the same instance
    • addActionListener

      public Whatsapp addActionListener(OnWhatsappAction onAction)
      Registers an action listener
      Parameters:
      onAction - the listener to register
      Returns:
      the same instance
    • addHistorySyncProgressListener

      public Whatsapp addHistorySyncProgressListener(OnHistorySyncProgress onSyncProgress)
      Registers a sync progress listener
      Parameters:
      onSyncProgress - the listener to register
      Returns:
      the same instance
    • addChatMessagesSyncListener

      public Whatsapp addChatMessagesSyncListener(OnWhatsappChatMessagesSync onChatRecentMessages)
      Registers a chat recent messages listener
      Parameters:
      onChatRecentMessages - the listener to register
      Returns:
      the same instance
    • addContactPresenceListener

      public Whatsapp addContactPresenceListener(OnWhatsappContactPresence onContactPresence)
      Registers a contact presence listener
      Parameters:
      onContactPresence - the listener to register
      Returns:
      the same instance
    • addContactsListener

      public Whatsapp addContactsListener(OnWhatsappContacts onContacts)
      Registers a contacts listener
      Parameters:
      onContacts - the listener to register
      Returns:
      the same instance
    • addMessageStatusListener

      public Whatsapp addMessageStatusListener(OnWhatsappMessageStatus onMessageStatus)
      Registers a message status listener
      Parameters:
      onMessageStatus - the listener to register
      Returns:
      the same instance
    • addDisconnectedListener

      public Whatsapp addDisconnectedListener(OnWhatsappDisconnected onDisconnected)
      Registers a disconnected listener
      Parameters:
      onDisconnected - the listener to register
      Returns:
      the same instance
    • addFeaturesListener

      public Whatsapp addFeaturesListener(OnWhatsappFeatures onFeatures)
      Registers a features listener
      Parameters:
      onFeatures - the listener to register
      Returns:
      the same instance
    • addLoggedInListener

      public Whatsapp addLoggedInListener(OnWhatsappLoggedIn onLoggedIn)
      Registers a logged in listener
      Parameters:
      onLoggedIn - the listener to register
      Returns:
      the same instance
    • addMessageDeletedListener

      public Whatsapp addMessageDeletedListener(OnWhatsappMessageDeleted onMessageDeleted)
      Registers a message deleted listener
      Parameters:
      onMessageDeleted - the listener to register
      Returns:
      the same instance
    • addMetadataListener

      public Whatsapp addMetadataListener(OnWhatsappMetadata onMetadata)
      Registers a metadata listener
      Parameters:
      onMetadata - the listener to register
      Returns:
      the same instance
    • addNewChatMessageListener

      public Whatsapp addNewChatMessageListener(OnWhatsappNewMessage onNewMessage)
      Registers a new message listener
      Parameters:
      onNewMessage - the listener to register
      Returns:
      the same instance
    • addNewStatusListener

      public Whatsapp addNewStatusListener(OnWhatsappNewStatus onNewStatus)
      Registers a new status listener
      Parameters:
      onNewStatus - the listener to register
      Returns:
      the same instance
    • addNodeReceivedListener

      public Whatsapp addNodeReceivedListener(OnWhatsappNodeReceived onNodeReceived)
      Registers a received node listener
      Parameters:
      onNodeReceived - the listener to register
      Returns:
      the same instance
    • addNodeSentListener

      public Whatsapp addNodeSentListener(OnWhatsappNodeSent onNodeSent)
      Registers a sent node listener
      Parameters:
      onNodeSent - the listener to register
      Returns:
      the same instance
    • addSettingListener

      public Whatsapp addSettingListener(OnWhatsappSetting onSetting)
      Registers a setting listener
      Parameters:
      onSetting - the listener to register
      Returns:
      the same instance
    • addMediaStatusListener

      public Whatsapp addMediaStatusListener(OnWhatsappMediaStatus onStatus)
      Registers a status listener
      Parameters:
      onStatus - the listener to register
      Returns:
      the same instance
    • addSocketEventListener

      public Whatsapp addSocketEventListener(OnWhatsappSocketEvent onSocketEvent)
      Registers an event listener
      Parameters:
      onSocketEvent - the listener to register
      Returns:
      the same instance
    • addHistorySyncProgressListener

      public Whatsapp addHistorySyncProgressListener(OnWhatsappHistorySyncProgress onSyncProgress)
      Registers a sync progress listener
      Parameters:
      onSyncProgress - the listener to register
      Returns:
      the same instance
    • addMessageReplyListener

      public Whatsapp addMessageReplyListener(OnWhatsappMessageReply onMessageReply)
      Registers a message reply listener
      Parameters:
      onMessageReply - the listener to register
      Returns:
      the same instance
    • addMessageReplyListener

      public Whatsapp addMessageReplyListener(ChatMessageInfo info, OnMessageReply onMessageReply)
      Registers a message reply listener for a specific message
      Parameters:
      info - the non-null target message
      onMessageReply - the non-null listener
    • addMessageReplyListener

      public Whatsapp addMessageReplyListener(OnMessageReply onMessageReply)
      Registers a message reply listener
      Parameters:
      onMessageReply - the listener to register
      Returns:
      the same instance
    • addMessageReplyListener

      public Whatsapp addMessageReplyListener(ChatMessageInfo info, OnWhatsappMessageReply onMessageReply)
      Registers a message reply listener for a specific message
      Parameters:
      info - the non-null target message
      onMessageReply - the non-null listener
    • addMessageReplyListener

      public Whatsapp addMessageReplyListener(String id, OnMessageReply onMessageReply)
      Registers a message reply listener for a specific message
      Parameters:
      id - the non-null id of the target message
      onMessageReply - the non-null listener
    • addMessageReplyListener

      public Whatsapp addMessageReplyListener(String id, OnWhatsappMessageReply onMessageReply)
      Registers a message reply listener for a specific message
      Parameters:
      id - the non-null id of the target message
      onMessageReply - the non-null listener
    • addNameChangedListener

      public Whatsapp addNameChangedListener(OnUserNameChanged onUserNameChanged)
      Registers a name change listener
      Parameters:
      onUserNameChanged - the non-null listener
    • addNameChangedListener

      public Whatsapp addNameChangedListener(OnWhatsappNameChanged onNameChange)
      Registers a name change listener
      Parameters:
      onNameChange - the non-null listener
    • addAboutChangedListener

      public Whatsapp addAboutChangedListener(OnUserAboutChanged onUserAboutChanged)
      Registers a status change listener
      Parameters:
      onUserAboutChanged - the non-null listener
    • addAboutChangedListener

      public Whatsapp addAboutChangedListener(OnWhatsappAboutChanged onUserStatusChange)
      Registers a status change listener
      Parameters:
      onUserStatusChange - the non-null listener
    • addUserPictureChangedListener

      public Whatsapp addUserPictureChangedListener(OnProfilePictureChanged onProfilePictureChanged)
      Registers a picture change listener
      Parameters:
      onProfilePictureChanged - the non-null listener
    • addUserPictureChangedListener

      public Whatsapp addUserPictureChangedListener(OnWhatsappProfilePictureChanged onUserPictureChange)
      Registers a picture change listener
      Parameters:
      onUserPictureChange - the non-null listener
    • addContactPictureChangedListener

      public Whatsapp addContactPictureChangedListener(OnContactPictureChanged onContactPictureChanged)
      Registers a profile picture listener
      Parameters:
      onContactPictureChanged - the non-null listener
    • addContactPictureChangedListener

      public Whatsapp addContactPictureChangedListener(OnWhatsappContactPictureChanged onProfilePictureChange)
      Registers a profile picture listener
      Parameters:
      onProfilePictureChange - the non-null listener
    • addGroupPictureChangedListener

      public Whatsapp addGroupPictureChangedListener(OnGroupPictureChange onGroupPictureChange)
      Registers a group picture listener
      Parameters:
      onGroupPictureChange - the non-null listener
    • addGroupPictureChangedListener

      public Whatsapp addGroupPictureChangedListener(OnWhatsappGroupPictureChange onGroupPictureChange)
      Registers a group picture listener
      Parameters:
      onGroupPictureChange - the non-null listener
    • addContactBlockedListener

      public Whatsapp addContactBlockedListener(OnContactBlocked onContactBlocked)
      Registers a contact blocked listener
      Parameters:
      onContactBlocked - the non-null listener
    • addContactBlockedListener

      public Whatsapp addContactBlockedListener(OnWhatsappContactBlocked onContactBlocked)
      Registers a contact blocked listener
      Parameters:
      onContactBlocked - the non-null listener
    • addPrivacySettingChangedListener

      public Whatsapp addPrivacySettingChangedListener(OnPrivacySettingChanged onPrivacySettingChanged)
      Registers a privacy setting changed listener
      Parameters:
      onPrivacySettingChanged - the listener to register
      Returns:
      the same instance
    • addPrivacySettingChangedListener

      public Whatsapp addPrivacySettingChangedListener(OnWhatsappPrivacySettingChanged onWhatsappPrivacySettingChanged)
      Registers a privacy setting changed listener
      Parameters:
      onWhatsappPrivacySettingChanged - the listener to register
      Returns:
      the same instance
    • addLinkedDevicesListener

      public Whatsapp addLinkedDevicesListener(OnLinkedDevices onLinkedDevices)
      Registers a companion devices changed listener
      Parameters:
      onLinkedDevices - the listener to register
      Returns:
      the same instance
    • addLinkedDevicesListener

      public Whatsapp addLinkedDevicesListener(OnWhatsappLinkedDevices onWhatsappLinkedDevices)
      Registers a companion devices changed listener
      Parameters:
      onWhatsappLinkedDevices - the listener to register
      Returns:
      the same instance
    • addRegistrationCodeListener

      public Whatsapp addRegistrationCodeListener(OnRegistrationCode onRegistrationCode)
      Registers a registration code listener for the mobile api
      Parameters:
      onRegistrationCode - the listener to register
      Returns:
      the same instance
    • addLinkedDevicesListener

      public Whatsapp addLinkedDevicesListener(OnWhatsappRegistrationCode onWhatsappRegistrationCode)
      Registers a registration code listener for the mobile api
      Parameters:
      onWhatsappRegistrationCode - the listener to register
      Returns:
      the same instance
    • addRegistrationCodeListener

      public Whatsapp addRegistrationCodeListener(OnCall onCall)
      Registers a call listener
      Parameters:
      onCall - the listener to register
      Returns:
      the same instance
    • addLinkedDevicesListener

      public Whatsapp addLinkedDevicesListener(OnWhatsappCall onWhatsappCall)
      Registers a call listener
      Parameters:
      onWhatsappCall - the listener to register
      Returns:
      the same instance
    • jidOrThrowError

      private Jid jidOrThrowError()