Notifications center

Configure user notifications

To create a notification for a user from a module or script, use the mgrctl utility .

Example of a command to add a notification:

/usr/local/mgr5/sbin/mgrctl -m notify notify.post user=root "msg=Hello, world!" level=danger

where:

  • user – the user for whom the notification is sent;
  • msg – notification text;
  • level – message type; possible values:
    • info;
    • success;
    • warning;
    • danger.

To create a notification with a link, use the mgrctl utility and the link parameter, in which you need to pass JSON with a link description.

Example of a command to add a notification with a link:

/usr/local/mgr5/sbin/mgrctl -m notify notify.post user=root "msg=Hello, world!" level=danger link='{"type":"form", "value":"func=site.edit", "name":"hello_details"}'

where link parameter includes:

  • type – the link type, only form is available;
  • value – the link to the ispmanager function. In addition to the function name, you can pass parameters, for example, func=site.edit&elid=example.com;
  • name – the name of the localized message from the desktop section. To get the final internal name, add the notify_link_ prefix. To add your own message, create an xml file. For example: /usr/local/mgr5/etc/xml/ispmgr_mod_notify.xml.

Example of filling an xml-file:

<?xml version="1.0" encoding="UTF-8"?>
<mgrdata>
  <lang name="ru">
    <messages name=desktop">
      <msg name="notify_link_hello_details">Link for the notification</msg>
  </lang>
</mgrdata>