-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
31 lines (31 loc) · 861 Bytes
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
(function() {
var Nexmo, auth, faultySMS, nexmo, simpleSMS;
Nexmo = require('./nexmo');
auth = {
key: 'INSERT-ACCOUNT-KEY',
secret: 'INSERT-ACCOUNT-SECRET'
};
nexmo = Nexmo.init(auth);
simpleSMS = {
from: 'Wilhelmbot',
to: 528100000000,
text: 'Greetings from the Matrix'
};
faultySMS = {
from: 'Anonymous'
};
nexmo.setMessage(simpleSMS);
nexmo.send(function(response) {
var balance, error, _ref, _ref2;
error = (_ref = response.messages[0]) != null ? _ref['error-text'] : void 0;
balance = (_ref2 = response.messages[0]) != null ? _ref2['remaining-balance'] : void 0;
if (error != null) {
console.log("Error: " + error);
} else {
console.log("Message delivered");
}
if (balance != null) {
return console.log("Remaining balance: " + balance);
}
});
}).call(this);