Twilio Sending messages in Node.js Sending Your First Message

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

Installing The Node Module

You can install this module by running the command below in your project directory:

npm install twilio

Sending Your Message

const accountSID = ''; // Obtained from the Twilio Console
const authToken = '';   // Obtained from the Twilio Console

const client = require('twilio')(accountSID, authToken);

client.messages.create({
    to: '',  // Number you want to send to
    from: '', // From a valid Twilio number
    body: 'Hello, from Stack Overflow', // What appears in the text message
})
.then((message) => console.log(message.sid));


Got any Twilio Question?