Skip to content

Notifications TypeScript

BL edited this page Dec 9, 2017 · 2 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);

Notifications

Search Notification

    let response = await Trello.notification.search('NOTIFICATION_ID').catch(error => {
        if (error) {
            console.log('error ', error);
        }
    });
    console.log('response', response);

Search Field Notification

    let response = await Trello.notification.searchField('NOTIFICATION_ID', 'FIELD_NAME').catch(error => {
        if (error) {
            console.log('error ', error);
        }
    });
    console.log('response', response);

Update Notification

    let id = 'NOTIFICATION_ID'; // REQUIRED
    let data = {
        unread: false
    };
    let response = await Trello.notification.update(id, data).catch(error => {
        if (error) {
            console.log('error ', error);
        }
    });
    console.log('response', response);
Clone this wiki locally