@avaya/infinity-agent-sdk - v1.0.0
    Preparing search index...

    Iterator for the message history of an interaction.

    • previous fetches older messages.
    • next fetches newer messages.

    The first call to previous or next - returns the most recent batch of messages and seeds the iterator from there. From that starting point, previous pages backward into older history and next fetches any newer messages that have since arrived.

    Concurrent calls to next / previous are serialized - they never run in parallel.

    const iter = interaction.getMessages({ pageSize: 50 });
    let batch = await iter.previous();
    while (iter.hasPrevious()) {
    batch = await iter.previous();
    }
    interface MessagesIterator {
        hasNext(): boolean;
        hasPrevious(): boolean;
        next(): Promise<Message[]>;
        previous(): Promise<Message[]>;
    }
    Index

    Methods

    • true when next can return more messages.

      Returns boolean

    • true when previous can return more messages.

      Returns boolean

    • Fetches the next batch of newer messages. Within the batch, messages are sorted oldest-first or newest-first according to GetMessagesOptions.order.

      Returns Promise<Message[]>

      If hasNext is false (code ASE-0003)

      If the fetch fails (code ASE-4007)

    • Fetches the next batch of older messages. Within the batch, messages are sorted oldest-first or newest-first according to GetMessagesOptions.order.

      Returns Promise<Message[]>

      If hasPrevious is false (code ASE-0003)

      If the fetch fails (code ASE-4007)