Example: Create and Schedule Custom Recommendations with Audiences

This example creates and schedules a custom recommendation with audiences.

Community managers can access, create, and delete audiences, definitions, and schedules for custom recommendations. (Community managers are users with the Create and Set Up Experiences or Manage Experiences permission.) Users with the Modify All Data permission can also access, create, and delete custom recommendation audiences, custom recommendation definitions, and scheduled custom recommendations.

These recommendations appear by default on the Customer Service template. They appear on the home and question detail pages and in the feed in Salesforce mobile web. They also appear anywhere community managers add recommendations using Experience Builder in the Customer Service template.

So that users don’t see the same recommendations all the time, Salesforce periodically removes and brings back custom recommendations that haven’t been accepted or dismissed.

/connect/communities/{communityId}/recommendation-definitions

POST

Custom Recommendation Definition Input

Custom Recommendation Definition

This example adds an image file that has been uploaded to Salesforce. To upload a new image file, see Uploading Binary Files.

/connect/recommendation-definitions/{recommendationDefinitionId}/photo

Use the recommendationDefinitionId returned in the Recommendation Definition response body in Step 1.

PUT

Photo Input

Photo

/connect/communities/{communityId}/recommendation-audiences

POST

Custom Recommendation Audience Input

Custom Recommendation Audience

/connect/communities/{communityId}/recommendation-audiences/{recommendationAudienceId}

Use the recommendationAudienceId returned in the Recommendation Audience response body in Step 3.

PATCH

Custom Recommendation Audience Input

In this example, this Recommendation Audience Input request body includes a criteria property that is a Custom List Audience Criteria Input request body. The Custom List Audience Criteria Input request body includes a members property that is a User ID Collection Input request body.

Custom Recommendation Audience

/connect/communities/{communityId}/scheduled-recommendations

POST

Scheduled Custom Recommendation Input

Scheduled Custom Recommendation