CommunityModeration Class

Get information about flagged feed items and comments in an Experience Cloud site. Add and remove flags from comments and feed items.

ConnectApi

These methods are for CommunityModeration. All methods are static.

All methods in this class require Chatter and are subject to the per user, per namespace, per hour rate limit.

Add a moderation flag to a comment.

29.0

Yes

public static ConnectApi.ModerationFlags addFlagToComment(String communityId, String commentId)

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

commentId

Type: String

ID for a comment.

Type: ConnectApi.​ModerationFlags

To add a flag to a comment, Allow members to flag content must be selected for an Experience Cloud site.

Add a moderation flag of the specified visibility to a comment.

30.0

Yes

public static ConnectApi.ModerationFlags addFlagToComment(String communityId, String commentId, ConnectApi.CommunityFlagVisibility visibility)

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

commentId

Type: String

ID for a comment.

visibility

Type: ConnectApi.​CommunityFlag​Visibility

Visibility behavior of a flag for various user types.

  • ModeratorsOnly—The flag is visible only to users with moderation permissions on the flagged element or item.
  • SelfAndModerators—The flag is visible to the creator of the flag and to users with moderation permissions on the flagged element or item.

Type: ConnectApi.​ModerationFlags

To add a flag to a comment, Allow members to flag content must be selected for an Experience Cloud site.

Add a moderation flag of the specified type to a comment.

38.0

Yes

public static ConnectApi.ModerationFlags addFlagToComment(String communityId, String commentId, ConnectApi.CommunityFlagType type)

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

commentId

Type: String

ID for a comment.

type

Type: ConnectApi.CommunityFlagType

Type of moderation flag.

  • FlagAsInappropriate—Flag for inappropriate content.
  • FlagAsSpam—Flag for spam.

If a type isn’t specified, it defaults to FlagAsInappropriate.

Type: ConnectApi.​ModerationFlags

To add a flag to a comment, Allow members to flag content must be selected for an Experience Cloud site.

Add a moderation flag with a note to a comment.

38.0

Yes

public static ConnectApi.ModerationFlags addFlagToComment(String communityId, String commentId, String note)

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

commentId

Type: String

ID for a comment.

note

Type: String

A note of up to 4,000 characters about the flag.

Type: ConnectApi.​ModerationFlags

To add a flag to a comment, Allow members to flag content must be selected for an Experience Cloud site.

Add a moderation flag of the specified type with a note to a comment.

38.0

Yes

public static ConnectApi.ModerationFlags addFlagToComment(String communityId, String commentId, ConnectApi.CommunityFlagType type, String note)

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

commentId

Type: String

ID for a comment.

type

Type: ConnectApi.CommunityFlagType

Type of moderation flag.

  • FlagAsInappropriate—Flag for inappropriate content.
  • FlagAsSpam—Flag for spam.

If a type isn’t specified, it defaults to FlagAsInappropriate.

note

Type: String

A note of up to 4,000 characters about the flag.

Type: ConnectApi.​ModerationFlags

To add a flag to a comment, Allow members to flag content must be selected for an Experience Cloud site.

Add a moderation flag of the specified type and visibility to a comment.

38.0

Yes

public static ConnectApi.ModerationFlags addFlagToComment(String communityId, String commentId, ConnectApi.CommunityFlagType type, ConnectApi.CommunityFlagVisibility visibility)

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

commentId

Type: String

ID for a comment.

type

Type: ConnectApi.CommunityFlagType

Type of moderation flag.

  • FlagAsInappropriate—Flag for inappropriate content.
  • FlagAsSpam—Flag for spam.

If a type isn’t specified, it defaults to FlagAsInappropriate.

visibility

Type: ConnectApi.​CommunityFlag​Visibility

Visibility behavior of a flag for various user types.

  • ModeratorsOnly—The flag is visible only to users with moderation permissions on the flagged element or item.
  • SelfAndModerators—The flag is visible to the creator of the flag and to users with moderation permissions on the flagged element or item.

Type: ConnectApi.​ModerationFlags

To add a flag to a comment, Allow members to flag content must be selected for an Experience Cloud site.

Add a moderation flag of the specified visibility with a note to a comment.

38.0

Yes

public static ConnectApi.ModerationFlags addFlagToComment(String communityId, String commentId, ConnectApi.CommunityFlagVisibility visibility, String note)

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

commentId

Type: String

ID for a comment.

visibility

Type: ConnectApi.​CommunityFlag​Visibility

Visibility behavior of a flag for various user types.

  • ModeratorsOnly—The flag is visible only to users with moderation permissions on the flagged element or item.
  • SelfAndModerators—The flag is visible to the creator of the flag and to users with moderation permissions on the flagged element or item.

note

Type: String

A note of up to 4,000 characters about the flag.

Type: ConnectApi.​ModerationFlags

To add a flag to a comment, Allow members to flag content must be selected for an Experience Cloud site.

Add a moderation flag of the specified type and visibility with a note to a comment.

38.0

Yes

public static ConnectApi.ModerationFlags addFlagToComment(String communityId, String commentId, ConnectApi.CommunityFlagType type, ConnectApi.CommunityFlagVisibility visibility, String note)

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

commentId

Type: String

ID for a comment.

type

Type: ConnectApi.CommunityFlagType

Type of moderation flag.

  • FlagAsInappropriate—Flag for inappropriate content.
  • FlagAsSpam—Flag for spam.

If a type isn’t specified, it defaults to FlagAsInappropriate.

visibility

Type: ConnectApi.​CommunityFlag​Visibility

Visibility behavior of a flag for various user types.

  • ModeratorsOnly—The flag is visible only to users with moderation permissions on the flagged element or item.
  • SelfAndModerators—The flag is visible to the creator of the flag and to users with moderation permissions on the flagged element or item.

note

Type: String

A note of up to 4,000 characters about the flag.

Type: ConnectApi.​ModerationFlags

To add a flag to a comment, Allow members to flag content must be selected for an Experience Cloud site.

Add a moderation flag to a feed element.

31.0

Yes

public static ConnectApi.ModerationCapability addFlagToFeedElement(String communityId, String feedElementId)

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

feedElementId

Type: String

ID of the feed element.

Type: ConnectApi.ModerationCapability

If the feed element doesn’t support this capability, the return value is ConnectApi.NotFoundException.

To add a flag to a feed element, Allow members to flag content must be selected for an Experience Cloud site.

Add a moderation flag of the specified visibility to a feed element.

31.0

Yes

public static ConnectApi.ModerationCapability addFlagToFeedElement(String communityId, String feedElementId, ConnectApi.CommunityFlagVisibility visibility)

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

feedElementId

Type: String

ID of the feed element.

visibility

Type: ConnectApi.CommunityFlagVisibility

Visibility behavior of a flag for various user types. One of these values:

  • ModeratorsOnly—The flag is visible only to users with moderation permissions on the flagged element or item.
  • SelfAndModerators—The flag is visible to the creator of the flag and to users with moderation permissions on the flagged element or item.

Type: ConnectApi.ModerationCapability

If the feed element doesn’t support this capability, the return value is ConnectApi.NotFoundException.

To add a flag to a feed element, Allow members to flag content must be selected for an Experience Cloud site.

Add a moderation flag of the specified type to a feed element.

38.0

Yes

public static ConnectApi.ModerationCapability addFlagToFeedElement(String communityId, String feedElementId, ConnectApi.CommunityFlagType type)

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

feedElementId

Type: String

ID of the feed element.

type

Type: ConnectApi.CommunityFlagType

Type of moderation flag.

  • FlagAsInappropriate—Flag for inappropriate content.
  • FlagAsSpam—Flag for spam.

If a type isn’t specified, it defaults to FlagAsInappropriate.

Type: ConnectApi.ModerationCapability

To add a flag to a feed element, Allow members to flag content must be selected for an Experience Cloud site.

Add a moderation flag with a note to a feed element.

38.0

Yes

public static ConnectApi.ModerationCapability addFlagToFeedElement(String communityId, String feedElementId, String note)

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

feedElementId

Type: String

ID of the feed element.

note

Type: String

A note of up to 4,000 characters about the flag.

Type: ConnectApi.ModerationCapability

To add a flag to a feed element, Allow members to flag content must be selected for an Experience Cloud site.

Add a moderation flag of the specified type with a note to a feed element.

38.0

Yes

public static ConnectApi.ModerationCapability addFlagToFeedElement(String communityId, String feedElementId, ConnectApi.CommunityFlagType type, String note)

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

feedElementId

Type: String

ID of the feed element.

type

Type: ConnectApi.CommunityFlagType

Type of moderation flag.

  • FlagAsInappropriate—Flag for inappropriate content.
  • FlagAsSpam—Flag for spam.

If a type isn’t specified, it defaults to FlagAsInappropriate.

note

Type: String

A note of up to 4,000 characters about the flag.

Type: ConnectApi.ModerationCapability

To add a flag to a feed element, Allow members to flag content must be selected for an Experience Cloud site.

Add a moderation flag of the specified type and visibility to a feed element.

38.0

Yes

public static ConnectApi.ModerationCapability addFlagToFeedElement(String communityId, String feedElementId, ConnectApi.CommunityFlagType type, ConnectApi.CommunityFlagVisibility visibility)

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

feedElementId

Type: String

ID of the feed element.

type

Type: ConnectApi.CommunityFlagType

Type of moderation flag.

  • FlagAsInappropriate—Flag for inappropriate content.
  • FlagAsSpam—Flag for spam.

If a type isn’t specified, it defaults to FlagAsInappropriate.

visibility

Type: ConnectApi.CommunityFlagVisibility

Visibility behavior of a flag for various user types. One of these values:

  • ModeratorsOnly—The flag is visible only to users with moderation permissions on the flagged element or item.
  • SelfAndModerators—The flag is visible to the creator of the flag and to users with moderation permissions on the flagged element or item.

Type: ConnectApi.ModerationCapability

To add a flag to a feed element, Allow members to flag content must be selected for an Experience Cloud site.

Add a moderation flag of the specified visibility with a note to a feed element.

38.0

Yes

public static ConnectApi.ModerationCapability addFlagToFeedElement(String communityId, String feedElementId, ConnectApi.CommunityFlagVisibility visibility, String note)

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

feedElementId

Type: String

ID of the feed element.

visibility

Type: ConnectApi.CommunityFlagVisibility

Visibility behavior of a flag for various user types. One of these values:

  • ModeratorsOnly—The flag is visible only to users with moderation permissions on the flagged element or item.
  • SelfAndModerators—The flag is visible to the creator of the flag and to users with moderation permissions on the flagged element or item.

note

Type: String

A note of up to 4,000 characters about the flag.

Type: ConnectApi.ModerationCapability

To add a flag to a feed element, Allow members to flag content must be selected for an Experience Cloud site.

Add a moderation flag of the specified type and visibility with a note to a feed element.

38.0

Yes

public static ConnectApi.ModerationCapability addFlagToFeedElement(String communityId, String feedElementId, ConnectApi.CommunityFlagType type, ConnectApi.CommunityFlagVisibility visibility, String note)

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

feedElementId

Type: String

ID of the feed element.

type

Type: ConnectApi.CommunityFlagType

Type of moderation flag.

  • FlagAsInappropriate—Flag for inappropriate content.
  • FlagAsSpam—Flag for spam.

If a type isn’t specified, it defaults to FlagAsInappropriate.

visibility

Type: ConnectApi.CommunityFlagVisibility

Visibility behavior of a flag for various user types. One of these values:

  • ModeratorsOnly—The flag is visible only to users with moderation permissions on the flagged element or item.
  • SelfAndModerators—The flag is visible to the creator of the flag and to users with moderation permissions on the flagged element or item.

note

Type: String

A note of up to 4,000 characters about the flag.

Type: ConnectApi.ModerationCapability

To add a flag to a feed element, Allow members to flag content must be selected for an Experience Cloud site.

Get the moderation flags on a comment.

29.0

Yes

public static ConnectApi.ModerationFlags getFlagsOnComment(String communityId, String commentId)

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

commentId

Type: String

ID for a comment.

Type: ConnectApi.​ModerationFlags

To get moderation flags, the context user must have the Moderate Experiences Feeds permission.

Get the moderation flags with specified visibility on a comment.

30.0

Yes

public static ConnectApi.ModerationFlags getFlagsOnComment(String communityId, String commentId, ConnectApi.CommunityFlagVisibility visibility)

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

commentId

Type: String

ID for a comment.

visibility

Type: ConnectApi.​CommunityFlag​Visibility

Visibility behavior of a flag for various user types.

  • ModeratorsOnly—The flag is visible only to users with moderation permissions on the flagged element or item.
  • SelfAndModerators—The flag is visible to the creator of the flag and to users with moderation permissions on the flagged element or item.

Type: ConnectApi.​ModerationFlags

To get moderation flags, the context user must have the Moderate Experiences Feeds permission.

Get a page of moderation flags on a comment.

40.0

Yes

public static ConnectApi.ModerationFlags getFlagsOnComment(String communityId, String commentId, Integer pageSize, String pageParam)

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

commentId

Type: String

ID for a comment.

pageSize

Type: Integer

Specifies the number of items per page. Valid values are from 1 through 100. The default size is 0.

pageParam

Type: String

Page token to use to view the page. Page tokens are returned as part of the response class, for example, currentPageToken or nextPageToken. If you pass in null, the first page is returned.

Type: ConnectApi.​ModerationFlags

To get moderation flags, the context user must have the Moderate Experiences Feeds permission.

Get a page of moderation flags with specified visibility on a comment.

40.0

Yes

public static ConnectApi.ModerationFlags getFlagsOnComment(String communityId, String commentId, ConnectApi.CommunityFlagVisibility visibility, Integer pageSize, String pageParam)

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

commentId

Type: String

ID for a comment.

visibility

Type: ConnectApi.​CommunityFlag​Visibility

Visibility behavior of a flag for various user types.

  • ModeratorsOnly—The flag is visible only to users with moderation permissions on the flagged element or item.
  • SelfAndModerators—The flag is visible to the creator of the flag and to users with moderation permissions on the flagged element or item.

pageSize

Type: Integer

Specifies the number of items per page. Valid values are from 1 through 100. The default size is 0.

pageParam

Type: String

Page token to use to view the page. Page tokens are returned as part of the response class, for example, currentPageToken or nextPageToken. If you pass in null, the first page is returned.

Type: ConnectApi.​ModerationFlags

To get moderation flags, the context user must have the Moderate Experiences Feeds permission.

Get the moderation flags on a feed element.

31.0

Yes

public static ConnectApi.ModerationCapability getFlagsOnFeedElement(String communityId, String feedElementId)

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

feedElementId

Type: String

ID of the feed element.

Type: ConnectApi.ModerationCapability

If the feed element doesn’t support this capability, the return value is ConnectApi.NotFoundException.

To get moderation flags, the context user must have the Moderate Experiences Feeds permission.

Get the moderation flags with specified visibility on a feed element.

31.0

Yes

public static ConnectApi.ModerationCapability getFlagsOnFeedElement(String communityId, String feedElementId, ConnectApi.CommunityFlagVisibility visibility)

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

feedElementId

Type: String

ID of the feed element.

visibility

Type: ConnectApi.CommunityFlagVisibility

Visibility behavior of a flag for various user types. One of these values:

  • ModeratorsOnly—The flag is visible only to users with moderation permissions on the flagged element or item.
  • SelfAndModerators—The flag is visible to the creator of the flag and to users with moderation permissions on the flagged element or item.

Type: ConnectApi.ModerationCapability

If the feed element doesn’t support this capability, the return value is ConnectApi.NotFoundException.

To get moderation flags, the context user must have the Moderate Experiences Feeds permission.

Get a page of moderation flags on a feed element.

40.0

Yes

public static ConnectApi.ModerationCapability getFlagsOnFeedElement(String communityId, String feedElementId, String pageParam, Integer pageSize)

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

feedElementId

Type: String

ID of the feed element.

pageParam

Type: String

Page token to use to view the page. Page tokens are returned as part of the response class, for example, currentPageToken or nextPageToken. If you pass in null, the first page is returned.

pageSize

Type: Integer

Specifies the number of items per page. Valid values are from 1 through 100. The default size is 0.

Type: ConnectApi.ModerationCapability

If the feed element doesn’t support this capability, the return value is ConnectApi.NotFoundException.

To get moderation flags, the context user must have the Moderate Experiences Feeds permission.

Get a page of moderation flags with specified visibility on a feed element.

40.0

Yes

public static ConnectApi.ModerationCapability getFlagsOnFeedElement(String communityId, String feedElementId, ConnectApi.CommunityFlagVisibility visibility, Integer pageSize, String pageParam)

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

feedElementId

Type: String

ID of the feed element.

visibility

Type: ConnectApi.CommunityFlagVisibility

Visibility behavior of a flag for various user types.

  • ModeratorsOnly—The flag is visible only to users with moderation permissions on the flagged element or item.
  • SelfAndModerators—The flag is visible to the creator of the flag and to users with moderation permissions on the flagged element or item.

pageSize

Type: Integer

Specifies the number of items per page. Valid values are from 1 through 100. The default size is 0.

pageParam

Type: String

Page token to use to view the page. Page tokens are returned as part of the response class, for example, currentPageToken or nextPageToken. If you pass in null, the first page is returned.

Type: ConnectApi.ModerationCapability

If the feed element doesn’t support this capability, the return value is ConnectApi.NotFoundException.

To get moderation flags, the context user must have the Moderate Experiences Feeds permission.

Remove a moderation flag from a comment.

29.0

Yes

public static ConnectApi.ModerationFlags removeFlagFromComment(String communityId, String commentId, String userId)

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

commentId

Type: String

ID for a comment.

userId

Type: String

ID of the context user for whom the flag is removed. Specify null to remove the flag for all users.

Type: Void

To remove a moderation flag, the context user must have added the flag or must have the Moderate Experiences Feeds permission.

Remove a moderation flag from a feed element.

31.0

Yes

public static void removeFlagFromFeedElement(String communityId, String feedElementId, String userId)

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

feedElementId

Type: String

ID of the feed element.

userId

Type: String

ID of the context user for whom the flag is removed. Specify null to remove the flag for all users.

Type: ConnectApi.ModerationCapability

If the feed element doesn’t support this capability, the return value is ConnectApi.NotFoundException.

To remove a moderation flag, the context user must have added the flag or must have the Moderate Experiences Feeds permission.

These methods for CommunityModeration are retired.

Add a moderation flag to a feed item.

29.0–31.0

In version 32.0 and later, use addFlagToFeedElement(communityId, feedElementId).

Yes

public static ConnectApi.ModerationFlags addFlagToFeedItem(String communityId, String feedItemId)

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

feedItemId

Type: String

ID for a feed item.

Type: ConnectApi.​ModerationFlags

To add a flag to a feed item, Allow members to flag content must be selected for an Experience Cloud site.

Add a moderation flag with specified visibility to a feed item.

30.0–31.0

In version 32.0 and later, use addFlagToFeedElement(communityId, feedElementId, visibility).

Yes

public static ConnectApi.ModerationFlags addFlagToFeedItem(String communityId, String feedItemId, ConnectApi.CommunityFlagVisibility visibility)

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

feedItemId

Type: String

ID for a feed item.

visibility

Type: ConnectApi.​CommunityFlag​Visibility

Visibility behavior of a flag for various user types.

  • ModeratorsOnly—The flag is visible only to users with moderation permissions on the flagged element or item.
  • SelfAndModerators—The flag is visible to the creator of the flag and to users with moderation permissions on the flagged element or item.

Type: ConnectApi.​ModerationFlags

To add a flag to a feed item, Allow members to flag content must be selected for an Experience Cloud site.

Get the moderation flags on a feed item.

29.0–31.0

In version 32.0 and later, use getFlagsOnFeedElement(communityId, feedElementId).

Yes

public static ConnectApi.ModerationFlags getFlagsOnFeedItem(String communityId, String feedItemId)

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

feedItemId

Type: String

ID for a feed item.

Type: ConnectApi.ModerationFlags

To get moderation flags, the context user must have the Moderate Experiences Feeds permission.

Get the moderation flags with specified visibility on a feed item.

30.0–31.0

In version 32.0 and later, use getFlagsOnFeedElement(communityId, feedElementId, visibility).

Yes

public static ConnectApi.ModerationFlags getFlagsOnFeedItem(String communityId, String feedItemId, ConnectApi.CommunityFlagVisibility visibility)

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

feedItemId

Type: String

ID for a feed item.

visibility

Type: ConnectApi.CommunityFlagVisibility

Visibility behavior of a flag for various user types. Values are:

  • ModeratorsOnly—The flag is visible only to users with moderation permissions on the flagged element or item.
  • SelfAndModerators—The flag is visible to the creator of the flag and to users with moderation permissions on the flagged element or item.

Type: ConnectApi.ModerationFlags

To get moderation flags, the context user must have the Moderate Experiences Feeds permission.

Remove a moderation flag from a feed item.

29.0–31.0

In version 32.0 and later, use removeFlagFromFeedElement(communityId, feedElementId, userId).

Yes

public static ConnectApi.ModerationFlags removeFlagsOnFeedItem(String communityId, String feedItemId, String userId)

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

feedItemId

Type: String

ID for a feed item.

userId

Type: String

ID of the context user for whom the flag is removed. Specify null to remove the flag for all users.

Type: Void

To remove a moderation flag, the context user must have added the flag or must have the Moderate Experiences Feeds permission.