Article Image
Article Image

We’ve been using Ticket Poker for a while, in my current team, and we’re pretty happy with it.

Now, after each planning session, I take the stories we create in Pivotal Tracker, use a command-line script to generate a Ticket Poker ticket for each one, then paste its URL back into the Pivotal story.

Pivotal Track Story

That gets a bit repetitive, so I decided to write a script to do the work for me.

The process goes like this;

  • Find all of the development stories in the Pivotal Tracker project which haven’t been estimated yet
  • For each of those stories, check if it already has a Ticket Poker ticket
  • If it doesn’t;

In ruby, that could look something like this (assuming project is a class representing a Pivotal Tracker project, and ticket_poker is a class that exposes the Ticket Poker API);

    .unestimated_stories(label: 'development')
    .each do |story|
      story.add_estimation_task(ticket_poker) unless story.has_estimation_task?

The Pivotal Tracker API is really easy to use. Fetching the stories just requires GETting the stories endpoint of their latest, stable REST API.$PROJECT_ID/stories

To filter for unestimated development stories, we just need to add a filter string as a querystring parameter;

label:"development" estimate:-1

We URL-encode that, and append it to the API URL as;

?filter=[encoded filter string]

To check if the story already has a Ticket Poker estimation ticket, check all the tasks belonging to the story, and see if any of them have “Ticket Poker” in their descriptions.

class Story


  def has_estimation_task?



We can get all the tasks belonging to the story by GETting the story tasks endpoint;$PROJECT_ID/stories/$STORY_ID/tasks

To add a ticket estimation task to the story, we first use the Ticket Poker API to create the ticket, then POST to the Pivotal Tracker story tasks endpoint to create the new task.

class Story


  def add_estimation_task(ticket_poker)
    url = ticket_poker.create(self.url)
    @project.add_task(self, "Ticket Poker #{url}")



Here, ticket_poker is an object that exposes the Ticket Poker API, and @project is a reference to a class representing our Pivotal Tracker project.

You can see the full script on the Ticket Poker API page (click on ‘Pivotal Tracker’ in the list of API Integration Examples).

It should be quite straightforward to follow this same pattern to integrate with any other planning tools, provided they have a suitable API. If you create any more integrations, please let me know and I’ll add them to the documentation.

Blog Logo

David Salgado



Ronin on Rails

Give a man a fish and he’ll eat for a day.
Give a fish a man and he’ll eat for weeks.

Back to Overview