Activity Feeds V3 is in closed alpha — do not use it in production (just yet).

Comments

Overview

Comments support voting, ranking, threading, images, URL previews, mentions and notifications.

Adding Comments

AddCommentRequest commentRequest =
    AddCommentRequest.builder()
        .comment("This is a test comment from Java SDK")
        .objectID(activityId)
        .objectType("activity")
        .userID(testUserId)
        .build();

AddCommentResponse response = feeds.addComment(commentRequest).execute().getData();

Updating Comments

AddCommentRequest commentRequest =
    AddCommentRequest.builder()
        .comment("This is a test comment from Java SDK")
        .objectID(activityId)
        .objectType("activity")
        .userID(testUserId)
        .build();

AddCommentResponse response = feeds.addComment(commentRequest).execute().getData();

Removing Comments

UpdateCommentRequest updateRequest =
    UpdateCommentRequest.builder().comment("Updated comment text from Java SDK").build();

UpdateCommentResponse response =
    feeds.updateComment(commentId, updateRequest).execute().getData();

Reading Comments

You’ll also want to show/return these comments. The most important is when reading the feed.

DeleteCommentRequest deleteRequest = DeleteCommentRequest.builder().build();
DeleteCommentResponse response =
    feeds.deleteComment(commentId, deleteRequest).execute().getData();

Querying Comments

You can also query the comments so you can show all comments for a given activity or user:

Map<String, Object> filter = new HashMap<>();
filter.put("object_id", activityId);

QueryCommentsRequest queryRequest =
    QueryCommentsRequest.builder().filter(filter).limit(10).build();

QueryCommentsResponse response = feeds.queryComments(queryRequest).execute().getData();

Comment Reactions

Map<String, Object> filter = new HashMap<>();
filter.put("object_id", activityId);

QueryCommentsRequest queryRequest =
    QueryCommentsRequest.builder().filter(filter).limit(10).build();

QueryCommentsResponse response = feeds.queryComments(queryRequest).execute().getData();

Comment Threading

DeleteCommentRequest deleteRequest = DeleteCommentRequest.builder().build();
DeleteCommentResponse response =
    feeds.deleteComment(commentId, deleteRequest).execute().getData();
© Getstream.io, Inc. All Rights Reserved.