Skip to content

Instantly share code, notes, and snippets.

@RobotRogue
Last active January 7, 2020 15:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RobotRogue/4306ad92c7db545169b716c35fbf37cf to your computer and use it in GitHub Desktop.
Save RobotRogue/4306ad92c7db545169b716c35fbf37cf to your computer and use it in GitHub Desktop.
// The below code is to be copied/pasted into a bookmarklet URL field (remove the comments or it won't work)
// When viewing a Jira ticket, post to a Slack channel that you have completed the ticket
// Requires you have a Slack Incoming webhook configured + the webhook URL
// That can be set up here: https://slack.com/apps/A0F7XDUAZ-incoming-webhooks
javascript: (function() {
const desc = document.getElementById("summary-val").innerText;
const ticketURL = document.URL;
const slackMsgStr =
":comet: *Finished testing:* :comet:\n- " + ticketURL + "\n- " + desc + "\n\n:white_check_mark: _Ready to Deploy!_";
const data = '{"text":"' + slackMsgStr + '"}';
if (data) {
const url =
"https://hooks.slack.com/services/XXXXXXXXX/XXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXX";
$.ajax({
url: url,
type: "POST",
crossDomain: true,
dataType: "application/json",
data: data,
success: function(response) {
console.log(response);
},
error: function(error) {
console.log(error);
}
});
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment