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

Can Scriptrunner check if Slack connection is valid?

Guy Incognito November 2, 2023

Hi all,

I use Scriptrunner SlackUtil class to send messages to Slack when an issue is transitioned to a certain status.

I wanted to reuse the same groovy script for all projects, so I stored the destination channel name as a project property, because each project has its own team & dedicated Slack channel.

The problem is that sometimes the project admin writes a wrong channel name, so I'd like to do an up-front validation of the connection before actually sending the message.

For now, as an alternative (and ugly) solution, I changed the script to be executed in the Validation of the transition, instead of the Post Function. I put the SlackUtil.message code within a try catch and return an invalid input exception if it fails.

What I'd like to have instead, is:

  • one script in Validation that check that the connection can be "established"
  • another script in Post Functions that actually sends the message

Is this possible?

 

Best regards

1 comment

Comment

Log in or Sign up to comment
Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 6, 2023

Hi @Guy Incognito

Unfortunately, there is no direct approach to do this.

Using ScriptRunner's SlackUtil, you can trigger only the method to message and upload.

For more information, you can view this Adaptavist Documentation.

Thank you and Kind regards,
Ram

Guy Incognito November 6, 2023

Thanks for confirming it @Ram Kumar Aravindakshan _Adaptavist_ 

 

Best regards

TAGS
AUG Leaders

Atlassian Community Events