Automation to share direct links to KB articles with portal users
Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.
Summary
This article explains the process of copying the Confluence URL using an Automation rule and pasting it into the comment on the issue publicly so that portal customers can view the KB article. This process saves time for agents because they don't have to manually add a comment to the issue.
Here's how the comment will look on issue view:
On portal:
Environment
Jira Service Management Cloud
Diagnosis
As this is an automatic process, we'll use an automation rule to accomplish this requirement.
As there is no direct way to get the URL of the Confluence pages linked to an issue, we will use the Send web request action in an Automation rule to execute the Get remote issue links endpoint:
https://<yoursitename>.atlassian.net/rest/api/3/issue/<issyekey>/remotelink
This API endpoint returns the remote issue links for an issue. When a remote issue link global ID is provided, the record with that global ID is returned. Otherwise all remote issue links are returned. Where a global ID includes reserved URL characters these must be escaped in the request.
Solution
Attached is the JSON file of the rule for reference:
Step 1:
Start by creating an Automation rule with a Manual trigger:
Select the
Step 2:
Add the Send web request action:
Enter the endpoint below:
https://<yoursitename>.atlassian.net/rest/api/3/issue/{{triggerIssue.key}}/remotelink
Check the flag Delay execution of subsequent rule actions until we've received a response for this web request.
Encode the credentials "<EMAIL>:<API_TOKEN>" with base64. We can do this with any online tool like Base64 encode. Make sure not to include a line break at the end. Add the Headers with Authorization Basic "<EMAIL>:<API_TOKEN>" encoded to base64.
E.g.: Authorization Basic HzxuhHbhzhdjasYTgdjGfrGHzxuhHbhzhdjasYTgdjGfrG
Step 3:
Add the action Comment on issue:
The smart value shown below will be rendered as the URL of the Confluence page:
{{webResponse.body.object.url}}
If the need arises, uncheck the flag:
Make sure to change the comment visibility to Share with customer.
If there are multiple pages linked, simply edit the rule to include all the links in the comment
To learn more about Jira automation, refer to Jira Cloud automation