Newer Version Available
Personalization Class
Namespace
Personalization Methods
createAudience(communityId, audience)
API Version
48.0
Requires Chatter
No
Signature
public static ConnectApi.Audience createAudience(String communityId, ConnectApi.AudienceInput audience)
Parameters
- communityId
- Type: String
- ID of the Experience Cloud site.
- audience
- Type: ConnectApi.AudienceInput
- A ConnectApi.AudienceInput object that defines the audience.
Return Value
Type: ConnectApi.Audience
createTargets(communityId, target)
API Version
48.0
Requires Chatter
No
Signature
public static ConnectApi.TargetCollection createTargets(String communityId, ConnectApi.TargetCollectionInput target)
Parameters
- communityId
- Type: String
- ID of the Experience Cloud site.
- target
- Type: ConnectApi.TargetCollectionInput
- A ConnectApi.TargetCollectionInput object that defines the targets.
Return Value
getAudience(communityId, audienceId, includeAudienceCriteria)
API Version
48.0
Available to Guest Users
48.0
Requires Chatter
No
Signature
public static ConnectApi.Audience getAudience(String communityId, String audienceId, Boolean includeAudienceCriteria)
Parameters
Return Value
Type: ConnectApi.Audience
getAudienceBatch(communityId, audienceIds)
API Version
48.0
Available to Guest Users
48.0
Requires Chatter
No
Signature
public static ConnectApi.BatchResult[] getAudienceBatch(String communityId, List<String> audienceIds)
Parameters
Return Value
Type: ConnectApi.BatchResult[]
The ConnectApi.BatchResult.getResult() method returns a ConnectApi.Audience object and errors for audiences that didn’t load.
getAudiences(communityId, ipAddress, domain, userId, publishStatus, includeAudienceCriteria, targetTypes, recordId)
API Version
51.0
Available to Guest Users
51.0
Requires Chatter
No
Signature
public static ConnectApi.AudienceCollection getAudiences(String communityId, String ipAddress, String domain, String userId, ConnectApi.PublishStatus publishStatus, Boolean includeAudienceCriteria, List<String> targetTypes, String recordId)
Parameters
- communityId
- Type: String
- ID for an Experience Cloud site, internal, or null.
- ipAddress
- Type: String
- IP address of the user. If null, no audiences with location criteria are returned.
- domain
- Type: String
- Name of the user’s Salesforce custom domain. If null, no audiences with domain criteria are returned.
- userId
- Type: String
- ID of the user. If null, defaults to the ID of the context user.
- publishStatus
- Type: ConnectApi.PublishStatus
- Publish status of the audience. Values are:
- Draft
- Live
- includeAudienceCriteria
- Type: Boolean
- Specifies whether to include audience criteria (true) or not (false). If unspecified, defaults to false.
- targetTypes
- Type: List<String>
- Comma-separated list of target types to filter the results. Supported values include:
- ExperienceVariation (version 48.0 and later)
- Custom object API names, such as CustomObjectName__c (version 48.0 and later)
- NavigationLinkSet (version 49.0 and later)
- Topic (version 49.0 and later)
- CollaborationGroup (version 49.0 and later)
- KnowledgeArticle (version 49.0 and later)
- ContentDocument (version 49.0 and later)
- ManagedContent (version 49.0 and later)
- Report (version 49.0 and later)
- Dashboard (version 49.0 and later)
- recordId
- Type: String
- ID of the record for field based criteria. If null, all applicable audiences with field based criteria are returned.
Return Value
getAudiences(communityId, ipAddress, domain, userId, publishStatus, includeAudienceCriteria, targetTypes)
API Version
48.0
Available to Guest Users
48.0
Requires Chatter
No
Signature
public static ConnectApi.AudienceCollection getAudiences(String communityId, String ipAddress, String domain, String userId, ConnectApi.PublishStatus publishStatus, Boolean includeAudienceCriteria, List<String> targetTypes)
Parameters
- communityId
- Type: String
- ID of the Experience Cloud site.
- ipAddress
- Type: String
- IP address of the user. If null, no audiences with location criteria are returned.
- domain
- Type: String
- Name of the user’s Salesforce custom domain. If null, no audiences with domain criteria are returned.
- userId
- Type: String
- ID of the user. If null, defaults to the ID of the context user.
- publishStatus
- Type: ConnectApi.PublishStatus
- Publish status of the audience. Values are:
- Draft
- Live
- includeAudienceCriteria
- Type: Boolean
- Specifies whether to include audience criteria (true) or not (false). If unspecified, defaults to false.
- targetTypes
- Type: List<String>
- Comma-separated list of target types to filter the results. Supported values include:
- ExperienceVariation (version 48.0 and later)
- Custom object API names, such as CustomObjectName__c (version 48.0 and later)
- NavigationLinkSet (version 49.0 and later)
- Topic (version 49.0 and later)
- CollaborationGroup (version 49.0 and later)
- KnowledgeArticle (version 49.0 and later)
- ContentDocument (version 49.0 and later)
- ManagedContent (version 49.0 and later)
- Report (version 49.0 and later)
- Dashboard (version 49.0 and later)
Return Value
getTarget(communityId, targetId)
API Version
48.0
Available to Guest Users
48.0
Requires Chatter
No
Signature
public static ConnectApi.Target getTarget(String communityId, String targetId)
Parameters
Return Value
Type: ConnectApi.Target
getTargetBatch(communityId, targetIds)
API Version
48.0
Available to Guest Users
48.0
Requires Chatter
No
Signature
public static ConnectApi.BatchResult[] getTargetBatch(String communityId, List<String> targetIds)
Parameters
Return Value
Type: ConnectApi.BatchResult
The ConnectApi.BatchResult.getResult() method returns a ConnectApi.Target object and errors for targets that didn’t load.
getTargets(communityId, ipAddress, domain, userId, publishStatus, recordId, targetTypes, includeAudience, includeAllMatchingTargetsWithinGroup, groupNames)
API Version
48.0
Available to Guest Users
48.0
Requires Chatter
No
Signature
public static ConnectApi.TargetCollection getTargets(String communityId, String ipAddress, String domain, String userId, ConnectApi.PublishStatus publishStatus, String recordId, List<String> targetTypes, Boolean includeAudience, Boolean includeAllMatchingTargetsWithinGroup, List<String> groupNames)
Parameters
- communityId
- Type: String
- ID of the Experience Cloud site.
- ipAddress
- Type: String
- IP address of the user. If null, no audiences with location criteria are returned.
- domain
- Type: String
- Name of the user’s Salesforce custom domain. If null, no audiences with domain criteria are returned.
- userId
- Type: String
- ID of the user. If null, the default is the ID of the context user.
- publishStatus
- Type: ConnectApi.PublishStatus
- Publish status of the target. Values are:
- Draft
- Live
- recordId
- Type: String
- ID of the record, if you want to specify field based criteria in audiences.
- targetTypes
- Type: List<String>
- Comma-separated list of target types to filter the results. Supported values include:
- ExperienceVariation (version 48.0 and later)
- Custom object API names, such as CustomObjectName__c (version 48.0 and later)
- NavigationLinkSet (version 49.0 and later)
- Topic (version 49.0 and later)
- CollaborationGroup (version 49.0 and later)
- KnowledgeArticle (version 49.0 and later)
- ContentDocument (version 49.0 and later)
- ManagedContent (version 49.0 and later)
- Report (version 49.0 and later)
- Dashboard (version 49.0 and later)
- includeAudience
- Type: Boolean
- Specifies whether to include the matching audience (true) or not (false). If null, the default is false.
- includeAllMatchingTargetsWithinGroup
- Type: Boolean
- Specifies whether to include all the matching targets within a target group (true) or not (false). If null, the default is false. If false, the first matching target within each group, based on priority within the group, is returned.
- groupNames
- Type: List<String>
- A comma-separated list of group names. Groups bundle related target and audience pairs.
Return Value
updateAudience(communityId, audienceId, audience)
API Version
48.0
Requires Chatter
No
Signature
public static ConnectApi.Audience updateAudience(String communityId, String audienceId, ConnectApi.AudienceInput audience)
Parameters
- communityId
- Type: String
- ID of the Experience Cloud site.
- audienceId
- Type: String
- ID of the audience.
- audience
- Type: ConnectApi.AudienceInput
- A ConnectApi.AudienceInput object that defines the updates to the audience.
Return Value
Type: ConnectApi.Audience
updateTargets(communityId, target)
API Version
48.0
Requires Chatter
No
Signature
public static ConnectApi.TargetCollection updateTargets(String communityId, ConnectApi.TargetCollectionUpdateInput target)
Parameters
- communityId
- Type: String
- ID of the Experience Cloud site.
- target
- Type: ConnectApi.TargetCollectionUpdateInput
- A ConnectApi.TargetCollectionUpdateInput object that defines the updates for the targets.