Git Product home page Git Product logo

trelloapp's Introduction

TrelloApp

Google Apps Script library for using the Trello RESTful API.

At the moment it provides:

  • authorization/authentication
  • listing of organisations and boards
  • getting a list id
  • creating new boards
  • creating new lists
  • creating new cards

The full API to the library is described in App.gs

You can use the TrelloApp library in you code by using the ID: MOXamiHNCH44xpQh9H7FTudnfWGfgtIUb.

Example Usage

Here's an example of using it to list your boards:

  • Create a new GSheet - this gives you an UI to initiate the auth flow.

  • Copy this code into the GSheet's script.

  • Include the TrelloApp (MOXamiHNCH44xpQh9H7FTudnfWGfgtIUb) and Dialog (MWPmswuaTtvxxYA71VTxu7B8_L47d2MW6) library

  • Run the code to auth TrelloApp with Trello - the first time you run test_createCard() should open a new window with a link you must click to initiate the auth flow.

  • Run the code a second time to get the boards JSON - Looking at the Logs you should see the JSON for all your boards.

You can also see an example of the auth flow and an example of TrelloApp's use in code in the TrelloSync add-ons.


function test_getBoards() {

  try {

    var trelloApp = new TrelloApp.App()    
    var boards = trelloApp.getMyBoards()
    Logger.log(boards)
  
  } catch (error) {

    if (error.name === 'AuthorizationError') {
    
      // This is a special error thrown by TrelloApp to indicate
      // that user authorization is required    
      showAuthorisationDialog()
      
    } else {
    
      throw error
    }
  }
  
  return
  
  // Private Functions
  // -----------------
  
  function showAuthorisationDialog() {
      
    var authorizationUrl = trelloApp.getAuthorizationUri()
    
    Dialog.show(
      'Opening authorization window...', 
        'Follow the instructions in this window, close ' + 
        'it and then try the action again. ' + 
        '<br/><br/>Look out for a warning that ' + 
        'your browser has blocked the authorisation pop-up from Trello. ' + 
        '<script>window.open("' + authorizationUrl + '")</script>',
      160)
      
  } // showAuthorisationDialog()
    
} // test_createCard()

function reset() {
  new TrelloApp.App().reset()
}

It is based on the code by jacobdvb in this StackOverflow question.

trelloapp's People

Contributors

andrewroberts avatar goizueta avatar

Stargazers

Conor avatar ACTPO HOMOC avatar Rodrigo Dias avatar  avatar Obi Vyvyan Sims avatar  avatar Chris Tales avatar Robotghost avatar Nate Bowman avatar AesisGit avatar Cody Henderson avatar Viktor Blaskovics avatar JackN avatar  avatar Martín Da Fonte avatar  avatar Emil Kjær Eriksen avatar Ben Newsome avatar Adam Wagner avatar Hung Le avatar Sam Mbale avatar Hironori Nadamoto avatar Ketzelle avatar Vintaclectic avatar Luke Bechtel avatar Jean Jordaan avatar Ken avatar Pavel Sevcik avatar

Watchers

Rev. Brian Scott O'keefe avatar James Cloos avatar guan lei avatar JackN avatar  avatar  avatar  avatar

trelloapp's Issues

Error Creating Card

When I run the code:

function test_createCard() {

  // Look for 'RTM List 1' in the 'Rose Task Manager' board and 
  // add a new card to it
  var trelloApp = new TrelloApp.App()
  trelloApp.getMyBoards().some(function(board) {
    if (board.getName() === 'Inbound Feedback') {
      var foundList = trelloApp.getBoardLists(board.getId()).some(function(list) {
        if (list.getName() === 'Inbox') {
          trelloApp.createCard({
            name: 'test card 3', 
            idList: list.getId(),
          }) 
          return true
        }
      }) 
      return foundList
    }
  })
} // test_createCard()

I get the error:
``[object Object] (line 96, file "Authorizer", project "TrelloApp")`

Any ideas what I'm doing incorrectly?

Option to Never Expire

Hey Andrew great job on this! Very helpful.

Was wondering how hard it would be to make it so that the token for trello never expired.

I can do the legwork and write up said code if you can point me in the right direction!

Thanks,
-Luke

app.gs not found

Hey, on the readme you mention a app.gs, did you mean app.js?
Because the app.gs link is broken atm

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.