Skip to main content
Example scripts
arrow icon
To homepage
Confluence
Cloud icon
Cloud

Add a Comment on a Page

Created 1 year ago, Updated 1 day(s) ago
App in script
ScriptRunner For Confluence
ScriptRunner For Confluence
by Adaptavist
Compatibility
compatibility bullet
Confluence
Language |
groovy
def pageId = '<YOUR_PAGE_ID>'
def comment = 'This is an automated comment by ScriptRunner!'
def rest = '/api/v2/footer-comments/'

post("/wiki${rest}")
    .header('Content-Type', 'application/json')
    .body([
        "pageId": pageId,
        "body": [
            "representation": "storage",
            "value": comment
        ]
    ])
    .asObject(Map)
    .body

logger.info ("Comment added.")
Having an issue with this script?
Report it here