Skip to content

agendor/rdstation-node-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NPM version Build Status Dependency Status

Client wrapper for Node.js integration with RDStation.

Install

$ npm install --save rdstation-node-client

Usage

First, initialize the resource

Currently, there are Services , Conversions and Leads modules.

var rdclient = require('rdstation-node-client');
var services = new rdclient.Services('your_private_token');
var conversions = new rdclient.Conversions('your_token');
var leads = new rdclient.Leads('your_private_token');

Services

Set a deal as won

var value = 120.00;
var email = 'email@example.com';

services.dealWon(value, email)
    .then(function (data) {
        console.log('Request done ', data);
    })
    .catch(function (err) {
        console.error(err);
    });

Set a deal as lost

var reason = 'Customer chose competitor product';
var leadId = 9999;

services.dealLost(reason, null, leadId)
    .then(function (data) {
        console.log('Request done ', data);
    })
    .catch(function (err) {
        console.error(err);
    });

Conversions

Create a new conversion

var identifier = 'action-name';

conversions.createConversion(identifier, {
    email: 'email@example.com',
    nome: 'Lead name',
}).then(function (data) {
    console.log('Request done ', data);
})
.catch(function (err) {
    console.error(err);
});

Leads

Change a lead stage to Lead

var email = 'email@example.com';
var opportunity = false; 
leads.changeStatusToLead(email, opportunity).then(function (data) {
    console.log('Request done ', data);
})
.catch(function (err) {
    console.error(err);
});	

Change a lead stage to Lead Qualified

var email = 'email@example.com';
var opportunity = false; 
leads.changeStatusToQualified(email, opportunity).then(function (data) {
    console.log('Request done ', data);
})
.catch(function (err) {
    console.error(err);
});	

Change a lead stage to Client

var email = 'email@example.com';
var opportunity = false; 
leads.changeStatusToClient(email, opportunity).then(function (data) {
    console.log('Request done ', data);
})
.catch(function (err) {
    console.error(err);
});	

Future development

Currently, this wrapper helps to:

  1. Make the request "Close a deal and mark a deal as lost" described in this article.
  2. Make the request to create a new conversion as described in this article.
  3. Make the request to change a lead stage described in this article.

There are few more possible actions with RD Station API as described here.

License

MIT © Agendor

About

Client wrapper for Node.js integration with RDStation.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •