*UPDATE* I’ve added UserVoice to Trello Integration too, via an additional endpoint. Check it out on Github: github.com/scottefein/slack-to-trello
One of my favorite features of Trello has been the Slack Integration. Every change, addition card-it’s really way too much to digest via email. But having it show up in Slack keeps me on top of it, without it feeling intrusive. However I still had to log into Trello to add new cards to the icebox. This is kind of annoying because I’ll be on a call, we’ll come up with a great idea, and I take a note in my Google Doc that I should add this idea to the IceBox. Or we’ll be conversing over Slack, mention that we should do something, and then forget to add it to Trello. This is a nuisance!
So I decided today that I’d like to be able to do”/trello As a lovely person, I should be able to adopt a kitten” and have a new card added to Trello. I wasn’t so concerned with organization, assignments, or details-just getting it into the IceBox is a good first step.
Slack luckily makes third-party integrations pretty simple. You fill out a form with the slack command you want and what endpoint they should post to, and boom, integrated. Now, I’d prefer they post JSON, but it’s still pretty simple to work with.
The harder part was setting up the API endpoint for Trello Integration. I decided to use Go + Google App Engine because I wanted to host it for free and Go is good at things like this.
Step 1: Getting Your App Key
Head on over here: https://trello.com/app-key and grab that key.
Step 2: Authorize Yourself to Your App
You might be use to Twitter, who just gives you your own token from the user interface, so you can easily just start making request against your own user. Trello doesn’t do that, so you need to get your token for your own user. You’re going to need read/write access.
https://trello.com/1/authorize?key=[slack]&name=slack-to-trello&expiration=never&response_type=token&scope=read,write
It’s going to give you a screen, grab your token off that screen and save it somewhere. This is the token you’re going to use to make all requests to Trello for the Slack Integration.
Step 3: Figuring Out Where to Put the Cards
Trello makes creating an integration for your own use rather difficult… We need a list to post these cards to, in this case “IceBox”, but to make a request to add a card to the IceBox list, we need the ID of that list. That’s where the hard part starts… You can’t get it off the interface, so you need to make a series of API calls to actually find the ID.
First you’ll need to get the ID of your Board
https://api.trello.com/1/organizations/papercall/boards?key=[app-key]&token=[token]
Find the board from the JSON (recommend using a JSON prettifier in Chrome) and grab the ID of the board.
Now to get all the Lists on that board… We can’t just tack more stuff onto the URL, we actually end up in a new Resource Scope.
https://api.trello.com/1/boards/[board-id]/lists?key=[app-key]&token=[token]
From here, you can grab the ID of the list you want to make requests on. Save that for later.
Step 4: Create a Config File
You should never store tokens or app secrets in your git repository, so the seamingly preferred method of doing this on AppEngine (as opposed to environmental variables) is GCFG (code.google.com/p/gcfg).
Make a file called app.gcfg and put the following inside:
[trello] token = [token] key = [key] idList = [id-of-list]
And then inside your GoApp, we’ll access it like this:
Step 5: Your app.yaml
For any AppEngine app, you need a yaml file that describes the app. Looks something like this:
Step 6: The Code
This is pretty basic. All you’re doing is going in and posting to the Trello /1/cards endpoint with the text from /trello on slack.
https://github.com/scottefein/slack-to-trello
And that’s it! You’ll need the Google App Engine SDK to do a goapp deploy. Your URL endpoint is now [project-name].appspot.com/send_to_trello
Step 7: Configure Slack
Head over to Slack, go to https://papercall.slack.com/services/new/slash-commands. Type in /trello or whatever command you want and click “Add Slash Command Integration”. All you need to do is paste the URL endpoint where it says URL, configure the autocomplete if you want, and click Save.
And you’re done! Happy Slacking with Trello Folks.
Came all the way through step 5, currently trying to figure out go app deployment. Any pointers?
Also btw for step 3, instead of the first api card to find the trello board id name, you can navigate to your trello board in your browser like https://trello.com/b/%5Bboard-id%5D/%5Bboard-name%5D
I made some progress following https://console.developers.google.com/start/appengine but currently getting
slackbot [8:24 PM] Only you can see this message
invalid key
Also in your step 7, you should replace [papercall] with my team name
It sounds like you’re getting an error from Trello. Are you sure you gave it the right API Key? Try writing the key to the logs and comparing.
Hey, I created a guide using nodejs/javascript and Heroku instead
Check it out at http://blog.supportkit.io/slack-to-trello/