Community生產力與協作github.com

steipete/twilio-sms

Twilio SMS CLI:購買/列出/保留號碼、發送/查詢訊息、憑證路由。

twilio-sms 是什麼?

此技能提供一個統一的 CLI 介面,用於管理 Twilio 電話號碼和 SMS 操作。它涵蓋了從購買新號碼、列出已擁有號碼、為號碼添加標籤保留,到發送簡訊及查詢傳入/傳出訊息等完整生命週期。技能會自動偵測並路由 Twilio 憑證:首先檢查環境變數,若不足則透過 1Password 查詢,必要時可切換為桌面版認證。支援透過 `twilio-cli` 或原生 `curl` 執行 REST API,並內建買前驗證、買後檢查及號碼保留邏輯,避免意外釋放號碼。此外,也提醒開發者注意國際 SMS 發送者顯示、A2P/10DLC 合規要求及試用帳戶的限制。

相容平台~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 工作:創建/購買號碼、列出已擁有的號碼、保留/標記號碼、發送簡訊,以及檢查傳入/傳出訊息。

安全

  • 絕不打印 Account SID、auth token、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. 僅檢查確切的環境變數是否存在:
    • TWILIO_ACCOUNT_SID
    • TWILIO_AUTH_TOKEN
    • 可選的 API 金鑰/密鑰變數
  3. 若只有部分環境變數存在,請先搜尋 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 設定檔需要帳戶認證 token,不僅是 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 - <用途>"

保留規則:只要號碼仍在 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'

備註

  • 國際 SMS 可能顯示字母數字或電信業者發送者,而非購買的美國號碼。
  • 美國 SMS 可能受合規限制。若發送給美國收件者失敗,請在盲目重試前檢查 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.

相關技能