Programmable Messaging API

One API for global, trusted messaging

Integrate a multichannel API to send and receive transactional SMS, MMS, and WhatsApp messages.

Twilio Programmable Messaging API is your solution for global messaging
Chat bubble with user symbol

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

Diagram showing how Twilio's Programmable Messaging API works

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


Chat bubble with globe

Reliable, global business messaging for any use case

Send appointment reminders and reduce no-shows with Twilio's Programmable Messaging API

Appointment reminders

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

Use Twilio's Programmable Messaging API to supercharge your lifecycle marketing

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.

Send delivery status updates with the Twilio Programmable Messaging API

Delivery notifications

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

Deliver emergency alerts with Twilio's Programmable Messaging API

Emergency alerts

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

Twilio's Programmable Messaging API helps prevent fraud with OTP

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


Twilio Channels logo

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


A pair of chat bubbles

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.

The Twilio Programmable Messaging API offers optimized message deliverability at-scale

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.