In openfire how to send message to muc on behalf of another user(impersonate)

In openfire I am writing a rest api plugin for sending message to muc but I need to create multiple connection for each user, join chatroom, send presence and then send message. SO, how can we create a connection like admin user and send message to the respective chatroom the user has requested by impersonating the sending user.

Are you creating a new REST API plugin, or are you trying to use our existing REST API plugin for Openfire?

I do not think that our existing plugin has functionality that allows you to send messages on behalf of a MUC room occupant.

If you’d like to create such functionality (without using the XMPP interface to Openfire), then you’d probably need to create a custom Openfire plugin that exposes this functionality. You can likely hook into the internal Java APIs of the MUC implementation to achieve this.

I am creating custom plugin for this. Is there any such example for trying out.

I can’t think of any example implementation that operates directly on the MUC API.

there is topic about this but it is not working for muc Can I send messages on behalf of a user? - #2 by Martin_Weusten