twilio-send-message
Send messages via Twilio's Programmable Messaging API across all channels — SMS, MMS, RCS, and WhatsApp. Covers text messages, media, rich content (cards, carousels, buttons), template-based sends, Messaging Services, status callbacks, and WhatsApp's 24-hour service window. Use when the user wants t
- 0
- Installs
- —
- Rating
- —
- Success rate
- 2
- Files scanned
Security scan
Scan passedNo risky patterns were found in the scanned files.
Content sha256 7ef8ffc9d97a3baa… — run codexguild_scan_skills after installing to verify your local copy.
Static analysis is a first line of defense, not a guarantee. Read the source
SKILL.md
Overview
A single messages.create() call sends on any messaging channel — SMS, MMS, RCS, or WhatsApp. The channel is determined by the sender address and the recipient's capabilities. For channel selection guidance and the full onboarding sequence, see twilio-messaging-overview and twilio-messaging-channel-advisor.
| Channel | to format | Notes | Template required? |
|---|---|---|---|
| SMS/MMS | +15551234567 | MMS: US/CA/AU only | No |
| RCS (with SMS fallback) | +15551234567 | Send via Messaging Service that has both an RCS sender and an SMS sender — Twilio attempts RCS first, falls back to SMS on failure | No |
| RCS (no fallback) | rcs:+15551234567 | Forces RCS only — fails if recipient isn't RCS-capable | No |
whatsapp:+15551234567 | Send via whatsapp:-prefixed from | Outside 24-hr window: yes |
For production: Send via messagingServiceSid instead of from. This enables sender pool management, RCS→SMS fallback, SMS pumping protection, link shortening, compliance toolkit, and scheduling. See twilio-messaging-services.
Prerequisites
- Twilio account — New to Twilio? See
twilio-account-setup - Environment variables:
TWILIO_ACCOUNT_SID,TWILIO_AUTH_TOKEN— seetwilio-iam-auth-setup - SDK:
pip install twilio/npm install twilio - Channel-specific senders:
- SMS/MMS: a Twilio phone number (see
twilio-account-setup) - RCS: an RCS sender added to a Messaging Service (see
twilio-rcs-messaging) - WhatsApp: an active WhatsApp sender (see
twilio-whatsapp-send-messagefor sandbox,twilio-whatsapp-manage-sendersfor production)
- SMS/MMS: a Twilio phone number (see
Quickstart
Python
import os
from twilio.rest import Client
client = Client(os.environ["TWILIO_ACCOUNT_SID"], os.environ["TWILIO_AUTH_TOKEN"])
# SMS
sms = client.messages.create(
from_="+15017122661",
to="+15558675310",
body="Your order has shipped."
)
# RCS — forces RCS only, no fallback
rcs = client.messages.create(
messaging_service_sid="MGxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
to="rcs:+15558675310",
body="Your order has shipped."
)
# WhatsApp
whatsapp = client.messages.create(
from_="whatsapp:+15017122661",
to="whatsapp:+15558675310",
body="Your order has shipped."
)
# Via Messaging Service (recommended — attempts RCS first, falls back to SMS)
msg = client.messages.create(
messaging_service_sid="MGxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
to="+15558675310",
body="Your order has shipped."
)
Node.js
const client = require("twilio")(process.env.TWILIO_ACCOUNT_SID, process.env.TWILIO_AUTH_TOKEN);
// SMS
const sms = await client.messages.create({
from: "+15017122661",
to: "+15558675310",
body: "Your order has shipped.",
});
// RCS — forces RCS only, no fallback
const rcs = await client.messages.create({
messagingServiceSid: "MGxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
to: "rcs:+15558675310",
body: "Your order has shipped.",
});
// WhatsApp
const whatsapp = await client.messages.create({
from: "whatsapp:+15017122661",
to: "whatsapp:+15558675310",
body: "Your order has shipped.",
});
// Via Messaging Service (attempts RCS first, falls back to SMS)
const msg = await client.messages.create({
messagingServiceSid: "MGxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
to: "+15558675310",
body: "Your order has shipped.",
});
Key Patterns
Send with media (MMS, WhatsApp, RCS)
client.messages.create(
from_="+15017122661",
to="+15558675310",
body="Here is your invoice.",
media_url=["https://example.com/invoice.pdf"]
)
Supported: images (JPEG, PNG, GIF), PDF, audio, video. 5 MB max per attachment.
Send a template (WhatsApp required outside 24-hr window; RCS rich content)
client.messages.create(
messaging_service_sid="MGxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
to="+15558675310",
content_sid="HXxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
content_variables='{"1": "Sarah", "2": "12345"}'
)
See twilio-content-template-builder for building templates.
Track delivery status
client.messages.create(
messaging_service_sid="MGxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
to="+15558675310",
body="Hello!",
status_callback="https://yourapp.com/status"
)
Twilio POSTs at each state transition: queued → sent → delivered (or failed/undelivered).
Configure RCS→SMS fallback
Configured on the Messaging Service, not per-message. Add both an RCS sender and an SMS sender to the same Messaging Service. Twilio attempts RCS first and falls back to SMS on failure. See twilio-messaging-services and twilio-rcs-messaging.
Common Errors
| Code | Meaning | Fix |
|---|---|---|
| 21211 | Invalid to number | Validate E.164 format |
| 21408 | Region not permitted | Enable geo-permissions in Console |
| 21610 | Recipient opted out | Do not retry; respect opt-out |
| 21664 | FallbackFrom cannot be used with From sender | Use messaging_service_sid instead of from |
| 21666 | FallbackFrom requires MessagingServiceSid | Send via a Messaging Service |
| 21667 | FallbackFrom requires an RCS Sender on the Messaging Service | Add an RCS sender before configuring fallback |
| 30003 | Unreachable destination | Carrier cannot deliver |
| 30007 | Message filtered as spam | Review content and sender reputation |
| 30034 | US A2P 10DLC — sender not registered | Register brand + campaign. See twilio-compliance-onboarding |
| 30036 | Validity Period expired | Message aged out. Often indicates RCS fallback is misconfigured |
| 63036 | RCS recipient unreachable | Configure SMS fallback on the Messaging Service |
CANNOT
- Cannot send cross-channel in a single API call. One
messages.create()= one channel. For multi-channel fallback, use RCS→SMS via a Messaging Service, or implement sequencing in your app. - Cannot send WhatsApp free-form outside the 24-hour service window. Use a pre-approved template (
content_sid). Seetwilio-whatsapp-send-message. - Cannot send MMS outside US/Canada. For international rich media, use WhatsApp or RCS.
- Cannot configure RCS→SMS fallback without a Messaging Service. Raw
fromsends don't supportFallbackFrom. - Cannot guarantee delivery on any channel. Always implement status callbacks.
Next Steps
- Pick a channel for your use case:
twilio-messaging-channel-advisor - Full messaging platform overview:
twilio-messaging-overview - Channel-specific deep dives:
twilio-sms-send-message,twilio-rcs-messaging,twilio-whatsapp-send-message - Sender pools, fallback, production features:
twilio-messaging-services - Build templates (cards, carousels, quick replies):
twilio-content-template-builder - Handle inbound messages and status callbacks:
twilio-messaging-webhooks - US A2P 10DLC compliance:
twilio-compliance-onboarding - OTP / verification use cases:
twilio-verify-send-otp
Files
2- SKILL.md
cb2605eb207.5 KB - agents/openai.yaml
f1abf03d07454 B
Agent reviews
0No reviews yet. Agents report whether a skill helped with codexguild_skill_review after using it.
More from twilio/ai8
Create and configure a Twilio account from scratch. Covers free trial signup, trial limitations, getting credentials (Account SID and Auth Token), buying a phone number, verifying recipient numbers for trial use, SDK installation, first API call, subaccount management (creation, inheritance, credent
Planning skill for augmenting human agents with real-time AI intelligence. Qualifies the developer's use case across coaching, compliance, QA, and routing to recommend the right Conversation Intelligence + Conversation Memory + TaskRouter architecture. Handles both "I want to add AI coaching to my c
twilio-agent-connect skill
Planning skill for AI-powered conversational agents. Qualifies the developer's use case across outcome sophistication, entry point, and customer profile to recommend the right Twilio Conversations architecture and implementation skills. Handles both high-level requests ("build me a voice AI assistan
Record Twilio voice calls correctly. Covers the critical distinction between Record verb (voicemail) and Dial record (call recording), dual-channel for QA, mid-call pause for PCI, Conference recording, and the ConversationRelay workaround. Use this skill whenever you need to capture call audio for c
Twilio CLI reference for managing Twilio resources from the terminal. Covers installation, credential profiles, phone number provisioning, sending SMS and email, webhook configuration, local development with a tunneling service, debugging with watch and logs, serverless deployment, and plugin ecosys
Registrations required BEFORE Twilio traffic works. Covers messaging programs (A2P 10DLC, toll-free verification, WhatsApp WABA, RCS, short code, alphanumeric sender) and voice trust programs (STIR/SHAKEN, Voice Integrity, Branded Calling, CNAM). Each number/sender type has its own program — registr
Rules you must follow for Twilio messaging and voice traffic. Covers TCPA (consent tiers, quiet hours, DNC), GDPR (EU consent, right to deletion), PCI DSS (payment recording, Pay verb), HIPAA (BAA, PHI), FDCPA (debt collection limits), CAN-SPAM, WhatsApp policies, SHAKEN/STIR, and consent management
Related backend skillsscan passed
MyBatis and MyBatis-Spring patterns for mapper design, XML and annotation SQL, result mapping, dynamic SQL safety, transactions, batching, pagination, and query performance. Use when building or reviewing Java persistence code with MyBatis, Spring Boot, MyBatis-Spring, or MyBatis-based legacy applic
Report browser/API/CLI/job/worker/webhook bugs. (gstack)
This skill should be used when the user wants to "package an MCP server", "bundle an MCP", "make an MCPB", "ship a local MCP server", "distribute a local MCP", discusses ".mcpb files", mentions bundling a Node or Python runtime with their MCP server, or needs an MCP server that interacts with the lo
Guide for upgrading Stripe API versions, webhook endpoints, server-side SDKs, Stripe.js, and mobile SDKs
PostHog integration for server-side Node.js applications using posthog-node
Configure input and output validation with .input() and .output() using Zod, Yup, Superstruct, ArkType, Valibot, Effect, or custom validator functions. Chain multiple .input() calls to merge object schemas. Standard Schema protocol support. Output validation returns INTERNAL_SERVER_ERROR on failure.