Labsco
openai logo

twilio-sms-send-message

✓ Official4,081

by openai · part of openai/plugins

SMS and MMS deep-dive reference. Covers SMS-specific error codes, message filtering troubleshooting ("Messages Being Filtered or Blocked?" diagnostic checklist), MMS media support (US/CA/AU only), and SMS pumping indicators. For sending SMS, use twilio-send-message instead. Use this skill only when debugging SMS delivery issues or needing SMS-specific details not in the consolidated send skill.

🧩 One of 7 skills in the openai/plugins package — works on its own, and pairs well with its siblings.

This is the playbook your agent receives when the skill activates — you don't need to read it to use the skill, but it's here to audit before installing.

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.


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.

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

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