Use case: Reply to an annotation
Before you start
Before you reply to an annotation, ensure you have completed the following prerequisites:
- Verify Permissions: Check that you have the necessary permissions to create replies to annotations in your project. This typically requires at least basic contributor access.
- Identify the Parent Annotation: Locate the specific annotation to which you want to reply. You'll need its unique identifier to create a properly linked response.
- Understand Threading Model: Be aware of how annotation replies work in the system. Replies create a threaded conversation attached to the original annotation, facilitating organized discussions.
- Set Up SDK Environment: Ensure your Unity environment is properly configured with the Collaboration SDK to interact with the annotation system.
- Consider Notification Impact: Be aware that creating a reply may trigger notifications to other users who are subscribed to the thread or the original annotation.
How do I...?
Reply to an existing annotation
To create a reply to an annotation, follow these steps:
- Get the Parent Annotation ID: Identify the unique ID of the annotation to which you want to respond. Note that what makes of an annotation a reply is the rootAnnotationId.
- Prepare the Project Identifier: Ensure you have the correct project identifier (GUID) for the project you want to search for.
- Prepare Asset Identifier: Ensure you have the correct and complete asset identifier (GUID) for the asset you want to search by.
- Create Reply Content: Prepare the content of your reply as a new Annotation. This typically includes text, but may support additional formatting depending on the system.
- Submit the Reply: Use the SDK to create a new reply linked to the parent annotation.
- Handle Response: Verify that the reply was successfully created and handle any errors appropriately.
- Update UI: If your application has a user interface displaying the annotation thread, refresh it to include the newly created reply.
Example:
var projectId = "example-project-id"; // Your project ID
var assetId = "example-asset-id"; // ID of the asset to which the annotation is attached
var rootAnnotationId = "example-root-annotation-id"; // ID of the original annotation
AnnotationId result = await annotationManagement.CreateAnnotationAsync(
projectId: projectId,
assetId: assetId,
rootAnnotationId: rootAnnotationId,
...
);
Include additional context in replies
To make your replies more informative and effective:
- Reference Specific Elements: If your reply addresses a particular part of the original annotation, consider including clear references.
- Add Attachments: If supported, enhance your reply with relevant files or images to better illustrate your point.
- Add Mentions: Mentions allow users to notify each other directly. They are encoded into the text field using the format:
:user[<userName>]{#<userId>}
Note
Curly and square brackets are part of the format, angle brackets indicate values to be substituted in this template. Where userName is a display name to use when rendering the mention, and userId is the Genesis ID of the user to notify. The mentioned user must be a member of the Project where the Annotation is created to receive the mention.