Home

Awesome

Node wrapper for Trello’s HTTP API.

Build Status

View Trello’s API documentation online.

Install

npm install node-trello

Getting your key and token

Example Code

Fetching card data

var Trello = require("node-trello");
var t = new Trello("<your key>", "<token>");

t.get("/1/members/me", function(err, data) {
  if (err) throw err;
  console.log(data);
});

// URL arguments are passed in as an object.
t.get("/1/members/me", { cards: "open" }, function(err, data) {
  if (err) throw err;
  console.log(data);
});

Uploading attachments to a card

var fs = require("fs");
var path = require("path");
var Trello = require("node-trello");
var t = new Trello("<your key>", "<token>");

var cardId = "<the card id>";
var pathToFile = path.resolve(__dirname, "/path/to/file.doc");

t.post("/1/cards/" + cardId + "/attachments", { attachment: fs.createReadStream(pathToFile) }, function (err, attachments) {
  if (err) throw err;
  console.log(attachments);
})

License

Released under MIT.