Skip to content

Actions TypeScript

BL edited this page Jun 8, 2018 · 3 revisions

Usage

export TRELLO_API_KEY=KEY
export TRELLO_OAUTH_TOKEN=TOKEN

Configuration

Set your Trello Api Key and Trello Auth Token.

import * as TrelloNodeAPI from 'trello-node-api';
const Trello = new TrelloNodeAPI();
Trello.setApiKey(apiKey);
Trello.setOauthToken(oauthToken);

Actions

Search Action

    let response;
    try {
        response = await Trello.action.search('ACTION_ID');
    } catch (error) {
        if (error) {
            console.log('error ', error);
        }
    }
    console.log('response', response);

Search Field Action

    let response;
    try {
        response = await Trello.action.searchField('ACTION_ID', 'FIELD_NAME');
    } catch (error) {
        if (error) {
            console.log('error ', error);
        }
    }
    console.log('response', response);

Update Action

    let id = 'ACTION_ID'; // REQUIRED
    let data = {
       text: 'text' // REQUIRED
    };
    let response;
    try {
       response = await Trello.action.update(id, data);
    } catch (error) {
       if (error) {
           console.log('error ', error);
       }
    }
    console.log('response', response);

Delete Action

    let response;
    try {
     response = await Trello.action.del('ACTION_ID');
    } catch (error) {
     if (error) {
         console.log('error ', error);
       }
    }
    console.log('response', response);