20. 12. 2024 Alessandra Castiglioni Atlassian, Development

Smart Confluence: Automating Actions Based on Text Content

In today’s fast-paced work environment, efficiency is paramount. Yet many Confluence users are missing out on a powerful time-saving feature: automation. Often overlooked, Confluence automation offers a robust toolkit to simplify workflows and improve collaboration among teams.

This article looks at one of the most versatile aspects of Confluence automation: triggering actions based on text content. We’ll explore how to set up rules that automatically perform actions whenever specific words or phrases appear within your Confluence pages after editing. By the end, you’ll understand how “Smart Confluence” can significantly reduce manual effort and improve content consistency.

Part 1: Basic Automation

Let’s dive into setting up a simple automation in Confluence. We’ll show you how to automatically add a label to a page whenever it’s edited and contains a particular word.

At the most basic level, Confluence automations allow you to check for a value on the title of a page, but not on the text of the page itself (we’ll get to that in the next part).

The first way to check on the text content of the page is to use a CQL type IF condition.

So let’s build a small automation that, if it detects the text “Atlassian” in the body of the page when edited, adds the label “Atlassian” to the page!

Although the effect doesn’t happen immediately, this automation was quite simple to construct.

Now let’s look at a somewhat more complex one that parses the text of a page by holding it in memory while the automation is running.

Part 2: Advanced Automation

We’ll use a web request action via automation to derive the text of the page and go on to analyze it.

The web request format to use is:

https://[myinstance]/wiki/api/v2/pages/{{page.id}}?body-format=[atlas_doc_format|storage]

Where instead of [myinstance] you should enter the name of your instance in the form myinstance.atlassian.net, and you have to select just one out of atlas_doc_format and storage in the final part instead of [atlas_doc_format|storage].

What’s the difference between these two options? With the first option (atlas_doc_format) you’ll have a serialized JSON, while with the second one (storage) you’ll have an HTML string; so how you can access the content of the page will be different.

You can then proceed to create a variable to store the result and then go run a check on it.

  • If you chose atlas_doc_format, the correct smart value to access the page data is {{webResponse.body.body.atlas_doc_format.value}}
  • If you chose storage, the correct smart value is {{webResponse.body.body.storage.value}}

From now on you can use a smart value condition block, configuring it with a regular expression to match the searched value. Once matched, a label can be added to the page as I described above.

As demonstrated in this guide, text-based automation in Confluence offers a powerful way to enhance productivity, improve content consistency, and foster seamless collaboration.

By learning how to trigger actions based on specific words or phrases within your pages, you can unlock a new level of efficiency within your team.

This guide has provided both basic and advanced techniques, helping you create a more dynamic and responsive Confluence environment.

Are you ready to explore these features and experience the transformative impact of “Smart Confluence”?

Alessandra Castiglioni

Alessandra Castiglioni

Author

Alessandra Castiglioni

Leave a Reply

Your email address will not be published. Required fields are marked *

Archive