Skip to content

Instantly share code, notes, and snippets.

@sergous
Last active November 30, 2023 06:49
Show Gist options
  • Save sergous/c429895e4a3da759c5674840727f7997 to your computer and use it in GitHub Desktop.
Save sergous/c429895e4a3da759c5674840727f7997 to your computer and use it in GitHub Desktop.
PivotalTracker Bookmarklet

Based on https://makandracards.com/makandra/465824-bookmarklet-to-generate-a-pivotal-tracker-story-from-zammad-ticket/read

This is a bookmarklet you can add to Chrome or Firefox which will allow you to create a story in Pivotal Tracker from a any URL. This might come in handy when creating stories.

But first you will have to set two variables in the script below:

pt_project_id: the ID of the Pivotal Tracker Project you want to add stories to. This can be found as part of the URL of the project (https://www.pivotaltracker.com/n/projects/<pt_project_id>)

pt_token: the Pivotal Tracker token used for authentication. Can be found in your PT profile

Just create a new Crome Bookmark with arbitrary title and paste the modified script to the URL-field. Don't worry about the newlines in the script.

javascript: (function() { var jq = document.createElement('script');  jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js";  document.getElementsByTagName('head')[0].appendChild(jq);  jQuery.noConflict(); var $ = window.jQuery; var pt_project_id = 'INSERT_PROJECT_ID';  var pt_token='INSERT_API_KEY';  var url = `https://www.pivotaltracker.com/services/v5/projects/${pt_project_id}/stories`; var title = prompt('Введите название истории в PivotalTracker', document.title); if (!title) return;  var data = {    name: title,    description: `siehe: ${window.location}`, labels: ['inbox']  };  var headers = { 'X-TrackerToken': pt_token };  $.post({ url: url, headers: headers, data: data }).done(function(res) {    var story_url = res.url;    window.open(story_url, '_blank');  }).fail(function(response) {    console.log(response);    alert( "error logged to console");  });})();
@sergous
Copy link
Author

sergous commented Nov 30, 2023

Add deskription

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment