Sending bulk SMS in Node.js using Twilio Last Updated : 27 Mar, 2020 Comments Improve Suggest changes Like Article Like Report SMS is a common method of sending short messages between cell phones, but these SMS can be sent to multiple users at a time using Twilio notify service. Sending bulk SMS to users at a time is possible using Twilio. Introduction: It's easy to get started and easy to use. It is widely used for sending bulk SMS. User can send SMS to desired mobile numbers fastly and efficiently. Installation of Twilio module: You can visit the link to Install twilio module. You can install this package by using the following command. npm install twilio After installing twilio you can check your twilio version in command prompt using the command. npm version twilio After that, you can create a folder and add a file. For example index.js. To run this file you need to run the following command. node index.js Requiring module: You need to include twilio module in your file by using these lines. const client = require('twilio')(YOUR_ACCOUNT_SID, YOUR_AUTH_TOKEN); Steps to get your YOUR_ACCOUNT_SID, YOUR_AUTH_TOKEN and YOUR_SERVICE_SID: Go to Twilio official website and create your account. After login, go to your dashboard and you can get your auth_token and account_sid. Now go to console/notify/services and create your own notify service. Now select a message service sid, if is it not showing then you have to create a message service sid and add a phone number to it and then you can see that message service sid in the drop-down as shown below. Copy your service_sid and click the save button. Filename: index.js javascript ACCOUNT_SID = 'Your_Account_Sid' AUTH_TOKEN = 'Your_Auth_Token' SERVICE_SID = 'Your_Service_Sid' const client = require('twilio')(ACCOUNT_SID, AUTH_TOKEN); // User-defined function to send bulk SMS to desired // numbers bypassing numbers list as parameter function sendBulkMessages(messageBody, numberList) { var numbers = []; for(i = 0; i < numberList.length; i++) { numbers.push(JSON.stringify({ binding_type: 'sms', address: numberList[i]})) } const notificationOpts = { toBinding: numbers, body: messageBody, }; client.notify .services(SERVICE_SID) .notifications.create(notificationOpts) .then(notification => console.log(notification.sid)) .catch(error => console.log(error)); } // Sending our custom message to all numbers // mentioned in array. sendBulkMessages('Greeting from geeksforgeeks', ['number1', 'number2']) // Example +919999999999 Steps to run the program: The project structure will look like this: Make sure you have installed twilio using the following commands: npm install twilio Run index.js file using following command: node index.js SMS send successfully to all numbers passed as parameter. Comment More infoAdvertise with us Next Article Sending bulk SMS in Node.js using Twilio G gouravhammad Follow Improve Article Tags : Technical Scripter JavaScript Web Technologies Node.js Node.js-Misc +1 More Similar Reads Sending SMS using NEXMO API in Node.js Introduction: SMS is a common method of sending short messages between cell phones, but these SMS can be sent using API in Node.js. Now there are lots of API in the market for sending SMS like Twilio, Exotel, etc to the user but the popular among them is Nexmo. Features of NEXMO: Integrating this mo 2 min read Sending bulk emails in Node.js using SendGrid API What is SendGrid API? SendGrid is a platform for sending transactional and marketing emails to the customers. It provides scalability, reliability, and deliverability which is an important issue for an organization.Benefits of using SendGrid API: If you are using Nodemailer with Gmail then you can s 2 min read Send Message to WhatsApp using Twilio in Node.js We all use WhatsApp in our daily life to send text messages to one another. We can send WhatsApp messages using the Twilio API in NodeJS using the following approach. Features of Twilio: Widely used module for sending text messages.Supports various languages.Can be also used to send programmable vo 3 min read How to Send Email using NodeJS? Sending emails programmatically is a common requirement in many applications, especially for user notifications, order confirmations, password resets, and newsletters. In this article, we will learn how to build a simple email-sending system using NodeJS. We will use Nodemailer, a popular module for 5 min read How to Send Email using Mailgun API in Node.js ? Sending an email is an essential part of any project and it can be achieved by using Mailgun API. It is very popular for sending emails. Features of Mailgun: . It is easy to get started and easy to use.It is a widely used and popular module for sending emails.Mails can also be scheduled. Installati 2 min read Like