A UnificationEngine client SDK for NodeJS
connection.sendMessage({
"receivers":[
{"name":"me"},
{"name":"Page", "id":"122"}
],
"message":{"body": "Hello World!"}
});
$ npm install --save ue-node-sdk
var UEClient = require('ue-node-sdk');
var app = new UEClient("APP_KEY","APP_SECRET");
app.createUser()
.then(function(user){
//user is a User object
})
.catch(function(err){
//Handle error
});
app.listUsers()
.then(function(users){
//users is an array of User objects
})
.catch(function(err){
//Handle error
});
app.deleteUser(user)
.then(function(){
//user deleted succesfully
})
.catch(function(err){
//Handle error
});
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 sideoptionalParams
an object with key:value pair
user.listConnections()
.then(function(connections){
//connections is an array of Connection objects
})
.catch(function(err){
//Handle error
});
user.removeConnection(connectionName)
.then(function(){
//connection removed successfully
})
.catch(function(err){
//Handle error
});
user.testConnection(serviceUrl) //eg: facebook://[email protected]
.then(function(){
//serviceUrl is valid and can be added as a conncetion
})
.catch(function(err){
//Handle error
});
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
});