Newer Version Available
Create and Schedule Custom Recommendations with Audiences
Community managers (users with the “Create and Set Up Communities” or “Manage Communities” permission) can access, create, and delete recommendation audiences, recommendation definitions, and scheduled recommendations in their communities. Users with the “Modify All Data” permission can also access, create, and delete recommendation audiences, recommendation definitions, and scheduled recommendations.
These recommendations appear by default on the Napili community home and question detail pages and in the feed in communities in the Salesforce1 mobile browser app. They also appear anywhere community managers add recommendations using Community Builder in communities using the Summer ’15 or later version of the Napili template.
Step 1: Define the Custom Recommendation
- Resource
- /connect/communities/communityId/recommendation-definitions
- HTTP method
- POST
- Request body
- Recommendation Definition Input
- Request body example
-
1{ 2 "name":"Corporate Training Project", 3 "title":"Want to learn more about the Corporate Training Project?", 4 "explanation":"Click this link to learn more!", 5 "actionUrl":"https://www.example.com", 6 "actionUrlName":"Launch" 7} - Response body
- Recommendation Definition
Step 2: Add an Image to the Custom Recommendation
This example adds an image file that has been uploaded to Salesforce. To upload a new image file, see Uploading Binary Files.
- Resource
-
/connect/recommendation-definitions/recommendationDefinitionId/photo
Use the recommendationDefinitionId returned in the Recommendation Definition response body in Step 1.
- HTTP method
- PUT
- Request body
- Photo Input
- Request body example
-
1{ 2 "cropSize" : "120", 3 "cropX" : "0", 4 "cropY" : "0", 5 "fileId" : "069D00000001IOh" 6} - Response body
- Photo
Step 3: Create a Recommendation Audience
- Resource
- /connect/communities/communityId/recommendation-audiences
- HTTP method
- POST
- Request body
- Recommendation Audience Input
- Request body example
-
1{ 2 "name" : "Custom App Users" 3} - Response body
- Recommendation Audience
Step 4: Add Members to the Recommendation Audience
- Resource
-
/connect/communities/communityId/recommendation-audiences/recommendationAudienceId
Use the recommendationAudienceId returned in the Recommendation Audience response body in Step 3.
- HTTP method
- PATCH
- Request body
- Recommendation Audience Input
- Request body example
-
1{ 2 "criteria" : { 3 "memberOperationType" : "Add", 4 "members" : { 5 "userIds" : [ 6 "005B0000000Ge16", 7 "005D0000001GpHp" 8 ] 9 }, 10 "type" : "CustomList" 11 } 12} - Response body
- Recommendation Audience
Step 5: Schedule the Custom Recommendation with the Audience
- Resource
- /connect/communities/communityId/scheduled-recommendations
- HTTP method
- POST
- Request body
- Scheduled Recommendation Input
- Request body example
-
1{ 2 "recommendationDefinitionId" : "0RDD00000004CEhOAM", 3 "recommendationAudienceId":"02JD00000008SfdMAE" 4} - Response body
- Scheduled Recommendation