2.0.4 • Published 5 years ago
onfleet v2.0.4
Onfleet node.js bindings DEPRECATED
The onfleet team finally made its own node.JS wrapper, use it instead.
Installation
npm install onfleet
API Overview
Every resource is accessed via your onfleet
instance:
var onfleet = require('onfleet')('YOUR_ONFLEET_API_KEY');
Every resource method accepts an optional callback as the last argument:
onfleet.tasks.create(
{ ... },
function(error, task) {
error; // null if no error occurred
task; // the created task object
}
);
Additionally, every resource method returns a promise, so you don't have to use the regular callback. E.g.
// Create a new task :
onfleet.tasks.create(
{ ... }
).then(function(task) {
// New task created
}).catch(function(err) {
// Deal with an error
});
Available resources & methods
Where you see params
it is a plain JavaScript object, e.g. { email: 'foo@example.com' }
- organizations
- administrators
- workers
- teams
list()
retrieve(teamId)
create([params])
update(teamId, [params])
upsertTask(teamId)
NB: You can only append tasks using an offset and not overwrite a team's tasklist (as of 2019-03-11), contrary to what the documentation indicates.delete(teamId)
- destinations
- recipients
- tasks
- webhooks