-
Notifications
You must be signed in to change notification settings - Fork 302
/
index.js
33 lines (23 loc) · 1.03 KB
/
index.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
require('total4');
const number = 'YOURPHONENUMBER';
LOAD(['config'], async function() {
// =============================================
// Method 1 : Await the response
// =============================================
var response = await API('TAPI', 'sms', { from: 'Total.js', to: number, body: 'Happy coding!' }).promise();
console.log(response);
// =============================================
// Method 2: with callback
// =============================================
API('TAPI', 'sms', { from: 'Total.js', to: number, body: 'Happy coding!' }, function(err, res, out) {
console.log(res);
});
// This assumes that you have set `totalapi` inf `/config` file
});
// =============================================
// Method 2: with apikey
// =============================================
const API_KEY = 'YOUR APIKEY';
TotalAPI(API_KEY, 'sms', { from: 'Total.js', to: number, body: 'Happy coding!' }, function(err, response) {
console.log(response);
});