Skip to main content

Add Comment

The LikeMinds ReactNative Feed SDK, users can engage in interactive discussions by adding comments to posts. This feature enables users to express their thoughts, ask questions, and engage with other members in a dynamic and collaborative manner.

Steps to add a comment on post

  1. Use the addComment() function provided by the lmFeedClient object created earlier.
  2. Create an instance of AddCommentRequest, as shown in the snippet and pass it to the above method.
  3. Use the response as per your requirement
try {
const addCommentRequest = AddCommentRequest.builder()
.setPostId("<ENTER_POST_ID>") // id of the post on which member has commented
.setText("Comment text") // comment text
.setTempId("<ENTER_TEMP_ID>")
.build();
const response = await lmFeedClient.addComment(addCommentRequest);
// Use the response as per your requirement.
} catch (error) {
// Use the error as per your requirement.
}

Additional Features

Tag a User

To tag a user, use the getTaggingList() function to fetch the list of users that can be tagged, and use the format <<[user.name]|route://user_profile/[user.sdkClientInfo.uuid]>> to embed it inside the text of the comment.

Models

AddCommentRequest

VARIABLETYPEDESCRIPTIONOPTIONAL
postIdstringID of the post on which member has commented.
textstringText content of the comment.
tempIdstringTemporary ID for Comment

AddCommentResponse

VARIABLETYPEDESCRIPTIONOPTIONAL
commentCommentObject of the added comment.
usersRecord<string,User>Map of user unique id to user object.