Bookmarklet to generate a Pivotal Tracker story from Zammad Ticket

This is a bookmarklet you can add to Chrome or Firefox which will allow you to create a story in Pivotal Tracker from a Zammad ticket. This might come in handy when creating stories for SWAT Teams.

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 or in ~/.config/geordi/global.yml if you have ever used geordi commit
javascript: (function() {
  var pt_project_id = 'XXX';
  var pt_token='XXX';

  var url = `https://www.pivotaltracker.com/services/v5/projects/${pt_project_id}/stories`;

  var data = {
    name: $('.ticket-title-update').first().text(),
    description: `siehe: ${window.location}`,
  };

  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");
  });
})();

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

Daniel Straßner Over 4 years ago