Solution overview

Scope

This design covers adding comments to both cloud and server macros and on draw.io diagrams only.

Sequence diagrams

Add a comment

@Starter(macro)
// get page Id from window.location
page = Confluence.getPage(pageId)


anchor = createAnchor(uuid) {
  p = findMacroPostion()
  newPage = updatePage(page, p, uuid)
}

Confluence.updatePage(pageId, newPage)

commentId = Confluence.createComment(pageId, anchor)

Save(commentId) {
  Confluence.updateContentProperty(commentId, anchorname)
}

Load comments

@Starter(Browser)
Macro.RenderComments() {
  comments = Confluence.getContentProerpty()
  foreach(comment) {
    commentId = comment.getId
    comment = Confluence.getComment(commentId)

    Render(comment) {
      // Comment can be resolved or deleted
      if(commentIsOpen) {
       show()
      }
    }  
  }
}

Title

Link

Comment

Add mention to Jira issue comment

https://community.atlassian.com/t5/Jira-Software-questions/Rest-API-v3-Add-Mention-to-Comment/qaq-p/1213708

{
  "type": "mention",
  "attrs": {
    "id": "ABCDE-ABCDE-ABCDE-ABCDE",
    "text": "@Bradley Ayers",
    "userType": "APP"
  }
}

Create comments using the content REST API

https://community.developer.atlassian.com/t/anyone-able-to-create-comments-using-the-content-rest-api/20312

Custom macro content in an overlay

https://developer.atlassian.com/cloud/confluence/viewing-custom-macro-content-in-an-overlay/

userKey is deprecated

https://developer.atlassian.com/cloud/confluence/deprecation-notice-user-privacy-api-migration-guide/