Open biolauri opened 3 years ago
I think this could already be possible: https://github.com/jenkinsci/slack-plugin/blob/0b18810ac0b258fef9897621ced6d679125a5095/src/main/java/jenkins/plugins/slack/workflow/SlackResponse.java#L23
The SlackResponse
constructor can take an JSONObject
.
Also serialization looks good:
def response = slackSend(message: "Hello World!")
writeJSON(json: response, file: 'response.json')
archiveArtifacts('response.json') // or stash(includes: 'response.json', name: 'slack_response')
Gives you something like this:
{"threadId":"XXXXXXXXXXX:123123123.000000","channelId":"XXXXXXXXXXX","ts":"1234000000.000000"}
^^ not ideal, would be good to have a clean fix, maybe just a slackAddReactionStep unless @jetersen you have any ideas.
^^ not ideal, would be good to have a clean fix, maybe just a slackAddReactionStep unless @jetersen you have any ideas.
Of course :laughing: But I'm curious, where would you stash the slackResponseObject in between runs?
^^ not ideal, would be good to have a clean fix, maybe just a slackAddReactionStep unless @jetersen you have any ideas.
Of course 😆 But I'm curious, where would you stash the slackResponseObject in between runs?
the step would just require the threadId, you wouldn't need the whole object
Your checklist for this issue
Description
As stated in the Readme, I'll file an issue as I wish to have support for Emoji reactions across restarts and pipeline runs. The latter one is especially useful for me as I trigger a Slack message by
post { failure { } }
and want to mark it resolved by a green check mark emoji withpost { fixed { } }
. This is currently not possible as I can't store the message/thread ID for subsequent runs and have to use the object returned byslackSend
(which I can not store).My current workaround is to post an answer to the message/thread ID (which works solely by ID) but it'd be much easier to have an emoji reaction which is shown directly instead of an answer.