Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Automation (Confluence): How to generate a list of pages and email the list?

P. Bryan Edge-Salois August 3, 2023

Hello! Hoping someone here can help me with this automation.

Objective: I am trying to create an automation that will generate a list of Confluence pages based on a CQL query and then email the list of pages (in a single email) to me.

The Challenge: The part I'm having trouble with is getting the automation to output the CQL query results into a single list/email. Note: The email method *does work* if I use a "For Each" branch -- but then I get 100 emails, each with a page title and link. :/ 

The Deets: My basic automation is as follows:

  1. Trigger - Schedule
  2. For Related Entities (CQL parameters/search)
  3. Action - Send Email 

This works fine outputting to the Audit Log -- but it's ugly and still requires a lot of work to make it more usable/actionable. I haven't figure out a way to get it all in a single email.

Does anyone have suggestions or know how to make this work? 

Thanks in advance! :) 

4 answers

2 votes
Dylan Soechting
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 4, 2023

Hello @P. Bryan Edge-Salois

Branches do not support aggregating data for a single action like you are trying to accomplish here. However, @Bill Sheboy is correct that going with a manual web request to the Confluence API could enable you to accomplish your desired outcome.

I used the Search content by CQL endpoint to find pages by CQL query. Then I followed up in the Send email action with the Multi-user picker smart values to use the fields from a list to put together an email body with the page title and page URL. I did need to hard code the base URL value in the email action. I will attach some screenshots that I hope will help.

image.pngimage.png

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.
August 4, 2023

Hey @Dylan Soechting -

How about we make this into a feature request (NOTE to anyone discovering this page later THIS IS NOT DOCUMENTATION, this is a FEATURE REQUEST):

Lookup content

Search for up to 100 pieces of content using a CQL query. Include the results list in other actions by using the {{lookupContent}} smart value. Learn more about using smart values with issue lists.

All properties can be accessed from the lookupContent list. For example, to print the titles and links for each page in bullet point form:

{{#lookupContent}}{{title}}: {{url}}
{{/}}

(Yes, there's the question of whether content is a page or blogpost, although I think blogposts can have titles too.)

I mean, you have {{cqlResult}}, so the data is there. You just need to make it into an iterable list.

Thanks!!

Like P. Bryan Edge-Salois likes this
Avinoam
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 7, 2023

Hi @Darryl Lee ! You're totally right :) This is something we have in our backlog to address within Confluence, and we'll be sure to post public updates once this is supported!

Like # people like this
P. Bryan Edge-Salois August 17, 2023

Yes -- this is a vastly over-complicated workaround for a very simple action: Isolate content by ancestor or parent, evaluate the created/modified dates, and output a list to a log or in an email. 

This is very simple functionality that should be easy to build.

0 votes
Jacquelyn Gallegos
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 9, 2024

Was there ever an update on this feature request? Do we have visibility on the feature request so we can look for any updates? 

Thank you!!!

0 votes
Dylan Soechting
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 10, 2024

@P. Bryan Edge-Salois Hello! I just wanted to circle back and make sure that you're aware that we have released a new action called "Lookup pages" which should make accomplishing your goal much easier. The action is very similar to the "Page branch", except instead of doing some action for every single page found, it will aggregate all of the results in a single smart value.

You can read a bit more about the action in this post.

0 votes
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 3, 2023

Hi @P. Bryan Edge-Salois -- Welcome to the Atlassian Community!

First thing, I do not have Confluence automation rules in my site, so I am making a suggestion based on what I know of automation for Jira.  With that out of the way...

Your use case is similar to using a scheduled rule on Jira issues and wanting one email communication (rather than one for each issue returned by JQL).  For Jira Cloud, you could use "Lookup Issues"...there does not appear to be an equivalent for Confluence automation.

Instead I wonder: could you use a web request action to call the Confluence REST API, and then iterate over the response to list the pages in a single email?

Kind regards,
Bill

P. Bryan Edge-Salois August 4, 2023

It's an interesting avenue to look into! Thank you! 

One would think this sort of functionality would be easier to build with standard tools... 

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events