@japofc/baileys - v2.4.7
    Preparing search index...

    Type Alias SocketConfig

    type SocketConfig = {
        agent?: Agent;
        appStateMacVerification: { patch: boolean; snapshot: boolean };
        auth: AuthenticationState;
        autoRotateQueryIds?: boolean;
        browser: WABrowserDescription;
        cachedGroupMetadata: (jid: string) => Promise<GroupMetadata | undefined>;
        callOfferCache?: CacheStore;
        connectTimeoutMs: number;
        countryCode: string;
        customUploadHosts: MediaConnInfo["hosts"];
        decryptFailureLog:
            | false
            | { max?: number; maxPerWindow?: number; windowMs?: number };
        defaultQueryTimeoutMs: number | undefined;
        emitOwnEvents: boolean;
        enableAutoSessionRecreation: boolean;
        enableRecentMessageCache: boolean;
        fetchAgent?: Agent;
        fireInitQueries: boolean;
        generateHighQualityLinkPreview: boolean;
        getMessage: (key: WAMessageKey) => Promise<any | undefined>;
        keepAliveIntervalMs: number;
        linkPreviewImageThumbnailWidth: number;
        logger: ILogger;
        makeSignalRepository: (
            auth: SignalAuthState,
            logger: ILogger,
            pnToLIDFunc?: (jids: string[]) => Promise<LIDMapping[] | undefined>,
        ) => SignalRepositoryWithLIDStore;
        markOnlineOnConnect: boolean;
        maxMsgRetryCount: number;
        mediaCache?: CacheStore;
        mobile?: boolean;
        msgRetryCounterCache?: CacheStore;
        options: RequestInit;
        patchMessageBeforeSending: (
            msg: any,
            recipientJids?: string[],
        ) =>
            | Promise<
                PatchedMessageWithRecipientJID[]
                | PatchedMessageWithRecipientJID,
            >
            | PatchedMessageWithRecipientJID[]
            | PatchedMessageWithRecipientJID;
        placeholderResendCache?: CacheStore;
        printQRInTerminal?: boolean;
        pushName?: string;
        qrTimeout?: number;
        retryRequestDelayMs: number;
        sendRateLimit?: SendGuardOptions;
        shouldIgnoreJid: (jid: string) => boolean | undefined;
        shouldSyncHistoryMessage: (msg: any) => boolean;
        syncFullHistory: boolean;
        transactionOpts: TransactionCapabilityOptions;
        userDevicesCache?: PossiblyExtendedCacheStore;
        usernameQueryIds?: Partial<
            Record<
                | "CHECK"
                | "CHECK_MULTI"
                | "SET"
                | "GET"
                | "GET_RECOMMENDATIONS"
                | "PIN_SET",
                string,
            >,
        >;
        version: WAVersion;
        waWebSocketUrl: string
        | URL;
    }
    Index
    agent?: Agent

    proxy agent

    appStateMacVerification: { patch: boolean; snapshot: boolean }

    verify app state MACs

    provide an auth state object to maintain the auth state

    autoRotateQueryIds?: boolean

    Auto-refresh the username GraphQL query_ids from the repo's main branch at socket creation (background, never throws, pinned IDs remain the fallback). Manual usernameQueryIds overrides always win. Default: false.

    override browser config

    cachedGroupMetadata: (jid: string) => Promise<GroupMetadata | undefined>

    cached group metadata, use to prevent redundant requests to WA & speed up msg sending

    callOfferCache?: CacheStore

    cache to store call offers

    connectTimeoutMs: number

    Fails the connection if the socket times out in this interval

    countryCode: string

    alphanumeric country code (USA -> US) for the number used

    customUploadHosts: MediaConnInfo["hosts"]

    custom upload hosts to upload media to

    decryptFailureLog:
        | false
        | { max?: number; maxPerWindow?: number; windowMs?: number }

    Rate-limit repeated decrypt-failure log lines for a dead session so a broken session cannot flood logs / exhaust the heap (see #2234). Pass an options object to tune the window/budget, or false to restore unlimited logging. Default: { windowMs: 60000, maxPerWindow: 5 }.

    Type Declaration

    • false
    • { max?: number; maxPerWindow?: number; windowMs?: number }
      • Optionalmax?: number

        cap on tracked session keys before oldest is pruned (default 5000)

      • OptionalmaxPerWindow?: number

        how many failures to log per session key per window (default 5)

      • OptionalwindowMs?: number

        length of each counting window in ms (default 60000)

    defaultQueryTimeoutMs: number | undefined

    Default timeout for queries, undefined for no timeout

    emitOwnEvents: boolean

    should events be emitted for actions done by this socket connection

    enableAutoSessionRecreation: boolean

    Enable automatic session recreation for failed messages

    enableRecentMessageCache: boolean

    Enable recent message caching for retry handling

    fetchAgent?: Agent

    agent used for fetch requests -- uploading/downloading media

    fireInitQueries: boolean

    Should baileys fire init queries automatically, default true

    generateHighQualityLinkPreview: boolean

    generate a high quality link preview, entails uploading the jpegThumbnail to WA

    getMessage: (key: WAMessageKey) => Promise<any | undefined>

    fetch a message from your store implement this so that messages failed to send (solves the "this message can take a while" issue) can be retried

    keepAliveIntervalMs: number

    ping-pong interval for WS connection

    linkPreviewImageThumbnailWidth: number

    width for link preview images

    logger: ILogger

    logger

    makeSignalRepository: (
        auth: SignalAuthState,
        logger: ILogger,
        pnToLIDFunc?: (jids: string[]) => Promise<LIDMapping[] | undefined>,
    ) => SignalRepositoryWithLIDStore
    markOnlineOnConnect: boolean

    marks the client as online whenever the socket successfully connects

    maxMsgRetryCount: number

    max retry count

    mediaCache?: CacheStore

    provide a cache to store media, so does not have to be re-uploaded

    mobile?: boolean

    should baileys use the mobile api instead of the multi device api

    This feature has been removed

    msgRetryCounterCache?: CacheStore

    map to store the retry counts for failed messages; used to determine whether to retry a message or not

    options: RequestInit

    options for HTTP fetch requests

    patchMessageBeforeSending: (
        msg: any,
        recipientJids?: string[],
    ) =>
        | Promise<
            PatchedMessageWithRecipientJID[]
            | PatchedMessageWithRecipientJID,
        >
        | PatchedMessageWithRecipientJID[]
        | PatchedMessageWithRecipientJID

    Optionally patch the message before sending out

    placeholderResendCache?: CacheStore

    cache to track placeholder resends

    printQRInTerminal?: boolean

    Print pairing QRs to the terminal automatically on connection.update (rendered with the built-in zero-dependency engine — see renderQRToTerminal in Utils for manual/custom rendering).

    pushName?: string

    Initial pushName carried in the registration ClientPayload (used by mock servers for deterministic phone assignment).

    qrTimeout?: number

    time to wait for the generation of the next QR in ms

    retryRequestDelayMs: number

    time to wait between sending new retry requests

    sendRateLimit?: SendGuardOptions

    Anti-ban outgoing pacing, applied transparently inside sendMessage(): a global messages/minute token bucket plus a minimum per-chat gap with jitter. Off by default. Individual calls can bypass with options.skipRateLimit. See createSendGuard().

    shouldIgnoreJid: (jid: string) => boolean | undefined

    Returns if a jid should be ignored, no event for that jid will be triggered. Messages from that jid will also not be decrypted

    shouldSyncHistoryMessage: (msg: any) => boolean

    manage history processing with this control; by default will sync up everything

    syncFullHistory: boolean

    Should Baileys ask the phone for full history, will be received async

    transaction capability options for SignalKeyStore

    userDevicesCache?: PossiblyExtendedCacheStore

    provide a cache to store a user's device list

    usernameQueryIds?: Partial<
        Record<
            | "CHECK"
            | "CHECK_MULTI"
            | "SET"
            | "GET"
            | "GET_RECOMMENDATIONS"
            | "PIN_SET",
            string,
        >,
    >

    Override the captured GraphQL query_ids used by the username APIs (checkUsername/setUsername/...). WhatsApp rotates these server-side; a rotated id fails with "GraphQL server error: Bad Request" and can be hot-patched here without waiting for a package update. Keys: CHECK, CHECK_MULTI, SET, GET, GET_RECOMMENDATIONS, PIN_SET.

    version: WAVersion

    version to connect with

    waWebSocketUrl: string | URL

    the WS url to connect to WA