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.
npm install node-vtiger
Show how to use the module.
Create, update, query, and delete a lead.
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
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 LOGGING_LEVEL = 'debug' # level of logging (error||warning||info||debug||trace) # The log in the module are at the level trace client = new vtws( VT_URL, VT_USER, VT_ACCESSKEY, LOGGING_LEVEL ) client.doLogin(callback) client.doQuery(query, callback) client.doDescribe(module, callback) client.doRetrieve(id, callback) client.doDelete(id, callback) client.doUpdate(valueMap, callback) client.doCreate(valueMap, callback) client.doSync(modifiedTime, module, callback) client.doListtypes(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 )
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
Public Domain The software is provided "as is", without warranty of any kind.