ChatterGroups Class
Namespace
ChatterGroups Methods
All methods in this class require Chatter and are subject to the per user, per namespace, per hour rate limit.
addMember(communityId, groupId, userId)
API Version
28.0
Requires Chatter
Yes
Signature
public static ConnectApi.GroupMember addMember(String communityId, String groupId, String userId)
Parameters
Return Value
Type: ConnectApi.GroupMember
Usage
addMemberWithRole(communityId, groupId, userId, role)
API Version
29.0
Requires Chatter
Yes
Signature
public static ConnectApi.GroupMember addMemberWithRole(String communityId, String groupId, String userId, ConnectApi.GroupMembershipType role)
Parameters
- communityId
- Type: String
- ID for an Experience Cloud site, internal, or null.
- groupId
- Type: String
- ID for a group.
- userId
- Type: String
- ID for a user.
- role
- Type: ConnectApi.GroupMembershipType
- The group membership type. One of these values:
- GroupManager
- StandardMember
Return Value
Type: ConnectApi.GroupMember
Usage
addRecord(communityId, groupId, recordId)
API Version
34.0
Requires Chatter
Yes
Signature
public static ConnectApi.GroupRecord addRecord(String communityId, String groupId, String recordId)
Parameters
Return Value
Type: ConnectApi.GroupRecord
createGroup(communityId, groupInput)
API Version
29.0
Requires Chatter
Yes
Signature
public static ConnectApi.ChatterGroupDetail createGroup(String, communityId, ConnectApi.ChatterGroupInput groupInput)
Parameters
- communityId
- Type: String,
- ID for an Experience Cloud site, internal, or null.
- groupInput
- Type: ConnectApi.ChatterGroupInput
- The properties of the group.
Return Value
deleteBannerPhoto(communityId, groupId)
API Version
36.0
Requires Chatter
Yes
Signature
public static Void deleteBannerPhoto(String communityId, String groupId)
Parameters
Return Value
Type: Void
Usage
deleteMember(communityId, membershipId)
API Version
28.0
Requires Chatter
Yes
Signature
public static Void deleteMember(String communityId, String membershipId)
Parameters
Return Value
Type: Void
Usage
This method is successful only when the context user is the group manager or owner, or has Modify All Data permission.
deletePhoto(communityId, groupId)
API Version
28.0
Requires Chatter
Yes
Signature
public static Void deletePhoto(String communityId, String groupId)
Parameters
Return Value
Type: Void
Usage
This method is only successful when the context user is the group manager or owner, or has Modify All Data permission.
getAnnouncements(communityId, groupId)
API Version
31.0
Requires Chatter
Yes
Signature
public static ConnectApi.AnnouncementPage getAnnouncements(String communityId, String groupId)
Parameters
Return Value
Usage
To post an announcement, get information about an announcement, update the expiration date of an announcement, or delete an announcement, use the methods of the ConnectApi.Announcements class.
getAnnouncements(communityId, groupId, pageParam, pageSize)
API Version
31.0
Requires Chatter
Yes
Signature
public static ConnectApi.AnnouncementPage getAnnouncements(String communityId, String groupId, Integer pageParam, Integer pageSize)
Parameters
- communityId
- Type: String
- ID for an Experience Cloud site, internal, or null.
- groupId
- Type: String
- ID for a group.
- pageParam
- Type: Integer
- Number of the page you want returned. Starts at 0. If you pass in null or 0, the first page is returned.
- pageSize
- Type: Integer
- Specifies the number of items per page. Valid values are from 1 through 100. If you pass in null, the default size is 25.
Return Value
Usage
To post an announcement, get information about an announcement, update the expiration date of an announcement, or delete an announcement, use the methods of the ConnectApi.Announcements class.
getBannerPhoto(communityId, groupId)
API Version
36.0
Requires Chatter
Yes
Signature
public static ConnectApi.BannerPhoto getBannerPhoto(String communityId, String groupId)
Parameters
Return Value
Type: ConnectApi.BannerPhoto
getGroup(communityId, groupId)
API Version
28.0
Available to Guest Users
31.0
Requires Chatter
Yes
Signature
public static ConnectApi.ChatterGroupDetail getGroup(String communityId, String groupId)
Parameters
Return Value
getGroupBatch(communityId, groupIds)
API Version
31.0
Requires Chatter
Yes
Signature
public static ConnectApi.BatchResult[] getGroupBatch(String communityId, List<String> groupIds)
Parameters
Return Value
Type: ConnectApi.BatchResult[]
The ConnectApi.BatchResult.getResult() method returns a ConnectApi.ChatterGroup object and errors embedded in the results for groups that didn’t load.
Example
// Create a list of groups.
ConnectApi.ChatterGroupPage groupPage = ConnectApi.ChatterGroups.getGroups(null);
// Create a list of group IDs.
List<String> groupIds = new List<String>();
for (ConnectApi.ChatterGroup aGroup : groupPage.groups){
groupIds.add(aGroup.id);
}
// Get info about all the groups in the list.
ConnectApi.BatchResult[] batchResults = ConnectApi.ChatterGroups.getGroupBatch(null, groupIds);
for (ConnectApi.BatchResult batchResult : batchResults) {
if (batchResult.isSuccess()) {
// Operation was successful.
// Print the number of members in each group.
ConnectApi.ChatterGroup aGroup;
if(batchResult.getResult() instanceof ConnectApi.ChatterGroup) {
aGroup = (ConnectApi.ChatterGroup) batchResult.getResult();
}
System.debug('SUCCESS');
System.debug(aGroup.memberCount);
}
else {
// Operation failed. Print errors.
System.debug('FAILURE');
System.debug(batchResult.getErrorMessage());
}
}
getGroupMembershipRequest(communityId, requestId)
API Version
28.0
Requires Chatter
Yes
Signature
public static ConnectApi.GroupMembershipRequest getGroupMembershipRequest(String communityId, String requestId)
Parameters
Return Value
Usage
This method is successful only when the context user is the group manager or owner, or has Modify All Data permission.
getGroupMembershipRequests(communityId, groupId)
API Version
28.0
Requires Chatter
Yes
Signature
public static ConnectApi.GroupMembershipRequests getGroupMembershipRequests(String communityId, String groupId)
Parameters
Return Value
Usage
This method is successful only when the context user is the group manager or owner, or has Modify All Data permission.
getGroupMembershipRequests(communityId, groupId, status)
API Version
28.0
Requires Chatter
Yes
Signature
public static ConnectApi.GroupMembershipRequests getGroupMembershipRequests(String communityId, String groupId, ConnectApi.GroupMembershipRequestStatus status)
Parameters
Return Value
Usage
This method is successful only when the context user is the group manager or owner, or has Modify All Data permission.
getGroups(communityId)
API Version
28.0
Available to Guest Users
31.0
Requires Chatter
Yes
Signature
public static ConnectApi.ChatterGroupPage getGroups(String communityId)
Parameters
- communityId
- Type: String
- ID for an Experience Cloud site, internal, or null.
Return Value
getGroups(communityId, pageParam, pageSize)
API Version
28.0
Available to Guest Users
31.0
Requires Chatter
Yes
Signature
public static ConnectApi.ChatterGroupPage getGroups(String communityId, Integer pageParam, Integer pageSize)
Parameters
- communityId
- Type: String
- ID for an Experience Cloud site, internal, or null.
- pageParam
- Type: Integer
- Number of the page you want returned. Starts at 0. If you pass in null or 0, the first page is returned.
- pageSize
- Type: Integer
- Specifies the number of items per page. Valid values are from 1 through 100. If you pass in null, the default size is 25.
Return Value
getGroups(communityId, pageParam, pageSize, archiveStatus)
API Version
29.0
Available to Guest Users
31.0
Requires Chatter
Yes
Signature
public static ConnectApi.ChatterGroupPage getGroups(String communityId, Integer pageParam, Integer pageSize, ConnectApi.GroupArchiveStatus archiveStatus)
Parameters
- communityId
- Type: String
- ID for an Experience Cloud site, internal, or null.
- pageParam
- Type: Integer
- Number of the page you want returned. Starts at 0. If you pass in null or 0, the first page is returned.
- pageSize
- Type: Integer
- Specifies the number of items per page. Valid values are from 1 through 100. If you pass in null, the default size is 25.
- archiveStatus
- Type: ConnectApi.GroupArchiveStatus
- Archive status of groups.
- All—All groups, including groups that are archived and groups that aren’t archived.
- Archived—Groups that are archived.
- NotArchived—Groups that aren’t archived.
- If you pass in null, the default value is All.
Return Value
getMember(communityId, membershipId)
API Version
28.0
Requires Chatter
Yes
Signature
public static ConnectApi.GroupMember getMember(String communityId, String membershipId)
Parameters
Return Value
Type: ConnectApi.GroupMember
getMembers(communityId, groupId)
API Version
28.0
Available to Guest Users
36.0
Requires Chatter
Yes
Signature
public static ConnectApi.GroupMemberPage getMembers(String communityId, String groupId)
Parameters
Return Value
getMembers(communityId, groupId, pageParam, pageSize)
API Version
28.0
Available to Guest Users
36.0
Requires Chatter
Yes
Signature
public static ConnectApi.GroupMemberPage getMembers(String communityId, String groupId, Integer pageParam, Integer pageSize)
Parameters
- communityId
- Type: String
- ID for an Experience Cloud site, internal, or null.
- groupId
- Type: String
- ID for a group.
- pageParam
- Type: Integer
- Number of the page you want returned. Starts at 0. If you pass in null or 0, the first page is returned.
- pageSize
- Type: Integer
- Specifies the number of items per page. Valid values are from 1 through 100. If you pass in null, the default size is 25.
Return Value
getMembershipBatch(communityId, membershipIds)
API Version
31.0
Requires Chatter
Yes
Signature
public static ConnectApi.BatchResult[] getMembershipBatch(String communityId, List<String> membershipIds)
Parameters
Return Value
Type: ConnectApi.BatchResult[]
The ConnectApi.BatchResult.getResult() method returns a ConnectApi.GroupMember object and errors embedded in the results for group memberships that didn’t load.
Example
// Get members of a group.
ConnectApi.GroupMemberPage membersPage = ConnectApi.ChatterGroups.getMembers(null, '0F9D00000000oOT');
// Create a list of membership IDs.
List<String> membersList = new List<String>();
for (ConnectApi.GroupMember groupMember : membersPage.members){
membersList.add(groupMember.id);
}
// Get info about all group memberships in the list.
ConnectApi.BatchResult[] batchResults = ConnectApi.ChatterGroups.getMembershipBatch(null, membersList);
for (ConnectApi.BatchResult batchResult : batchResults) {
if (batchResult.isSuccess()) {
// Operation was successful.
// Print the first name of each member.
ConnectApi.GroupMember groupMember;
if(batchResult.getResult() instanceof ConnectApi.GroupMember) {
groupMember = (ConnectApi.GroupMember) batchResult.getResult();
}
System.debug('SUCCESS');
System.debug(groupMember.user.firstName);
}
else {
// Operation failed. Print errors.
System.debug('FAILURE');
System.debug(batchResult.getErrorMessage());
}
}
getMyChatterSettings(communityId, groupId)
API Version
28.0
Requires Chatter
Yes
Signature
public static ConnectApi.GroupChatterSettings getMyChatterSettings(String communityId, String groupId)
Parameters
Return Value
getPhoto(communityId, groupId)
API Version
28.0
Requires Chatter
Yes
Signature
public static ConnectApi.Photo getPhoto(String communityId, String groupId)
Parameters
Return Value
Type: ConnectApi.Photo
getRecord(communityId, groupRecordId)
API Version
34.0
Requires Chatter
Yes
Signature
public static ConnectApi.GroupRecord getRecord(String communityId, String groupRecordId)
Parameters
Return Value
Type: ConnectApi.GroupRecord
getRecords(communityId, groupId)
API Version
33.0
Requires Chatter
Yes
Signature
public static ConnectApi.GroupRecordPage getRecords(String communityId, String groupId)
Parameters
Return Value
getRecords(communityId, groupId, pageParam, pageSize)
API Version
33.0
Requires Chatter
Yes
Signature
public static ConnectApi.GroupRecordPage getRecords(String communityId, String groupId, Integer pageParam, Integer pageSize)
Parameters
- communityId
- Type: String
- ID for an Experience Cloud site, internal, or null.
- groupId
- Type: String
- ID for a group.
- pageParam
- Type: Integer
- Number of the page you want returned. Starts at 0. If you pass in null or 0, the first page is returned.
- pageSize
- Type: Integer
- Specifies the number of items per page. Valid values are from 1 through 100. If you pass in null, the default size is 25.
Return Value
inviteUsers(groupId, invite)
API Version
39.0
Requires Chatter
Yes
Signature
public static ConnectApi.Invitations inviteUsers(String groupId, ConnectApi.InviteInput invite)
Parameters
- groupId
- Type: String
- ID of the group.
- invite
- Type: ConnectApi.InviteInput
- A ConnectApi.InviteInput body.
Return Value
Type: ConnectApi.Invitations
postAnnouncement(communityId, groupId, announcement)
API Version
31.0
Requires Chatter
Yes
Signature
public static ConnectApi.Announcement postAnnouncement(String communityId, String groupId, ConnectApi.AnnouncementInput announcement)
Parameters
- communityId
- Type: String
- ID for an Experience Cloud site, internal, or null.
- groupId
- Type: String
- ID for a group.
- announcement
- Type: ConnectApi.AnnouncementInput
- A ConnectApi.AnnouncementInput object.
Return Value
Type: ConnectApi.Announcement
Usage
Use an announcement to highlight information. Users can discuss, like, and post comments on announcements. Deleting the feed post deletes the announcement.
To post an announcement, get information about an announcement, update the expiration date of an announcement, or delete an announcement, use the methods of the ConnectApi.Announcements class.
removeRecord(communityId, groupRecordId)
API Version
34.0
Requires Chatter
Yes
Signature
public static Void removeRecord(String communityId, String groupRecordId)
Parameters
Return Value
Type: Void
requestGroupMembership(communityId, groupId)
API Version
28.0
Requires Chatter
Yes
Signature
public static ConnectApi.GroupMembershipRequest requestGroupMembership(String communityId, String groupId)
Parameters
Return Value
Sample: Requesting to Join a Private Group
This sample code calls ConnectApi.ChatterGroups.requestGroupMembership to request to join a private group.
String communityId = null;
ID groupId = '0F9x00000000hAZ';
ConnectApi.GroupMembershipRequest membershipRequest = ConnectApi.ChatterGroups.requestGroupMembership(communityId, groupId);
searchGroups(communityId, q)
API Version
28.0
Available to Guest Users
31.0
Requires Chatter
Yes
Signature
public static ConnectApi.ChatterGroupPage searchGroups(String communityId, String q)
Parameters
Return Value
Usage
searchGroups(communityId, q, pageParam, pageSize)
API Version
28.0
Available to Guest Users
31.0
Requires Chatter
Yes
Signature
public static ConnectApi.ChatterGroupPage searchGroups(String communityId, String q, Integer pageParam, Integer pageSize)
Parameters
- communityId
- Type: String
- ID for an Experience Cloud site, internal, or null.
- q
- Type: String
- Specifies the string to search. The search string must contain at least two characters, not including wildcards. See Wildcards. Can be specified as null.
- pageParam
- Type: Integer
- Number of the page you want returned. Starts at 0. If you pass in null or 0, the first page is returned.
- pageSize
- Type: Integer
- Specifies the number of items per page. Valid values are from 1 through 100. If you pass in null, the default size is 25.
Return Value
Usage
searchGroups(communityId, q, archiveStatus, pageParam, pageSize)
API Version
29.0
Available to Guest Users
31.0
Requires Chatter
Yes
Signature
public static ConnectApi.ChatterGroupPage searchGroups(String communityId, String q, ConnectApi.GroupArchiveStatus archiveStatus, Integer pageParam, Integer pageSize)
Parameters
- communityId
- Type: String
- ID for an Experience Cloud site, internal, or null.
- q
- Type: String
- Specifies the string to search. The search string must contain at least two characters, not including wildcards. See Wildcards. Can be specified as null.
- archiveStatus
- Type: ConnectApi.GroupArchiveStatus
-
Archive status of groups.
- All—All groups, including groups that are archived and groups that aren’t archived.
- Archived—Groups that are archived.
- NotArchived—Groups that aren’t archived.
- pageParam
- Type: Integer
- Number of the page you want returned. Starts at 0. If you pass in null or 0, the first page is returned.
- pageSize
- Type: Integer
- Specifies the number of items per page. Valid values are from 1 through 100. If you pass in null, the default size is 25.
Return Value
Usage
setBannerPhoto(communityId, groupId, fileId, versionNumber)
API Version
36.0
Requires Chatter
Yes
Signature
public static ConnectApi.BannerPhoto setBannerPhoto(String communityId, String groupId, String fileId, Integer versionNumber)
Parameters
- communityId
- Type: String
- ID for an Experience Cloud site, internal, or null.
- groupId
- Type: String
- The ID of the group.
- fileId
- Type: String
- The ID of the already uploaded file. The key prefix must be 069, and the image must be smaller than 8 MB.
- versionNumber
- Type: Integer
- Version number of the existing file. Specify either an existing version number or, to get the latest version, specify null.
Return Value
Type: ConnectApi.BannerPhoto
Usage
Photos are processed asynchronously and might not be visible right away.
setBannerPhoto(communityId, groupId, fileUpload)
API Version
36.0
Requires Chatter
Yes
Signature
public static ConnectApi.BannerPhoto setBannerPhoto(String communityId, String groupId, ConnectApi.BinaryInput fileUpload)
Parameters
- communityId
- Type: String
- ID for an Experience Cloud site, internal, or null.
- groupId
- Type: String
- The ID of the group.
- fileUpload
- Type: ConnectApi.BinaryInput
- File to use as the photo. The content type must be usable as an image.
Return Value
Type: ConnectApi.BannerPhoto
Usage
Photos are processed asynchronously and might not be visible right away.
setBannerPhotoWithAttributes(communityId, groupId, bannerPhoto)
API Version
36.0
Requires Chatter
Yes
Signature
public static ConnectApi.BannerPhoto setBannerPhotoWithAttributes(String communityId, String groupId, ConnectApi.BannerPhotoInput bannerPhoto)
Parameters
- communityId
- Type: String
- ID for an Experience Cloud site, internal, or null.
- groupId
- Type: String
- The ID of the group.
- bannerPhoto
- Type: ConnectApi.BannerPhotoInput
- A ConnectApi.BannerPhotoInput object that specifies the ID and version of the file, and how to crop the file.
Return Value
Type: ConnectApi.BannerPhoto
Usage
Photos are processed asynchronously and might not be visible right away.
setBannerPhotoWithAttributes(communityId, groupId, bannerPhoto, fileUpload)
API Version
36.0
Requires Chatter
Yes
Signature
public static ConnectApi.BannerPhoto setBannerPhotoWithAttributes(String communityId, String groupId, ConnectApi.BannerPhotoInput bannerPhoto, ConnectApi.BinaryInput fileUpload)
Parameters
- communityId
- Type: String
- ID for an Experience Cloud site, internal, or null.
- groupId
- Type: String
- The ID of the group.
- bannerPhoto
- Type: ConnectApi.BannerPhotoInput
- A ConnectApi.BannerPhotoInput object specifying the cropping parameters.
- fileUpload
- Type: ConnectApi.BinaryInput
- File to use as the photo. The content type must be usable as an image.
Return Value
Type: ConnectApi.BannerPhoto
Usage
Photos are processed asynchronously and might not be visible right away.
setPhoto(communityId, groupId, fileId, versionNumber)
API Version
28.0
Requires Chatter
Yes
Signature
public static ConnectApi.Photo setPhoto(String communityId, String groupId, String fileId, Integer versionNumber)
Parameters
- communityId
- Type: String
- ID for an Experience Cloud site, internal, or null.
- groupId
- Type: String
- ID for a group.
- fileId
- Type: String
- ID of a file already uploaded. The key prefix must be 069, and the file must be an image that is smaller than 2 GB.
- versionNumber
- Type: Integer
- Version number of the existing file. Specify either an existing version number or, to get the latest version, specify null.
Return Value
Type: ConnectApi.Photo
Usage
This method is successful only when the context user is the group manager or owner, or has Modify All Data permission.
Photos are processed asynchronously and might not be visible right away.
Sample: Updating a Group Photo with an Existing File
When a group is created, it doesn’t have a group photo. You can set an existing photo that has already been uploaded to Salesforce as the group photo. The key prefix must be 069 and the file size must be less than 2 GB.
String communityId = null;
ID groupId = '0F9x00000000hAK';
ID fileId = '069x00000001Ion';
// Set photo
ConnectApi.Photo photo = ConnectApi.ChatterGroups.setPhoto(communityId, groupId, fileId, null);
setPhoto(communityId, groupId, fileUpload)
API Version
28.0
Requires Chatter
Yes
Signature
public static ConnectApi.Photo setPhoto(String communityId, String groupId, ConnectApi.BinaryInput fileUpload)
Parameters
- communityId
- Type: String
- ID for an Experience Cloud site, internal, or null.
- groupId
- Type: String
- ID for a group.
- fileUpload
- Type: ConnectApi.BinaryInput
- File to use as the photo. The content type must be usable as an image.
Return Value
Type: ConnectApi.Photo
Usage
This method is successful only when the context user is the group manager or owner, or has Modify All Data permission.
Photos are processed asynchronously and might not be visible right away.
Sample: Uploading a New File and Using It as a Group Photo
When a group is created, it doesn’t have a group photo. You can upload a photo and set it as the group photo.
String communityId = null;
ID groupId = '0F9x00000000hAP';
ID photoId = '069x00000001Ioo';
// Set photo
List<ContentVersion> groupPhoto = [Select c.VersionData From ContentVersion c where ContentDocumentId=:photoId];
ConnectApi.BinaryInput binary = new ConnectApi.BinaryInput(groupPhoto.get(0).VersionData, 'image/png', 'image.png');
ConnectApi.Photo photo = ConnectApi.ChatterGroups.setPhoto(communityId, groupId, binary);
setPhotoWithAttributes(communityId, groupId, photo)
API Version
29.0
Requires Chatter
Yes
Signature
public static ConnectApi.Photo setPhotoWithAttributes(String communityId, String groupId, ConnectApi.PhotoInput photo)
Parameters
- communityId
- Type: String
- ID for an Experience Cloud site, internal, or null.
- groupId
- Type: String
- ID for a group.
- photo
- Type: ConnectApi.PhotoInput
- A ConnectApi.PhotoInput object that specifies the ID and version of the file, and how to crop the file.
Return Value
Type: ConnectApi.Photo
Usage
This method is successful only when the context user is the group manager or owner, or has Modify All Data permission.
Photos are processed asynchronously and might not be visible right away.
setPhotoWithAttributes(communityId, groupId, photo, fileUpload)
API Version
29.0
Requires Chatter
Yes
Signature
public static ConnectApi.Photo setPhotoWithAttributes(String communityId, String groupId, ConnectApi.PhotoInput photo, ConnectApi.BinaryInput fileUpload)
Parameters
- communityId
- Type: String
- ID for an Experience Cloud site, internal, or null.
- groupId
- Type: String
- ID for a group.
- photo
- Type: ConnectApi.PhotoInput
- A ConnectApi.PhotoInput object that specifies how to crop the file specified in fileUpload.
- fileUpload
- Type: ConnectApi.BinaryInput
- File to use as the photo. The content type must be usable as an image.
Return Value
Type: ConnectApi.Photo
Usage
This method is successful only when the context user is the group manager or owner, or has Modify All Data permission.
Photos are processed asynchronously and might not be visible right away.
updateGroup(communityId, groupId, groupInput)
API Version
28.0
Requires Chatter
Yes
Signature
public static ConnectApi.ChatterGroup updateGroup(String communityId, String groupId, ConnectApi.ChatterGroupInput groupInput)
Parameters
- communityId
- Type: String
- ID for an Experience Cloud site, internal, or null.
- groupId
- Type: String
- ID for a group.
- groupInput
- Type: ConnectApi.ChatterGroupInput
- A ConnectApi.ChatterGroupInput object.
Return Value
Type: ConnectApi.ChatterGroup
Usage
This method is successful only when the context user is the group manager or owner, or has Modify All Data permission. Use this method to update any settings in the ConnectApi.ChatterGroupInput class. These settings include the group title and text in the “Information” section, whether the group is public or private, and whether the group is archived.
Example
String groupId = '0F9D00000000qSz';
String communityId = null;
ConnectApi.ChatterGroupInput groupInput = new ConnectApi.ChatterGroupInput();
groupInput.isArchived = true;
ConnectApi.ChatterGroups.updateGroup(communityId, groupId, groupInput);
updateGroupMember(communityId, membershipId, role)
API Version
29.0
Requires Chatter
Yes
Signature
public static ConnectApi.ChatterGroup updateGroupMember(String communityId, String membershipId, ConnectApi.GroupMembershipType role)
Parameters
- communityId
- Type: String
- ID for an Experience Cloud site, internal, or null.
- membershipId
- Type: String
- ID for a membership.
- role
- Type: ConnectApi.GroupMembershipType
- The group membership type. One of these values:
- GroupManager
- StandardMember
Return Value
Type: ConnectApi.ChatterGroup
Usage
updateMyChatterSettings(communityId, groupId, emailFrequency)
API Version
28.0
Requires Chatter
Yes
Signature
public static ConnectApi.GroupChatterSettings updateMyChatterSettings(String communityId, String groupId, ConnectApi.GroupEmailFrequency emailFrequency)
Parameters
- communityId
- Type: String
- ID for an Experience Cloud site, internal, or null.
- groupId
- Type: String
- ID for a group.
- emailFrequency
- Type: ConnectApi.GroupEmailFrequency
- Frequency with which a user receives
email.
- EachPost
- DailyDigest
- WeeklyDigest
- Never
- UseDefault
The value UseDefault uses the value set in a call to updateChatterSettings(communityId, userId, defaultGroupEmailFrequency).
Return Value
updateRequestStatus(communityId, requestId, status)
API Version
28.0
Requires Chatter
Yes
Signature
public static ConnectApi.GroupMembershipRequest updateRequestStatus(String communityId, String requestId, ConnectApi.GroupMembershipRequestStatus status)
Parameters
- communityId
- Type: String
- ID for an Experience Cloud site, internal, or null.
- requestId
- Type: String
- ID for a request to join a private group.
- status
- Type: ConnectApi.GroupMembershipRequestStatus
- Status of the request:
- Accepted
- Declined
The Pending value of the enum is not valid in this method.
Return Value
Usage
This method is successful only when the context user is the group manager or owner, or has Modify All Data permission.
Sample: Accepting or Declining a Request to Join a Private Group
This sample code calls ConnectApi.ChatterGroups.updateRequestStatus and passes it the membership request ID and an ConnectApi.GroupMembershipRequestStatus.Accepted status. You can also pass ConnectApi.GroupMembershipRequestStatus.Declined.
String communityId = null;
ID groupId = '0F9x00000000hAZ';
String requestId = '0I5x000000001snCAA';
ConnectApi.GroupMembershipRequest membershipRequestRep = ConnectApi.ChatterGroups.updateRequestStatus(communityId, requestId,
ConnectApi.GroupMembershipRequestStatus.Accepted);
updateRequestStatus(communityId, requestId, status, responseMessage)
API Version
35.0
Requires Chatter
Yes
Signature
public static ConnectApi.GroupMembershipRequest updateRequestStatus(String communityId, String requestId, ConnectApi.GroupMembershipRequestStatus status, String responseMessage)
Parameters
- communityId
- Type: String
- ID for an Experience Cloud site, internal, or null.
- requestId
- Type: String
- ID for a request to join a private group.
- status
- Type: ConnectApi.GroupMembershipRequestStatus
- Status of the request:
- Accepted
- Declined
The Pending value of the enum is not valid in this method.
- responseMessage
- Type: String
- Provide a message to the user if their membership request is declined. The value of
this property is used only when the value of the status property is Declined.
The maximum length is 756 characters.
Return Value
Usage
ChatterGroups Test Methods
For information about using these methods to test your ConnectApi code, see Testing ConnectApi Code.
setTestSearchGroups(communityId, q, result)
API Version
29.0
Signature
public static Void setTestSearchGroups(String communityId, String q, ConnectApi.ChatterGroupPage result)
Parameters
- communityId
- Type: String
- ID for an Experience Cloud site, internal, or null.
- q
- Type: String
- Specifies the string to search. The search string must contain at least two characters, not including wildcards. See Wildcards. Can be specified as null.
- result
- Type: ConnectApi.ChatterGroupPage
- Test ConnectApi.ChatterGroupPage object.
Return Value
Type: Void
setTestSearchGroups(communityId, q, pageParam, pageSize, result)
API Version
28.0
Signature
public static Void setTestSearchGroups(String communityId, String q, Integer pageParam, Integer pageSize, ConnectApi.ChatterGroupPage result)
Parameters
- communityId
- Type: String
- ID for an Experience Cloud site, internal, or null.
- q
- Type: String
- Specifies the string to search. The search string must contain at least two characters, not including wildcards. See Wildcards. Can be specified as null.
- pageParam
- Type: Integer
- Number of the page you want returned. Starts at 0. If you pass in null or 0, the first page is returned.
- pageSize
- Type: Integer
- Specifies the number of items per page. Valid values are from 1 through 100. If you pass in null, the default size is 25.
- result
- Type: ConnectApi.ChatterGroupPage
- Test ConnectApi.ChatterGroupPage object.
Return Value
Type: Void
setTestSearchGroups(communityId, q, archiveStatus, pageParam, pageSize, result)
API Version
29.0
Signature
public static Void setTestSearchGroups(String communityId, String q, ConnectApi.GroupArchiveStatus, archiveStatus, Integer pageParam, Integer pageSize, ConnectApi.ChatterGroupPage result)
Parameters
- communityId
- Type: String
- ID for an Experience Cloud site, internal, or null.
- q
- Type: String
- Specifies the string to search. The search string must contain at least two characters, not including wildcards. See Wildcards. Can be specified as null.
- archiveStatus
- Type: ConnectApi.GroupArchiveStatus
- Archive status of groups.
- All—All groups, including groups that are archived and groups that aren’t archived.
- Archived—Groups that are archived.
- NotArchived—Groups that aren’t archived.
- pageParam
- Type: Integer
- Number of the page you want returned. Starts at 0. If you pass in null or 0, the first page is returned.
- pageSize
- Type: Integer
- Specifies the number of items per page. Valid values are from 1 through 100. If you pass in null, the default size is 25.
- result
- Type: ConnectApi.ChatterGroupPage
- Test ConnectApi.ChatterGroupPage object.
Return Value
Type: Void