TwilioSending messages in Node.js


Introduction

Twilio allows you to send and receive text messages with Node.js by using the twilio-node library to make calls. This guide assumes you've already setup an account with Twilio and have your account SID and the authentication token from the Twilio Console.

Parameters

ParameterDetails
toA valid phone number to receive the message
fromA Twilio number that is assigned to you
bodyThe body of the text message limited to 1600 characters
StatusCallbackA URL that Twilio posts to when a message status changes
maxPriceSet the maximum price of a message
validityPeriodThe number of seconds the message will remain in the Twilio queue
provideFeedbackBoolean value, when set to true
mediaUrlA URL containing a gif, png or jpeg content that will be sent with the message

Remarks

2.0 SDK Deprecation

Twilio has two versions of the twilio-node module, a 2.0 SDK and a 3.0 SDK. It is recommended to use the 3.0 SDK as the 2.0 SDK will be deprecated on the 8/31/2017.

Deprecation notice: New functionality will only be added to the new library (Node Helper Library 3.x). The old library (2.x) will be officially supported until 8/31/2017. After that day, Twilio will stop providing bug fixes and Support might ask you to upgrade before debugging issues. https://www.twilio.com/docs/libraries/node

Parameter Reference

You can refer to the Twilio REST documents for a more detailed description. Twilio also has a JSdocs which can be used as a reference.