Function makeWASocket

  • Parameters

    Returns {
        addChatLabel: ((jid, labelId) => Promise<void>);
        addMessageLabel: ((jid, messageId, labelId) => Promise<void>);
        appPatch: ((patchCreate) => Promise<void>);
        assertSessions: ((jids, force) => Promise<boolean>);
        authState: {
            creds: AuthenticationCreds;
            keys: SignalKeyStoreWithTransaction;
        };
        chatModify: ((mod, jid) => Promise<void>);
        cleanDirtyBits: ((type, fromTimestamp?) => Promise<void>);
        end: ((error) => void);
        ev: BaileysBufferableEventEmitter;
        fetchBlocklist: (() => Promise<string[]>);
        fetchPrivacySettings: ((force?) => Promise<{
            [_: string]: string;
        }>);
        fetchStatus: ((jid) => Promise<undefined | {
            setAt: Date;
            status: undefined | string;
        }>);
        generateMessageTag: (() => string);
        getBusinessProfile: ((jid) => Promise<void | WABusinessProfile>);
        getCatalog: ((__namedParameters) => Promise<{
            nextPageCursor: undefined | string;
            products: Product[];
        }>);
        getCollections: ((jid?, limit?) => Promise<{
            collections: CatalogCollection[];
        }>);
        getOrderDetails: ((orderId, tokenBase64) => Promise<OrderDetails>);
        getPrivacyTokens: ((jids) => Promise<BinaryNode>);
        groupAcceptInvite: ((code) => Promise<undefined | string>);
        groupAcceptInviteV4: ((...args) => Promise<string>);
        groupCreate: ((subject, participants) => Promise<GroupMetadata>);
        groupFetchAllParticipating: (() => Promise<{
            [_: string]: GroupMetadata;
        }>);
        groupGetInviteInfo: ((code) => Promise<GroupMetadata>);
        groupInviteCode: ((jid) => Promise<undefined | string>);
        groupLeave: ((id) => Promise<void>);
        groupMetadata: ((jid) => Promise<GroupMetadata>);
        groupParticipantsUpdate: ((jid, participants, action) => Promise<{
            content: BinaryNode;
            jid: string;
            status: string;
        }[]>);
        groupRequestParticipantsList: ((jid) => Promise<{
            [key: string]: string;
        }[]>);
        groupRequestParticipantsUpdate: ((jid, participants, action) => Promise<{
            jid: string;
            status: string;
        }[]>);
        groupRevokeInvite: ((jid) => Promise<undefined | string>);
        groupSettingUpdate: ((jid, setting) => Promise<void>);
        groupToggleEphemeral: ((jid, ephemeralExpiration) => Promise<void>);
        groupUpdateDescription: ((jid, description?) => Promise<void>);
        groupUpdateSubject: ((jid, subject) => Promise<void>);
        logout: ((msg?) => Promise<void>);
        onUnexpectedError: ((err, msg) => void);
        onWhatsApp: ((...jids) => Promise<{
            exists: boolean;
            jid: string;
        }[]>);
        presenceSubscribe: ((toJid, tcToken?) => Promise<void>);
        processingMutex: {
            mutex<T>(code) => Promise<T>;
        };
        productCreate: ((create) => Promise<Product>);
        productDelete: ((productIds) => Promise<{
            deleted: number;
        }>);
        productUpdate: ((productId, update) => Promise<Product>);
        profilePictureUrl: ((jid, type?, timeoutMs?) => Promise<undefined | string>);
        query: ((node, timeoutMs?) => Promise<BinaryNode>);
        readMessages: ((keys) => Promise<void>);
        refreshMediaConn: ((forceGet?) => Promise<MediaConnInfo>);
        register: ((code) => Promise<ExistsResponse>);
        rejectCall: ((callId, callFrom) => Promise<void>);
        relayMessage: ((jid, message, __namedParameters) => Promise<string>);
        removeChatLabel: ((jid, labelId) => Promise<void>);
        removeMessageLabel: ((jid, messageId, labelId) => Promise<void>);
        removeProfilePicture: ((jid) => Promise<void>);
        requestPairingCode: ((phoneNumber) => Promise<string>);
        requestRegistrationCode: ((registrationOptions?) => Promise<ExistsResponse>);
        resyncAppState: ((...args) => Promise<void>);
        sendMessage: ((jid, content, options?) => Promise<undefined | WebMessageInfo>);
        sendMessageAck: ((__namedParameters) => Promise<void>);
        sendNode: ((frame) => Promise<void>);
        sendPresenceUpdate: ((type, toJid?) => Promise<void>);
        sendRawMessage: ((data) => Promise<void>);
        sendReceipt: ((jid, participant, messageIds, type) => Promise<void>);
        sendReceipts: ((keys, type) => Promise<void>);
        sendRetryRequest: ((node, forceIncludeKeys?) => Promise<void>);
        signalRepository: SignalRepository;
        type: "md";
        updateBlockStatus: ((jid, action) => Promise<void>);
        updateDefaultDisappearingMode: ((duration) => Promise<void>);
        updateGroupsAddPrivacy: ((value) => Promise<void>);
        updateLastSeenPrivacy: ((value) => Promise<void>);
        updateMediaMessage: ((message) => Promise<IWebMessageInfo>);
        updateOnlinePrivacy: ((value) => Promise<void>);
        updateProfileName: ((name) => Promise<void>);
        updateProfilePicture: ((jid, content) => Promise<void>);
        updateProfilePicturePrivacy: ((value) => Promise<void>);
        updateProfileStatus: ((status) => Promise<void>);
        updateReadReceiptsPrivacy: ((value) => Promise<void>);
        updateStatusPrivacy: ((value) => Promise<void>);
        uploadPreKeys: ((count?) => Promise<void>);
        uploadPreKeysToServerIfRequired: (() => Promise<void>);
        upsertMessage: ((...args) => Promise<void>);
        user: undefined | Contact;
        waUploadToServer: WAMediaUploadFunction;
        waitForConnectionUpdate: ((check, timeoutMs?) => Promise<void>);
        waitForMessage: (<T>(msgId, timeoutMs?) => Promise<T>);
        waitForSocketOpen: (() => Promise<void>);
        ws: any;
    }

    • addChatLabel: ((jid, labelId) => Promise<void>)
        • (jid, labelId): Promise<void>
        • Adds label for the chats

          Parameters

          • jid: string
          • labelId: string

          Returns Promise<void>

    • addMessageLabel: ((jid, messageId, labelId) => Promise<void>)
        • (jid, messageId, labelId): Promise<void>
        • Adds label for the message

          Parameters

          • jid: string
          • messageId: string
          • labelId: string

          Returns Promise<void>

    • appPatch: ((patchCreate) => Promise<void>)
        • (patchCreate): Promise<void>
        • Parameters

          Returns Promise<void>

    • assertSessions: ((jids, force) => Promise<boolean>)
        • (jids, force): Promise<boolean>
        • Parameters

          • jids: string[]
          • force: boolean

          Returns Promise<boolean>

    • authState: {
          creds: AuthenticationCreds;
          keys: SignalKeyStoreWithTransaction;
      }
    • chatModify: ((mod, jid) => Promise<void>)
        • (mod, jid): Promise<void>
        • modify a chat -- mark unread, read etc. lastMessages must be sorted in reverse chronologically requires the last messages till the last message received; required for archive & unread

          Parameters

          Returns Promise<void>

    • cleanDirtyBits: ((type, fromTimestamp?) => Promise<void>)
        • (type, fromTimestamp?): Promise<void>
        • Parameters

          • type: "account_sync" | "groups"
          • Optional fromTimestamp: string | number

          Returns Promise<void>

    • end: ((error) => void)
        • (error): void
        • Parameters

          • error: undefined | Error

          Returns void

    • ev: BaileysBufferableEventEmitter
    • fetchBlocklist: (() => Promise<string[]>)
        • (): Promise<string[]>
        • Returns Promise<string[]>

    • fetchPrivacySettings: ((force?) => Promise<{
          [_: string]: string;
      }>)
        • (force?): Promise<{
              [_: string]: string;
          }>
        • Parameters

          • force: boolean = false

          Returns Promise<{
              [_: string]: string;
          }>

    • fetchStatus: ((jid) => Promise<undefined | {
          setAt: Date;
          status: undefined | string;
      }>)
        • (jid): Promise<undefined | {
              setAt: Date;
              status: undefined | string;
          }>
        • Parameters

          • jid: string

          Returns Promise<undefined | {
              setAt: Date;
              status: undefined | string;
          }>

    • generateMessageTag: (() => string)
        • (): string
        • Returns string

    • getBusinessProfile: ((jid) => Promise<void | WABusinessProfile>)
    • getCatalog: ((__namedParameters) => Promise<{
          nextPageCursor: undefined | string;
          products: Product[];
      }>)
        • (__namedParameters): Promise<{
              nextPageCursor: undefined | string;
              products: Product[];
          }>
        • Parameters

          Returns Promise<{
              nextPageCursor: undefined | string;
              products: Product[];
          }>

    • getCollections: ((jid?, limit?) => Promise<{
          collections: CatalogCollection[];
      }>)
        • (jid?, limit?): Promise<{
              collections: CatalogCollection[];
          }>
        • Parameters

          • Optional jid: string
          • limit: number = 51

          Returns Promise<{
              collections: CatalogCollection[];
          }>

    • getOrderDetails: ((orderId, tokenBase64) => Promise<OrderDetails>)
    • getPrivacyTokens: ((jids) => Promise<BinaryNode>)
    • groupAcceptInvite: ((code) => Promise<undefined | string>)
        • (code): Promise<undefined | string>
        • Parameters

          • code: string

          Returns Promise<undefined | string>

    • groupAcceptInviteV4: ((...args) => Promise<string>)
    • groupCreate: ((subject, participants) => Promise<GroupMetadata>)
    • groupFetchAllParticipating: (() => Promise<{
          [_: string]: GroupMetadata;
      }>)
    • groupGetInviteInfo: ((code) => Promise<GroupMetadata>)
    • groupInviteCode: ((jid) => Promise<undefined | string>)
        • (jid): Promise<undefined | string>
        • Parameters

          • jid: string

          Returns Promise<undefined | string>

    • groupLeave: ((id) => Promise<void>)
        • (id): Promise<void>
        • Parameters

          • id: string

          Returns Promise<void>

    • groupMetadata: ((jid) => Promise<GroupMetadata>)
    • groupParticipantsUpdate: ((jid, participants, action) => Promise<{
          content: BinaryNode;
          jid: string;
          status: string;
      }[]>)
        • (jid, participants, action): Promise<{
              content: BinaryNode;
              jid: string;
              status: string;
          }[]>
        • Parameters

          Returns Promise<{
              content: BinaryNode;
              jid: string;
              status: string;
          }[]>

    • groupRequestParticipantsList: ((jid) => Promise<{
          [key: string]: string;
      }[]>)
        • (jid): Promise<{
              [key: string]: string;
          }[]>
        • Parameters

          • jid: string

          Returns Promise<{
              [key: string]: string;
          }[]>

    • groupRequestParticipantsUpdate: ((jid, participants, action) => Promise<{
          jid: string;
          status: string;
      }[]>)
        • (jid, participants, action): Promise<{
              jid: string;
              status: string;
          }[]>
        • Parameters

          • jid: string
          • participants: string[]
          • action: "reject" | "approve"

          Returns Promise<{
              jid: string;
              status: string;
          }[]>

    • groupRevokeInvite: ((jid) => Promise<undefined | string>)
        • (jid): Promise<undefined | string>
        • Parameters

          • jid: string

          Returns Promise<undefined | string>

    • groupSettingUpdate: ((jid, setting) => Promise<void>)
        • (jid, setting): Promise<void>
        • Parameters

          • jid: string
          • setting: "announcement" | "locked" | "not_announcement" | "unlocked"

          Returns Promise<void>

    • groupToggleEphemeral: ((jid, ephemeralExpiration) => Promise<void>)
        • (jid, ephemeralExpiration): Promise<void>
        • Parameters

          • jid: string
          • ephemeralExpiration: number

          Returns Promise<void>

    • groupUpdateDescription: ((jid, description?) => Promise<void>)
        • (jid, description?): Promise<void>
        • Parameters

          • jid: string
          • Optional description: string

          Returns Promise<void>

    • groupUpdateSubject: ((jid, subject) => Promise<void>)
        • (jid, subject): Promise<void>
        • Parameters

          • jid: string
          • subject: string

          Returns Promise<void>

    • logout: ((msg?) => Promise<void>)
        • (msg?): Promise<void>
        • logout & invalidate connection

          Parameters

          • Optional msg: string

          Returns Promise<void>

    • onUnexpectedError: ((err, msg) => void)
        • (err, msg): void
        • log & process any unexpected errors

          Parameters

          • err: Error | Boom<any>
          • msg: string

          Returns void

    • onWhatsApp: ((...jids) => Promise<{
          exists: boolean;
          jid: string;
      }[]>)
        • (...jids): Promise<{
              exists: boolean;
              jid: string;
          }[]>
        • Parameters

          • Rest ...jids: string[]

          Returns Promise<{
              exists: boolean;
              jid: string;
          }[]>

    • presenceSubscribe: ((toJid, tcToken?) => Promise<void>)
        • (toJid, tcToken?): Promise<void>
        • Parameters

          • toJid: string

            the jid to subscribe to

          • Optional tcToken: Buffer

            token for subscription, use if present

          Returns Promise<void>

    • processingMutex: {
          mutex<T>(code) => Promise<T>;
      }
      • mutex:function
        • Type Parameters

          • T

          Parameters

          • code: (() => T | Promise<T>)
              • (): T | Promise<T>
              • Returns T | Promise<T>

          Returns Promise<T>

    • productCreate: ((create) => Promise<Product>)
    • productDelete: ((productIds) => Promise<{
          deleted: number;
      }>)
        • (productIds): Promise<{
              deleted: number;
          }>
        • Parameters

          • productIds: string[]

          Returns Promise<{
              deleted: number;
          }>

    • productUpdate: ((productId, update) => Promise<Product>)
    • profilePictureUrl: ((jid, type?, timeoutMs?) => Promise<undefined | string>)
        • (jid, type?, timeoutMs?): Promise<undefined | string>
        • fetch the profile picture of a user/group type = "preview" for a low res picture type = "image for the high res picture"

          Parameters

          • jid: string
          • type: "image" | "preview" = 'preview'
          • Optional timeoutMs: number

          Returns Promise<undefined | string>

    • query: ((node, timeoutMs?) => Promise<BinaryNode>)
        • (node, timeoutMs?): Promise<BinaryNode>
        • send a query, and wait for its response. auto-generates message ID if not provided

          Parameters

          Returns Promise<BinaryNode>

    • readMessages: ((keys) => Promise<void>)
        • (keys): Promise<void>
        • Bulk read messages. Keys can be from different chats & participants

          Parameters

          Returns Promise<void>

    • refreshMediaConn: ((forceGet?) => Promise<MediaConnInfo>)
    • register: ((code) => Promise<ExistsResponse>)
        • (code): Promise<ExistsResponse>
        • Parameters

          • code: string

          Returns Promise<ExistsResponse>

    • rejectCall: ((callId, callFrom) => Promise<void>)
        • (callId, callFrom): Promise<void>
        • Parameters

          • callId: string
          • callFrom: string

          Returns Promise<void>

    • relayMessage: ((jid, message, __namedParameters) => Promise<string>)
        • (jid, message, __namedParameters): Promise<string>
        • Parameters

          Returns Promise<string>

    • removeChatLabel: ((jid, labelId) => Promise<void>)
        • (jid, labelId): Promise<void>
        • Removes label for the chat

          Parameters

          • jid: string
          • labelId: string

          Returns Promise<void>

    • removeMessageLabel: ((jid, messageId, labelId) => Promise<void>)
        • (jid, messageId, labelId): Promise<void>
        • Removes label for the message

          Parameters

          • jid: string
          • messageId: string
          • labelId: string

          Returns Promise<void>

    • removeProfilePicture: ((jid) => Promise<void>)
        • (jid): Promise<void>
        • remove the profile picture for yourself or a group

          Parameters

          • jid: string

          Returns Promise<void>

    • requestPairingCode: ((phoneNumber) => Promise<string>)
        • (phoneNumber): Promise<string>
        • Parameters

          • phoneNumber: string

          Returns Promise<string>

    • requestRegistrationCode: ((registrationOptions?) => Promise<ExistsResponse>)
        • (registrationOptions?): Promise<ExistsResponse>
        • Parameters

          • Optional registrationOptions: RegistrationOptions

          Returns Promise<ExistsResponse>

    • resyncAppState: ((...args) => Promise<void>)
        • (...args): Promise<void>
        • Parameters

          • Rest ...args: [collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean]

          Returns Promise<void>

    • sendMessage: ((jid, content, options?) => Promise<undefined | WebMessageInfo>)
    • sendMessageAck: ((__namedParameters) => Promise<void>)
        • (__namedParameters): Promise<void>
        • Parameters

          Returns Promise<void>

    • sendNode: ((frame) => Promise<void>)
        • (frame): Promise<void>
        • send a binary node

          Parameters

          Returns Promise<void>

    • sendPresenceUpdate: ((type, toJid?) => Promise<void>)
        • (type, toJid?): Promise<void>
        • Parameters

          Returns Promise<void>

    • sendRawMessage: ((data) => Promise<void>)
        • (data): Promise<void>
        • send a raw buffer

          Parameters

          • data: Uint8Array | Buffer

          Returns Promise<void>

    • sendReceipt: ((jid, participant, messageIds, type) => Promise<void>)
        • (jid, participant, messageIds, type): Promise<void>
        • generic send receipt function used for receipts of phone call, read, delivery etc.

          Parameters

          Returns Promise<void>

    • sendReceipts: ((keys, type) => Promise<void>)
    • sendRetryRequest: ((node, forceIncludeKeys?) => Promise<void>)
        • (node, forceIncludeKeys?): Promise<void>
        • Parameters

          Returns Promise<void>

    • signalRepository: SignalRepository
    • type: "md"
    • updateBlockStatus: ((jid, action) => Promise<void>)
        • (jid, action): Promise<void>
        • Parameters

          • jid: string
          • action: "block" | "unblock"

          Returns Promise<void>

    • updateDefaultDisappearingMode: ((duration) => Promise<void>)
        • (duration): Promise<void>
        • Parameters

          • duration: number

          Returns Promise<void>

    • updateGroupsAddPrivacy: ((value) => Promise<void>)
        • (value): Promise<void>
        • Parameters

          Returns Promise<void>

    • updateLastSeenPrivacy: ((value) => Promise<void>)
        • (value): Promise<void>
        • Parameters

          Returns Promise<void>

    • updateMediaMessage: ((message) => Promise<IWebMessageInfo>)
    • updateOnlinePrivacy: ((value) => Promise<void>)
    • updateProfileName: ((name) => Promise<void>)
        • (name): Promise<void>
        • Parameters

          • name: string

          Returns Promise<void>

    • updateProfilePicture: ((jid, content) => Promise<void>)
        • (jid, content): Promise<void>
        • update the profile picture for yourself or a group

          Parameters

          Returns Promise<void>

    • updateProfilePicturePrivacy: ((value) => Promise<void>)
        • (value): Promise<void>
        • Parameters

          Returns Promise<void>

    • updateProfileStatus: ((status) => Promise<void>)
        • (status): Promise<void>
        • update the profile status for yourself

          Parameters

          • status: string

          Returns Promise<void>

    • updateReadReceiptsPrivacy: ((value) => Promise<void>)
    • updateStatusPrivacy: ((value) => Promise<void>)
        • (value): Promise<void>
        • Parameters

          Returns Promise<void>

    • uploadPreKeys: ((count?) => Promise<void>)
        • (count?): Promise<void>
        • generates and uploads a set of pre-keys to the server

          Parameters

          • count: number = INITIAL_PREKEY_COUNT

          Returns Promise<void>

    • uploadPreKeysToServerIfRequired: (() => Promise<void>)
        • (): Promise<void>
        • Returns Promise<void>

    • upsertMessage: ((...args) => Promise<void>)
    • user: undefined | Contact
    • waUploadToServer: WAMediaUploadFunction
    • waitForConnectionUpdate: ((check, timeoutMs?) => Promise<void>)
        • (check, timeoutMs?): Promise<void>
        • Waits for the connection to WA to reach a state

          Parameters

          • check: ((u) => undefined | boolean)
              • (u): undefined | boolean
              • Parameters

                Returns undefined | boolean

          • Optional timeoutMs: number

          Returns Promise<void>

    • waitForMessage: (<T>(msgId, timeoutMs?) => Promise<T>)
        • <T>(msgId, timeoutMs?): Promise<T>
        • Wait for a message with a certain tag to be received

          Type Parameters

          • T

          Parameters

          • msgId: string

            the message tag to await

          • timeoutMs: undefined | number = defaultQueryTimeoutMs

            timeout after which the promise will reject

          Returns Promise<T>

    • waitForSocketOpen: (() => Promise<void>)
        • (): Promise<void>
        • Returns Promise<void>

    • ws: any

Generated using TypeDoc