Assistance to Understand and Implement Automation for Adding Labels to Confluence Pages-on workflows

Brian Kirwa September 24, 2024

I hope you're doing well. I need assistance in understanding the instructions provided in relation to adding labels to Confluence pages through automation I'm using 2 different rules 1 creates a page in confluence. But I want the label to be added based on the workflows status i.e when issue is done it adds the labels to the page which was created on the other rule. Below are the details I received, but I'm having trouble fully grasping how to implement it.

**Context**:
I am working on a Jira automation that involves creating Confluence pages and linking them to Jira issues. The next step is to add a label to the created Confluence page. Here's the process as it was explained to me:

1. Since the smart value for the created page can't be stored after certain levels, I need to add a "create variable action" and call this variable `pageID`.
2. The `pageID` variable will be used to add a link between the page and the Jira Issue using the following endpoint:
 
 ```
 POST: https://xxxxxxxxxx.atlassian.net/rest/api/3/issue/{issue.key}/remotelink/
 
 Body:
 {
 "object": {
 "url": "https://xxxxxxxxxx.atlassian.net/wiki/pages/viewpage.action?pageId={{pageID}}",
 "title": "Wiki Page"
 }
 }
 ```

3. In the second rule, I need to extract the remote link URL using a web request to:

 ```
 GET: https://xxxxxxxx.atlassian.net/rest/api/3/issue/{issue.key}/remotelink
 ```

4. A new variable `pageID` will be created from the extracted URL using regex.
 
5. Finally, I will send a web request to add the label to the page with this endpoint:

 ```
 POST: https://xxxxxxxxxx.atlassian.net/wiki/rest/api/content/{pageID}/label
 ```

My Questions:
1. How exactly should the variable `pageID` be created and stored, especially after the first rule execution?
2. Could you clarify how to set up the second rule to extract the `pageID` from the URL using regex?
3. How do I handle the remote link retrieval step and ensure the page ID is properly passed through each step in the automation?
4. Any examples or additional clarification on adding labels using these API calls would be helpful.

I would appreciate any additional resources, videos, or documentation that can clarify this process.

Thank you for your support.

Best regards,
Brian

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events