Announcements Class
Access information about announcements and post announcements.
Use the ConnectApi.Announcements class to get, create, update, and delete announcements. Use an announcement to highlight information. Users can discuss, like, and post comments on announcements. Deleting the feed post deletes the announcement.
This image shows an announcement displayed in a group. Creating an announcement also creates a feed item with the announcement text.

An announcement displays in a designated location in the Salesforce UI until 11:59 p.m. on its expiration date, unless it’s deleted or replaced by another announcement.
These methods are for Announcements. All methods are static.
All methods in this class require Chatter and are subject to the per user, per namespace, per hour rate limit.
-
deleteAnnouncement(communityId, announcementId)
Delete an announcement.
-
getAnnouncement(communityId, announcementId)
Get an announcement.
-
getAnnouncements(communityId, parentId)
Get the first page of announcements.
-
getAnnouncements(communityId, parentId, pageParam, pageSize)
Get a page of announcements.
-
postAnnouncement(communityId, announcement)
Post an announcement.
-
updateAnnouncement(communityId, announcementId, expirationDate)
Update the expiration date of an announcement.
Delete an announcement.
31.0
Yes
public static void deleteAnnouncement(String communityId, String announcementId)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- announcementId
Type: String
An announcement ID, which has a prefix of 0BT.
Type: Void
To get a list of announcements in a group, call getAnnouncements(communityId, parentId) or getAnnouncements(communityId, parentId, pageParam, pageSize).
To post an announcement to a group, call postAnnouncement(communityId, announcement) .
Get an announcement.
31.0
Yes
public static ConnectApi.Announcement getAnnouncement(String communityId, String announcementId)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- announcementId
Type: String
An announcement ID, which has a prefix of 0BT.
Type: ConnectApi.Announcement
To get a list of announcements in a group, call getAnnouncements(communityId, parentId) or getAnnouncements(communityId, parentId, pageParam, pageSize).
To post an announcement to a group, call postAnnouncement(communityId, announcement) .
Get the first page of announcements.
36.0
38.0
Yes
public static ConnectApi.AnnouncementPage getAnnouncements(String communityId, String parentId)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- parentId
Type: String
ID of the parent entity for the announcement, that is, a group ID when the announcement appears in a group.
Type: ConnectApi.AnnouncementPage
Get a page of announcements.
36.0
38.0
Yes
public static ConnectApi.AnnouncementPage getAnnouncements(String communityId, String parentId, Integer pageParam, Integer pageSize)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- parentId
Type: String
ID of the parent entity for the announcement, that is, a group ID when the announcement appears in a group.
- pageParam
Type: Integer
Number of the page you want returned. Starts at 0. If you pass in
nullor 0, the first page is returned.- pageSize
Type: Integer
Specifies the number of announcements per page.
Type: ConnectApi.AnnouncementPage
Post an announcement.
36.0
Yes
public static ConnectApi.Announcement postAnnouncement(String communityId, ConnectApi.AnnouncementInput announcement)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- announcement
Type:
ConnectApi.AnnouncementInputA
ConnectApi.AnnouncementInputobject.
Type: ConnectApi.Announcement
Update the expiration date of an announcement.
31.0
Yes
public static ConnectApi.Announcement updateAnnouncement(String communityId, String announcementId, Datetime expirationDate)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- announcementId
Type: String
An announcement ID, which has a prefix of 0BT.
- expirationDate
Type: Datetime
The Salesforce UI displays an announcement until 11:59 p.m. on this date unless another announcement is posted first. The Salesforce UI ignores the time value in the
expirationDate. However, you can use the time value to create your own display logic in your own UI.
Type: ConnectApi.Announcement
To get a list of announcements in a group, call getAnnouncements(communityId, parentId) or getAnnouncements(communityId, parentId, pageParam, pageSize).
To post an announcement to a group, call postAnnouncement(communityId, announcement) .