Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Suggested knowledge base article smart value

Rune Rasmussen January 7, 2021

Situation:

We use Jira Cloud, and the Service Desk for internet ticketing.
When a user creates a ticket, three knowledge base articles are suggested.
More often than not, these are overlooked by the end user.

We want to create automation that sends an e-mail to the reporter containing links to these three suggested knowledge base articles.

Problem:

I can, for the life of me, not find the smart value(s) needed to link/reference these articles.

What I've tried:

Digged through Atlassian documentation on smart values.

Installed JSONView plugin for my browser, and trawled through the company.atlassian.net/rest/api/2/issue-1234 data.

2 answers

1 accepted

2 votes
Answer accepted
Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 7, 2021

So I enabled Chrome's Developer Tools and watched the Network tab when I entered "VPN help" into the Summary of a Service Desk request and saw this query pop up:

https://MYSITE.atlassian.net/rest/servicedesk/knowledgebase/latest/articles/search?project=HELP&query=VPN%20help&spaceKey=HELP

That returns a JSON result with the suggested results.

You would do this in Automation by using Web Requests, querying for  {{issue.summary.urlencode()}}

https://community.atlassian.com/t5/Jira-articles/Automation-for-Jira-Send-web-request-using-Jira-REST-API/ba-p/1443828

I think you could then send an email that contains the contents of those results, using something like:

{{#webhookResponse.body.results}}
* <a href="{{url}}">{{title}}</a>
{{/}}

Unfortunately that endpoint is not documented and the article titles contain Confluence markup which will be a pain to cleanup.

An alternate (and actually documented) endpoint you could hit is here:

https://developer.atlassian.com/cloud/jira/service-desk/rest/api-group-servicedesk/#api-rest-servicedeskapi-servicedesk-servicedeskid-knowledgebase-article-get

This is the URL I used to get the same results (without markup):

https://MYSITE.atlassian.net/rest/servicedeskapi/servicedesk/1/knowledgebase/article?query=VPN%20help

With results from a Web Request might show up here:

{{#webhookResponse.body.values}}
<li><a href="{{content.iframeSrc}}">{{title}}</a>
{{/}}

Unfortunately the iframe link is lacking any... context. But the data is there.

Oh, here's the fix for that:

{{#webhookResponse.body.values}}
<li><a href="https://MYSITE.atlassian.net/servicedesk/customer/portal/1/article/{{source.pageId}}">{{title}}</a>
{{/}}

I think this is all the pieces you need. LMK.

Rune Rasmussen January 14, 2021

Thank you darryl!

With a bit of help from a colleague, we got it working with a bit of automation looking like this:

When an issue is created --> Send web request --> Send email

Web request:
Webhook URL: https://MYSITE.atlassian.net/rest/servicedeskapi/servicedesk/1/knowledgebase/article?query={{issue.summary.urlencode()}}&limit=3
Header: X-ExperimentalApi - opt-in
Header: Authorization - [my basic auth token]

HTTP method: GET
Wait for response: checked.

Email:
To: Reporter
Subject: [Whatever you want]
Content: {{#webhookResponse.body.values}}
<li><a href="https://MYSITE.atlassian.net/servicedesk/customer/portal/1/article/{{source.pageId}}">{{title}}</a>
{{/}}

I set "limit=3" in the URL because the UI the end user sees only displays 3 articles, and we want to avoid drowning them with information.
The default limit turned out to be 10.

Rune Rasmussen January 14, 2021

Thank you Daryl!

I think I managed to delete my first reply, so here it is again :)

With some help from a colleague we got it working.
Our automation looks like this:

Issue created --> Send web request --> Send email.

Web request:

URL: https://MYSITE.atlassian.net/rest/servicedeskapi/servicedesk/1/knowledgebase/article?query={{issue.summary.urlencode()}}&limit=3

Header: X-ExperimentalApi : opt-in
Header: Authorizatoin : [my basic auth token]

HTTP method: GET

Wait for response: checked

Email:

To: Reporter
Subject: [whatever you want it to be]
Content: {{#webhookResponse.body.values}}
<li><a href="https://MYSITE.atlassian.net/servicedesk/customer/portal/1/article/{{source.pageId}}">{{title}}</a>
{{/}}

We set the "limit=3" parameter in the URL to match the amount of articles presented in the UI the end user sees.
The default limit turned out to be 10.

Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 14, 2021

So glad it worked for you.

Shoot, forgot to warn you about the X-ExperimentalApi : opt-in header. That got me when I was testing this.

Good call on limiting it to 3.

0 votes
Daneli Galan September 8, 2023

Is there another way to implement this? I am new to JIRA and need a similar solution as the solution above did not work for me? 

Rune Rasmussen September 11, 2023

I am not aware of any other ways of implementing it. At least I have not found any options, toggles, or other built in way of doing this.

It's not possible to add the suggested articles directly in the Customer Notifications.

Daneli Galan September 11, 2023

Appreciate the reply back , i will continue to try your method above

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events