• Fetch messages from a chat

    Parameters

    Returns Promise<RawMessage[]>

    List of raw messages

    // Some messages
    WPP.chat.getMessages('[number]@c.us', {
    count: 20,
    });

    // All messages
    WPP.chat.getMessages('[number]@c.us', {
    count: -1,
    });

    // Last 20 unread messages
    WPP.chat.getMessages('[number]@c.us', {
    count: 20,
    onlyUnread: true,
    });

    // All unread messages
    WPP.chat.getMessages('[number]@c.us', {
    count: -1,
    onlyUnread: true,
    });

    // 20 messages before specific message
    WPP.chat.getMessages('[number]@c.us', {
    count: 20,
    direction: 'before',
    id: '<full message id>'
    });

    // Only media messages (url, document and links)
    WPP.chat.getMessages('[number]@c.us', {
    count: 20,
    media: 'all',
    });

    // Only image messages
    WPP.chat.getMessages('[number]@c.us', {
    count: 20,
    media: 'image',
    });

    // Only document messages
    WPP.chat.getMessages('[number]@c.us', {
    count: 20,
    media: 'document',
    });

    // Only link (url) messages
    WPP.chat.getMessages('[number]@c.us', {
    count: 20,
    media: 'url',
    });