How to Use Confluence Attachments in Jira Automation
Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.
Summary
This custom solution utilizes an internal API endpoint, which is subject to alterations without prior notification, potentially leading to the disruption of the implemented solution.
This article explains how to send direct attachment links for attachments on a Confluence page from within Jira.
Solution
ℹ️ We will use Rest API Calls to Get the list of attachments to the Confluence Page and use the Attachment ID to send an email with a downloadable link:
API Calls to Get the Attachment ID: Get Attachments
URI Call to Download the Attachment: Download Attachments
⚠️Please note the end user must have access to the Confluence page to download the attachment using the link.
Use the steps below to configure a rule to automatically send an attachment link for direct download:
Step 1: Create an API Key for your admin account
Log in to
https://id.atlassian.com/manage-profile/security/api-tokens
.
Click Create API token.
From the dialog that appears, enter a memorable and concise Label for your token and click Create.
Click Copy to clipboard, then paste the token elsewhere to save.
Step 2: Get list of Attachments added to the Page
Go to Project Settings > Automation > Create Rule
One could either configure an Automated Trigger or have a Manual Trigger; as stated in Jira automation triggers, for the purpose of this example we will use a Scheduled Trigger.
Select "Send Web Request" under "Add an Action"
Web Request URL | https://<sitename.atlassian.com>/wiki/rest/api/content/{id}/child/attachment |
Headers (Optional)
Authorization | Basic <Base64-ApiKey> |
X-ExperimentalAPI | opt-in |
BASE64 encode the string on a Linux/Unix/MacOS:
echo -n user@example.com:api_token_string | base64
HTTP Method: GET
Enable "Delay execution of subsequent rule actions until we've received a response for this web request"
Add comments/log action to capture Attachment ID from the Web Response: {{webResponse.body.results.id}}

Step 3: Send Attachment in Email
If there are multiple Attachments, we need to run the API against each Attachment ID
Add an Advanced branch component with variable attach referring to the smart value {{webResponse.body.results.id}}
Add action Send Email with the following link in the email body
https://<sitename.atlassian.net>.atlassian.net/wiki/rest/api/content/56360967/child/attachment/{{attach}}/download
Sample Automation Rule
Was this helpful?