Programmable Messaging API

One Messaging API to reliably reach 7B+ devices

Send and receive transactional SMS, MMS, and WhatsApp messages at scale, for less. Customers received $1.4M in net margin benefits over 3 years after switching to Twilio*.

Illustration of an insurance company’s user interface as they process a customer quote and send confirmation update messages.
Illustration of an insurance company’s user interface as they process a customer quote and send confirmation update messages.

Build scalable messaging into your applications with just a few lines of code

Diagram of software for transactional messaging
Diagram of software for transactional messaging

Software for transactional messaging at any scale

Send alerts and notifications, promotions, and marketing messages on your customers’ favorite channels with one API. The Programmable Messaging API includes software for managing phone numbers, deliverability, compliance, replies, and more.

Use cases


Reliable, global business messaging for any use case

Appointment reminders

Reduce no-shows by reminding customers of upcoming appointments to either confirm or reschedule over their preferred channels.

Lifecycle marketing

Increase customer conversion and retention with marketing messages sent over their preferred channels.

Account notifications

Keep customers updated on time-sensitive information with relevant, personalized account notifications.

Delivery notifications

Update customers on their delivery progress and offer two-way, self-service notifications.

Emergency alerts

Quickly send warning alerts, public safety advisories, event cancellations, and more to message recipients’ preferred channels.

Verifications and one-time passcodes

Verify users’ phone number at sign up or login to prevent bots, ensure customer trust, and guarantee accurate deliverability.

“Implementing Twilio was an easy lift from our perspective. We were able to realize our vision for improved customer experience very quickly.”

Raj Anbalagan VP of Digital Technology and Innovation, Panera

“With Twilio and [Twilio] SendGrid, we’ve been able to provide a very high caliber, high quality product that our customers are rating very well on a regular basis through NPS and CSAT.”

Andrea Wan Head of SMS, Klaviyo

Channels


Send and receive transactional messages on the most popular channels

  • Twilio Messaging logo
    SMS

    Reach a global audience for one-way notifications, alerts, and promotions with SMS.

  • Twilio WhatsApp Business API logo
    WhatsApp

    Provide customer care and deliver notifications on the world’s most popular messaging app.

  • Twilio MMS Messaging logo
    MMS

    MMS Deliver rich marketing messages with multimedia capabilities using MMS.

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 MessagingX.

Send an SMS 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({body: 'Hi there', from: '+15017122661', 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(
                              body='Hi there',
                              from_='+15017122661',
                              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(
            body: "Hi there",
            from: new Twilio.Types.PhoneNumber("+15017122661"),
            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());
    }
}
<?php

// Update the path below to your autoload.php,
// see https://getcomposer.org/doc/01-basic-usage.md
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
                           ["body" => "Hi there", "from" => "+15017122661"]
                  );

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(
                             body: 'Hi there',
                             from: '+15017122661',
                             to: '+15558675310'
                           )

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

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

Capabilities


Powering next-generation transactional messaging

Optimized message deliverability at scale

  • Global senders

    Reach consumers in 180+ countries with localized senders, global guidelines, and regulatory compliance tools.

  • Real-time route optimization

    Automatic rerouting of global traffic every 75s to avoid outages and latency.

  • Messaging Insights

    Real-time analytics for monitoring and troubleshooting message delivery and engagement.

  • Message fallback

    Automatic fallback to SMS when a message is not deliverable via WhatsApp or short code.

Real-time analytics for monitoring message delivery and engagement
Real-time analytics for monitoring message delivery and engagement
A Forrester Consulting study about the ROI of Twilio Messaging.
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.

Pricing


Scalable messaging solutions with flexible pricing

Get started with the Programmable Messaging API for free. Only pay for the messages you send and receive, per phone number, and channel-specific fees. No commitments. Enjoy discounts for high-volume messaging.


*The Total Economic Impact™ of Twilio Messaging, a commissioned study conducted by Forrester Consulting, April 2023. Results are for a composite organization representative of interviewed customers.

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%