Chapter 1

Get Set Up: Migrate to Twilio SMS API

Person with headphones using a laptop in a home office with warm lighting and various tech gadgets.
Person with headphones using a laptop in a home office with warm lighting and various tech gadgets.

Step 1: Create and Configure Your Twilio Account

Before diving into migration, take a few preparatory steps to set yourself up for success:

  1. Sign Up for a Twilio Account: Begin by creating a Twilio account (if you haven’t already).

  2. Business Verification & Compliance: Prepare your business details for Carrier compliance requirements. Twilio uses a centralized Trust Hub for verifying customers (Know Your Customer) and registering messaging use cases. Create a Primary Business Profile in the Trust Hub, which streamlines compliance across all channels​. For ISV customers, use this guide to set up your customers for success on 10DLC numbers.  For U.S. messaging, you’ll need to register your Brand and Campaign for A2P 10DLC (10-digit long codes) to comply with carrier rules. Twilio’s onboarding wizard will guide you through each step, making it as easy as possible to provide the required information​. If you plan to use a Toll-Free number, be ready to submit a brief use-case description for verification.
Twilio Console sign up page
Twilio Console sign up page

Step 2: Install the Twilio SDK for Your Language

Twilio provides SDKs for all major programming languages using our quickstart guides.

Node.js Example:

  • npm install twilio

Twilio Advantage: Developer friendly SDKs with native support for delivery receipts, webhooks, error tracing, and real-time observability.

Close-up of a person's hand using a black gaming mouse with neon blue and pink lighting.
Close-up of a person's hand using a black gaming mouse with neon blue and pink lighting.

Step 3: Start Moving Your Numbers

You can port your existing phone numbers to Twilio. Note that if you have Voice on the same number, porting will always port the Voice channel in addition to Messaging. If you wish to use Twilio for Messaging while leaving Voice with the incumbent carrier, you can leverage Hosted SMS.

Man with glasses focused on computer screen displaying code at nighttime
Man with glasses focused on computer screen displaying code at nighttime

Short Code: 

Due to the carrier compliance requirements for short codes, short code numbers follow a separate migration process; please refer to the US Short Code Migration Process and FAQ

10DLC and Toll Free

  • For 10DLC and Toll Free: Port Your Phone Numbers to Twilio: You can bring over your existing long codes and toll-free numbers to Twilio through a porting process. Start by gathering your current provider account details (account number, PIN if applicable, and a copy of the latest bill if required for verification). In the Twilio Console, initiate a port request for each number or batch of numbers. Twilio will coordinate with your current provider and the carriers to transfer the numbers. A standard port for a small quantity of numbers typically takes about 1-2 weeks (excluding public holidays) once paperwork is submitted​.  Larger bulk ports (50+ numbers) may take 4–6 weeks​.  

  • Twilio will provide an estimated completion date, to avoid any business impact. During the interim, your numbers continue to work on your current provider until the moment they switch to Twilio, so there’s low to no downtime. (You can also set up a temporary Twilio number for testing while you wait.)  Additionally, you can leverage our Porting API to automate port request submission for each number.

  • Ensure you complete the necessary compliance setup for the number types you are using. 

  • If you also send or receive Voice calls on your numbers, we strongly advise setting up SHAKEN/STIR and Voice Integrity as well – it’s free of cost and helps bolster your call reputation with carriers and reduce the risk of “Spam Likely” labeling.

Twilio Advantage: Full control over sender type improves branding, deliverability, and compliance alignment.

Step 4: Replace Bandwidth Messaging Code with Twilio

BEFORE: Code Example

"id": "1589228074636lm4k2je7j7jklbn2",
"owner": "+15554443333",
"applicationId": "93de2206-9669-4e07-948d-329f4b722ee2"
"time": "2024-12-02T20:15:57.278Z",
"segmentCount": 2,
"direction": "in",
"to": [
"+15552223333"
],
"from": "+15553332222",
"media": [
"https://dev.PROVIDER.com/images/PROVIDER-logo.png"
],
"text": "Hello world",
"tag": "custom tag",
"priority": "default",
"expiration": "2021-02-01T11:29:18-05:00"

AFTER: Twilio Programmable Messaging

const client = require('twilio')('TWILIO_SID', 'TWILIO_AUTH_TOKEN');
client.messages.create({
  from: 'TWILIO_NUMBER',
  to: '+1234567890',
  body: 'Hello from Twilio!',
  statusCallback: 'https://yourdomain.com/sms-status'
});

NOTE: Twilio handles message sending throughput and queuing on your behalf, so you don’t have to worry about it – if you have implemented message throttling or queueing in your existing code, you can remove that when you make the switch to Twilio.

Twilio Advantage: A full-featured, scalable API with support for delivery tracking, messaging services, sender pooling, and advanced analytics.