-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
26 lines (19 loc) · 1.05 KB
/
test.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
//require the Twilio module and create a REST client
var twilio = require('twilio')
var client = twilio('AC4ae2ff325dad1c269fac9fa9935cb6d0', '63f51e3d32ed6d0ebbaa46c6359e9cbe');
//Send an SMS text message
client.sendSms({
to:'+15037296270', // Any number Twilio can deliver to
from: '+19712051258', // A number you bought from Twilio and can use for outbound communication
body: 'does this work?' // this of the SMS message
}, function(err, responseData) { //this function is executed when a response is received from Twilio
if (!err) { // "err" is an error received during the request, if any
// "responseData" is a JavaScript object containing data received from Twilio.
// A sample response from sending an SMS message is here (click "JSON" to see how the data appears in JavaScript):
// http://www.twilio.com/docs/api/rest/sending-sms#example-1
console.log(responseData.from); // outputs "+9712051258"
console.log(responseData.body); // outputs "does this work?"
} else {
console.log(err);
}
});