Create confluence page based on issues set to specific status

James Wardle
Contributor
December 13, 2022

Hello. I'd like an automation rule to set up a new page in Confluence based on all the tickets set to a specific status that day.

So, I'd like a page created today that shows all the tickets that have been set to "Released to Production" today only. And then tomorrow I'd like a new page created, that shows all the tickets that have been set to "Released to Production" tomorrow only (so no inclusions of today's tickets).

I know how to create a new page in Confluence, but I'm stuck on how to configure it so it shows the tickets for the relevant day only. 

Any help would be appreciated.

1 answer

2 votes
Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 13, 2022

Hey @James Wardle !

You can use a Scheduled Trigger to run every day at say, 11:59PM, and then I would use the Lookup Issues action to search for issues matching something like this JQL:

project=YOURPROJECT and Status changed TO "Released to Production" ON {{now.convertToTimeZone("America/Los_Angeles").jiraDate}}

(You would want to use your time zone. More details on Jira smart values - date and time.)

You would then Create a Confluence Page with the issues that were found, using List functions to iterate through the {{lookupIssues}} smart value.

In it's most simple form this would give you linked issues and summaries:

Here's a list of issues released on {{now.convertToTimeZone("America/Los_Angeles").jiraDate}}

{{#lookupIssues}}
* {{key}} - {{summary}}
{{/}}

But there's a more elaborate example with a table here:

https://community.atlassian.com/t5/Jira-Service-Management/LookupIssues-email-sending-issues-to-reporters-that-aren-t/qaq-p/2034077

Please let me know if this works!

Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 13, 2022

OOOOF, it looks like this only creates a page, but without content. I need to read up on the new Confluence automation feature to see if we can then figure out how to populate the content on the new page we just created.

Originally I was going to do this with an incoming webhook trigger in Confluence that would be called from a web request from Jira (which would be sent in automation format), but I was hoping to avoid that extra complication.

Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 13, 2022

Humph. It looks like Automation doesn't currently support the adding/replacing the actual body of a Confluence page.

I found this add-on:

And this article that uses web requests from Jira to talk to the Confluence REST API directly for publishing page content:

I guess until Atlassian adds support for adding/editing Confluence the page body, those are your only options. Bummer.

Like # people like this
James Wardle
Contributor
December 21, 2022

Hey @Darryl Lee - thanks so much for the effort you've put into this. I really appreciate it.

I'll have a look at the suggestions you've made and see if I can make it work for us. 

Elelta D
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 2, 2023

hey there @James Wardle and @Darryl Lee 

I saw this thread and wanted to jump in and give you a few pointers as I have recently helped a customer with a very similar request.

I wrote this article on how to use the 'send web request' action to create a page with content in it, this is specifically on using the lookup object condition to pull data from Jira insights into a confluence page.

However, my colleague and I also helped a customer create a page in confluence using a template and smart values to populate Jira fields into a table. 

We took the storage format of a page already created in Confluence (in the format that we want) and then added the smart values into the fields as shown in the storage format. 

Looking at your request @James Wardle I reckon the solution outlined in my article might help to create a page with a list of tickets that have been released.

I hope this helps and happy new year!

Like James Wardle likes this
James Wardle
Contributor
January 3, 2023

Hey @Elelta D - thanks for this! I'm stuck on the authorisation part though, what is needed after "Basic"? I get the following error when I run the rule.

Screenshot 2023-01-03 at 11.59.21.png

Elelta D
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 3, 2023

Hey there @James Wardle

What you need is an encoded string of your_email and your_user_api_token and this is what you will put next to Basic, see below on how to to get your string.

Authorization: Basic <your_encoded_string>

To get your encoded string you do the following steps:

  1. Generate an API Token for your Atlassian Account: https://id.atlassian.com/manage/api-tokens
  2. Build a string of the form your_email@domain.com:your_user_api_token.
  3. You'll need to encode your authorization credentials to base64. There are online tools (i.e., https://www.base64encode.net/) that you can use to create your base64 encoded string. For example, your_email@domain.com:your_user_api_token base64 encoded is eW91cl9lbWFpbEBkb21haW4uY29tOnlvdXJfdXNlcl9hcGlfdG9rZW4=
  4. Supply an Authorization header with content Basic followed by the encoded string. Example: Authorization: Basic eW91cl9lbWFpbEBkb21haW4uY29tOnlvdXJfdXNlcl9hcGlfdG9rZW4=

That should sort out your authentication issue :) 

Like James Wardle likes this
James Wardle
Contributor
January 5, 2023

Hey @Elelta D  - thanks a lot for the help, I was able to configure what I needed.

When: Scheduled
Then: Lookup issues (search for issues using JQL)
If: Advanced compare condition (checks if {{lookupIssues.size}} is greater than 0)
Then: Send web request

In the Custom data field I have this:

{
"id": null,
"type": "page",
"title": "Release Notes {{now.convertToTimeZone("Europe/London").jiraDate}}",
"space": { "key": "TEST" },
"body":{"storage":{"value":
"||Key||Summary||Type||Created||Assignee||Reporter||\n{{#lookupIssues}}|{{Tier}}|{{key}}|{{summary}}|{{issuetype.name}}|{{created.jiraDate}}|{{assignee.displayName}}|{{reporter.displayName}}|\n{{/}}","representation":"wiki"}}
}



 Works a treat!

Like Darryl Lee likes this
Elelta D
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 5, 2023

that is GREAT news. Glad to have been of help :-) 

Like James Wardle likes this
Chris Carpenter
Contributor
October 12, 2023

Hey folks
Sorting through a similar issue. I have a page being created through an automation for jira webhook just fine, but im struggling to figure out how to include a label on the page that gets created. 

Any idea how to accomplish that?

Thanks!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events