Skip to content

Instantly share code, notes, and snippets.

@reganstarr
Last active March 24, 2016 15:35
Show Gist options
  • Save reganstarr/7b57ffa71fc0df854dcb to your computer and use it in GitHub Desktop.
Save reganstarr/7b57ffa71fc0df854dcb to your computer and use it in GitHub Desktop.
/*To get the Trello checklist ID...
1. Open the card that contains the checklist
2. In the right sidebar of the card, click on "Share and more"
3. Click "Export JSON"
4. Select all of that JSON and Copy it to your clipboard
5. Go to http://www.jsoneditoronline.org/
6. Paste in the JSON in the box on the left
7. Click the right arrow [>] button
8. On the right side, scroll down until you see the "checklists" key, then click the arrows to expand that section
9. Use the "name" key find the correct checklist, then copy the "id" value of that checklist
*/
var trelloChecklistId = "";
// To get this, go to https://trello.com/app-key
var trelloApiKey = "";
// To get this, go to https://trello.com/app-key, find where it says, "you can manually generate a Token" and click on the "Token" link.
var trelloToken = "";
var checklistItemName = "name=" + encodeURIComponent("PUT THE TEXT OF THE CHECKLIST ITEM HERE");
var trelloApiUrl = 'https://api.trello.com/1/checklists/' + trelloChecklistId + '/checkItems?key=' + trelloApiKey + '&token=' + trelloToken;
fetch(trelloApiUrl, {method: 'POST', headers: {'Content-Type': 'application/x-www-form-urlencoded'}, body: checklistItemName})
.then(function(res) {
return res.json();
})
.then(function(body) {
var output = {body: body};
callback(null, output);
})
.catch(callback);
@dimitrieh
Copy link

Awesome! Could you explain in comments what you do from line 28 "fetch" part?

Also how would this do, when using Zapier Code Python?

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