Customer io

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

Customer io is an AI agent skill from the GitHub repository mvanhorn/printing-press-library. Every Customer.io action a marketer or ops engineer takes — campaigns, broadcasts, segments, deliveries, exports, suppressions, Reverse-ETL — wrapped in named verbs, backed by a local SQLite cache, and served through a bundled MCP server. Trigger phrases: `use customer-io`, `run customer-io`, `trigg

How to use this skill

Skill file

Customer.io — Printing Press CLI

Prerequisites: Install the CLI

This skill drives the customer-io-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 customer-io --cli-only

```

  1. Verify: customer-io-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/marketing/customer-io/cmd/customer-io-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 you need to do anything in Customer.io that's tedious in the web UI: bulk suppressions with an audit trail, journey funnels cross-cut by segment, customer-360 timelines for incident triage, broadcast pre-flight before a high-stakes send, or Reverse-ETL health checks. It is also the right tool when an agent needs to drive Customer.io — the bundled MCP server exposes the same verbs over stdio and HTTP transports. For raw event ingestion (the Track API) or per-source CDP write keys, prefer one of the official server-side SDKs.

Unique Capabilities

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

Local state that compounds

_Reach for this when an agent is asked 'what fraction of segment X completed journey Y' — the answer is one query against synced data, not two exports and a spreadsheet._

```bash

customer-io campaigns funnel cmp_482 --segment seg_19 --since 30d --json

```

_Use when validating audience design — 'are my churned-risk and high-value segments overlapping?' — without exporting twice._

```bash

customer-io segments overlap seg_19 seg_42 seg_88 --json

```

_Reach for this on incident triage or 'did the welcome SMS go out to this user?' — one command instead of a UI scroll-fest._

```bash

customer-io customers timeline alice@example.com --since 30d --json

```

Send-time safety

_Use before any broadcast to avoid double-sending, accidental over-mailing, or 429 storms._

```bash

customer-io broadcasts preflight 123457 bcr_77 --segment seg_19 --json

```

_Use when an ops engineer needs to explain why a customer is suppressed, or when auditing complaint-driven churn._

```bash

customer-io suppressions audit --since 30d --reason bounce --json

```

_Use as the daily standup question 'are warehouse syncs healthy?' — replaces three separate api calls + jq filters._

```bash

customer-io cdp-reverse-etl health --since 24h --watch

```

Audit and provenance

_Use for compliance-driven bulk actions where you need to defend later 'who got suppressed when, by whom, with what status code'._

```bash

customer-io suppressions bulk add --from-csv complaints.csv --reason complaint --dry-run

```

_Pipe the bundle into Claude or a Notion doc for one-shot incident handoff; replaces 30+ minutes of UI scrolling._

```bash

customer-io deliveries triage --template tx_91 --status bounced --since 1h --bundle ./incident-2026-05-07

```

Command Reference

broadcasts — List, inspect, and trigger one-off broadcasts (1 req / 10 s rate-limited)

campaigns — List campaigns and read campaign + journey metrics

cdp_destinations — List CDP destinations (Premium feature)

cdp_reverse_etl — List Reverse-ETL syncs (Premium feature)

cdp_sources — List CDP data sources (Premium feature)

customers — Manage Customer.io customer profiles within an environment (workspace)

deliveries — Inspect delivery events (sends, opens, clicks, bounces, complaints)

exports — Start, monitor, and download data exports (segment members, deliveries, customers, etc.)

segments — List segments and inspect segment membership

suppressions — Suppress and unsuppress customers; the official audit surface for compliance actions

transactional — Inspect transactional templates and metrics

webhooks — Manage Reporting Webhooks for delivery + engagement events

workspaces — List the environments (workspaces) visible to the Service Account

Finding the right command

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

customer-io-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

Find which high-value customers haven't engaged with the welcome journey

customer-io campaigns funnel cmp_welcome --segment seg_high_value --since 90d --agent --select steps.delivered.count,steps.opened.count,steps.clicked.count,non_engaged.recipients

The funnel command joins synced deliveries with segment members; --agent + --select narrows the deeply-nested funnel response to just the counts and the non-engaged recipient list, keeping the agent's context lean.

Draft an incident bundle for a transactional bounce spike

customer-io deliveries triage --template tx_password_reset --status bounced --since 2h --bundle ./incident-bounce-2026-05-07

Writes summary.md with grouped error reasons, deliveries.jsonl with full delivery objects, and recipients.txt — paste-ready for a Notion incident doc or a Claude summarize prompt.

Prove that a broadcast is safe to trigger

customer-io broadcasts preflight bcr_summer_promo --segment seg_active_30d --json

Returns a green/yellow/red verdict with structured reasons (segment size, suppression overlap, last-sent recency from synced deliveries). Run before every broadcast at non-trivial scale.

Bulk-suppress a complaint list with provenance

customer-io suppressions bulk add --from-csv complaints-2026-05.csv --reason complaint --dry-run

Drop --dry-run to commit. Every call lands in ~/.customer-io/audit/suppressions-2026-05-07.jsonl with timestamp, recipient, status, and HTTP code — defensible later.

Watch Reverse-ETL syncs in real time

customer-io cdp-reverse-etl health --watch --since 24h

Polls every 60 s and prints a status row per sync; pipe to tee to keep a log.

Auth Setup

Customer.io uses Service Account tokens (sa_live_* prefix). The CLI exchanges the token for a short-lived JWT via the OAuth client-credentials endpoint at https://us.fly.customer.io/v1/service_accounts/oauth/token (or eu.fly.customer.io for EU workspaces) and uses the JWT as the Bearer for both the Journeys UI API (/v1/...) and the CDP control plane (/cdp/api/...). Run customer-io auth login --sa-token $CIO_TOKEN --region us once; the cached JWT auto-refreshes. The Track API (separate Site ID + API Key auth) is intentionally out of scope for v1 — the SA token is the unified credential.

Run customer-io-pp-cli doctor to verify setup.

Agent Mode

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

```bash

customer-io-pp-cli broadcasts list mock-value --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:

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

Entries are stored locally at ~/.customer-io-pp-cli/feedback.jsonl. They are never POSTed unless CUSTOMER_IO_FEEDBACK_ENDPOINT is set AND either --send is passed or CUSTOMER_IO_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.

customer-io-pp-cli profile save briefing --json
customer-io-pp-cli --profile briefing broadcasts list mock-value
customer-io-pp-cli profile list --json
customer-io-pp-cli profile show briefing
customer-io-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 customer-io-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/other/customer-io/cmd/customer-io-pp-mcp@latest

```

  1. Register with Claude Code:

```bash

claude mcp add customer-io-pp-mcp -- customer-io-pp-mcp

```

  1. Verify: claude mcp list

Direct Use

  1. Check if installed: which customer-io-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

customer-io-pp-cli <command> [subcommand] [args] --agent

```

  1. If ambiguous, drill into subcommand help: customer-io-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.