Integrates Twilio SMS, voice, WhatsApp, and 2FA/Verify into Python applications. Covers sending/receiving messages, TwiML IVR menus, webhook signature validation, E.164 formatting, rate limiting, and compliance.
Ships in 10-platform. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
当你要在应用里集成 Twilio 通信能力时使用,典型场景:
不该用的边界:
通用前置:凭据走环境变量,号码用 E.164 格式(+ 加国家码,如 +14155551234)。
TWILIO_ACCOUNT_SID / TWILIO_AUTH_TOKEN 注入环境变量,生产优先用可吊销的 API Key(TWILIO_API_KEY_SID + TWILIO_API_KEY_SECRET + TWILIO_ACCOUNT_SID)替代 Auth Token。绝不硬编码、绝不放进客户端 JS。Client(...).messages.create(to, from_, body, status_callback),发前校验 E.164、估算分段(每 160 字符 1 段,超出会拆分并加价),捕获 TwilioRestException 并按错误码分支处理。TWILIO_VERIFY_SID;services(sid).verifications.create(to, channel) 发码,verification_checks.create(to, code) 校验(status == "approved" 即通过)。验证码全权交给 Twilio,不要入库。VoiceResponse + Gather(收键 num_digits / timeout / action)搭菜单,<Dial> 转接、<Record> 留言。无状态,状态靠 URL 参数 / 会话维护。出站呼叫用 client.calls.create(to, from_, url=...)。RequestValidator(auth_token).validate(url, params, signature) 校验 X-Twilio-Signature,校验失败返回 403;处理要快、尽快返回 ("", 200)。whatsapp: 前缀。24 小时会话窗口内可自由文本(≤1024 字符),窗口外只能发预审模板(content_sid + content_variables)。按用户维护会话过期时间。20429 语音 / 30429 消息)做指数退避 + jitter 重试,其他错误直接抛。瞬时不可达(30003/30008/30009)可隔较长间隔重试,永久失败不重试。核心调用速查:
from twilio.rest import Client
from twilio.base.exceptions import TwilioRestException
client = Client(os.environ["TWILIO_ACCOUNT_SID"], os.environ["TWILIO_AUTH_TOKEN"])
# 发短信
msg = client.messages.create(to="+14155551234", from_=FROM, body="文本",
status_callback="https://app/webhooks/status")
# Verify 2FA:发码 / 校验
client.verify.v2.services(SID).verifications.create(to="+1...", channel="sms")
chk = client.verify.v2.services(SID).verification_checks.create(to="+1...", code="123456")
ok = chk.status == "approved"
# Webhook 签名校验(必做)
from twilio.request_validator import RequestValidator
RequestValidator(os.environ["TWILIO_AUTH_TOKEN"]).validate(
request.url, request.form.to_dict(), request.headers.get("X-Twilio-Signature", ""))
E.164 校验正则:^\+[1-9]\d{1,14}$。
关键错误码(按码分支处理,别只看 message):
带校验与错误处理的发短信骨架:
def send_sms(to, body):
if not re.match(r'^\+[1-9]\d{1,14}$', to):
return {"success": False, "error": "号码须为 E.164 格式 (+14155551234)"}
try:
m = client.messages.create(to=to, from_=FROM, body=body)
return {"success": True, "message_sid": m.sid, "status": m.status}
except TwilioRestException as e:
codes = {21610: "用户已退订,须回 START 重新订阅",
30003: "手机不可达(关机/飞行模式)",
30429: "触发限流,请指数退避重试"}
return {"success": False, "error_code": e.code, "error": codes.get(e.code, e.msg)}
入站短信处理退订/订阅关键词(合规必做):
body = request.form.get("Body", "").strip().upper()
if body in ["STOP", "UNSUBSCRIBE", "CANCEL", "END", "QUIT"]:
mark_user_opted_out(from_number); return "", 200
if body in ["START", "SUBSCRIBE", "YES", "UNSTOP"]:
mark_user_opted_in(from_number); return "", 200
限流退避重试装饰器(仅重试 20429/30429,带 jitter 防惊群):
delay = min(base_delay * (2 ** attempt) + random.uniform(0, 1), max_delay)
time.sleep(delay)
X-Twilio-Signature 等于谁知道 URL 谁就能伪造回调(假投递、伪造入站消息、欺诈验证)。代理/ngrok 下注意用 Twilio 实际请求的完整 URL(可能要从 X-Forwarded-Proto/Host 重建),生产用稳定 URL。采编自 sickn33/antigravity-awesome-skills(MIT);上游原始内容致谢 vibeship-spawner-skills(Apache 2.0)。本条目为适配重写,凭据、号码与合规细节请按自身环境验证。
What SKILL.md sets; muted values are Claude Code's defaults
66 skills in this plugin
/agentmail-email-infra当 AI 智能体需要真实邮箱完成注册/验证码/事务通信时使用;通过 AgentMail REST API 开通账号、收发邮件、注册 Webhook、查询 karma 余额并产出可执行调用;不适用于自建/企业 SMTP/IMAP 或个人邮箱代收。触发词:AgentMail、智能体邮箱、theagentmail.net/agentphone-voice-sms-agents当需要给 AI 代理配备电话号码、发起/接听语音通话、收发短信、查看通话转写或配置 Webhook 时使用;调用 AgentPhone REST API(base=https://api.agentphone.to/v1)完成代理/号码/通话/短信/Webhook/用量的全生命周期管理,产出可直接执行的 curl 与 Webhook 处理代码;不适用于自建 Twilio/SIP/STUN 等底层电信栈或非 AgentPhone 平台。触发词:电话代理、语音通话、短信、号码、Webhook、转写。/ai-native-cli-design当设计/改造供 AI 智能体调用的命令行工具时使用;按 core/recommended/ecosystem 三层产出 JSON 优先、可校验的 CLI 契约(默认 JSON、结构化错误、退出码、护栏、agent/ 目录与自描述);不适用于纯人类交互 CLI、GUI 或库 API 设计;触发词:agent CLI、AI 友好命令行、CLI JSON 输出、退出码规范、agent/ 目录/10-platform:twilio-communicationsfrom 10-platform
npx claudepluginhub findscripter/everything-skills --plugin 10-platformOther plugins' skills for the same job