A Node module to assist with connections to the Tide business banking API
$ npm install --save node-tide
Below is a quick guide to using the node-tide module, you can see full information in the documentation. There is also a quick example application available showing full integration with expressJs.
You can easily get the URL required to authenticate against the Tide OAuth2 API.
var nodeTide = require('node-tide');
// Create a new Tide application
var tide = new nodeTide.Tide();
// Generate the OAuth2 URL the user needs to authenticate
var authenticationUrl = nodeTide.auth.generateAuthUrl({
applicationName: "Node Tide Application",
redirectUrl: "https://mytideapp.com/tide/auth"
});
console.log(authenticationUrl);
import { Tide, AuthenticationConfig } from "node-tide";
// Create a new Tide application
let tide = new Tide();
// Generate the OAuth2 URL the user needs to authenticate
let authenticationUrl: string = tide.auth.generateAuthUrl({
applicationName: "Node Tide Application",
redirectUrl: "https://mytideapp.com/tide/auth"
} as AuthenticationConfig);
console.log(authenticationUrl);
Once you have authenticated you can then pull a list of companies for the user.
var nodeTide = require('node-tide');
var accessToken = "my4cc35570k3n"; // From authentication
// Create a new Tide application
var tide = new nodeTide.Tide(accessToken);
// Gets a list of companies
tide.companies.all()
.then(function(companies) {
for (var i = 0; i < companies.length; i++) {
console.log(companies[i].name);
}
})
import { Tide, Company } from "node-tide";
let accessToken: string = "my4cc35570k3n"; // From authentication
// Create a new Tide application
let tide = new Tide(accessToken);
// Gets a list of companies
this.companies.all()
.then((companies: Company[]) => {
companies.forEach((company: Company) => {
console.log(company.name);
})
})
Once you have a company ID you can then pull a list of accounts associated wtih a company.
var nodeTide = require('node-tide');
var accessToken = "my4cc35570k3n"; // From authentication
var companyId = 182736; // From the company list
// Create a new Tide application
var tide = new nodeTide.Tide(accessToken);
// Gets a list of accounts
tide.accounts.all(companyId)
.then(function(accounts) {
for (var i = 0; i < accounts.length; i++) {
console.log(accounts[i].name);
}
})
import { Tide, Account } from "node-tide";
let accessToken: string = "my4cc35570k3n"; // From authentication
let companyId: number = 182736; // From the company list
// Create a new Tide application
let tide = new Tide(accessToken);
// Gets a list of accounts
this.accounts.all(companyId)
.then((accounts: Account[]) => {
accounts.forEach((account: Account) => {
console.log(account.name);
})
})
Once you have an account ID you can then pull a list of transactions from an account.
var nodeTide = require('node-tide');
var accessToken = "my4cc35570k3n"; // From authentication
var accountId = 60192; // From the company list
// Create a new Tide application
var tide = new nodeTide.Tide(accessToken);
// Gets a list of accounts
tide.transactions.all(accountId)
.then(function(transactions) {
for (var i = 0; i < accounts.length; i++) {
console.log(transactions[i].amount);
}
})
import { Tide, Transaction } from "node-tide";
let accessToken: string = "my4cc35570k3n"; // From authentication
let accountId: number = 60192; // From the company list
// Create a new Tide application
let tide = new Tide(accessToken);
// Gets a list of accounts
this.transactions.all(accountId)
.then((transactions: Transaction[]) => {
transactions.forEach((transaction: Transaction) => {
console.log(transaction.amount);
})
})
It is also possible to filter transactions by reference using this.transactions.findReference(accountId, 'My Reference')
and also by date range using this.transactions.findDateRange(accountId, moment().subtract(2, 'days'))
MIT © Simon Skinner