Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
twilio avatar

Twilio Sms Send Message

  • 791 installs
  • 26 repo stars
  • Updated July 29, 2026
  • twilio/ai

Twilio skill for sending SMS via Messages API with compliance and configuration guidance.

About

Twilio skill for sending SMS messages through the Messages API. Covers account setup prerequisites, choosing From phone numbers or Messaging Services, formatting E.164 destinations, handling opt-out and compliance requirements, and interpreting API error codes. Documents REST and helper library patterns with environment variable configuration for Account SID and Auth Token. Includes guidance on message status callbacks, rate limits, and geographic restrictions. Part of the Twilio AI skill family for messaging integration in agent-built applications.

  • Twilio Messages API SMS send with From number or Messaging Service
  • E.164 phone formatting and compliance opt-out handling
  • Account SID and Auth Token environment configuration
  • Status callback webhooks and delivery error interpretation
  • Geographic and carrier restriction awareness for SMS routes

Twilio Sms Send Message by the numbers

  • 791 all-time installs (skills.sh)
  • +11 installs in the week ending Aug 5, 2026 (Skillselion tracking)
  • Ranked #487 of 4,347 Backend & APIs skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
At a glance

twilio-sms-send-message capabilities & compatibility

Capabilities
send sms · configure messaging service · handle sms errors
Works with
slack
Use cases
api development · email
Runs
Remote server
Pricing
Paid
npx skills add https://github.com/twilio/ai --skill twilio-sms-send-message

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs791
repo stars26
Last updatedJuly 29, 2026
Repositorytwilio/ai

How do I send an SMS message through Twilio correctly?

Send SMS messages via Twilio REST API with correct From number, Messaging Service, compliance, and error handling patterns.

Who is it for?

Developers integrating Twilio SMS into apps or agent workflows.

Skip if: WhatsApp-only or voice-only Twilio features without SMS.

When should I use this skill?

User needs to send SMS via Twilio, configure messaging, or handle Twilio SMS errors.

What you get

SMS sent via Twilio API with proper From, E.164 To, and compliance handling.

Files

SKILL.mdMarkdownGitHub ↗

Overview

SMS is one channel in Twilio's Messaging platform. All channels — SMS, WhatsApp, RCS, Facebook Messenger — share the same messages.create() API. See twilio-messaging-overview for the full channel comparison and onboarding sequence.

When to use SMSWhen to consider alternatives
Reach any phone number globallyNeed rich media outside US/CA/AU → WhatsApp
No app install requiredOpted-in audience prefers chat apps → WhatsApp
Time-sensitive alerts (OTP, outage)Marketing campaigns → twilio-marketing-promotions-advisor
Regulatory/compliance requires SMSCost-sensitive high-volume → WhatsApp (lower per-msg cost in many markets)

For production SMS: Use a Messaging Service (messagingServiceSid) instead of a raw from number. It enables sender pool management, compliance toolkit, SMS pumping protection, link shortening, and message scheduling. See twilio-messaging-services.

Every outbound SMS requires a from Twilio number (or messagingServiceSid) and a to recipient — both in E.164 format.

---

Prerequisites

  • Twilio account with an SMS-capable phone number

— New to Twilio? See twilio-account-setup for signup, getting a number, and trial limitations

  • Environment variables:
  • TWILIO_ACCOUNT_SID
  • TWILIO_AUTH_TOKEN

— See twilio-iam-auth-setup for credential setup and best practices

  • SDK: pip install twilio / npm install twilio

---

Quickstart

Python

import os
from twilio.rest import Client

client = Client(os.environ["TWILIO_ACCOUNT_SID"], os.environ["TWILIO_AUTH_TOKEN"])

message = client.messages.create(
    from_="+15017122661",   # Your Twilio number (E.164)
    to="+15558675310",      # Recipient (E.164)
    body="Your appointment is confirmed for tomorrow at 2pm."
)

print(message.sid)     # SMxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
print(message.status)  # queued | sent | delivered | failed

Node.js

const twilio = require("twilio");
const client = twilio(process.env.TWILIO_ACCOUNT_SID, process.env.TWILIO_AUTH_TOKEN);

const message = await client.messages.create({
    from: "+15017122661",
    to: "+15558675310",
    body: "Your appointment is confirmed for tomorrow at 2pm.",
});

console.log(message.sid);
console.log(message.status);

---

Key Patterns

Send MMS (with media)

Python

message = client.messages.create(
    from_="+15017122661",
    to="+15558675310",
    body="Here is your invoice.",
    media_url=["https://example.com/invoice.pdf"]
)

Node.js

const message = await client.messages.create({
    from: "+15017122661",
    to: "+15558675310",
    body: "Here is your invoice.",
    mediaUrl: ["https://example.com/invoice.pdf"],
});

Supported media types: images (JPEG, PNG, GIF), PDF, audio, video. Max 5 MB per message.

Send via Messaging Service (recommended for scale)

Use messagingServiceSid instead of from — Twilio picks the best sender automatically from your pool.

Python

message = client.messages.create(
    messaging_service_sid="MGxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    to="+15558675310",
    body="Your order has shipped."
)

Node.js

const message = await client.messages.create({
    messagingServiceSid: "MGxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    to: "+15558675310",
    body: "Your order has shipped.",
});

Track Delivery Status

Python

message = client.messages.create(
    from_="+15017122661",
    to="+15558675310",
    body="Hello!",
    status_callback="https://yourapp.com/sms-status"
)

Node.js

const message = await client.messages.create({
    from: "+15017122661",
    to: "+15558675310",
    body: "Hello!",
    statusCallback: "https://yourapp.com/sms-status",
});

Twilio POSTs to your URL at each transition: queued → sent → delivered (or failed/undelivered).

---

Response Fields

FieldDescription
sidMessage identifier (SM...)
statusqueued, sent, delivered, undelivered, failed
error_codePopulated on failure
error_messageHuman-readable description
priceCost (populated after delivery)
date_sentUTC timestamp

---

Common Errors

CodeMeaningFix
21211Invalid to numberValidate E.164 format
21408Permission to send to region not enabledEnable geo-permissions in Console
21610Number is on blocklist (opted out)Do not retry; respect opt-out
30003Unreachable destinationCarrier cannot deliver; try later
30007Message filtered as spamReview content and sender reputation
30034Message from unregistered numberComplete A2P 10DLC registration — see twilio-compliance-onboarding
30450SMS pumping detectedMessage blocked by SMS pumping protection — see twilio-messaging-services

Messages Being Filtered or Blocked?

If your messages aren't being delivered, check these causes in order:

1. Unregistered sender (error 30034) — US 10DLC numbers must be registered. See twilio-compliance-onboarding 2. Spam filtered (error 30007) — Carrier flagged content. Check: opt-out language included? URL shorteners avoided? Content matches registered campaign? 3. Opted-out recipient (error 21610) — Recipient sent STOP. Do not retry. See twilio-compliance-traffic 4. Geo-permissions disabled (error 21408) — Enable the destination country in Console > Messaging > Settings > Geo Permissions. See twilio-security-hardening 5. SMS pumping (error 30450) — Artificial traffic detected. Whitelist known prefixes via Global Safe List. See twilio-messaging-services 6. Account suspended — Check Console for account status notifications. See twilio-account-setup

For delivery event tracking, set up StatusCallbacks or use twilio-debugging-observability.

---

CANNOT

  • Cannot send without E.164 format — Both from and to must be + followed by country code and number
  • Cannot send to unverified numbers on trial accounts — Upgrade to paid or verify recipient numbers first
  • Cannot send MMS outside US, Canada, and Australia — MMS is only supported on US/CA/AU numbers; for international rich media use WhatsApp
  • Cannot exceed 1,600 characters per message — Longer messages are automatically split into segments (each billed separately)
  • Cannot prevent SMS pumping without a Messaging Service — Enable SMS pumping protection via Messaging Services to prevent artificial traffic inflation. See twilio-messaging-services

---

Next Steps

  • Channel overview and onboarding guide: twilio-messaging-overview
  • Receive inbound SMS and delivery status: twilio-messaging-webhooks
  • Manage sender pools at scale: twilio-messaging-services
  • US compliance for A2P traffic: twilio-compliance-onboarding
  • Send via WhatsApp instead: twilio-whatsapp-send-message

Related skills

FAQ

From number or Messaging Service?

Use a purchased Twilio number as From or a Messaging Service SID for pooled sender management.

What phone format is required?

Destination numbers must be E.164 format with country code.

What credentials are needed?

TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN from the Twilio console.

Backend & APIsintegrationsbackend

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.