How to use confluence attachments in Jira Automation

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Cloud のみ - この記事は クラウド プラットフォームのアトラシアン製品に適用されます。

   

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. 

環境

Jira Service Management cloud

ソリューション 

(info) 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 
    (warning) 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
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 useScheduled Trigger.

  • Select "Send Web Request " under "Add an Action" 


    Headers ( Optional )

    認証

    Basic  <Base64-ApiKey>

    X-ExperimentalAPIopt-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


To get content/PageID :

Copy it from the URL of the conflunce page: https://<sitename>.atlassian.net/wiki/spaces/AT/pages/<content_ID>/PageName
                                        or
Use the API Call to get the Content ID 

最終更新日 2023 年 9 月 22 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.