acquireio
v1.0.0
Published
A node.js wrapper for the Acquire.io REST API
Downloads
11
Maintainers
Readme
Acquire REST API for Node.js
This repository contains the open source Node.js client for Acquire's REST API. Documentation can be found at: https://developer.acquire.io
Requirements
- Login for a Acquire account
- All requests to Acquire’s APIs require you to authenticate with an API_KEY
- Authentication is provided by API KEY
- These API keys can be generated from the settings
- You are able to manage API keys through the UI, by logging into the Acquire account and managing the API key there
- Here is an example of the API Key dashboard in the settings.
Settings > For Developers > API Key
- Acquire REST API for Node.js requires Node.js >= 0.10 or io.js
Installation
npm install acquireio
Usage
We have put some self-explanatory examples in the examples directory, but here is a quick breakdown on how it works.
Let's go ahead and initialize the library first. Don't forget to replace <API_KEY>
with your actual api key.
CommonJS require syntax:
var acquire = require('acquireio')('<YOUR_ACCOUNT_UID>', '<YOUR_API_KEY>');
Typescript with ES6 import (or .mjs with Node >= v13):
import initAI from 'acquireio';
const acquire = initAI('<YOUR_ACCOUNT_UID>', '<YOUR_API_KEY>');
Tip: Don't forget to enable the esModuleInterop
in tsconfig.json.
Nice! Now we can send API requests through node. Let's use getting your balance overview as an example:
// Get your account crm module setting
acquire.account.setting.read("crm", function (err, data) {
if (err) {
return console.log(err);
}
console.log(data);
});
// Result object:
{
bot: {
agent_smart_suggestion: "no",
allow_automated_emojis: "yes"
}
cobrowse: {
ask_permission: "yes"
default_drawing_mode: "no"
},
crm: {
hide_widget_in_mobiles: "no",
hide_widget_in_web: "no",
language_backend: "hi"
}
security: {
allow_user_saml_login: "no",
frontend_whitelist_domains: []
},
voip: {
max_voip_numbers: "1"
}
}
Or in case of an error:
{ [Error: api error]
"error": {
"code": "UNAUTHORIZED",
"message": "Unauthorized.",
"data": {
"loginURL": "https://accounts.acquire.io/login?endpoint=__endpoint&return=__return&account=raju"
}
}
}
Notes
Contact and Case API use different pagination semantics:
Contact API uses limit and offset params for list methods (where applicable)
// list conversations
//In this case 20 is limit and 0 is offset
acquire.crm.contact.list(20, 0, function (err, response) {
if (err) {
return console.log(err);
}
console.log(response);
});
Authentication
We sign our HTTP requests to allow you to verify that they actually came from us (authentication) and that they haven't been altered along the way (integrity).
Documentation
Complete documentation, instructions, and examples are available at: https://developer.acquire.io
License
The Acquire REST API for Node.js is licensed under The BSD 2-Clause License. Copyright (c) 2020, Acquire.io