Creating a Confluence page with list of latest Jira Comments

Carl Pritchett
Contributor
June 25, 2024

Hi, 

I spent some time working out how to, on a schedule, get the latest comment from a set of Jira Issues and then create a Confluence page with them as a summary.

It's not perfect, but could be a good start for people to build on. 
Issues:

- Jira comments are in wiki format, but Confluence doesn't appear to support this

 

Here's what I did:

Create a scheduled task 

Created a lookup Issues tasks that finds the set of Jira issues I'm interested in

Create a Send web request that 

  • Creates a new page under a specified page
  • Uses the lookup to
    • list each issue
    • indicate if it has no comments
    • show the last comment
    • indicate if the comment is older than 14 days

The request URL is `https://<yoursite>.atlassian.net/wiki/api/v2/pages`

Method is: POST

Custom content:

{
"spaceId": "<id of page space here - get from the key",
"status": "current",
"title": "Your page title {{now.jqlDateTime}}",
"parentId": "<id of the parent page>",
"body": {
"representation": "storage",
"value": "{{#lookupIssues}}{{key}} {{summary.htmlEncode}}<\/strong>\n{{#if(comments.size.eq(0))}}Issue has no comments<\/span>{{/}}{{#if(comments.size.gt(0))}}{{#if(now.minusDays(14).isAfter(comments.last.created))}}No comment in the last 14 days<\/span>\n{{/}}Last comment @ {{comments.last.created.jiraDate}}\n{{comments.last.body.htmlEncode}}{{/}}\n\n{{/lookupIssues}}"
}
}


Get the space id via 

https://YOURURL.atlassian.net/wiki/rest/api/space/<space_key_of_parent_page>

The use an Authorization header with the value:

Basic base64(youremail:your_api_token)

To get a token and generate a base64 encoding

Generate a token via https://id.atlassian.com/manage-profile/security/api-tokens

echo -n your_email:your_token | base64

 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events