How to make App-generated message visible only to App-user

I am developing an app that lists all the users in a room and checks when each user last logged in.
I construct the message like this:

 const builder = modify.getCreator().startMessage()
            .setSender(context.getSender())
            .setText(messageText)
            .setUsernameAlias('security-check')
            .setRoom(room);

How can I ensure that the output of the app is not visible to all users of the room (so to speak, it becomes a system message). Is there a “setVisibilty”-Property?

Thanks in advance!

Regards!

Hi,

good question and I don’t know the answer, but I know a man who might!!

I’ll try and find out.

1 Like

That would be great!
Thanks!

Hi :slight_smile:

What you seem to be looking for is an “ephemeral message”. The way to achieve this is by using modify.getNotifier().notifyUser(context.getSender(), message). However, note that this message will NOT be visible forever - it will vanish as soon as the user’s screen is refreshed.

Method reference: INotifier | Rocket.Chat Apps TypeScript Definition

2 Likes

That’s great!

Thanks a lot!

Best regards!