How to get ids of archived messages?

I have implemented archive in Openfire but when server sends me response, it is not giving any message id that was attached. Is there any way which provide me message id of message ?

My requirement is simple, if user is deleting application and installing it again, user should get all messages in 1:1 conversation from the beginning.

Guide me how to achieve this ? Is there any way out ?