How to retrieve the chat history from openfire server?

I have created a chat application using openfire server and used Smack Api.Its all working fine,now i need to retreive the chat history from openfire server.
I have installed Monitoring Plugin to archive the chat.

In above screenshot, I can able to see the chat history for both one to one chat and group chat.
Now i need to get the chat history through app programmatically.I have referred many articles and post but did not find a solution.
If anyone know please tell your suggestions.

Thanks in advance.

You have a couple of options, each with its own caveats:

  • You can use the MAM protocol over XMPP to retrieve the messages from the archive(s) that the XMPP user has access to.
  • There is a largely undocumented REST-like API that exposes message archives for public group chats (not one-on-one chat) that is enabled when you enable the 'Expose log files of public group chats through a web interface ’ feature of the Monitoring Service plugin.
  • Eventually, these messages are stored in a database (but not in realtime, and the database structures might change in later releases). You could try to tap directly into the database.
  • A plugin could be created that exposes the data that you are interested in through an API of your preference. You could either do that yourself, or you could enlist someone, for example from our directory of professional partners.