Showing notifications

Notification

Notifications are banner-type messages that inform the user about system and app events. Notifications are displayed prominently at the top of the Magnolia UI. They capture the user’s attention effectively but do not interrupt what the user is currently working on. Notifications are the only persistent message type. The user can safely close the notification banner and read the full message in the Notifications app later.

Showing a notification message in app code

To show a notification message:

  1. Inject MessageManager into your class so that you can access the messaging convenience methods. Create a new Message object. Pass MessageType only if you want to create your own message types.

@Inject
public MyClass(MessageManager messageManager) {
   this.messageManager = messageManager
}

public void handleGroupMessage(final String group, final MessageType type, final String subject, final String message) {
   messageManager.sendGroupMessage(group, new Message(type, subject, message));
}

Showing a notification to a named user

MessageManager provides convenience methods for sending messages. The user will be notified instantly with a notification banner if they are currently signed in. In any case, the message is stored in the Notifications app.

void sendMessage(String user, Message message);

Showing a notification to all users in a group

The users in the group will be notified instantly with a notification banner if they are currently signed in. In any case, the message is stored in the Notifications app.

void sendGroupMessage(String group, Message message);

Showing a notification to the current user

The current user will be notified with a notification banner.

void sendLocalMessage(Message message);
}

Broadcast a notification message to all users

The users will be notified instantly with a notification banner if they are currently signed in. In any case, the message will be stored in the Notifications app.

void broadcastMessage(Message message);

See MessagesManager for more information.

Sending a notification using the Messages app

The Messages app is a tool that allows you to send notifications to individual users, groups or all users. This app is only available to the superuser role by default, as configured in app launcher permissions.

Feedback