Simplified API client for AmoCRM.
npm install amocrm-api
var AmoCRM = require('amocrm-api');
var amo = new AmoCRM('https://your-domain.amocrm.ru');
amo.auth({
USER_LOGIN: '[email protected]',
USER_HASH: 'd10532200r202eefwa9c7eab290237a6'
}).then(function createSomeTasks () {
return amo.createTask({
task_type: 1,
text: 'Task text',
responsible_user_id: 123,
complete_till: new Date().getTime()
});
});
auth
method should be used to initiate user session. You need to auth before doing any other request.
amo.auth({
USER_LOGIN: '[email protected]',
USER_HASH: 'd10532200r202eefwa9c7eab290237a6'
}).then(function doSomethingAuthorized () {
//...
});
Create task and assign it to responsible user. For extended usage see official docs.
amo.createTask({
task_type: 1,
text: 'Task text',
responsible_user_id: 123,
complete_till: new Date().getTime()
});
Create contact. For extended usage see official docs
amo.createContact({
name: 'Вася Пупкин',
responsible_user_id: 540759
}).then(function afterContactCreated (res) {
console.log(res.id); // created contact id
});
MIT