Overview
The Collaboration API provides real-time collaboration features for AFFiNE, including comments, mentions, notifications, and workspace sharing capabilities.Comments
Get Comments
Retrieve comments for a specific document with pagination.The document ID to retrieve comments for
Pagination parameters for the comment list
Get Comment Changes
Retrieve recent comment changes (updates, deletions) for a document.The type of change:
update or deleteCreate Comment
Add a new comment to a document.Update Comment
Edit an existing comment’s content.Resolve Comment
Mark a comment as resolved or unresolved.Delete Comment
Remove a comment from a document.Replies
Create Reply
Add a reply to an existing comment.Update Reply
Edit a reply’s content.Delete Reply
Remove a reply from a comment.Mentions
Mention User
Mention a user in a document to send them a notification.Users can only mention other members who have access to the workspace.
Notifications
Get Notifications
Retrieve notifications for the current user.Get Notification Count
Get the count of unread notifications.Mark Notification as Read
Mark a specific notification as read.Mark All Notifications as Read
Mark all notifications as read for the current user.Type Definitions
CommentObjectType
Unique comment identifier
Comment content in ProseMirror JSON format
Whether the comment is marked as resolved
Comment creation timestamp
Last update timestamp
The user who created the comment
Array of replies to this comment
ReplyObjectType
Unique reply identifier
Parent comment ID
Reply content in ProseMirror JSON format
Reply creation timestamp
Last update timestamp
The user who created the reply
NotificationType Enum
Types of notifications:Mention- User was mentioned in a documentComment- New comment on a documentCommentMention- User was mentioned in a commentInvitation- Workspace invitation receivedInvitationAccepted- Invitation was acceptedInvitationBlocked- Invitation was blockedInvitationRejected- Invitation was rejectedInvitationReviewRequest- Review request for invitationInvitationReviewApproved- Invitation review approvedInvitationReviewDeclined- Invitation review declined
NotificationLevel Enum
Notification priority levels:None- No notificationMin- Minimal priorityLow- Low priorityDefault- Normal priorityHigh- High priority
Error Handling
- CommentNotFound
- MentionUserDocAccessDenied
- NotificationNotFound