Twilio

From mvanhorn/printing-press-library · View interactive version

Twilio is an AI agent skill from the GitHub repository mvanhorn/printing-press-library. Every Twilio Core feature, plus offline message and call history, FTS, and SQL-grade analytics no other Twilio tool... Trigger phrases: `send an SMS via Twilio`, `list Twilio messages`, `Twilio call recordings`, `Twilio usage cost`, `Twilio opt-out audit`, `use twilio`, `run twilio`.

How to use this skill

Skill file

Twilio — Printing Press CLI

Prerequisites: Install the CLI

This skill drives the twilio-pp-cli binary. You must verify the CLI is installed before invoking any command from this skill. If it is missing, install it first:

  1. Install via the Printing Press installer. It defaults binaries to $HOME/.local/bin on macOS/Linux and %LOCALAPPDATA%\Programs\PrintingPress\bin on Windows:

```bash

npx -y @mvanhorn/printing-press-library install twilio --cli-only

```

  1. Verify: twilio-pp-cli --version
  2. Ensure the reported install directory is on $PATH for the agent/runtime that will invoke this skill.

If the npx install fails (no Node, offline, etc.), fall back to a direct Go install (requires Go 1.26.6 or newer):

go install github.com/mvanhorn/printing-press-library/library/social-and-messaging/twilio/cmd/twilio-pp-cli@latest

If --version reports "command not found" after install, the runtime cannot see the binary directory on $PATH. Do not proceed with skill commands until verification succeeds.

When to Use This CLI

Reach for this CLI when an agent or operator needs Twilio data they cannot get in one API call: cross-subaccount aggregation, delivery-failure analysis, TCPA opt-out audits, idle-number cleanup, or any 'how was last week' question. It is also the right tool for incident triage when a CallSid needs the full Call+Recording+Transcription stitch in one command. Skip it for one-off message sends if you already have twilio-cli configured — but for any analytic or investigative workflow it is faster, offline-capable, and agent-native.

Unique Capabilities

These capabilities aren't available in any other tool for this API.

Local state that compounds

_When debugging delivery, agents need the failure distribution, not 4000 individual rows. This command answers 'why is delivery degraded' in one query._

```bash

twilio-pp-cli delivery-failures --since 7d --json

```

_For agency operators, this is the entire monthly billing report in one command. Agents can run it with --period thisMonth for a live forecast._

```bash

twilio-pp-cli subaccount-spend --period last-month --csv > march-billing.csv

```

_Operations dashboards need the funnel, not the raw rows. One query is the whole 'is delivery healthy right now' answer._

```bash

twilio-pp-cli message-status-funnel --since 24h --json

```

_Outbound campaign tuning depends on knowing the human-pickup rate vs voicemail rate. Agents can answer this without paging through thousands of call records._

```bash

twilio-pp-cli call-disposition --since 7d --json

```

Cross-entity stitches

_On-call engineers paged about a dropped call need the full picture in seconds, not three API round trips while the customer waits._

```bash

twilio-pp-cli call-trace CAxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --json

```

_At $1/number/month, agencies running 100+ subaccount numbers can save hundreds annually. Agents can run it as a monthly cleanup task._

```bash

twilio-pp-cli idle-numbers --since 30d --json

```

_Orphan webhooks silently fail incoming calls and SMS. Quarterly audit is cheap insurance against silent dropped traffic._

```bash

twilio-pp-cli webhook-audit --probe --json

```

_When investigating a customer complaint or fraud claim, the full back-and-forth is one query. Agents can answer 'what did we say to this number' without four searches._

```bash

twilio-pp-cli conversation +14155551234 --json

```

Compliance & audit

_TCPA fines are $500–$1,500 per violation. Compliance teams audit for this quarterly; agents can spot-check it any time._

```bash

twilio-pp-cli opt-out-violations --since 90d --json --select to,opt_out_at,subsequent_send_at,message_sid

```

_Every Twilio user Googles error codes. Bundling the explanation with the count removes a constant context-switch._

```bash

twilio-pp-cli error-code-explain --since 7d --json

```

Agent-native plumbing

_Without freshness UX every analytic command is suspect. One read tells the agent whether to call sync first._

```bash

twilio-pp-cli sync-status --json

```

_Incident triage and on-call response need a live feed of failures, not a polling shell loop. One command, no daemon._

```bash

twilio-pp-cli tail-messages --status failed --follow

```

Command Reference

2010-04-01 — Manage 2010 04 01

addresses — Manage addresses

addresses-json — Manage addresses json

applications — Manage applications

applications-json — Manage applications json

authorized-connect-apps — Manage authorized connect apps

authorized-connect-apps-json — Manage authorized connect apps json

available-phone-numbers — Manage available phone numbers

available-phone-numbers-json — Manage available phone numbers json

balance-json — Manage balance json

calls — Manage calls

calls-json — Manage calls json

conferences — Manage conferences

conferences-json — Manage conferences json

connect-apps — Manage connect apps

connect-apps-json — Manage connect apps json

incoming-phone-numbers — Manage incoming phone numbers

incoming-phone-numbers-json — Manage incoming phone numbers json

keys — Manage keys

keys-json — Manage keys json

messages — Manage messages

messages-json — Manage messages json

notifications — Manage notifications

notifications-json — Manage notifications json

outgoing-caller-ids — Manage outgoing caller ids

outgoing-caller-ids-json — Manage outgoing caller ids json

queues — Manage queues

queues-json — Manage queues json

recordings — Manage recordings

recordings-json — Manage recordings json

signing-keys — Manage signing keys

signing-keys-json — Manage signing keys json

sip — Manage sip

sms — Manage sms

tokens-json — Manage tokens json

transcriptions — Manage transcriptions

transcriptions-json — Manage transcriptions json

usage — Manage usage

Finding the right command

When you know what you want to do but not which command does it, ask the CLI directly:

twilio-pp-cli which "<capability in your own words>"

which resolves a natural-language capability query to the best matching command from this CLI's curated feature index. Exit code 0 means at least one match; exit code 2 means no confident match — fall back to --help or use a narrower query.

Recipes

Weekly delivery-failure report

twilio-pp-cli delivery-failures --since 7d --json --select error_code,to_country,count,cost_total

Runs the failure aggregation against the local store, narrows the response to the four fields that matter so an agent can summarise without parsing 4000 raw rows.

Last-month agency billing CSV

twilio-pp-cli subaccount-spend --period last-month --csv > march-billing.csv

Walks every subaccount, calls usage/records per subaccount, pivots categories to columns, writes one wide CSV the finance team can paste straight into a spreadsheet.

On-call call-trace from a Slack page

twilio-pp-cli call-trace CAxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --json --select call.status,call.duration,recordings,transcriptions.text

Single command for the full Call → Recording → Transcription chain. Use --select with dotted paths to keep the response small enough that an agent can summarise it in a Slack reply.

Quarterly TCPA opt-out audit

twilio-pp-cli opt-out-violations --since 90d --csv > q1-opt-out-audit.csv

Local temporal join finds inbound STOP/UNSUBSCRIBE messages and any subsequent outbound messages to the same number — the report compliance teams pay legal teams to construct manually today.

Find idle numbers wasting money

twilio-pp-cli idle-numbers --since 30d --json --select phone_number,friendly_name,monthly_cost,last_activity

LEFT JOIN over IncomingPhoneNumbers / Messages / Calls flagging numbers with no activity in 30 days. Output is one row per number with the dollar amount being wasted per month.

Auth Setup

Twilio uses HTTP Basic auth. You can authenticate with your Account SID (AC...) plus your Auth Token, OR with a scoped API Key SID (SK...) plus its Secret. The Account SID is always required because it is part of the URL path. Run twilio-pp-cli doctor to verify your credentials, detect whether the key is master or scoped, and warn on parent/subaccount mismatches.

Run twilio-pp-cli doctor to verify setup.

Agent Mode

Add --agent to any command. Expands to: --json --compact --no-input --no-color --yes.

```bash

twilio-pp-cli 2010-04-01 create-account --agent --select id,name,status

```

Response envelope

Commands that read from the local store or the API wrap output in a provenance envelope:

{
  "meta": {"source": "live" | "local", "synced_at": "...", "reason": "..."},
  "results": <data>
}

Parse .results for data and .meta.source to know whether it's live or local. A human-readable N results (live) summary is printed to stderr only when stdout is a terminal — piped/agent consumers get pure JSON on stdout.

Agent Feedback

When you (or the agent) notice something off about this CLI, record it:

twilio-pp-cli feedback "the --since flag is inclusive but docs say exclusive"
twilio-pp-cli feedback --stdin < notes.txt
twilio-pp-cli feedback list --json --limit 10

Entries are stored locally at ~/.twilio-pp-cli/feedback.jsonl. They are never POSTed unless TWILIO_FEEDBACK_ENDPOINT is set AND either --send is passed or TWILIO_FEEDBACK_AUTO_SEND=true. Default behavior is local-only.

Write what surprised you, not a bug report. Short, specific, one line: that is the part that compounds.

Output Delivery

Every command accepts --deliver <sink>. The output goes to the named sink in addition to (or instead of) stdout, so agents can route command results without hand-piping. Three sinks are supported:

| Sink | Effect |

|------|--------|

| stdout | Default; write to stdout only |

| file:<path> | Atomically write output to <path> (tmp + rename) |

| webhook:<url> | POST the output body to the URL (application/json or application/x-ndjson when --compact) |

Unknown schemes are refused with a structured error naming the supported set. Webhook failures return non-zero and log the URL + HTTP status on stderr.

Named Profiles

A profile is a saved set of flag values, reused across invocations. Use it when a scheduled agent calls the same command every run with the same configuration - HeyGen's "Beacon" pattern.

twilio-pp-cli profile save briefing --json
twilio-pp-cli --profile briefing 2010-04-01 create-account
twilio-pp-cli profile list --json
twilio-pp-cli profile show briefing
twilio-pp-cli profile delete briefing --yes

Explicit flags always win over profile values; profile values win over defaults. agent-context lists all available profiles under available_profiles so introspecting agents discover them at runtime.

Exit Codes

| Code | Meaning |

|------|---------|

| 0 | Success |

| 2 | Usage error (wrong arguments) |

| 3 | Resource not found |

| 4 | Authentication required |

| 5 | API error (upstream issue) |

| 7 | Rate limited (wait and retry) |

| 10 | Config error |

Argument Parsing

Parse $ARGUMENTS:

  1. Empty, help, or --help → show twilio-pp-cli --help output
  2. Starts with install → ends with mcp → MCP installation; otherwise → see Prerequisites above
  3. Anything else → Direct Use (execute as CLI command with --agent)

MCP Server Installation

  1. Install the MCP server:

```bash

go install github.com/mvanhorn/printing-press-library/library/social-and-messaging/twilio/cmd/twilio-pp-mcp@latest

```

  1. Register with Claude Code:

```bash

claude mcp add twilio-pp-mcp -- twilio-pp-mcp

```

  1. Verify: claude mcp list

Direct Use

  1. Check if installed: which twilio-pp-cli

If not found, offer to install (see Prerequisites at the top of this skill).

  1. Match the user query to the best command from the Unique Capabilities and Command Reference above.
  2. Execute with the --agent flag:

```bash

twilio-pp-cli <command> [subcommand] [args] --agent

```

  1. If ambiguous, drill into subcommand help: twilio-pp-cli <command> --help.
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.