// adds a like to the previously created comment
await client.Reactions.AddChildAsync(comment, "like", activity.Id, "bob")
Child Reactions
A reaction can also be added to another reaction; in this case, a child reaction is created. Child reactions are created in the same way as regular reactions but have a few crucial differences:
Child reactions are not part of the parent activity counts
Child reactions are only returned when the parent is returned
In order to paginate over reactions, you need to filter using the parent reaction ID
Recent children reactions and their counts are added to the parent reaction body
Reaction nesting is limited. The deepest level where you can insert your child reaction is 3.
Let’s take an example: Bob creates an activity
Alice comments on this activity
Bob comments on Alice’s comment
Carl comments on Bob’s comment.
Carl’s comment is at the maximum third nesting level, so Alice can’t like or comment on Carl’s comment because it would be the fourth level of nesting.
// adds a like to the previously created comment
client.reactions.addChild("like", comment);
# adds a like to the previously created comment
client.reactions.add_child("like", comment, user_id="mike")
# adds a like to the previously created comment
client.reactions.add_child("like", comment_id, user_id="mike")
// adds a like to the previously created comment
$client->reactions()->addChild("like", $comment_id, "mike");
Reaction reaction = Reaction.builder().kind("like").build();
// adds a like to the previously created comment
reaction = client.reactions().addChild("john-doe", comment.getId(), reaction).get();
// adds a like to the previously created comment
r := stream.AddReactionRequestObject{
Kind: "like",
ActivityID: activity.ID,
UserID: "bob",
}
resp, err := client.Reactions().AddChild(context.TODO(), comment.ID, r)
if err != nil {
panic(err)
}
// add a like reaction to the previously created comment
client.add(reactionToParentReaction: commentReaction, kindOf: "like") { result in /* ... */ }
await client.reactions.addChild('like', comment.id!);