Community生产力与协作github.com

steipete/twilio-sms

Twilio SMS CLI:购买/列出/保留号码,发送/检查消息,凭据路由。

twilio-sms 是什么?

此技能专为开发者和AI代理用户设计,用于通过命令行界面管理Twilio电话号和SMS功能。它支持购买和列出号码、标记保留号码、发送短信以及检查收发消息。该技能强调安全性,避免泄露敏感信息(如账户SID、认证令牌)及真实电话号码,并通过凭证路由从1Password等安全存储中自动检索Twilio凭据。支持Twilio CLI和REST API两种操作方式,确保在CLI不可用时仍能正常工作。此外,它还提供了处理合规限制(如A2P/10DLC注册)和解析JSON响应的指导,适合在Claude Code等AI代理平台上使用。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/steipete/agent-scripts/tree/main/skills/twilio-sms

Installed? Explore more 生产力与协作 skills: steipete/gemini, steipete/gh-issues, steipete/skill-creator · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

Twilio SMS

用于Twilio电话号码和SMS相关操作:创建/购买号码、列出已拥有号码、保留/标记号码、发送短信以及检查收发消息。

安全

  • 切勿打印账户SID、认证令牌、API密钥、TOTP码或完整的1Password条目JSON。
  • 不要在此技能中存储真实的电话号码、SID、姓名或特定账户的条目ID。
  • 使用 $one-password 读取密钥。op 仅在 tmux 中使用。
  • 如果需要桌面端1Password访问,请通过 env -u OP_SERVICE_ACCOUNT_TOKEN op ... 取消设置服务账户认证。
  • 仅打印凭据的形状:字段是否存在、长度、前缀类别(如有用)。
  • 公共写入或日志:除非用户要求读取/检查SMS,否则避免泄露消息内容。

凭据路由

  1. 检查Twilio CLI/配置文件:
    • twilio --version 或 npx -y twilio-cli --version
    • twilio profiles:list 或 npx -y twilio-cli profiles:list
  2. 仅检查确切的env变量是否存在:
    • TWILIO_ACCOUNT_SID
    • TWILIO_AUTH_TOKEN
    • 可选的API密钥/密钥变量
  3. 如果仅存在部分env,首先搜索1Password元数据。
  4. 优先选择字段匹配以下条件的条目:
    • TWILIO_ACCOUNT_SID
    • TWILIO_AUTH_TOKEN
    • 可选的 TWILIO_FROM_NUMBER
  5. 如果 op 只能看到受限制的保险库,则使用 env -u OP_SERVICE_ACCOUNT_TOKEN 重试桌面端支持的读取。
  6. 在购买或发送之前验证认证:
curl -sS -u "$TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN" \
  "https://api.twilio.com/2010-04-01/Accounts/$TWILIO_ACCOUNT_SID.json"

CLI 设置

创建Twilio CLI配置文件需要账户认证令牌,而不仅仅是API密钥凭据:

npx -y twilio-cli profiles:create "$TWILIO_ACCOUNT_SID" \
  --auth-token "$TWILIO_AUTH_TOKEN" \
  --profile default --force --silent
npx -y twilio-cli profiles:use default

当 twilio 未安装时,使用 npx -y twilio-cli。

号码

列出已拥有的号码:

npx -y twilio-cli api:core:incoming-phone-numbers:list \
  --properties phoneNumber,friendlyName,capabilities

搜索美国本地SMS可用库存:

npx -y twilio-cli api:core:available-phone-numbers:local:list \
  --country-code US --sms-enabled --voice-enabled --limit 5

如果CLI形状笨拙或缺少标志,使用REST:

curl -sS -u "$TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN" \
  "https://api.twilio.com/2010-04-01/Accounts/$TWILIO_ACCOUNT_SID/AvailablePhoneNumbers/US/Local.json?SmsEnabled=true&VoiceEnabled=true&PageSize=5"

购买一个候选号码:

curl -sS -u "$TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN" \
  -X POST "https://api.twilio.com/2010-04-01/Accounts/$TWILIO_ACCOUNT_SID/IncomingPhoneNumbers.json" \
  --data-urlencode "PhoneNumber=$PHONE_NUMBER"

购买后验证所有权和功能。Twilio JSON使用小写键:

capabilities.sms
capabilities.mms
capabilities.voice

标记用户希望保留的号码:

npx -y twilio-cli api:core:incoming-phone-numbers:update \
  --sid "$PHONE_NUMBER_SID" \
  --friendly-name "KEEP - <purpose>"

保留规则:只要号码还在Twilio账户中且计费正常,就应保留。除非用户明确要求,否则不要释放或删除。

SMS

发送短信:

npx -y twilio-cli api:core:messages:create \
  --from "$FROM_NUMBER" \
  --to "$TO_NUMBER" \
  --body "$BODY" \
  -o json

获取状态:

npx -y twilio-cli api:core:messages:fetch --sid "$MESSAGE_SID" -o json

检查发送到某号码的入站消息:

npx -y twilio-cli api:core:messages:list \
  --to "$NUMBER" --limit 20 -o json

检查从某号码发出的出站消息:

npx -y twilio-cli api:core:messages:list \
  --from "$NUMBER" --limit 20 -o json

Twilio CLI JSON可能为单个资源命令返回数组。请防御性解析:

jq 'if type=="array" then .[0] else . end'

备注

  • 国际短信可能显示字母数字或运营商发送者,而非购买的美国号码。
  • 美国短信可能受合规限制。如果向美国接收方发送失败,请在盲目重试前检查A2P/10DLC注册状态。
  • 试用账户可能限制接收方。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

steipete/agent-transcript

GitHub PR/issue agent transcripts: redact, preview, and insert safely.

steipete/beeper

Beeper cache: contact hints, room lookup, WhatsApp/iMessage traces, FTS.

steipete/browser-use

Existing Chrome automation: Chrome plugin first, mcporter fallback.

steipete/clawsweeper-status

ClawSweeper status: URLs, workflow health, active workers, ops snapshot.

steipete/clickclack

ClickClack ops: chat app, Hetzner deploy, DNS/docs/app, Docker rollout.

steipete/cloudflare-registrar

Cloudflare Registrar: domain availability, prices, registration via mcporter.

steipete/codex-debugging

Codex debugging: codex-rs core/tui/exec/cli/app-server/config.

steipete/create-cli

CLI UX/spec: args, flags, help, output, errors, config, dry-run.

steipete/discord-clawd

Discord-backed OpenClaw agent/session relay; not archive search.

steipete/domain-dns-ops

DNS/domain ops: registrars, zones, redirects, DNS/HTTP verify, manager truth.

steipete/frontend-design

Frontend UI: pages, apps, components, polished non-generic design.

steipete/github-author-context

GitHub contributor context: identity, activity, trust, company/team signal.

steipete/github-cache-hygiene

GitHub quota/cache hygiene: gh, ghx, xcache, gitcrawl, mirrors, limits.

steipete/github-deep-review

GitHub deep review: bugs, PRs, best fix, stale-or-real, read code first.

steipete/github-project-triage

GitHub issue/PR triage: queues, CI, blockers, risk, proof, next actions.

steipete/hopper-debugger

Hopper debugging: macOS/iOS binaries, ObjC/Swift symbols, dyld, LLDB.

steipete/instruments-profiling

Instruments/xctrace profiling: macOS/iOS traces, binaries, args, exports.

steipete/mac-maintenance

Mac upkeep: brew update/upgrade, pull clean repos, empty Trash.

steipete/maintainer-orchestrator

Open-source maintainer orchestration: Codex app workers, work recovery, dependencies, vision, releases.

steipete/markdown-converter

Markdown conversion: PDF, Office, HTML, data, OCR, audio, ZIP, YouTube.

相关技能