2

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 Answers1

0

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('contact@example.org');

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

});
JC Brand
  • 2,652
  • 18
  • 18