Skip to content

Instantly share code, notes, and snippets.

@ajvargo
Created October 1, 2018 18:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajvargo/7d0c07502d249ccc017da883f1ff1571 to your computer and use it in GitHub Desktop.
Save ajvargo/7d0c07502d249ccc017da883f1ff1571 to your computer and use it in GitHub Desktop.
A simple way to pull a card trello cards info into org.
;; For key & token, go to https://trello.com/app-key The key should be
;; front and center. For the token, follow the 'Token' link in the
;; first paragraph and then 'Allow'
;; Just does the title and main contents. pulling in checklists is on my list.
;; inserting assumes you have the bullet point, but not the todo
;; ** <c>
(defvar trello-key "")
(defvar trello-token "")
(defun trello-get-ticket-json (card-id)
"Get json from Trello for CARD-ID"
(url-retrieve-synchronously (concat
"https://trello.com/c/"
card-id ".json"
"?key=" trello-key
"&token=" trello-token
"&fields=name,shortUrl,desc")))
(defun trello-card-json-string(card-id)
"Get json string from api result buffer"
(with-current-buffer (trello-get-ticket-json card-id)
(beginning-of-buffer)
(delete-region (point-min) (- (search-forward "{" nil t) 1))
(buffer-string)))
(defun trello-card-details(card-id)
(json-read-from-string (trello-card-json-string card-id)))
(defun org-insert-trello-todo (card-id)
(interactive "MCard id: ")
(let ((card-details (trello-card-details card-id)))
(insert "TODO "
(alist-get 'name card-details)
" | [["
(alist-get 'shortUrl card-details)
"][Trello]]\n\n"
(alist-get 'desc card-details))))
(defun ajv-org-refile-to-work-datetree ()
(interactive)
(org-refile-to-datetree "~/org/work-journal.org"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment