Create Confluence Pages/Posts with Jira Automation

Jira Automation is an Atlassian plugin to automate repetitive tasks. It is very widely used and drastically simplifies common tasks. For example, you can have issues with a priority greater than Medium sent to you at the end of every week or auto-assign certain tickets to a special team.

Jira Automation currently has no Confluence connector and Atlassian has stated that they currently are not planning to add a Confluence integration (see the links at the end).

Solution

Disclaimer: We are the developers of mailto.wiki – Email for Confluence which is part of the solution below.

If you, however, don’t want to miss this functionality you can make use of the plugin mailto.wiki – Email for Confluence. mailto.wiki allows you to send emails to your Confluence instances. Jira Automation on the other hand can send emails. The combination of the two is a well-functioning workaround. With mailto.wiki you register email addresses which can be seen similar to mailboxes for different Spaces and Pages. To send content to Confluence, you need to register an email address and create an action in the automation that sends the results to that email address. The plugin will then post the emails to Confluence.

Example: Weekly Release Report

In this example, we want to do a release status report on a weekly basis. Instead of emailing this to all involved persons, we want to store this in Confluence so that you have a central place to see and comment on the current release status. To do so we need to complete two steps.

1. Set up mailto.wiki

For this example, we assume that you have installed the mailto.wiki plugin, set up the mandatory configuration, and have at least one valid mailto.wiki email address registered. If you haven’t, you can have a look at our getting started article.

With mailto.wiki we can manage how and where content is created in Confluence. A good place for our reports would be under a reporting page in the appropriate product space. In our case, we want to save the reports under Example Product > Weekly Release Reports. The way to do so is by using a space rule. This space rule should fulfill two tasks:

  • Identify all emails from the related Jira automation.
  • Move these emails to Example Product > Weekly Release Reports.

To create a new space rule you need to go to the configuration page of the plugin and then to the Space Rules section. How to get to the configuration page is described in the getting started article referenced above. When you are on the page you have to click on “Add Rule”, after that a modal will open which will guide you through the creation process.

The part to identify a group of emails in a space rule is called condition. The condition can for example identify emails by sender, recipient, or specific subjects. We use the subject as an identifier of our release reports:

Subject contains “Example Product Weekly Release Report

The next step is to configure what should be done with these emails. In our case, we want to populate them under the above-named reports page. To do so we define the action in the space rule:

Move emails to Space “Example Product” as Page under Parent Page “Weekly Release Reports”.

The completed space rule looks like this:

It is important that you save the space rule and afterward save the settings. With that done we’ve completed step one. mailto.wiki listens now on emails with a certain subject. Now we need to set up the automation to send these emails.

2. Set up Jira Automation

With Jira Automation, we decide what to put in the release report and when to send it. For this example, we want to collect all issues with a high priority every 7 days (weekly).

To create a new Jira Automation you have to go to the project you want the automation to execute for and click on the lightning symbol in the upper right corner. This will ask you to select the trigger for the automation. Select scheduled.

For the sake of simplicity, we have not used a cron expression. We repeat the task every 7 days. It is important here not to select “Run a JQL search and execute actions for each issue in the query“, otherwise the bulk action used later will not work as desired.

Jira Automation: Weekly trigger

Next, we need to filter what information we want to send. To do this, we use the Lookup action, as this bulks all issues of a JQL. We want to filter all issues of the Example Project (EP) with a priority higher than medium.

Jira Automation: Lookup issues

Finally, we want to send those issues in an email to Confluence. To do so, we need to add a Send email action. In the to field, there must be a mailto.wiki address registered by you. To make our previously defined space rule work, set the subject to “Example Product Weekly Release Report“. Make sure you’ve correctly spelled everything. Then you can define the content of the mail, e.g.

<ul>
{{#lookupIssues}}
<li>{{key}} - {{summary}}</li>
{{/}}
</ul>

This will create a simple list of all issues with their summary. You can find a list of all available keywords under lookup in the following article.

Jira Automation: Send email action.

Afterward, you can publish and test your rule. If no emails land in the expected place, it is always good to first check whether the email lands in the default space or was accidentally published as a blog. Sometimes it just takes 2-3 minutes for an email to be published. It is also advisable to define a recipient for replies in the “More Option”-section of the email action. If mailto.wiki does not send the email to Confluence for some technical reason, you will receive bounce messages.

Conclusion

The combination of Jira Automation and mailto.wiki allows you to heavily automate reporting and create complex evaluations with Jira and Confluence. If you have further questions you can have a look at our documentation or send an email to support@mailto.wiki.

Tickets

https://community.atlassian.com/t5/Marketplace-Apps-Integrations/Can-I-create-a-Confluence-page-with-an-Automation-for-Jira-Rule/qaq-p/965680

https://community.atlassian.com/t5/Automation-questions/Atlassian-Jira-to-Confluence-integration-question/qaq-p/1436913

https://community.atlassian.com/t5/Automation-questions/Is-there-a-way-to-update-a-confluence-page-using-Jira-Automation/qaq-p/1434816#U1436209

https://codebarrel.atlassian.net/browse/AUT-269