How to get the message unique id?

Hi,
I’m creating a QA Moderated chat system and we’re using the lib jitsi meet low level API.
How can I get a messages’ unique id? Does one already exist when a user joins a room?
I have this function:

                room.on(
                    JitsiMeetJS.events.conference.USER_JOINED,
                    (id, user) => {
                        users[id] = {
                            displayName: user._displayName,
                            role: user._role,
                            user: user
                        };
                        alert(id);
                    });

the id that’s being passed that’s the id of the user right and not a unique id of the message?

Correct.

What message? Every message (chat message) has an id, as every stanza actually has an id per the xmpp RFCs, but that is not exposed outside the library.

Okay I guess if we want messages to be permanent we should store them in our database, because the messages are stored in the client memory?

Yep, by default prosody keeps 20 messages as room history and sends them to users. You need to check prosody side and custom modules.
There are already prosody community modules for storing messages, check on their website. https://modules.prosody.im/