SMS

Deliver at scale with proven APIs for SMS

Send and receive text messages with just a few lines of code on Messaging, the trusted platform for cross-channel messaging.

Illustration of a banking app with messages to a customer to confirm recent purchases from their account.

Engage customers globally with reliable SMS messaging

Launching a trusted SMS solution is easy with Messaging. Twilio gives you developer-friendly APIs, scalability, and built-in software for compliance, routing, and advanced use cases. All to help you get to market faster, and with unmatched deliverability.

APIs


Scale from concept to global solution with flexible SMS APIs

Programmable messaging API connecting to customers through preferred channel

Programmable Messaging API

Send transactional MMS, SMS, and WhatsApp messages with a single API.

  • Reach 180+ countries reliably with localized senders, compliance tools, and global guidelines.

  • Manage compliance, deliverability, replies, and more with Twilio’s programmable software.

  • Monitor and troubleshoot message delivery and engagement with real-time analytics.

Conversations api connecting with multiparty  through various channels

Conversations API

Drive two-way engagement with cross-channel messaging for MMS and more using a single API.

  • Power commerce and support on SMS, MMS, chat, Facebook Messenger, and WhatsApp.

  • Manage participants, archive messages, and orchestrate workflows without additional code.

  • Get to market faster with quick-starts, sample apps, and SDKs.

Use cases


Start and scale customer relationships

Notifications

Send personalized alerts, reminders, and notifications for appointments, deliveries, and more with the Programmable Messaging API.

Verifications

Deliver one-time passwords for fast onboarding that reduces support costs and fraud at once.

Promotions

Distribute marketing messages and offers with the Programmable Messaging API to drive leads, sales, and loyalty.

Conversational care and commerce

Support the full customer journey with two-way, SMS for support, sales, and lead generation with the Conversations API.

A Forrester Consulting study about the ROI of Twilio Messaging.

Resources

The Total Economic Impact™ of Twilio Messaging

A commissioned study conducted by Forrester Consulting found Twilio Messaging provided a 3% increase in messages delivered, a 15% improvement among development teams, and a 30 to 40% opt-in rate for SMS marketing. 

Developer resources


Read the Docs

Explore quick-start guides, code snippets, SDKs, and more in our comprehensive resource library to kickstart your build for Facebook Messenger with Messaging.

Create a message

// Download the helper library from https://www.twilio.com/docs/node/install
// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = require('twilio')(accountSid, authToken);

client.messages
      .create({from: '+15017122661', body: 'Hi there', to: '+15558675310'})
      .then(message => console.log(message.sid));
# Download the helper library from https://www.twilio.com/docs/python/install
import os
from twilio.rest import Client


# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = os.environ['TWILIO_ACCOUNT_SID']
auth_token = os.environ['TWILIO_AUTH_TOKEN']
client = Client(account_sid, auth_token)

message = client.messages.create(
                              from_='+15017122661',
                              body='Hi there',
                              to='+15558675310'
                          )

print(message.sid)
// Install the C# / .NET helper library from twilio.com/docs/csharp/install

using System;
using Twilio;
using Twilio.Rest.Api.V2010.Account;


class Program
{
    static void Main(string[] args)
    {
        // Find your Account SID and Auth Token at twilio.com/console
        // and set the environment variables. See http://twil.io/secure
        string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
        string authToken = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");

        TwilioClient.Init(accountSid, authToken);

        var message = MessageResource.Create(
            from: new Twilio.Types.PhoneNumber("+15017122661"),
            body: "Hi there",
            to: new Twilio.Types.PhoneNumber("+15558675310")
        );

        Console.WriteLine(message.Sid);
    }
}
// Install the Java helper library from twilio.com/docs/java/install

import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.Message;
import com.twilio.type.PhoneNumber;

public class Example {
    // Find your Account SID and Auth Token at twilio.com/console
    // and set the environment variables. See http://twil.io/secure
    public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID");
    public static final String AUTH_TOKEN = System.getenv("TWILIO_AUTH_TOKEN");

    public static void main(String[] args) {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
        Message message = Message.creator(
                new com.twilio.type.PhoneNumber("+15558675310"),
                new com.twilio.type.PhoneNumber("+15017122661"),
                "Hi there")
            .create();

        System.out.println(message.getSid());
    }
}
require_once '/path/to/vendor/autoload.php';

use Twilio\Rest\Client;

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
$sid = getenv("TWILIO_ACCOUNT_SID");
$token = getenv("TWILIO_AUTH_TOKEN");
$twilio = new Client($sid, $token);

$message = $twilio->messages
                  ->create("+15558675310", // to
                           ["from" => "+15017122661", "body" => "Hi there"]
                  );

print($message->sid);
# Download the helper library from https://www.twilio.com/docs/ruby/install
require 'rubygems'
require 'twilio-ruby'

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
@client = Twilio::REST::Client.new(account_sid, auth_token)

message = @client.messages.create(
                             from: '+15017122661',
                             body: 'Hi there',
                             to: '+15558675310'
                           )

puts message.sid
# Install the twilio-cli from https://twil.io/cli

twilio api:core:messages:create \\
    --from +15017122661 \\
    --body "Hi there" \\
    --to +15558675310
curl -X POST "https://api.twilio.com/2010-04-01/Accounts/\$TWILIO_ACCOUNT_SID/Messages.json" \\
--data-urlencode "From=+15017122661" \\
--data-urlencode "Body=Hi there" \\
--data-urlencode "To=+15558675310" \\
-u \$TWILIO_ACCOUNT_SID:\$TWILIO_AUTH_TOKEN

Pricing


SMS made easy with Messaging

Send and receive text messages at scale with two developer-friendly APIs in one trusted platform, Messaging. Pay as you go and enjoy scaling discounts for high-volume and long-term use.

FAQs


SMS messaging FAQs

An SMS API is an application program interface that lets you send SMS text messages through an SMS gateway. 

SMS APIs 'bridge the gap' between telecommunications carrier networks and the internet so you can easily send and receive text messages from web applications.

SMS API full definition

Bulk SMS messaging is when you send SMS to large lists of recipients. To send bulk SMS, you need: 

1. An SMS service provider that can deliver your messages for you

For large-scale messaging use cases, it’s important to find an SMS service that can deliver messages reliable at any volume.

2. The right kind of phone number to send messages en masse

Application-to-person 10-digit long codes (A2P 10DLC) are verified numbers specifically made for businesses to send messages to customers. Short codes (5- or 6-digit numbers) that are approved by carriers are another option for high-throughput messages. Toll-free numbers (10-digit numbers like 833-569-67XX) are another option for high throughput.

3. The right message

Create messages that are meaningful and valuable to your recipients. If you fail to do this, recipients will ignore your messages or block your number. We recommend personalizing messages as much as possible. 

4. Opt-ins

To send to any recipients, you need to build a list of people who have expressly opted in to your messages. 


For more information, read SMS Bulk Messaging 101

SMS marketing is sending marketing messages directly to customers’ phones via SMS or text message. Sometimes you might hear SMS marketing referred to as text message marketing.  

SMS marketing covers any kind of promotion message, including discount offers, product announcements, personalized offers, abandoned cart announcements, and more. If you can get customers to opt in to SMS marketing messages, you can benefit from high open rates, high response rates, and fast delivery straight to customers.

SMS marketing for beginners

How to champion SMS marketing to your stakeholders

  1. First, find and sign up for an SMS API provider like Twilio
  2. Get an API key from your provider
  3. Purchase a phone number to send the messages from
  4. Decide what type of messages you want to send and how you want to send them
  5. Write code to connect to the API and send your messages
  6. Test your code to verify that your messages are going through

The amount of time it takes to integrate an SMS API depends on the complexity of your project and your experience with similar integrations.

Get started with our Programmable SMS quickstart

See the Programmable Messaging API overview

An SMS API makes it easy to send and receive SMS and MMS messages from a web application via an HTTP request. 

SMS APIs act as a connection between your app to the telecommunications carrier networks so you can send and receive text messages to recipients. They also convert the message to a format that can be sent over the carrier network/that the web application can understand when someone responds. 

How to use Twilio’s REST APIs

An SMS gateway is a service that makes it possible to send and receive SMS text messages through a REST API (like an SMS API). This is the “bridge” between the code you write in your web application and the global telecommunications network that delivers it to a recipient’s mobile phone. 

The SMS gateway is also what translates the message so it’s compatible with the carrier network.

They usually route SMS text messages to the telco networks via an SMPP interface that networks expose, either directly or via an aggregator that sells messages to multiple networks.

See more information on SMS gateways

Toll-free numbers

Toll-free numbers are 10-digit numbers that have a standard prefix like 800 or 833 (1-833-456-78XX). 

  • Can be used for calls and text messages
  • Support high-throughput for high-volume use cases like notifications, alerts, and promotions
  • Require a verification process for high-volume use cases 

See more about toll-free numbers

 

A2P 10DLC

Application-to-person 10-digit long codes are numbers with a local prefix, like +1 (415) 568-00XX. 

  • Specifically for business messaging traffic
  • Support both phone calls and text messages
  • A verification process is required to prove you are a trusted sender with approved campaigns

See more about 10DLC numbers 

 

Short codes

Short codes are 5-6 character codes (56748) that are recognizable, and can be used for text and picture messaging.

  • Throughput starts at 100 messages per second
  • Support high-volume use cases like alerts, notifications, verifications, and promotions
  • A verification process is required to prove you are a trusted sender with approved campaigns

See more about short codes

New

Introducing Twilio Messaging Engagement Suite

Get simpler development, quicker time to market, and higher deliverability rates.* See how Message Scheduling, Link Shortening with Click Tracking, advanced data, and real-time dashboards can benefit your business. 

 

* In an evaluation of more than 63M messages sent through Twilio with shortened hyperlinks, messages with shortened hyperlinks by 3rd party Link Shorteners were filtered at 1.96% or 28x the rate of Twilio which was filtered at a rate of 0.07%