Function makeInMemoryStore

  • Parameters

    • __namedParameters: BaileysInMemoryStoreConfig

    Returns {
        bind: ((ev) => void);
        chats: default<Chat, string>;
        contacts: {
            [_: string]: Contact;
        };
        fetchGroupMetadata: ((jid, sock) => Promise<GroupMetadata>);
        fetchImageUrl: ((jid, sock) => Promise<undefined | null | string>);
        fetchMessageReceipts: ((__namedParameters) => Promise<undefined | null | IUserReceipt[]>);
        fromJSON: ((json) => void);
        getChatLabels: ((chatId) => LabelAssociation[]);
        getLabels: (() => ObjectRepository<Label>);
        getMessageLabels: ((messageId) => string[]);
        groupMetadata: {
            [_: string]: GroupMetadata;
        };
        labelAssociations: default<LabelAssociation, string>;
        labels: ObjectRepository<Label>;
        loadMessage: ((jid, id) => Promise<undefined | IWebMessageInfo>);
        loadMessages: ((jid, count, cursor) => Promise<IWebMessageInfo[]>);
        messages: {
            [_: string]: ReturnType<typeof makeMessagesDictionary>;
        };
        mostRecentMessage: ((jid) => Promise<IWebMessageInfo>);
        presences: {
            [id: string]: {
                [participant: string]: PresenceData;
            };
        };
        readFromFile: ((path) => void);
        state: ConnectionState;
        toJSON: (() => {
            chats: default<Chat, string>;
            contacts: {
                [_: string]: Contact;
            };
            labelAssociations: default<LabelAssociation, string>;
            labels: ObjectRepository<Label>;
            messages: {
                [_: string]: ReturnType<typeof makeMessagesDictionary>;
            };
        });
        writeToFile: ((path) => void);
    }

    • bind: ((ev) => void)
        • (ev): void
        • binds to a BaileysEventEmitter. It listens to all events and constructs a state that you can query accurate data from. Eg. can use the store to fetch chats, contacts, messages etc.

          Parameters

          Returns void

    • chats: default<Chat, string>
    • contacts: {
          [_: string]: Contact;
      }
    • fetchGroupMetadata: ((jid, sock) => Promise<GroupMetadata>)
        • (jid, sock): Promise<GroupMetadata>
        • Parameters

          • jid: string
          • sock: undefined | {
                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;
            }

          Returns Promise<GroupMetadata>

    • fetchImageUrl: ((jid, sock) => Promise<undefined | null | string>)
        • (jid, sock): Promise<undefined | null | string>
        • Parameters

          • jid: string
          • sock: undefined | {
                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;
            }

          Returns Promise<undefined | null | string>

    • fetchMessageReceipts: ((__namedParameters) => Promise<undefined | null | IUserReceipt[]>)
    • fromJSON: ((json) => void)
        • (json): void
        • Parameters

          • json: {
                chats: Chat[];
                contacts: {
                    [id: string]: Contact;
                };
                labelAssociations: LabelAssociation[];
                labels: {
                    [labelId: string]: Label;
                };
                messages: {
                    [id: string]: WAMessage[];
                };
            }
            • chats: Chat[]
            • contacts: {
                  [id: string]: Contact;
              }
            • labelAssociations: LabelAssociation[]
            • labels: {
                  [labelId: string]: Label;
              }
              • [labelId: string]: Label
            • messages: {
                  [id: string]: WAMessage[];
              }

          Returns void

    • getChatLabels: ((chatId) => LabelAssociation[])
        • (chatId): LabelAssociation[]
        • Get labels for chat

          Parameters

          • chatId: string

          Returns LabelAssociation[]

          Label IDs

    • getLabels: (() => ObjectRepository<Label>)
        • (): ObjectRepository<Label>
        • Get all available labels for profile

          Keep in mind that the list is formed from predefined tags and tags that were "caught" during their editing.

          Returns ObjectRepository<Label>

    • getMessageLabels: ((messageId) => string[])
        • (messageId): string[]
        • Get labels for message

          Parameters

          • messageId: string

          Returns string[]

          Label IDs

    • groupMetadata: {
          [_: string]: GroupMetadata;
      }
    • labelAssociations: default<LabelAssociation, string>
    • labels: ObjectRepository<Label>
    • loadMessage: ((jid, id) => Promise<undefined | IWebMessageInfo>)
    • loadMessages: ((jid, count, cursor) => Promise<IWebMessageInfo[]>)
    • messages: {
          [_: string]: ReturnType<typeof makeMessagesDictionary>;
      }
      • [_: string]: ReturnType<typeof makeMessagesDictionary>
    • mostRecentMessage: ((jid) => Promise<IWebMessageInfo>)
    • presences: {
          [id: string]: {
              [participant: string]: PresenceData;
          };
      }
    • readFromFile: ((path) => void)
        • (path): void
        • Parameters

          • path: string

          Returns void

    • state: ConnectionState
    • toJSON: (() => {
          chats: default<Chat, string>;
          contacts: {
              [_: string]: Contact;
          };
          labelAssociations: default<LabelAssociation, string>;
          labels: ObjectRepository<Label>;
          messages: {
              [_: string]: ReturnType<typeof makeMessagesDictionary>;
          };
      })
        • (): {
              chats: default<Chat, string>;
              contacts: {
                  [_: string]: Contact;
              };
              labelAssociations: default<LabelAssociation, string>;
              labels: ObjectRepository<Label>;
              messages: {
                  [_: string]: ReturnType<typeof makeMessagesDictionary>;
              };
          }
        • Returns {
              chats: default<Chat, string>;
              contacts: {
                  [_: string]: Contact;
              };
              labelAssociations: default<LabelAssociation, string>;
              labels: ObjectRepository<Label>;
              messages: {
                  [_: string]: ReturnType<typeof makeMessagesDictionary>;
              };
          }

          • chats: default<Chat, string>
          • contacts: {
                [_: string]: Contact;
            }
          • labelAssociations: default<LabelAssociation, string>
          • labels: ObjectRepository<Label>
          • messages: {
                [_: string]: ReturnType<typeof makeMessagesDictionary>;
            }
            • [_: string]: ReturnType<typeof makeMessagesDictionary>
    • writeToFile: ((path) => void)
        • (path): void
        • Parameters

          • path: string

          Returns void

Generated using TypeDoc