node-vtiger

0.3.4 • Public • Published

Vtiger API Connection Library for Node.js Applications

Abstract

Node-vtiger, written in CoffeeScript, is a wrapper of Vtiger REST API in Node.js.
I use it for a robot (node) which is doing automated tasks.

Install

  npm install node-vtiger

Test

Show how to use the module.
The test is tranparent, it creates a lead, update, query, and delete it.
The test use step module for serial execution.

    npm install step
    test/main.js url username accesskey
    test/main.js http://example.com/vtigercrm admin vHgFdsrFrdRdfR

Usage

VTiger webservice API: https://wiki.vtiger.com/index.php/Webservices_tutorials

    vtws = require('node-vtiger')
    VT_URL = 'http://example.com/vtigercrm'
    VT_USER = 'admin'
    VT_ACCESSKEY = 'rFtfsdRfTgUggY' # accesskey is in your vtiger user preferences
    LEVEL = 'debug' # level of logging (error||warning||warn||info||debug||trace)
                    # The log in the module are at the level trace

    client = new vtws(VT_URL, VT_USER, VT_ACCESSKEY, 'debug')
    client.doLogin(callback)
    client.doQuery(query, callback)
    client.doDescribe(module, callback)
    client.doRetrieve(id, callback)
    client.doUpdate(valuemap, callback)
    client.doCreate(valuemap, callback)
    client.doSync(modifiedTime, module, callback)

Example with Step, the very useful control-flow node library:

    Step   = require 'step'
    client = new vtws(VT_URL, VT_USER, VT_ACCESSKEY, 'warning')

    Step(
        login = ->
            return client.doLogin this
    ,
        doQuery = (err, result) ->
            query = "SELECT * FROM Leads WHERE lead_no='LEA12345'"
            client.doQuery query, this
    ,
        doWhatYouWant = (err, result) ->
            console.log JSON.stringify result
    )

Acknowledgement

http://forge.vtiger.com/projects/vtwsclib
http://vtiger.com
http://nodejs.org
http://coffeescript.org
https://github.com/mikeal/request
https://github.com/drd0rk/logger
https://github.com/creationix/step

License

Public Domain & copyleft: http://www.nolicense.org
The software is provided "as is", without warranty of any kind.

Dependents (0)

Package Sidebar

Install

npm i node-vtiger

Weekly Downloads

1

Version

0.3.4

License

NoLicense

Last publish

Collaborators

  • clipi