1.0.16 • Published 7 years ago

ue-node-sdk v1.0.16

Weekly downloads
29
License
Apache-2.0
Repository
github
Last release
7 years ago

unificationengine-client NPM version Build Status Dependency Status

A UnificationEngine client SDK for NodeJS

Here's how simple it is to post a message on your wall and a Facebook page, in a single call:

connection.sendMessage({
    "receivers":[
        {"name":"me"},
        {"name":"Page", "id":"122"}
    ],
    "message":{"body": "Hello World!"}
});

Installation

$ npm install --save ue-node-sdk

Usage

var UEClient = require('ue-node-sdk');

var app = new UEClient("APP_KEY","APP_SECRET");

Creating User

app.createUser()
.then(function(user){
   //user is a User object
})
.catch(function(err){
   //Handle error
});

Listing Users

app.listUsers()
.then(function(users){
   //users is an array of User objects
})
.catch(function(err){
   //Handle error
});

Deleting User

app.deleteUser(user)
.then(function(){
	//user deleted succesfully
})
.catch(function(err){
   //Handle error
});

Adding a connection to a user

user.addConnection(connectionName, service, serviceAccessToken, optionalParams)
.then(function(connection){
	//connection is a Connection object
})
.catch(function(err){
   //Handle error
});
  • connectionName must be unique per connection.
  • serviceAccessToken has to be valid and working from the provider side
  • optionalParams an object with key:value pair

Listing User connections

user.listConnections()
.then(function(connections){
	//connections is an array of Connection objects
})
.catch(function(err){
   //Handle error
});

Removing a User Connection

user.removeConnection(connectionName)
.then(function(){
	//connection removed successfully
})
.catch(function(err){
   //Handle error
});

Testing a connection

user.testConnection(serviceUrl) //eg: facebook://accesstoken@facebook.com
.then(function(){
	//serviceUrl is valid and can be added as a conncetion
})
.catch(function(err){
   //Handle error
});

Sending a message using a connection

connection.sendMessage({
  "receivers":[
    {
    	"name":"me"
    },
    {
    	"name":"Page",
    	"id":"122"
    }
  ],
  "message":{
    "subject":"test",
    "body": "ABC",            
    "image":"http://imageUrl",
    "link":{
      "uri": "http://google.com",
      "description": "link desc",
      "title":"link title"
    }
  }
})
.then(function(uris){
	console.log(uris); //URIs of the sent messages
})
.catch(function(err){
	//handle error
});
1.0.16

7 years ago

1.0.15

7 years ago

1.0.14

7 years ago

1.0.13

8 years ago

1.0.12

8 years ago

1.0.11

8 years ago

1.0.10

8 years ago

1.0.9

8 years ago

1.0.8

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago