Create Confluence Pages from Jira using Automation

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.


Often JSM issues result in a how-to document or a knowledgebase article. Or sometimes internal teams need to create confluence pages for a Jira issue to continue the conversation about the issue with detailed specifications for collaboration or perform a post-incident review. 

This article shows how one can use an Automation rule to create a confluence page from a Jira issue at any point adding some content from the Jira issue to the newly created page. For this kb, an agent can create a knowledgebase article at any point and add the kb link back to the Jira issue for reference.


Automation for Jira


  1. Add a workflow transition called Create a knowledgebase in your workflow to create a kb once an issue is Resolved. 
    If you want to allow the agent to create the kb from the issue from any status in the workflow, at any point, then you can create a transition called Create a knowledgebase that transitions from Any status to Itself. So that when the agent uses this transition, the issue transitions back to itself and trigger the automation to create the confluence page 

  2. Create an Automation rule that using the next steps that triggers when an issue is transitioned

  3. Add an if/else Automation block.
    To the If block, add the following Advanced compare condition to compare if the issue is transitioned from the same status back to itself (In this case we only have one transition called Create a knowledgebase that allows an issue to transition back top itself)
    Compare if the value of the previous status and the current status is the same using the smart value:


    If there are multiple statuses with a transition back to itself, in that case, you can add a label when the Create a knowledgebase transition is performed and then use that label as one of the conditions in the automatiion rule before creating the kb.

  4. If the advanced condition is successful, add an action to trigger the action Send web request to send an HTTP request to create new content using the confluence Create content API

    In the Authorization header make sure that you add the keyword Basic followed by the base64 of your emailaddress:APItoken.So if the base64 of the emailaddress:APItoken is AB12XY45 then to the Authorization header add the value Basic AB12XY45

    Enable the Delay execution of subsequent action option to receive a response to the create content request

    Add the following Custom data  to create the confluence content on space with key  KBJA in this case:

      "title": "KB - {{issue.key}} - {{issue.summary}}",
      "type": "page",
      "space": {
        "key": "KBJA"
      "body": {
        "storage": {
                       "value": "<ac:layout><ac:layout-section ac:type=\"single\"><ac:layout-cell><p><ac:structured-macro ac:name=\"jira\" ac:schema-version=\"1\" ac:macro-id=\"f69babcc-73d3-459f-b293-f705404487bb\"><ac:parameter ac:name=\"server\">System JIRA</ac:parameter><ac:parameter ac:name=\"columns\">key,summary,type,created,updated,due,assignee,reporter,priority,status,resolution</ac:parameter><ac:parameter ac:name=\"serverId\">0b3ca688-de42-3628-9deb-3d904609ac2b</ac:parameter><ac:parameter ac:name=\"key\">{{issue.key}}</ac:parameter></ac:structured-macro></p></ac:layout-cell><ac:layout-cell><h1>Description</h1><br /><p>{{issue.description.htmlEncode}}</p><br /></ac:layout-cell><ac:layout-cell><h1>Problems Identified</h1><br /><p>{{issue.description.htmlEncode}}</p><br /></ac:layout-cell><ac:layout-cell><h1> Resolution Action</h1><br /><p>{{issue.description.htmlEncode}}</p><br /></ac:layout-cell></ac:layout-section></ac:layout>",
    		  "representation": "storage"
  5. Proceed with adding a comment on the issue with the link to the newly created confluence page:

    Here is the link to the new draft kb: [{{webhookResponse.body.title}}|{{webhookResponse.body._links.base.concat(webhookResponse.body._links.webui)}}]

Last modified on Jun 15, 2021

Was this helpful?

Provide feedback about this article
Powered by Confluence and Scroll Viewport.