Send a message using the Twilio API
var Twilio = require('machinepack-twilio');
// Send a message using the Twilio API
Twilio.sendMessage({
accountSid: 'DZe5eafd3c69b1e74example5852c04a9102',
authToken: 'Dafd4example5852c3c69bZe5e1e704a9102',
to: '+16155556789',
body: 'Example message',
mediaUrl: 'http://imgur.com/somePic.jpg',
from: '+16155551234',
}).exec({
// An unexpected error occurred.
error: function (err) {
},
// No sender ("From") phone numbers are available to your Twilio account.
noPhoneNumbersAvailable: function () {
},
// Either a "body" or "mediaUrl" (or both) must be specified
noBodyOrMediaSpecified: function () {
},
// OK.
success: function () {
},
});
The "account sid" associated with your Twilio account.
'DZe5eafd3c69b1e74example5852c04a9102'
The "auth token" associated with your Twilio account.
'Dafd4example5852c3c69bZe5e1e704a9102'
This is the 'To' phone number the message is sending to.
'+16155556789'
This is the body of the message being sent
'Example message'
This is the URL of an image to send
'http://imgur.com/somePic.jpg'
This is the 'From' phone number you'd like to use to send the SMS.
'+16155551234'
An unexpected error occurred.
N/A
No sender ("From") phone numbers are available to your Twilio account.
Either a "body" or "mediaUrl" (or both) must be specified
OK.
N/A