Conversejs has support to get archive message in indexedDb by plugin not?

91 Views Asked by At

Please show me how conversejs can get the message stored in indexedDb by plugin if possible? I want to create my own chat history list interface because controlbox is not suitable for my business.

1

There are 1 best solutions below

0
JC Brand On

The messages are stored in a Collection which is set as the messages attribute on the ChatBox model. A ChatBox represents the Chat conversation with a particular contact.

converse.plugins.add("my-plugin", {
  
  initialize() {
    const { api } = this._converse;
    const chat = api.chats.get('[email protected]');

    // log all messages to the console
    chat.messages.forEach(m => console.log(m.get('body'));
  }

});