« Back

Announcements and Alerts

April 14, 2008 By Ray Augé

In Liferay 5.0.0+ we have added a new feature: Announcements/Alerts.

Announcements/Alerts are two portlets which can be used to broadcast some message to a list of users within a known scope. Essentially they provide a mass messaging engine you'd tend to think of as a "news letter" or one-way messaging.


They provide the following features:

  1. Configurable, unlimited number of Announcement Types through portal.properties (add locatized type names via Liferay's resource bundle extension mechanism).
  2. Delivery to known scopes, called Delivery Scope, including:
    1. Individual User (API only)
    2. Role
    3. User Group
    4. Community
    5. Organization
  3. Delivery Mechanisms include Email, SMS, and Website. (Website delivery is acheived simply by adding the portlet to any page accessible to the user. The content of the portlet is allways sensitive to the viewing user.)
  4. Scheduled delivery. Each entry has a Display and Expiration Date. The entry won't be delivered until Display Date is <= now. Expiration Date is used primarily for the "Website" delivery mechanism.
  5. Read Tracking. Website delivery tracks timestamped read status per user, per entry.
  6. Subscription Control per user, per Announcement Type. A user determines which Delivery Mechanism to use for each individual Announcement Type. See the My Account page.
  7. Broadcast Control of announcements. Broadcasting Announcements is not a permission which should be granted lightly. As such, a user must first be granted Add Entry permission on the portlet to access the Announcement management functions. Secondly, a user must have Assign Member permission on a given scope in order to be able to broadcast an Announcement/Alert to that scope.

i.e. a Community Owner is not, by default, granted permission to broadcast Announcements or Alerts to their own Community. The Portal Admin must first has to grant them Add Entry permission on the portlet. Only then would they have all the permissions required (they would already have Assign Member as a function of being the owner) to broacast to their own Community. This is to prevent abuse of portal resources and prevent needless spamming of portal users.

Via the service API we now have a means of enabling event based messaging to individual users (or any delivery scope) without having to explicitly write new delivery services or functions.

There are still a few features that I'd like to see added to this portlet, but I think we now have a good base to build on.

Showing 50 Comments

Eric Brennan
4/14/08 12:06 PM

Thanks for the new feature list. I can see this porlet getting lots and lots of use. A great add-on. I just have to take the time and properly configure my mail server now.

Is there any other location that lists the new features in 5.0?

Eric

Ray Augé
4/14/08 12:27 PM

You can take a look at the Road Map (http://www.liferay.com/web/guest/139) but this isn't a complete list... as you can clearly see. emoticon

I believe there are changes coming to revise that roadmap though...

Cheers!

Christian Steiger
4/14/08 3:00 PM

great feature!
When will you release Liferay 5.0?
cheers
christian

Michel Gelinas
5/7/08 7:21 AM

Very Nice!
Have you planed to improve this feature by adding the possiblity to create annoucement in multi-language (Localized)?
It would be very useful!

Ray Augé
5/7/08 7:36 PM

Yes, It's on my todo list. emoticon

andrei harhots
5/29/08 8:58 AM

Hi, Ray
What are differences between Announcements and Alerts portlets?
(Except red frame around Alerts)

Thanx.

Ray Augé
5/29/08 9:17 AM

The idea is that "Alerts" is hidden by default. Suppose if you placed it on User pages, later when you have an urgent message to display to some scope of users, you create an alert, and the portlet appears on their page (when they didn't even know it was there).
In this scenario, you also can take away the ability to remove it... so that they don't just get ride of it (do this by adding it using one of the static techniques: layout-templates, layout config).

About the style... it's really designed to be taken by a portal admin and make it look how ever you wish... The css is designed to be pretty friendly to suite. As well, each "type" of Alert can be styled to whatever purpose it might server.

- A "new feature" alert might be something eye catching and all hip "look at this new toy".
- A "warning" alert might be "Hey, you owe us money, pay your bill or we'll cancel your account."

Announcements are more of the day-to-day type of things, where a user can view the history of the Announcements they received (no history view for Alerts). Also, Announcements is more the type of portlet that a User "might" be free to remove form their page.

HTH!

andrei harhots
5/30/08 12:05 AM

Appreciate your helpful answer, Ray!

Peter Hovens
6/30/08 3:11 PM

A great function indeed! Is the 'auto-hiding-when empty' working in 5.0.1 or is this feature yet to be implemented? Thnx, Peter

Mike Cunneen
8/1/08 9:11 PM

Hi Ray,

I like the feature, but when there are no alerts to display it just says "No entries were found." (so the users do know it's there). Is there any way around this?

Mike

Allen Chiang
8/13/08 10:39 AM

Can I configure this portlet like the chat-portlet, so I don't have to added it to users' page. Or I can consume the remotes service (if it provided) with javascript to add a link on a page (using javascript in the theme) if new entries exist.

Ray Augé
8/13/08 2:30 PM

Hi Mike,

I just fixed the issue last night. Sorry about that. The "Hide" feature works again. It had regressed.

Ray Augé
8/13/08 2:32 PM

The remote service (including javascript) is complete, as such you should be able to consume the full array of features.

Allen Chiang
8/14/08 9:36 AM

Hi Ray,
That's great! Thanks!
So the portlet doesn't need in any one of a user's page if I am only use the service script, right ?
Thanks again.

Allen

Ray Augé
8/14/08 2:31 PM

If I understand correctly, you just want to use the service with your own UI implementation, then you are correct. You would not require the portlet at all, simply use the service to handle all the CRUD operations.

Note there is one Utility class (which is not directly part of the service) which will be important to aggregate the "scopes" available to a given user.

LinkedHashMap<Long, long[]> scopes = AnnouncementsUtil.getAnnouncementScopes(user.getUserId());

"scopes" is then passed into the:

AnnouncementsEntryLocalServiceUtil.getEntries()

as a parameter which constrains the returned results to all those scopes to which the user belongs.

Richard Becher
8/21/08 6:55 AM

Hi Ray,

I want to set up the Announcement (or Alerts) to send an email to each of the specified users within the Scope specified. Is there a way to do this WITHOUT forcing each user to subscribe to it?

Thanks in advance!

Auditya manikanta Vadrevu
10/15/08 3:50 AM

hi ray,
what should i use to create custom program using API for announcements to particular user only

Brant Levinson
3/11/09 8:49 PM

This is a great addition to the capabilities! I am able to get the Announcements to work, although I setup an Alert including the time/date and put it on a page for a user. Then logged in as the user and waited until that time, but the Alert never came. Nothing is shown where the portlet was placed. Is that setup how's it supposed to work? I refreshed as well and still did not see it. I made the scope be the entire organization and logged in as a user in that organization.

Shiva Iyer
4/3/09 12:07 AM

Why Announcements hidden by "Super Admin" (test@liferay.com) is visible for "Normal users". Is announcement are hide at personal level or depending on the Distribution Scope.

Nicolas G.
4/10/09 7:42 AM

Hi Ray,
I also would like to send an announcement to an individual user ; in your article you speak about using an API to do that. Could you please precise a little bite more ...
Many many thanks in advance,
Regards,
Nico

Denis Signoretto
11/20/09 12:53 AM

Hy ray, I'm looking for newsletter capability on Liferay. I'm wondering if I can use announcements to send all community users an HTML email athoring it with HTML Text Area or even more as a WebContent. How can I do it?

Is there a wiki page or any other complete documentation about alerts and announcement?

Thanks,
Denis.

Denis Signoretto
11/20/09 12:54 AM

Hy ray, I'm looking for newsletter capability on Liferay. I'm wondering if I can use announcements to send all community users an HTML email athoring it with HTML Text Area or even more as a WebContent. How can I do it?

Is there a wiki page or any other complete documentation about alerts and announcement?

Thanks,
Denis.

Denis Signoretto
11/20/09 1:06 AM

Hi Ray, I think that announcements it's really nice and important feature. Why don't add it on Control Panel?

D.

Ray Augé
11/23/09 2:14 AM

Good question!

Should be simple through configuration. Could you submit a feature request ticket to JIRA?

Thanks

Denis Signoretto
11/23/09 6:57 AM

Done !

http://issues.liferay.com/browse/LPS-6118

Tim Scholten
12/16/09 7:15 AM

Broadcast Control Question:
I am looking enable all users of a particular community to have the permissions to make announcements. This works if I grant them "Add Entry" & "community owner " permissions... however having all users with the "community owner" role enables too much and is not desirable.

So the crux of my question is, is it possible to give all members of the community permissions required for broadcasting Announcements to the community scope?

I am just beginning to understand how Liferay handles permissions but, I am wondering if there is away that only the Announcements portlet is enabled for these users with the Community Owner role (or functional equivalent) and not the entire portal page.

Tim

Ray Augé
12/16/09 7:29 AM

Depending on your version of the portal (anything > 5.1.2 I think), there should be a Manage Announcements permission for each "scope" resource, such as Community, User Group, Organization, etc.

Andreas Stangl
2/15/10 5:31 AM

Is there a plan to add a rich-text editor for announcements? Currently I am able to write html code by hand but it would be nice to have some wysiwyg editor.

Pravin Pawar
3/6/10 4:32 AM

Hi Ray,
I am also facing the same problem as Tim. I have added add Entry & configuration permission to member of organization having HR as a organization role. Still that user is unable to add announcement and gets "You have entered invalid data. Please try again." error message. For distribution scope dropdown values are not shown, only optgroups are displayed.

Boris Niyazov
4/27/10 8:19 PM

There is a problem with the announcement distribution scope. Looks like the roles distribution scope doesn't work when users assigned to the role implicitly via user group. The user must be explicitly assigned to the role in order to see the announcement with the distribution scope for the role. We use LR 5.2.3

Luis Rodríguez Fernández
11/16/10 7:28 AM

Hi Nicolas,

We are also looking for this funcionality. I mean, we also would like to send and announcement to an individual user. Have you finally resolved this?

Really thanks,

Luis

Ray Augé
11/16/10 7:38 AM

To send alerts/announcements to individual users do:

AnnouncementsEntryLocalServiceUtil.addEntry(userIdOfCurrentUser, User.class.getName(), targetUserId, title, content, url, type, displayDateMonth, displayDateDay, displayDateYear, displayDateHour, displayDateMinute, expirationDateMonth, expirationDateDay, expirationDateYear, expirationDateHour, expirationDateMinute, priority, alert);

Luis Rodríguez Fernández
11/16/10 10:12 AM

Hi Ray,

Really, really thanks for your fast answer!!! We are not at the office at the moment, but tomorrow it is the first thing we are going to do at work.

Best regards,

Luis

Luis Rodríguez Fernández
11/17/10 12:16 AM

Hi Ray,

It works!!! Really thank you again!

Best regards,

Luis

ps: only one, the method ask for a long value in the second parameter, so we should use:

long userClassNameId = PortalUtil.getClassNameId(User.class);

Ray Augé
11/17/10 5:31 AM

You got it! Good catch!

Ibrahim Bakhit
12/16/10 8:11 AM

Hi Ray
How can the announcement portlet be customized to support localization or better yet be integrated with existing liferay WCM capabilities?
Thanks

Ray Augé
12/17/10 9:49 AM

Hmm, yeah. I've received similar requests before, but haven't yet had time to work on them. Is there a ticket in the Community Backlog on JIRA? That's where we would start.

There may be a few quick hacks you could make to get it working with WCM, but it's kind of quirky. Basically replace the title and content fields with the groupId and articleId values of a selected article (you'd have to copy the code for one of the article selectors we have in the portal, i.e. in asset publisher) and then on render use the JournalContentUtil to render the article using the groupId and articleId values stored in the title and content fields. Note you'd also have to alter the Message listener that sends out messages via Email and SMS to do the same.

Hack-ish, but may do what you want in the short term.

Ibrahim Bakhit
12/17/10 11:23 AM

Thanks Ray, this is good enough for my purposes. It is an admin side work and not client facing, so it is not as bad.

As for JIRA, I will search Community Backlog later and if there isn't a ticket on the issue, I will open one.

Thanks again and stay warm!

Ibrahim Bakhit
12/20/10 3:41 PM

Created LPS-14400 to track localization support and/or integration of Announcement Portlet with Liferay WCM. I hope that is what is needed.

Ray Augé
12/20/10 4:39 PM

Great! I made a few updates to the issue details. Filed under "Community Backlog", also added to "Portlet - Announcements" component, also removed specified backports. We can determine if backport is feasible when that time comes (i.e. if we have to change the DB for any reason, we wouldn't be able to backport).

Thanks Ibrahim!

Ivano Carrara
1/18/11 8:46 AM

Hi Ray, I need some help about the Alarm portlet..

I'm able to send alarms via email to Administrator scope from the Administrator user.

This is the unique scope reachable via email ... The Administrator is not able to send alarms via email to any scope ! Note that on the appropriate Web pages, the alarms shows up for the appropriate User/scope. I'm using the official 6.0.5 version of Community Edition.

Please, could you help me ? Thank you in advance ! Ivano

Ray Augé
1/18/11 9:03 AM

If you take a look under the user profile you will see "Announcements". Each user can opt in or out of which type of alerts/announcements get sent via email (or SMS). So, if you want to force alerts to be sent via email or SMS, you might need to add an override for that user setting.

Ivano Carrara
1/18/11 9:06 AM

Thank you Ray, but ... of course in the user profile of the destination user there is the flag "email" checked" !

Ray Augé
1/18/11 9:13 AM

hmm, I'm not sure what might be the problem! I don't know what to suggest. Unfortunately I don't have time at the moment to test it myself! Perhaps if you search JIRA (http://issues.liferay.com) for related tickets, it might be a bug that is either pending, or if lucky, fixed since then. If not please if you could file a ticket!

Ivano Carrara
1/18/11 9:36 AM

I'm sorry ... It is a so big issue ... In fact, actually the only delivery method to send Alarms is via Web pages, and only the Administrator is able to send emails to Administrator scope !

It is strange that nobody found this issue... maibe it is my fault ...

I'll try to search and/or submit a ticket ...

Thank you!

Ivano Carrara
1/18/11 9:57 AM

I just created this tickets: "LPS-14825 - No emails sent from the Alarms portlet - only emails from the Administrator to Administrator scope was delivered"

Thank you in advance for any help !

Ray Augé
1/18/11 10:00 AM

Thank you Ivano! And sorry that I was not able to give you a quick solution!

Ivano Carrara
3/23/11 3:44 PM

Hi Ray !

Please, could you address us to understand how the Announcements portlet send messages via SMS ? I need to catch the messages and routing it to my SMS delivery system.

Thank you in advance !

Ivano C.

Vanita Chawla
3/31/11 9:31 AM

Hi Ray,

We have the same issue with 5.2 sp4 EE. No email being sent to the user even when user has opted in for Ammouncement alerts. We'll open a ticket.

Thanks!
Vanita

JohnnyBrew .
9/14/11 1:43 PM

Can someone please tell me how to use HTML tags within the Content section of an Announcement? I'd like to add line breaks, urls, etc. THANKS!