When I use the Create Slack channel for incident action, is there a way to get the channel ID later on in the automation? It does not appear to be available in the issue as a field from what I can tell.
Hi Nick,
I’ve found my own solution as I needed a solution to archive a channel once an incident was transitioned to Closed and needed the channel ID
So using “Create Slack Channel for an Incident” doesn’t allow to to get the Channel ID so what I’ve done is using:
Sent webrequest to:
POST https://slack.com/api/conversations.create
with a payload of :
{{{
"name": "major-incident-issue.key.toLowerCase()",
"is_private": false
}}}
Then create a variable of webResponse.body.channel.id and update a custom field (simple text) with the variable value.
At this point I have a new channel and a custom field with the channel ID for later use
However there are no new members so I’ve used another webrequest to get the assignee:
GET https://slack.com/api/users.lookupByEmail?email=\{{issue.assignee.emailAddress }}
This gets me the slack user Id, then add that to an assignee variable
I then then another webrequest
POST https://slack.com/api/conversations.invite
This a payload of:
{{{
"channel": "createdChannel",
"users": "assigneeResponse"
}}}
I then repeat the process for Team Lead in the event that there is no assignee.
Finally a rule that on Transition to Closed archives the channel:
POST https://slack.com/api/conversations.archive
and payload:
{{{
"channel": "issue.customfield_11069"
}}}
This archives the channel and the process is complete.
Regards
Matt
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.