version: 3.0.4
This SDK requires a Node.js (at least version 4.x). It also requires the Node Package Manager aka npm to resolve the dependencies.
You can install shoutout-sdk via npm
shoutout-sdk is available on NPM as the
shoutout-sdk
package
npm install shoutout-sdk --save
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);
}
});