Back to Top

libraries > Twilio.js

new Twilio()

Send a SMS message and more with the Twilio Rest API.

Properties

Name Type Description
twilioKey string

The Key from your Twilio Project's Page.

twilioSecret string

The Secret from your Twilio Project's Page.

Examples

const Twilio = require('vendor/Twilio.js');
const twilio = new Twilio(twilioSid, twilioToken);
twilio.send({
  to: '+1123456789',
  from: '+1123456789',
  body: 'Hello :)',
});

Returns

Twilio

Twilio.send(data[, options])

Send an SMS message.

Parameters

Name Type Description
data object
data.to string

The phone number to send the SMS to, including country code and no spaces or dashes. Example (USA): +1123456789.

data.from string

The phone number that the SMS will be sent from. Must be registered in Twilio.

data.body string

The SMS message text.

options boolean Optional
options.debug boolean

Set to true to debug the Twilio API request.

Optional

Returns

boolean