Example
Listen for changes to the changes in the list of mentioned users in a comment
instance.addEventListener("comments.mention", (event) => {
const { comment, modifications } = event;
modifications.forEach((modification) => {
const { userId, action } = modification;
if (action === "ADDED") {
console.log(`User ${userId} was mentioned in comment ${comment.id}`);
} else {
console.log(`User ${userId} was unmentioned in comment ${comment.id}`);
}
});
});
See Also
Properties
A list of modifications that were applied to the comment.
This event is emitted when the list of users mentioned in a comment changes or a new comment is created with mentions. The
modificationsproperty contains a list of modifications that were applied to the comment. Each modification contains the user ID and the action that was performed.The event is only emitted for the user that created or updated the comment either via the UI or the API. If you want to listen for changes to comments made by other users, you can use the
comments.create,comments.changeandcomments.deleteevent. You get the affected comment in the event payload and can check the mentioned users using Comment.getMentionedUserIds method.