Pragmatic Jira Automation: Atlassian's 3 Ways of Using Jira and Confluence Together, We Unveil the 4

Kiet Ngo
Contributor
April 11, 2024

 If you use Jira and Confluence together, have you ever had to:

  • Create a Jira issue, then
  • Switch to Confluence to create a page, then
  • Link said Confluence page to that Jira issue?

This involves a lot of tedious and manual steps, as well as switching between Jira and Confluence. The linking step requires you to manually specify the Jira issue and the Confluence page being linked to. Most of the current docs & guides available from Atlassian more or less follow this manual method:

What if I tell you, there is another secret way achieving the similar result?

AgileOps - What if I tell you we have a better way to do this?

In this article, I’ll introduce our AgileOps way of seamlessly integrating Jira and Confluence together, by leveraging the power of Jira Automation and REST API calls. We can trigger this automation process from a specific Jira issue and then have the Confluence page automatically created and linked back to Jira.

First, let’s see how the solution works in action. Then we’ll dive deeper into how to set it up.

 


The Demo

In any Jira issue, we trigger this Create page in Confluence automation rule. I’ll show you how to set it up in the next section The Setup:

AgileOps -  Create page in Confluence automation rule

Voila, a new Confluence page is automatically created and linked back to the triggered Jira issue:

AgileOps - A new Confluence page is automatically created and linked back to the triggered Jira issue

Navigating to the created Confluence page, we can see the page has been automatically linked to the Jira issue, resulting in a bio-directional link in one simple process.

AgileOps - We can see the page has been automatically linked to the Jira issue

This saves you the hassle of having to go back and forth between Jira and Confluence and manually linking Jira issue and Confluence page.

 


The Setup

Step 1: Create a manual Jira Automation rule

Click Create rule, then choose Manual trigger from issue as the trigger:

AgileOps - Create a manual Jira Automation rule

Step 2: Configure an action step to create Confluence page

Add a new component, choose Create page in Confluence as an action:

AgileOps - Configure an action step to create Confluence page

Then, click Connect to connect with the Confluence site we want to create page from, and configure the options as shown below:

AgileOps - Connect to connect with the Confluence site we want to create page from, and configure the options as shown below
  1. On the Title field, refer to Jira issues - smart values on how to extract data from the Jira issue, and populate the Confluence page title
  2. Choose the Space where you want to host the created page
  3. Choose Parent Page where you want the created page resides in
  4. On the Template field, choose a page template if you want to the created page to base on, or leave None to have it created as an empty page

When the rule is triggered on a Jira issue, this action step will create a Confluence page with the title populated from the Jira issue data.

Step 3: Link the newly created Confluence page to the triggered Jira issue using remote links REST API

AgileOps - Link the newly created Confluence page to the triggered Jira issue using remote links REST API

Add a new Send web request action step, then configure the options as shown below:

  1. In Web request URL, put https://YOUR_ATLASSIAN_SITE/rest/api/2/issue/{{issue.key}}/remotelink
  2. For HTTP method, choose POST
  3. For Web request body, choose Custom data
  4. In the Custom data field, put the following snippet:
{
  "globalId": "appId=YOUR_CONFLUENCE_APP_ID&pageId={{createdPage.id}}",
  "application": {
    "type": "com.atlassian.confluence",
    "name": "System Confluence"
  },
  "relationship": "Wiki Page",
  "object": {
    "url": "https://YOUR_ATLASSIAN_SITE/wiki/pages/viewpage.action?pageId={{createdPage.id}}",
    "title": "Wiki Page",
    }
}
AgileOps - Obtain the id value

Finally, publish the rule and turn it on.

 


The Result

Now, pick any Jira issue, run the published rule, and you should see everything works exactly like The Demo:

  • A new Confluence page is automatically created, with title filled with Jira issue’s key, summary, and current timestamp.
  • This new page will then be automatically linked back with the Jira issue.

 


The Uses Cases

This solution is a game-changer for various tasks:

  • Social media marketing: Automatically create a detailed Confluence page for new article ideas through Jira. It simplifies tracking progress and organizing content.
  • Software development: Log bugs in Jira and generate Confluence pages for them. This keeps track of bug details, affected users, and fix status in sync.
  • IT service management: You can create a Confluence page for each incident or problem Jira issue, detailing the incident description, timeline, affected users, and resolution status.

To sum it up, using Jira and Confluence together, the way this article suggests, can really boost how well your team works together and cuts down on the back-and-forth between different apps. It's flexible enough to fit into any department's workflow.

 


I wrote blog posts about Jira, Automation, Atlassian ecosystem that help make business processes run more efficient:

Follow me and stay tuned for the upcoming articles on this topic:

  • Pragmatic Jira Automation: Jira Governance Loop - Using Jira to Manage Jira
  • Pragmatic Jira Automation: Document Generator with Jira, Automation, Confluence, and K15t Scroll PDF Exporter
  • Pragmatic Jira Automation: How Did We Use Jira as a full-pledge CRM system

5 comments

Comment

Log in or Sign up to comment
Alan Bruce
Contributor
April 11, 2024

Well done. Thank you for sharing. 

Dan W
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.
April 11, 2024

Is there a method to pull fields from the Jira issue and add them to the confluence page?  Our Confluence is whitelisted so we aren't able to call the API endpoints from Jira so I am working on a method to create a page from a Jira Automation that passes the body for the create page endpoint to a lamda that then passes that information into Confluence to create a page.  It works but is not very clean and difficult to configure.

Anne Saunders
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.
April 11, 2024

Smart values work but they're finicky. I was trying to populate a table on a Confluence page and had to settle for sending the values in a list.

Dan W
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.
April 12, 2024

I am able to populate a table with individual fields, I ended up setting the field values into a variable in the automation and that has worked better for custom fields, The page I am working on only interacts with 1 jira issue I suspect if I had to use multiple it would be much more difficult.

Like Anne Saunders likes this
Anne Saunders
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.
April 12, 2024

@Dan W That's slick! I may go update mine!

Anne Saunders
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.
April 11, 2024

This is very cool, and my team is going to be jazzed.

I'd like to recommend a couple edits to the article. 

  1. In Step 4 of the Send a Web Request section, the comma after "Wiki Page"breaks the json. 

  2. In the afterthought about the Authorization header, it would be better to direct users to a page that clearly says something like, "the Authorization value should be 

    basic <credentials>

    where <credentials> is the base64 encoding of your account email, followed by a colon, followed by your Atlassian account API token with no spaces between them."
Like # people like this
Ruud Ravensbergen April 15, 2024

Hi
I have gone through all the steps in this example. However, the page is created, but no links appear in the Confluence page and the Jira issue. I am an admin on both the Confluence Space and the Jira Project.
I get this in the audit log:

Action details:
     Manual trigger
     Ruud Ravensbergen triggered the rule
Create page in Confluence
     Created page: SBP1-880 - [SBP1] - Determine KPE theme
Send web request
     Error publishing web request. Response HTTP status:
          404
     Error response HTTP body:
     {"errorMessages":["Issue does not exist or you do not have permission to see it."],"errors":{}}


But the page is there.

Anne Saunders
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.
April 15, 2024

@Ruud Ravensbergen It seems like your Authorization Header isn't configured correctly. Did you follow these steps: https://community.atlassian.com/t5/Jira-Software-articles/Automation-for-Jira-Send-web-request-using-Jira-REST-API/ba-p/1443828?

 

Ruud Ravensbergen April 15, 2024

Schermafbeelding 2024-04-16 070709.png

And i used this Powersheel code to make the Value
Schermafbeelding 2024-04-16 070919.png

And I also tested using only the "Create page in Confluence" but there is no link to it either, Maybe I should talk to functional management.

Edit : I did see my typo, set it to basic. still does not work

Like Anne Saunders likes this
Anne Saunders
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.
April 17, 2024

@Ruud Ravensbergen I always generate my base64 via Terminal on my Mac - you might try whatever gives you a command line prompt  You might try this and see if you get a different encoded value; also make sure to trim your white space. Beyond that, I'm really not sure what to try, other than to have another Jira admin try with their credentials.

(I initially read "Powersheel" as "Powersheet" and assumed it was an unknown-to-me spreadsheet product - sorry!)

Like Ruud Ravensbergen likes this
Susan Waldrip
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 13, 2024

Hi @Kiet Ngo , thanks for writing up this procedure in such detail. Would it be possible to display Confluence blogs, whiteboards, or even databases in JSM using this method? I'm not a script writer or very knowledgeable in API usage so don't know the limitations but @Robert Hean is looking for a way to do this and I was wondering if this would be possible. Thanks!

Kiet Ngo
Contributor
August 13, 2024

Hi @Susan Waldrip 

This solution, like other integration solutions, depends on the exposed APIs of the destination system. The best way to assess feasibility is to check whether those objects (such as blogs, whiteboards, and databases) are supported by Atlassian's APIs.

 

I did some quick research, and looks like whiteboards are supported here, but databases are not.

Like Susan Waldrip likes this
Susan Waldrip
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 14, 2024

Thanks @Kiet Ngo , I appreciate your time to research this. @Robert Hean , are you able to tell if Atlassian's APIs will support what you need?

Robert Hean
Contributor
August 16, 2024

@Susan Waldrip  - unsure! Will have to find time to try it out

 

Like Susan Waldrip likes this
TAGS
AUG Leaders

Atlassian Community Events