npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

agile_crm_with_promise

v1.2.9

Published

Rest call to Agile CRM

Downloads

1

Readme

Agile CRM Node JS API

Forked from

Agile CRM is a new breed CRM software with sales and marketing automation.

Table of contents

NPM Install

Requirements

API's details

Changes

1 Contact

2. Deal

3. Note

4. Task

5. Dynamic Filter

NPM Agile CRM Installation

  $ npm install agile_crm

Requirements

  1. Two files required agilecrm.js and test.js OR

  2. Setting Domain Name and API Key

In the above image, API Key is present at the "API & Analytics" tab at https://mycompany.agilecrm.com/#analytics-code.

    Domain Name : mycompany
    API Key     : myagilecrmapikey

So you have to update your

    var AgileCRMManager = require("./agilecrm.js");
    var obj = new AgileCRMManager("DOMAIN", "KEY", "EMAIL");
    var success = function (data) {
    console.log(data);
   	console.log("hello");
    };
    var error = function (data) {
    console.log(data);
      };

API's details

Changes

API supports the promise.

Use a new object contactAPIPromise.

  var AgileCRMManager = require("./agilecrm.js");
  var obj = new AgileCRMManager("DOMAIN", "KEY", "EMAIL");

  obj.contactAPIPromise.getContactByEmail('[email protected]').then(data => console.log(data).catch(error => error);

Errors for Add and Update now do not print a stack trace if you will get API error..


1. Contact

1.1 To get a contact by email

  var AgileCRMManager = require("./agilecrm.js");
  var obj = new AgileCRMManager("DOMAIN", "KEY", "EMAIL");
  var success = function (data) {
    console.log(data);
	};
  var error = function (data) {
    console.log(data);
	};

obj.contactAPI.getContactByEmail('[email protected]', success, error);

1.2 To get a contact by contact ID

  var AgileCRMManager = require("./agilecrm.js");
  var obj = new AgileCRMManager("DOMAIN", "KEY", "EMAIL");
  var success = function (data) {
    console.log(data);
	};
  var error = function (data) {
    console.log(data);
	};

obj.contactAPI.getContactById('5736096881180672', success, error);

1.3 To create a contact

Acceptable request Representation:

{
    "star_value": "4",
    "lead_score": "92",
    "tags": [
        "Lead",
        "Likely Buyer"
    ],
    "properties": [
        {
            "type": "SYSTEM",
            "name": "first_name",
            "value": "Los "
        },
        {
            "type": "SYSTEM",
            "name": "last_name",
            "value": "Bruikheilmer"
        },
        {
            "type": "SYSTEM",
            "name": "company",
            "value": "steady.inc"
        },
        {
            "type": "SYSTEM",
            "name": "title",
            "value": "VP Sales"
        },
        {
            "type": "SYSTEM",
            "name": "email",
            "subtype": "work",
            "value": "[email protected]  "
        },
        {
            "type": "SYSTEM",
            "name": "address",
            "value": "{\"address\":\"225 George Street\",\"city\":\"NSW\",\"state\":\"Sydney\",\"zip\":\"2000\",\"country\":\"Australia\"}"
        },
        {
            "type": "CUSTOM",
            "name": "My Custom Field",
            "value": "Custom value"
        }
    ]
}
  var AgileCRMManager = require("./agilecrm.js");
  var obj = new AgileCRMManager("DOMAIN", "KEY", "EMAIL");
  var success = function (data) {
    console.log(data);
	};
  var error = function (data) {
    console.log(data);
	};

  var contact = {
    "lead_score": "92",
    "tags": [
        "Lead",
        "Likely Buyer"
    ],
    "properties": [
        {
            "type": "SYSTEM",
            "name": "first_name",
            "value": "Los "
        },
        {
            "type": "SYSTEM",
            "name": "email",
            "subtype": "work",
            "value": "[email protected]"
        },
        {
            "type": "SYSTEM",
            "name": "address",
            "value": "{\"address\":\"225 George Street\",\"city\":\"NSW\",\"state\":\"Sydney\",\"zip\":\"2000\",\"country\":\"Australia\"}"
        }
    ]
  };

obj.contactAPI.add(contact, success, error);

1.4 To update a contact

  var AgileCRMManager = require("./agilecrm.js");
  var obj = new AgileCRMManager("DOMAIN", "KEY", "EMAIL");
  var success = function (data) {
    console.log(data);
	};
  var error = function (data) {
    console.log(data);
	};
  var update_contact = {
    "id": "5698936018829312",
    "properties": [
        {
            "type": "SYSTEM",
            "name": "first_name",
            "value": "Losalitest"
        },
        {
            "type": "SYSTEM",
            "name": "last_name",
            "value": "Lee"
        }
    ]
};
obj.contactAPI.update(update_contact, success, error);

1.5 To delete a contact

  var AgileCRMManager = require("./agilecrm.js");
  var obj = new AgileCRMManager("DOMAIN", "KEY", "EMAIL");
  var success = function (data) {
    console.log(data);
	};
  var error = function (data) {
    console.log(data);
	};

  obj.contactAPI.deleteContact('5633009881448448', success, error);

1.6 To update tags to a contact

  var AgileCRMManager = require("./agilecrm.js");
  var obj = new AgileCRMManager("DOMAIN", "KEY", "EMAIL");
  var success = function (data) {
    console.log(data);
	};
  var error = function (data) {
    console.log(data);
	};

  var update_tags = {
    "id": "5671839405703168",
    "tags": [
        "test1",
        "test2"
    ]
};


obj.contactAPI.updateTagsById(update_tags, success, error);

1.7 To delete tags to a contact

  var AgileCRMManager = require("./agilecrm.js");
  var obj = new AgileCRMManager("DOMAIN", "KEY", "EMAIL");
  var success = function (data) {
    console.log(data);
	};
  var error = function (data) {
    console.log(data);
	};

  var delete_tags = {
    "id": "5671839405703168",
    "tags": [
        "test1"
    ]
};


obj.contactAPI.deleteTagsById(delete_tags, success, error);

1.8 Change owner of a contact

  var AgileCRMManager = require("./agilecrm.js");
  var obj = new AgileCRMManager("DOMAIN", "KEY", "EMAIL");
  var success = function (data) {
    console.log(data);
	};
  var error = function (data) {
    console.log(data);
	};

 obj.contactAPI.changeContactOwner('[email protected]','5650547373768704',success, error);

###2. Deal

2.1 To get a deal by deal ID

  var AgileCRMManager = require("./agilecrm.js");
  var obj = new AgileCRMManager("DOMAIN", "KEY", "EMAIL");
  var success = function (data) {
    console.log(data);
	};
  var error = function (data) {
    console.log(data);
	};

obj.contactAPI.getDealById('5650703586426880', success, error);

2.2 To get deals by contact id

  var AgileCRMManager = require("./agilecrm.js");
  var obj = new AgileCRMManager("DOMAIN", "KEY", "EMAIL");
  var success = function (data) {
    console.log(data);
	};
  var error = function (data) {
    console.log(data);
	};

obj.contactAPI.getDealByContactId("5675392618725376", success, error);

2.3 To create a deal

Acceptable request Representation:

{
    "name": "Deal-Tomato",
    "expected_value": "500",
    "probability": "75",
    "close_date": 1455042600,
    "milestone": "Proposal",
    "contact_ids": [
        "5758948741218304"
    ],
    "custom_data": [
        {
            "name": "Group Size",
            "value": "10"
        }
    ]
}
  var AgileCRMManager = require("./agilecrm.js");
  var obj = new AgileCRMManager("DOMAIN", "KEY", "EMAIL");
  var success = function (data) {
    console.log(data);
	};
  var error = function (data) {
    console.log(data);
	};

  var deal = {
    "name": "Deal-Tomato",
    "expected_value": "500",
    "probability": "75",
    "close_date": 1455042600,
    "milestone": "Proposal",
    "contact_ids": [
        "5758948741218304"
    ],
    "custom_data": [
        {
            "name": "Group Size",
            "value": "10"
        }
    ]
};

obj.contactAPI.createDeal(deal, success, error);

2.4 To update a deal

  var AgileCRMManager = require("./agilecrm.js");
  var obj = new AgileCRMManager("DOMAIN", "KEY", "EMAIL");
  var success = function (data) {
    console.log(data);
	};
  var error = function (data) {
    console.log(data);
	};

  var update_deal = {
    "id": "5122047336251392",
    "expected_value": "1000",
    "contact_ids": [
        "5675392618725376",
        "5744178885558278"
    ],
    "custom_data": [
        {
            "name": "dealTester",
            "value": "hello hello2"
        }
    ]
};


obj.contactAPI.updateDeal(update_deal, success, error);

2.5 To delete a deal

  var AgileCRMManager = require("./agilecrm.js");
  var obj = new AgileCRMManager("DOMAIN", "KEY", "EMAIL");
  var success = function (data) {
    console.log(data);
	};
  var error = function (data) {
    console.log(data);
	};

  obj.contactAPI.deleteDealById('5650703586426880', success, error);

2.6 Get deal source

  var AgileCRMManager = require("./agilecrm.js");
  var obj = new AgileCRMManager("DOMAIN", "KEY", "EMAIL");
  var success = function (data) {
    console.log(data);
	};
  var error = function (data) {
    console.log(data);
	};

  obj.contactAPI.getDealSource(success, error);

###3. Note

3.1 Create a note to a contact

  var AgileCRMManager = require("./agilecrm.js");
  var obj = new AgileCRMManager("DOMAIN", "KEY", "EMAIL");
  var success = function (data) {
    console.log(data);
	};
  var error = function (data) {
    console.log(data);
	};

  var note = {
    "subject": " Note subject",
    "description": "Note description",
    "contact_ids": [
        "5688267051630592",
        "5721389839417344"
    ]
  };

  obj.contactAPI.createNote(note, success, error);

3.2 Update a note to a contact

  var AgileCRMManager = require("./agilecrm.js");
  var obj = new AgileCRMManager("DOMAIN", "KEY", "EMAIL");
  var success = function (data) {
    console.log(data);
	};
  var error = function (data) {
    console.log(data);
	};

  var update_note = {
    "id": "5754615706419200",
    "subject": "Test",
    "description": "Sample test updated1",
    "contact_ids": [
        "5630286201094144"
    ]
  };

  obj.contactAPI.updateNote(update_note, success, error);

3.3 Get note by contact ID

  var AgileCRMManager = require("./agilecrm.js");
  var obj = new AgileCRMManager("DOMAIN", "KEY", "EMAIL");
  var success = function (data) {
    console.log(data);
	};
  var error = function (data) {
    console.log(data);
	};

  obj.contactAPI.getNoteByContactId("5630286201094144", success, error);

3.4 Delete a note by contact ID and note ID

  • Delete a note from a contact
  • first parameter ID is contact and second one is note ID
  var AgileCRMManager = require("./agilecrm.js");
  var obj = new AgileCRMManager("DOMAIN", "KEY", "EMAIL");
  var success = function (data) {
    console.log(data);
	};
  var error = function (data) {
    console.log(data);
	};

  obj.contactAPI.deleteNoteById("5630286201094144","5754615706419200", success, error);

###4. Task

4.1 Create a task to a contact

  • Task type accepeted value : CALL, EMAIL, FOLLOW_UP, MEETING, MILESTONE, SEND, TWEET, OTHER
  • Task priority_type accepeted value : HIGH, NORMAL, LOW
  • Task due accepeted value : epoch time in miliseconds
  var AgileCRMManager = require("./agilecrm.js");
  var obj = new AgileCRMManager("DOMAIN", "KEY", "EMAIL");
  var success = function (data) {
    console.log(data);
	};
  var error = function (data) {
    console.log(data);
	};

  var task = {
    "subject": "test",
    "contacts": [
        "5630286201094144"
    ],
    "type": "EMAIL",
    "priority_type": "HIGH",
    "due": 11545245654
  };


  obj.contactAPI.createTask(task, success, error);

4.2 Create a task to a contact by email ID

  • Task type accepeted value : CALL, EMAIL, FOLLOW_UP, MEETING, MILESTONE, SEND, TWEET, OTHER
  • Task priority_type accepeted value : HIGH, NORMAL, LOW
  • Task due accepeted value : epoch time in miliseconds
  var AgileCRMManager = require("./agilecrm.js");
  var obj = new AgileCRMManager("DOMAIN", "KEY", "EMAIL");
  var success = function (data) {
    console.log(data);
	};

  var error = function (data) {
    console.log(data);
	};

  var task_email = {
    "subject": "test email task",
    "type": "EMAIL",
    "priority_type": "HIGH",
    "due": 11545245654
  };


  obj.contactAPI.createTaskByEmail("[email protected]",task_email, success, error);

4.3 Update a task to a contact

  • Task type accepeted value : CALL, EMAIL, FOLLOW_UP, MEETING, MILESTONE, SEND, TWEET, OTHER
  • Task priority_type accepeted value : HIGH, NORMAL, LOW
  • Task due accepeted value : epoch time in miliseconds
  var AgileCRMManager = require("./agilecrm.js");
  var obj = new AgileCRMManager("DOMAIN", "KEY", "EMAIL");
  var success = function (data) {
    console.log(data);
	};

  var error = function (data) {
    console.log(data);
	};

  var update_task = {
    "id": "5637588316585984",
    "subject": "test updated",
    "contacts": [
        "5630286201094144"
    ],
    "type": "EMAIL",
    "priority_type": "HIGH",
    "due": 11545245654
  };


  obj.contactAPI.updateTask(update_task, success, error);

4.4 Get a task by task ID

  var AgileCRMManager = require("./agilecrm.js");
  var obj = new AgileCRMManager("DOMAIN", "KEY", "EMAIL");
  var success = function (data) {
    console.log(data);
	};

  var error = function (data) {
    console.log(data);
	};

  obj.contactAPI.getTaskById('5766696644116480', success, error);

4.5 Delete a task by task ID

  var AgileCRMManager = require("./agilecrm.js");
  var obj = new AgileCRMManager("DOMAIN", "KEY", "EMAIL");
  var success = function (data) {
    console.log(data);
	};

  var error = function (data) {
    console.log(data);
	};

  obj.contactAPI.deleteTaskById('5766696644116480', success, error);

###5. Dynamic filter

5.1 Get contacts by property

  var AgileCRMManager = require("./agilecrm.js");
  var obj = new AgileCRMManager("DOMAIN", "KEY", "EMAIL");
  var success = function (data) {
    console.log(data);
	};
  var error = function (data) {
    console.log(data);
	};

  obj.contactAPI.getContactsByPropertyFilter('Country','United State',success, error);

5.2 Get contacts or companies by tag

  var AgileCRMManager = require("./agilecrm.js");
  var obj = new AgileCRMManager("DOMAIN", "KEY", "EMAIL");
  var success = function (data) {
    console.log(data);
	};
  var error = function (data) {
    console.log(data);
	};

  obj.contactAPI.getContactsByTagFilter('tester tag',success, error);

5.3 Get companies by property

  var AgileCRMManager = require("./agilecrm.js");
  var obj = new AgileCRMManager("DOMAIN", "KEY", "EMAIL");
  var success = function (data) {
    console.log(data);
	};
  var error = function (data) {
    console.log(data);
	};

  obj.contactAPI.getCompaniesByPropertyFilter('Custom Field Name','xyz120202',success, error);