@leafwell/aircall-client
v0.0.8
Published
Aircall API client
Downloads
6
Readme
Aircall Client
A simple READ ONLY Aircall client for node.
Installation
Using npm:
$ npm install @leafwell/aircall-client
Using yarn:
$ yarn add @leafwell/aircall-client
Example
import { Aircall } from '@leafwell/aircall-client';
(async function test() {
try {
const aircall = new Aircall({
apiID: 'XXX',
apiToken: 'YYY',
});
const calls = await aircall.calls.list();
console.log(calls.data);
console.log(calls.meta);
} catch (error) {
if (error.response) {
// The request was made and the server responded with a status code
// that falls out of the range of 2xx
console.log(error.response.data);
// console.log(error.response.status);
console.log(error.response.headers);
} else if (error.request) {
// The request was made but no response was received
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of
// http.ClientRequest in node.js
console.log(error.request);
} else {
// Something happened in setting up the request that triggered an Error
console.log('Error', error.message);
}
console.log(error.config);
}
})();
Usage
Calls
You can list calls with:
aircall.calls.list(options?);
You can get a call with:
aircall.calls.get(id);
Contacts
You can list contacts with:
aircall.contacts.list(options?);
You can get a contact with:
aircall.contacts.get(id);
Teams
You can list teams with:
aircall.teams.list(options?);
You can get a team with:
aircall.teams.get(id);
Users
You can list users with:
aircall.users.list(options?);
You can get a user with:
aircall.users.get(id);