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.
Parameter | Details |
---|---|
to | A valid phone number to receive the message |
from | A Twilio number that is assigned to you |
body | The body of the text message limited to 1600 characters |
StatusCallback | A URL that Twilio posts to when a message status changes |
maxPrice | Set the maximum price of a message |
validityPeriod | The number of seconds the message will remain in the Twilio queue |
provideFeedback | Boolean value, when set to true |
mediaUrl | A URL containing a gif, png or jpeg content that will be sent with the message |
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
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.