Create Pivotal Tracker ticket from Help Scout conversation (bookmarklet)
// Install: | |
// Add your own Pivotal Tracker API token and project ID into the code below | |
// Optionally (if you've added Help Scout as an external integration) fill in the integration ID - you can see this in the URL | |
// when you edit the Help Scout integration in Pivotal. | |
// Then copy the code into a new bookmark | |
// To use: | |
// When you are viewing a Help Scout conversation select the text you want to appear as the Pivotal Tracker story (optional - if you | |
// don't do this the story will be "See https://secure.helpscout.net/conversation/1234/1"). Then click the bookmarklet and a new | |
// story will be created in Pivotal. The response from Pivotal will be shown in a small window in the top right of the Help Scout page. | |
javascript:(function() { | |
var API_TOKEN = "1234...."; | |
var PROJECT_ID = "1234..."; | |
var INTEGRATION_ID = ""; | |
var messageId = window.location.href.split("/conversation/")[1]; | |
var subject = $("#subject").text(); | |
var body = window.getSelection().toString() || "See: " + window.location.href; | |
$("[name='PT-INTEGRATION']").remove(); | |
var target = $("<iframe name='PT-INTEGRATION' height='50' width='200'>"); | |
target.css({ position: "absolute", top: "0", right: "0", backgroundColor: "#fff" }); | |
$("body").append(target); | |
var form = $("<form method='POST' target='PT-INTEGRATION'>").attr("action", "https://www.pivotaltracker.com/services/v3/projects/" + PROJECT_ID + "/stories"); | |
var token = $("<input name='token'>").val(API_TOKEN); | |
var name = $("<input name='story[name]' value=''>").val(subject); | |
var desc = $("<input name='story[description]'>").val(body); | |
form.append(token, name, desc); | |
if (INTEGRATION_ID) { | |
var eid = $("<input name='story[external_id]'>").val(messageId); | |
var iid = $("<input name='story[integration_id]'>").val(INTEGRATION_ID); | |
form.append(eid, iid); | |
} | |
form.submit(); | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment