Skip to main content
Programmable Messaging API

One API for global, trusted messaging

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

Illustration of person using programmable api to connect through preferred channels

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

Diagram of programmable messaging api

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.

messaging-customer-quote-portrait.png

“We needed a technology partner that could integrate seamlessly across our stack and help us iterate quickly using analytical insights. Twilio had the features we needed, and performed well in financial modeling; but most importantly, our engineers were excited to use it.”

Alan Bustelo-Killam, Product Manager
messaging-customer-quote-portrait.png

“Twilio is a cost efficient and simple way to test the feasibility of new features. We ended up choosing Twilio’s API for WhatsApp because it meant we could focus on the product, not on the complex requirements of WhatsApp’s infrastructure.”

Anne Byrne, Backend Engineer, Customer Experience Team

Channels

Send and receive transactional messages
on the most popular channels

  • SMS

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

  • MMS

    Deliver rich marketing messages with multimedia capabilities using MMS.

  • WhatsApp

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

Developer resources

Send an SMS message
  • Node.js
  • Python
  • C#
  • Java
  • Go
  • PHP
  • Ruby
  • twilio-cli
  • curl
//Downloadthehelperlibraryfromhttps://www.twilio.com/docs/node/install//FindyourAccountSIDandAuthTokenattwilio.com/console//andsettheenvironmentvariables.Seehttp://twil.io/secureconstaccountSid=process.env.TWILIO_ACCOUNT_SID;constauthToken=process.env.TWILIO_AUTH_TOKEN;constclient=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/installimportosfromtwilio.restimportClient# Find your Account SID and Auth Token at twilio.com/console# and set the environment variables. See http://twil.io/secureaccount_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/installusingSystem;usingTwilio;usingTwilio.Rest.Api.V2010.Account;classProgram{staticvoidMain(string[]args){// Find your Account SID and Auth Token at twilio.com/console// and set the environment variables. See http://twil.io/securestringaccountSid=Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");stringauthToken=Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");TwilioClient.Init(accountSid,authToken);varmessage=MessageResource.Create(body:"Hi there",from:newTwilio.Types.PhoneNumber("+15017122661"),to:newTwilio.Types.PhoneNumber("+15558675310"));Console.WriteLine(message.Sid);}}
// Install the Java helper library from twilio.com/docs/java/installimportcom.twilio.Twilio;importcom.twilio.rest.api.v2010.account.Message;importcom.twilio.type.PhoneNumber;publicclassExample{// Find your Account SID and Auth Token at twilio.com/console// and set the environment variables. See http://twil.io/securepublicstaticfinalStringACCOUNT_SID=System.getenv("TWILIO_ACCOUNT_SID");publicstaticfinalStringAUTH_TOKEN=System.getenv("TWILIO_AUTH_TOKEN");publicstaticvoidmain(String[]args){Twilio.init(ACCOUNT_SID,AUTH_TOKEN);Messagemessage=Message.creator(newcom.twilio.type.PhoneNumber("+15558675310"),newcom.twilio.type.PhoneNumber("+15017122661"),"Hi there").create();System.out.println(message.getSid());}}
// Download the helper library from https://www.twilio.com/docs/go/installpackagemainimport("fmt""github.com/twilio/twilio-go"api"github.com/twilio/twilio-go/rest/api/v2010")funcmain(){// Find your Account SID and Auth Token at twilio.com/console// and set the environment variables. See http://twil.io/secureclient:=twilio.NewRestClient()params:=&api.CreateMessageParams{}params.SetBody("Hi there")params.SetFrom("+15017122661")params.SetTo("+15558675310")resp,err:=client.Api.CreateMessage(params)iferr!=nil{fmt.Println(err.Error())}else{ifresp.Sid!=nil{fmt.Println(*resp.Sid)}else{fmt.Println(resp.Sid)}}}
<?php// Update the path below to your autoload.php,// see https://getcomposer.org/doc/01-basic-usage.mdrequire_once'/path/to/vendor/autoload.php';useTwilio\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=newClient($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/installrequire'rubygems'require'twilio-ruby'# Find your Account SID and Auth Token at twilio.com/console# and set the environment variables. See http://twil.io/secureaccount_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')putsmessage.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

Read the Docs

Explore quick-start guides, code snippets, and a comprehensive resource library to kickstart your build with the Programmable Messaging API.

CAPABILITIES

Powering next-generation
transactional messaging

Illustration real-time analytics for monitoring message delivery and engagement

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.
Illustration of verified trust hub experience reaching customer through vetted catalog of apis

Global business messaging at any scale

  • Super Network: 1,500+ tier-1 carrier connections, the widest footprint of data signals, and telco and ML experts provide unrivaled reliability.
  • High-volume global senders: A global, vetted catalog of high-throughput toll-free numbers, short codes, alphanumeric sender IDs, and 10-digit long codes.
  • Trust Hub and APIs: Onboard to verified communications from a centralized Console experience or integrate our APIs into third-party products.
  • SMS validity period: Dictate the length of time to attempt queued message delivery before failing to ensure urgent messages are delivered when relevant.
Illustration of scheduled message redaction to protect customer data

Take control of your business messaging

  • Advanced opt-out: Customize opt-ins and opt-outs for local regulations and languages in the Console.
  • Message redaction: Redact the last 4 digits of phone numbers and message bodies to protect sensitive data.
  • Message scheduling: Schedule SMS, MMS, or WhatsApp messages to be sent at a future date and time with a single API call. Included for free with Messaging Services.
  • Inbound message routing: Handle replies using inbound message webhooks, Twilio Studio, or Twilio Conversations for channel and participant flexibility.
Illustration of twilio segment integration to deliver a personalized customer experience

Create an engaging, omnichannel experience

  • Twilio Segment integration: Deliver personalized messages at scale using real-time, first-party data by integrating messaging into Twilio Segment.
  • Content API: Translate rich message content across multiple channels with a single framework.
  • MMS for long text messages: Send long text messages as MMS to reduce costs, maximize throughput, and ensure an appealing visual experience.

Pricing

Scalable messaging solutions
with flexible pricing

Only pay for the messages you send with no subscriptions, and try the Programmable Messaging API for free. Get additional volume and committed use discounts as you scale.