amocrm-api

AmoCRM api client

Usage no npm install needed!

<script type="module">
  import amocrmApi from 'https://cdn.skypack.dev/amocrm-api';
</script>

README

AmoCRM API client for nodejs

Simplified API client for AmoCRM.

Installation

npm install amocrm-api

Usage

var AmoCRM = require('amocrm-api');
var amo = new AmoCRM('https://your-domain.amocrm.ru');

amo.auth({
    USER_LOGIN: 'your-email@example.com',
    USER_HASH: 'd10532200r202eefwa9c7eab290237a6'
}).then(function createSomeTasks () {
    return amo.createTask({
        task_type: 1,
        text: 'Task text',
        responsible_user_id: 123,
        complete_till: new Date().getTime()
    });
});

Available methods

auth

auth method should be used to initiate user session. You need to auth before doing any other request.

amo.auth({
    USER_LOGIN: 'your-email@example.com',
    USER_HASH: 'd10532200r202eefwa9c7eab290237a6'
}).then(function doSomethingAuthorized () {
    //...
});

createTask

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()
});

createContact

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
});

License

MIT