Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
How to create Trello Cards from the Command Line (with a ~10 minute set-up)
  1. This is quick and dirty and not terribly maintainable. But it's very useful for creating quick cards from the terminal. Requires familiarity with Trello and a basic understanding of bash.
  2. Log-in to Trello.
  3. Go to: https://trello.com/1/appKey/generate
  4. Make note of your key. Replace any mention of YourTrelloKey with this hash.
  5. Create a token. Go to https://trello.com/1/authorize?key=YourTrelloKey&name=SimpleBASHScript&expiration=never&response_type=token&scope=read,write in your browser and follow directions.
  6. Make note of the token. Replace any mention of YourTrelloToken with this looong hash.
  7. Pick a reasonable number of the most popular boards you use. Grab the URLs of those boards. At the same time, think of short, one-word, easy-to-remember names for each board (e.g., work, homeprojects, wedding).
  8. Grab the board IDs of the boards you chose. It'll be the ~8 character hash-like string in the URL. E.g., for https://trello.com/b/aWsGTrsD/work the ID is aWsGTrsD
  9. One by one, plug those IDs into the following API call: https://trello.com/1/boards/insertBOARDIDhere/lists?key=YourTrelloKey (via browser or cURL)
  10. Look at the resulting json, and, for each board, decide on the list (e.g, bullpen, doing, To Be Done) where you would most likely put a quick placeholder card (the list won't be dynamic, only the board). Make note of the 'id' property for each chosen list (one per board).
  11. Make note of your new values that pair short board name with list id property. E.g. -- work => wjeh18ehdkqwjeh7y1987
  12. Take all this info and insert it into this bash script template: https://gist.github.com/CrookedNumber/8857003 [Name the file something like: 'trello']
  13. Make sure your new script is executable and in a sensible location, like /usr/local/bin
  14. Adding a ticket should now be as easy as: trello wedding "Taste cakes"
  15. Read much more about the Trello API at: https://trello.com/docs/

Hwulex commented Aug 25, 2016

Thanks for this excellent Gist, helped a lot with a small project. One thing to note is the API call in #9 is missing the token parameter, without which you get a permission denied error.

alpha1125 commented Aug 25, 2016 edited

#9, as Hwulex suggested (thanks btw)

https://trello.com/1/boards/<BOARDID>/lists?key=<KEY>&token=<TOKEN>
see: https://developers.trello.com/advanced-reference/list#get-1-lists-idlist

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