can i send bulk sms with twilio ?

can i send bulk sms with twilio

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:

  1. It’s easy to get started and easy to use.
  2. It is widely used for sending bulk SMS.
  3. 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.

    1. npm install twilio
    2. After installing twilio you can check your twilio version in command prompt using the command.
      npm version twilio
    3. 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
    4. 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:

  1. 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.Dashboard of Twilio account
  2. Now go to console/notify/services and create your own notify service.
    Creating notify service
  3. 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.
    Saving service
  4. Copy your service_sid and click the save button.Filename: index.js

     

     

    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:

      1. The project structure will look like this:
        Project-Structure
      2. Make sure you have installed twilio using the following commands:
        npm install twilio
      3. Run index.js file using following command:
        node index.js

        Output of above command

      4. SMS send successfully to all numbers passed as parameter.
        Success

can I send a bulk SMS?

Ready to send your first bulk SMS message but not sure where to get started? Follow this step-by-step guide, and you’ll be sending high-volume text messages in no time.

1. Grow an audience

To start, you’ll need a contact list of recipients who have explicitly permitted you to message them. Start growing your SMS subscriber list by placing an opt-in form on your website or encouraging your prospects and customers to text a keyword (like “Join” or your company name) to a mobile number or short code. You can also send a double-opt-in message to confirm their subscription and ensure you only have interested users on your list.

2. Find an SMS service provider

Next, you’ll need to find an SMS service provider to help you send your bulk SMS message. With Twilio’s Programmable Messaging API, you can easily send SMS messages to every subscriber on your list. Not only can you send messages quickly and easily, but you can also get access to our robust library of documentation, sample code, and developer tools to help you build exactly what you want—fast. Plus, we’ll handle carrier and global regulations, so you can focus on reaching your customers and crafting the perfect bulk SMS message.

3. Get a short code

If you rely on long code (or a 10-digit phone number) to send more than a few hundred messages a day, your messages could end up in the spam folder. That can be a problem when trying to send bulk SMS messages.

Instead, short codes (or 5- or 6-digit numbers) are preapproved by carriers to have a high throughput and aren’t subject to carrier filtering, allowing you to send and receive bulk SMS/MMS messages more effectively. You can easily buy short codes from Twilio if your brand doesn’t have any or port existing numbers to the Twilio platform to get right to sending. Twilio also offers volume discounts for SMS and short code SMS messages if your monthly sends exceed 500,000 to 4.5 million messages so that your business reliably reaches your customers and at a reasonable price.

4. Craft your message

Once you’ve found a bulk SMS service provider and procured a short code, you’re almost ready to send. All that’s left is to choose which audience you’re sending to and draft your message. While this part sounds simple, don’t rush it. Every text blast you send should be meaningful and provide value to your subscribers, so they remain engaged and loyal to your brand. If you need some inspiration to get your bulk SMS message started, check out our text blast writing best practices in the next section.

5. Send it

Lastly, it’s time to send your message to the world. Using your email service provider of choice, you’ll need to set your recipient, sender, and content parameters. Your recipient list will be who you’re sending to, while your company’s long or short code will be your sender. As you may have guessed, your SMS content consists of the full text message or media content you want to include in your SMS/MMS message. Once you have all this information prepared, you’re ready to hit “Send,” sit back, and start tracking the message’s performance. To help, here’s a simple example for sending programmable SMS text or picture messages.

Prefer a step-by-step guide to sending your first message with Twilio? Check out our Programmable SMS quickstart guide in your preferred language: C#, Java, Node.js, PHP, Python, or Ruby.