Files
marketingskills/tools/integrations/twilio.md
T
Corey Haines d36433703b feat: add sms skill + 5 SMS platform integration docs (#307)
New skill: skills/sms/
- SKILL.md (336 lines, under 500 limit): strategy, when SMS beats email,
  compliance overview, sequence types, copy guidelines, platform selection,
  measurement, common mistakes
- references/compliance.md: TCPA, A2P 10DLC, EU GDPR, CASL, Australia,
  opt-in disclosure templates, STOP/HELP response templates, audit checklist
- references/sequence-templates.md: full copy templates with character
  counts for welcome, abandoned cart, browse abandonment, post-purchase,
  win-back, promotional, transactional, re-engagement, replenishment, VIP
- references/platforms.md: platform deep-dives across Klaviyo SMS,
  Postscript, Attentive, Twilio, Plivo, AudienceTap, Brevo, SimpleTexting,
  Customer.io
- evals/evals.json: 6 evals covering getting started, abandoned cart,
  TCPA compliance, opt-out diagnosis, A2P throughput, emoji segment cost

New integration docs:
- tools/integrations/twilio.md
- tools/integrations/postscript.md
- tools/integrations/attentive.md
- tools/integrations/plivo.md
- tools/integrations/audiencetap.md

Registry + marketplace wiring:
- tools/REGISTRY.md: 5 new entries + new SMS / Messaging category section
- .claude-plugin/marketplace.json: bumped to 2.1.0, SMS added to plugin description
- VERSIONS.md: sms 1.0.0 + 2.1.0 changelog entry
- README.md: skill table re-sorted via sync-skills.js, sms added to ASCII flow

All 41 skills pass validation. sync-skills.js is idempotent on current state.

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-21 16:44:47 -07:00

153 lines
4.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Twilio
Programmable communications platform: SMS, MMS, WhatsApp, voice, email (via SendGrid). The default low-level API for custom SMS builds, transactional messaging, and B2B SaaS embedding SMS into products.
## Capabilities
| Integration | Available | Notes |
|-------------|-----------|-------|
| API | ✓ | REST API, well-documented, mature |
| MCP | - | Not available natively (community wrappers exist) |
| CLI | ✓ | Official `twilio` CLI |
| SDK | ✓ | Node, Python, Ruby, PHP, Java, Go, C#, .NET |
## Authentication
- **Type**: Basic auth with Account SID + Auth Token (or API Key SID + Secret)
- **Header**: `Authorization: Basic base64(AccountSID:AuthToken)`
- **Get credentials**: https://console.twilio.com → Account Info
- **Recommendation**: Use API Keys (revocable, scoped) for production rather than the master Auth Token
## Common Agent Operations
### Send SMS
```bash
POST https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Messages.json
To=+15551234567
From=+15559876543
Body=Hello from Twilio
```
### Send MMS
```bash
POST https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Messages.json
To=+15551234567
From=+15559876543
Body=Check this out
MediaUrl=https://example.com/image.jpg
```
### List messages
```bash
GET https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Messages.json?PageSize=50
```
### Get message status
```bash
GET https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Messages/{MessageSid}.json
```
Status values: `queued`, `sending`, `sent`, `delivered`, `undelivered`, `failed`.
### List phone numbers
```bash
GET https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers.json
```
### Buy a phone number
```bash
POST https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers.json
PhoneNumber=+15559876543
```
### Configure webhook for inbound messages
```bash
POST https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/{Sid}.json
SmsUrl=https://your-app.com/sms-webhook
SmsMethod=POST
```
Inbound SMS POSTs to the webhook with: `From`, `To`, `Body`, `MessageSid`, `NumMedia`, etc.
### A2P 10DLC registration (US)
```bash
# Create brand
POST https://messaging.twilio.com/v1/a2p/BrandRegistrations
CustomerProfileBundleSid=...
A2PProfileBundleSid=...
# Create campaign
POST https://messaging.twilio.com/v1/Services/{ServiceSid}/Compliance/Usa2p
BrandRegistrationSid=...
Description=...
MessageSamples[]=Sample text 1
MessageFlow=Opt-in flow description
UseCase=MARKETING
```
Most workflows are clearer in the Console UI. Programmatic registration is for high-scale platforms managing many brands.
## API Pattern
REST + form-encoded request bodies (not JSON for most endpoints). Resources nested under Account: `/Accounts/{AccountSid}/...`. Pagination via `Page`, `PageSize`, `NextPageUri`.
## Key Concepts
- **Messaging Service**: virtual sender container; load-balances across multiple numbers, handles A2P registration grouping
- **Sticky Sender**: same recipient always receives from the same number within a service
- **Geo-Match**: route to a number matching the recipient's country/region
- **Status Callback**: webhook fired on every delivery state change
- **Carrier Lookup**: pre-send check for line type (mobile, landline, VoIP) — costs ~$0.005
## Pricing
- US 10DLC SMS: $0.0079/msg
- US toll-free SMS: $0.0079/msg
- US short code SMS: $0.0079/msg + $1,000/mo lease
- MMS: ~$0.02
- Carrier surcharges (~$0.005 US 10DLC)
- A2P 10DLC: ~$15 brand + $10/mo per campaign
- Phone number rental: $1.15/mo (10DLC) to $2/mo (toll-free)
## Rate Limits
- Default: 1 msg/sec on long codes (10DLC trust score raises this to 4100+)
- Short code: 100+ msg/sec
- Messaging Services throttle automatically
- Carrier filtering applies above contracted throughput
## When to Use
- Building custom SMS flows into a product (B2B SaaS, mobile apps)
- Transactional and auth SMS (OTPs, alerts, notifications)
- Multi-channel orchestration (SMS + voice + WhatsApp)
- High-volume programmable messaging
- When you need full control and minimal abstraction
- Backing store for Customer.io / Segment / other orchestration layers
## When NOT to Use
- DTC ecom marketing flows — use Klaviyo, Postscript, or Attentive (better tooling for cart recovery, segments, A/B tests)
- If you don't want to handle compliance plumbing — Twilio gives you primitives, not policy
- Marketing UI for non-technical users — there isn't one
## Relevant Skills
- sms
- emails (transactional sister product via SendGrid)
- onboarding (post-signup SMS milestones)