shoutout-sdk
v3.0.4
Published
shoutout sdk for nodejs
Downloads
232
Readme
ShoutOUT SDK for Nodejs
version: 3.0.3
Requirements
This SDK requires a Node.js (at least version 4.x). It also requires the Node Package Manager aka npm to resolve the dependencies.
Installation
You can install shoutout-sdk via npm
Via NPM
shoutout-sdk is available on NPM as the
shoutout-sdk
package
Installation
npm install shoutout-sdk --save
Configure SDK
var ShoutoutClient = require('shoutout-sdk');
var apiKey = 'XXXXXXXXX.XXXXXXXXX.XXXXXXXXX';
var debug = true, verifySSL = false;
var client = new ShoutoutClient(apiKey, debug, verifySSL);
###Create or Update Contacts
####Example
var contacts = [{
user_id: '94777123456',
mobile_number: '94777123456',
email: '[email protected]',
name: 'Duke',
tags: ['lead']
}];
client.createContacts(contacts, (error, result) => {
if (error) {
console.error('error ', error);
} else {
console.log('result ', result);
}
});
###Create Activity
####Example
var activity = {
userId: '94777123456',
activityName: 'Sample Activity',
activityData: {
param1: 'val1',
param2: 'val2',
param3: 'val3'
}
};
client.createActivity(activity, (error, result) => {
if (error) {
console.error('error ', error);
} else {
console.log('result ', result);
}
});
###Send Message
####Example
var message = {
source: 'ShoutDEMO',
destinations: ['94777123456'],
content: {
sms: 'Sent via SMS Gateway'
},
transports: ['sms']
};
client.sendMessage(message, (error, result) => {
if (error) {
console.error('error ', error);
} else {
console.log('result ', result);
}
});