Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Can I use the api to query a Jira Issue for a connected Slack channel?

edub
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 11, 2024

I want to use an API to query the url for the Connected Slack Channel to a jira issue. (not the remote link mind you)

I've tried looking through the JIRA v2 and v3 API for a method to query this information but I can't find anything.


The closest I've come to finding it is using the expand flag while querying a Jira Issue.

This lists the jira issue properties, and therein are keys which are interesting, but I can't find a way to query the properties further to find the slack link attached to the jira issue.


/rest/api/2/issue/10000?fields=properties&properties=*all


 Results in

{
  "keys": [
    {
      "key": "10000",
      "self": "https://foo.atlassian.net/rest/api/2/issue/10000/properties/10000"
    },
    {
      "key": "issue.content.panel.customised.flag",
      "self": "https://foo.atlassian.net/rest/api/2/issue/10000/properties/issue.content.panel.customised.flag"
    },
    {
      "key": "jira-slack-integration-channelsConnected",
      "self": "https://foo.atlassian.net/rest/api/2/issue/10000/properties/jira-slack-integration-channelsConnected"
    },
    {
      "key": "jira-slack-integration_connected-channels",
      "self": "https://foo.atlassian.net/rest/api/2/issue/10000/properties/jira-slack-integration_connected-channels"
    }
  ]
}  

 
I'm guessing I need to query the app properties to relate a jira issue property key to a value the app stores that would be the slack url.

Haven't figured out yet how to do that..(https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-app-properties/#api-rest-atlassian-connect-1-addons-addonkey-properties-get may have some clues)

Thanks

1 answer

1 vote
Sunny Ape
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 11, 2024

Hello @edub 

You've half discovered the answer... Slack is using Issue properties to store information about itself (its settings).

Since you now know the keys for those Issue properties, all you need to do is lookup the values being stored for those keys for that Issue. This is done using the Get Issue property endpoint.

PS. The more direct way to find what properties, if any, have been created for an Issue is to use the Get Issue property keys endpoint.

PPS. Add the rest-api and api tags to your question, or it will get lost in the noise of all the other generic questions about Jira and Slack.

PPPS. You named your Atlassian domain 'foo'? Really??

Have fun.

edub
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 11, 2024

Thats what I thought too! I was super excited when I queried those properties values and then this is what was returned.



GET for /rest/api/2/issue/10000/properties/jira-slack-integration-channelsConnected

returns:
```
{"key":"jira-slack-integration-channelsConnected",

"value":{"state":"hasConnectedChannels"}}
```

GET for /rest/api/2/issue/10000/properties/jira-slack-integration_connected-channels

returns:
{"key":"jira-slack-integration_connected-channels",

"value":{"added":"jira-slack-integration_connected-channels"}}


Thanks for the tip about get issue property keys that would have helped earlier when I didn't realize not all values were being returned for a given GET issue request.

Really appreciate your help

Sunny Ape
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 11, 2024

Well, in that case, it's most likely that the Slack app is just using those two Issue properties as flags to know it's enabled for that Issue and has connected channels, but it is storing the more detailed information about those channels internally, in its own properties.

The App property endpoints can't be used to accessed those properties outside the scope of the Connect or Forge app that owns / manages those properties, so you can't query them as a user. Also, if the app was built with Forge, it could also be using Forge's Storage method, which is absolutely only accessible by the app itself.

So, unless the app has its own API to expose such information (which I doubt), you don't have much chance of getting that information.

Oh well

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events