Pp sendgrid

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

Pp sendgrid is an AI agent skill from the GitHub repository mvanhorn/printing-press-library. Every Twilio SendGrid endpoint, plus offline suppression diffs, stats time-series rollups, and a template-variable... Trigger phrases: `send transactional mail`, `manage SendGrid suppressions`, `audit SendGrid bounces`, `SendGrid templates lint`, `SendGrid stats rollup`, `use sendgrid`, `run sendgri

How to use this skill

Skill file

<!-- GENERATED FILE — DO NOT EDIT.

This file is a verbatim mirror of library/productivity/sendgrid/SKILL.md,

regenerated post-merge by tools/generate-skills/. Hand-edits here are

silently overwritten on the next regen. Edit the library/ source instead.

See the repository agent guide, section "Generated artifacts: registry.json, cli-skills/". -->

Twilio SendGrid — Printing Press CLI

Prerequisites: Install the CLI

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

```

  1. Verify: sendgrid-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/productivity/sendgrid/cmd/sendgrid-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

Use sendgrid-pp-cli for any SendGrid task an agent or operator wants to run from the terminal: transactional mail sends, suppression hygiene, contact list mirror, marketing campaign post-mortems, deliverability stats reporting, template management, and subuser rollups. It is the right choice when the workflow needs cross-endpoint joins (bounce investigations) or offline analysis (stats rollups, diffs) that the live API alone cannot produce.

Unique Capabilities

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

Local state that compounds

_When you need to reconcile SendGrid's suppression list with another system without writing custom glue code per suppression type._

```bash

sendgrid-pp-cli suppression sync --from internal-suppressions.csv --apply --dry-run --json

```

_When auditing CRM ↔ SendGrid drift before a cleanup pass or migration._

```bash

sendgrid-pp-cli suppression diff bounces --against crm-export.csv --json

```

_Use for trend reporting and weekly deliverability standups without paying for paid analytics._

```bash

sendgrid-pp-cli stats rollup --by week --metric opens,clicks --window 90d --json

```

_Use during template review to see exactly what changed between draft versions._

```bash

sendgrid-pp-cli templates diff d-abc123 v1 v2

```

Pre-flight checks the API skips

_Use before any production send to catch silently-empty template variables that would otherwise ship as blanks._

```bash

sendgrid-pp-cli templates lint d-abc123 --against '{"first_name":"Sam"}' --json

```

Cross-endpoint joins

_When a customer reports they aren't getting emails and you need a fast root cause._

```bash

sendgrid-pp-cli bounce why user@example.com --json

```

_Use for tenant-level deliverability reporting when you run subusers and need per-tenant numbers in one view._

```bash

sendgrid-pp-cli subusers rollup --metric reputation,bounces --window 30d --json

```

Rate-aware streaming

_Use during a deliverability incident to watch events as they happen without tripping the rate limit._

```bash

sendgrid-pp-cli activity tail --filter status:bounce --json

```

Command Reference

access-settings — Manage access settings

alerts — Twilio SendGrid Alerts API.

api-keys — Twilio SendGrid API Keys API.

asm — Manage asm

browsers — Manage browsers

campaigns — Manage campaigns

categories — Twilio SendGrid Category Stats API

clients — Manage clients

contactdb — Manage contactdb

designs — Twilio SendGrid Marketing Campaigns Designs API

devices — Manage devices

engagementquality — Manage engagementquality

geo — Manage geo

ips — Manage ips

logs — Manage logs

mail — Manage mail

mail-settings — Twilio SendGrid Mail Settings API

mailbox-providers — Manage mailbox providers

marketing — Manage marketing

messages — Manage messages

partner-settings — Twilio SendGrid Partner Settings API

partners — Manage partners

recipients — Twilio SendGrid Legacy Marketing Campaigns Contacts: Recipients API

scopes — Twilio SendGrid Scopes API

send-ips — Manage send ips

senders — Twilio SendGrid Marketing Campaigns Senders API

sso — Manage sso

stats — Twilio SendGrid Marketing Campaigns Stats API

subusers — Twilio SendGrid Subusers API

suppression — Twilio SendGrid Suppressions API

teammates — Twilio SendGrid Teammates API

templates — Twilio SendGrid Templates API

tracking-settings — Manage tracking settings

user — Manage user

validations — Manage validations

verified-senders — Manage verified senders

whitelabel — Manage whitelabel

Finding the right command

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

sendgrid-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 deliverability standup

sendgrid-pp-cli stats rollup --by week --metric opens,clicks,bounces --window 30d --agent --select rollup.week,rollup.metric,rollup.value,rollup.wow_delta

Pull a 30-day weekly rollup as agent-native JSON with only the columns the standup needs.

Suppression hygiene cycle

sendgrid-pp-cli sync suppressions && sendgrid-pp-cli suppression diff bounces --against crm.csv --json

Refresh the local mirror, then diff against your CRM export to find addresses that escaped suppression.

Bounce root cause

sendgrid-pp-cli bounce why user@example.com --agent

Joins suppressions, activity, and stats to produce a single narrative for a single bouncing address.

Template pre-flight

sendgrid-pp-cli templates lint d-abc123 --against '{"first_name":"Sam","order_id":"ord_42"}' --json

Catch missing Handlebars variables before triggering a production send.

Auth Setup

sendgrid-pp-cli reads SENDGRID_API_KEY (Bearer token) from the environment. Use a restricted key for read-only auditing or a full-access key for sends. Subuser impersonation via the on-behalf-of header is supported on admin endpoints (mail/send excluded by SendGrid policy).

Run sendgrid-pp-cli doctor to verify setup.

Agent Mode

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

```bash

sendgrid-pp-cli alerts list --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 AND no machine-format flag (--json, --csv, --compact, --quiet, --plain, --select) is set — piped/agent consumers and explicit-format runs get pure JSON on stdout.

Agent Feedback

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

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

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

sendgrid-pp-cli profile save briefing --json
sendgrid-pp-cli --profile briefing alerts list
sendgrid-pp-cli profile list --json
sendgrid-pp-cli profile show briefing
sendgrid-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 sendgrid-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

Install the MCP binary from this CLI's published public-library entry or pre-built release, then register it:

claude mcp add sendgrid-pp-mcp -- sendgrid-pp-mcp

Verify: claude mcp list

Direct Use

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

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

```

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