@wppconnect/wa-js - v4.6.0
    Preparing search index...

    Function find

    • Find a chat by id

      This create a new chat if no one was found

      Parameters

      • chatId: string | Wid

        The chat id

      • originType: ChatOriginType = 'createChat'

        Why the chat is being created. Only relevant when the chat does not exist yet and needs to be created. Use 'username_contactless_search' for contacts resolved from a @username: it is the only origin that makes WhatsApp share your own phone number with the contact when your account has no username, matching the native flow.

      Returns Promise<ChatModel>

      const chat = await WPP.chat.find('[number]@c.us');

      // For a contact resolved from a @username lookup, pass the matching origin
      // so WhatsApp applies the same LID metadata it applies natively
      const { wid } = await WPP.contact.queryUsernameExists('someusername');
      const chat = await WPP.chat.find(wid, 'username_contactless_search');