Nylas

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

Nylas is an AI agent skill from the GitHub repository mvanhorn/printing-press-library. Every Nylas API, plus a local SQLite mirror, cross-grant search, and confirm-by-hash sending no other Nylas tool has. Trigger phrases: `search my Nylas inbox across all grants`, `what changed in Nylas in the last 2 hours`, `first-response time on my Nylas threads`, `replay a Nylas webhook locally`,

How to use this skill

Skill file

Nylas — Printing Press CLI

Prerequisites: Install the CLI

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

```

  1. Verify: nylas-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/nylas/cmd/nylas-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 nylas-pp-cli when you need to query Nylas data across multiple grants, run repeat 'what changed since' polls cheaply, compose SQL over messages and events, or sample the wire payload of a send before it goes out. For pure single-call API parity with the official SDK, the official nylas-cli is also a fine choice.

Unique Capabilities

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

Local state that compounds

_Reach for this when an agent needs to answer questions repeatedly without burning rate-limit on every call._

```bash

nylas-pp-cli sync --resources messages,events --since 24h --agent

```

_Cheapest path to 'what changed' polling without API round-trips._

```bash

nylas-pp-cli since 2h --resource messages --agent --select id,subject,from,grant_id

```

_Use this to find references anywhere across a tenant without N separate searches._

```bash

nylas-pp-cli search "invoice overdue" --type messages --limit 50 --agent

```

_Pipe Nylas data into duckdb or a notebook in one command._

```bash

nylas-pp-cli export --resource messages --since 90d --format ndjson

```

Cross-grant analytics

_Surfaces 'who actually matters to this tenant' in one call for CRM hygiene or agent prioritisation._

```bash

nylas-pp-cli gravity --top 25 --since 90d --agent

```

_An SLA dashboard in one command, impossible against the live API in under five minutes of round-trips._

```bash

nylas-pp-cli response-time --group-by domain --since 30d --agent

```

Reliability & safety

_Reproduce a production webhook bug in seconds without waiting for the next event to fire._

```bash

nylas-pp-cli webhook-replay --since 24h --trigger message.created --to http://localhost:3000/hook

```

_Every destructive action is reviewable; an agent can show the payload before sending._

```bash

nylas-pp-cli grants messages send 550e8400-e29b-41d4-a716-446655440000 --to PII_EMAIL_EXAMPLE --body 'note' --dry-run

nylas-pp-cli grants messages send 550e8400-e29b-41d4-a716-446655440000 --to PII_EMAIL_EXAMPLE --body 'note' --yes

```

_Safe to call inside an agent retry loop._

```bash

nylas-pp-cli grants messages send 550e8400-e29b-41d4-a716-446655440000 --to PII_EMAIL_EXAMPLE --body 'note' --idempotent --agent

```

_Tells you which mailboxes are quietly broken before users notice._

```bash

nylas-pp-cli grants doctor --agent

```

Agent-native plumbing

_Anything we forgot to expose as a verb, an LLM can still answer through SQL._

```bash

nylas-pp-cli sql "SELECT from_addr, COUNT(*) FROM messages GROUP BY 1 ORDER BY 2 DESC LIMIT 20" --agent

```

_One flag flips the entire CLI into LLM-safe mode; eliminates a class of prompt-eats-stdin bugs._

```bash

nylas-pp-cli grants get-all --agent --limit 10

```

Command Reference

admin — Manage admin

applications — In the context of the Nylas APIs, an "application" is the object record of your Nylas application.

<div id="admonition-info">🔍 <b>The term "application" can refer to any of three concepts</b>: your Nylas application, the project you're building ("your application" or "your app"), and applications that you use to connect to service providers ("provider auth applications"). We try to be specific in this documentation to avoid confusion. The API endpoints described here are for working with your Nylas application, specifically.</div>

The Nylas application is the central resource for your Nylas implementation. It collects the connectors that you use to store information about third party services that your application connects to, and stores the grants that you create when using connectors.

Nylas applications also allow you to define your specific branding, change the look and feel of the Nylas Hosted authentication flow, and list your application's callback URIs.

Application callback URIs

Your Nylas application includes a list of allowed callback URIs. These are known URIs that Nylas can direct users to after authentication. You need to define at least _one_ callback URI so your users can complete the auth flow.

You must include any callback URIs you plan to use in this list. If an auth payload includes a callback URI that isn't on the list, the whole authentication flow fails.

Application limitations

<div id="admonition-warning">⚠️ <b>You can create, edit, and delete applications from the Nylas Dashboard</b>. You <i>cannot</i> create, edit, or delete them using the Nylas APIs.</div>

Keep the following limitations in mind as you work with Nylas applications:

calendars — The Nylas Calendar API allows you to create and manage calendars, and access the events they contain. Nylas uses the same commands to manage calendars across providers, and you can refer to specific calendars using the provider's calendar_id.

Depending on the provider, a calendar might be accessed by only one person, or shared among several users. Some common calendars might include Personal, Work, or Shared calendars.

A calendar might contain overlapping events or conflicting schedules. You can use the Get Availability endpoint to find the best time for an event by identifying time periods that have no conflicting events among all participants.

Find a calendar ID

You must specify a calendar_id in all calls you make to the Nylas Calendar API. You can use primary to specify the primary calendar associated with a grant, or you can look up the ID of the calendar that you want to work with and use that.

For virtual calendars, the primary calendar is the first created for a virtual account. You _cannot_ delete a virtual calendar that's designated as primary.

For iCloud, there is no primary calendar.

Free/Busy information

The Get Free/Busy Schedule endpoint is available for all providers, including Virtual Calendars, except for iCloud.

The Get Availability endpoint doesn't support the free_busy object.

Virtual calendars

Nylas allows you to create virtual calendars for users and resources that might not have calendars on your providers (for example, external contractors or meeting rooms). You can use the Nylas Calendar and Events APIs with the virtual accounts that power virtual calendars, just like you would any other account. Virtual accounts don't provide email or contacts features, so you can't use them with the Email or Contacts APIs.

For more information, see Using virtual calendars.

Metadata on calendars

You can add metadata to new and existing calendars by including the metadata sub-object in your POST, PUT, or PATCH request. For more information, see the Metadata documentation.

Calendar scopes

The table below lists the Calendar endpoints and which scopes they require. The table shortens the full scope URI for space reasons, so add the prefix for the provider when requesting scopes.

The ☑️ in each column indicates the most restrictive scope you can request for each provider and still use that API. More permissive scopes appear under the minimum option. If you're already using one of the permissive scopes, you don't need to add the more restrictive scope.

| Endpoint | Google Scopes</br>https://www.googleapis.com/auth/... | Microsoft Scopes</br>https://graph.microsoft.com/... |

| :------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------ | :----------------------------------------------------- |

| GET /calendars</br>GET /calendars/<CALENDAR_ID></br>POST /calendars/free-busy</br>POST /calendars/availability | /calendar.readonly ☑️</br>/calendar | Calendars.Read ☑️</br>Calendars.ReadWrite |

| POST /calendars</br>PUT /calendars/<CALENDAR_ID></br>DELETE /calendars/<CALENDAR_ID> | /calendar ☑️ | Calendars.ReadWrite ☑️ |

For more information about scopes, see Using scopes to request user data.

Calendar activity notifications

You can subscribe to the following triggers so Nylas notifies you about changes to your users' calendar data:

For more information, see the Calendar webhook notification schemas.

Microsoft event considerations

Microsoft Outlook events are often shared across all calendars in a user's account. If the user creates an event on one of their calendars, you can retrieve it using another calendar ID from their grant.

channels — Manage channels

connect — Manage connect

connectors — Manage connectors

domains — Manage domains

grants — Manage grants

lists — The Lists endpoints let you manage typed collections of values (email addresses, domains, or top-level domains) that can be referenced by Rules using the in_list condition operator. Lists provide a way to maintain dynamic allow lists and block lists that are evaluated during inbound rule processing and outbound send evaluation without needing to update individual rules.

Each list has a type that determines what kind of values it accepts and which rule condition fields it can be matched against:

List type is set at creation time and cannot be changed. Items within a list are managed via the /v3/lists/{list_id}/items sub-resource endpoints. Values are automatically normalized (lowercased and trimmed) and validated against the list's type. Duplicate additions are silently ignored.

migration-tools — Manage migration tools

notetakers — Nylas Notetaker is a real-time meeting bot that you can invite to your online meetings. It records and transcribes your discussion, and delivers results to you using the Nylas API and webhook notifications.

The CODE0 endpoints let you interact with Nylas Notetaker while referencing a specific grant so you can use Notetaker's calendar sync features for your authenticated users.

The CODE0 endpoints let you send Notetakers that aren't connected to a grant as standalone Notetakers.

Calendar sync

Notetaker works with the Nylas Calendar API to automatically sync with calendars and events. When you sync Notetaker with a grant's calendar or event, Nylas tracks their join times and meeting links so the Notetaker is always sent to the meeting on time.

Webhook notifications

Nylas sends webhook notifications when a Notetaker bot is created, updated, or deleted, and when the recording media is available.

policies — The Policies endpoints let you define the operational configuration for Nylas Agent Accounts, including message limits, attachment constraints, spam detection settings, and linked rules for inbound message filtering. Each policy is scoped to your application and can be assigned to one or more Agent Accounts.

Policies let you control:

Policy limits are validated against your plan's maximum values. If a limit field is omitted, it defaults to the plan maximum. If a requested value exceeds the plan limit, the API returns an error.

providers — Manage providers

rules — The Rules endpoints let you define automated filtering and routing logic for Nylas Agent Accounts. Each rule specifies a trigger (inbound or outbound), matching conditions, and actions to perform when those conditions are met.

Inbound rules run when mail arrives. Conditions match the sender — from.address, from.domain, or from.tld. Actions include blocking the message at the SMTP level, marking as spam, assigning to a folder, marking as read or starred, archiving, and trashing.

Outbound rules run before a send is submitted to the email provider. Conditions can match sender data (from.address, from.domain, from.tld), recipient data (recipient.address, recipient.domain, recipient.tld), or the send type via outbound.type (compose for new messages, reply for replies). A block action on an outbound rule rejects the send with HTTP 403 before it reaches the provider, so no message is delivered and no sent copy is stored. Non-blocking actions (mark_as_spam, archive, mark_as_read, mark_as_starred, assign_to_folder, trash) apply to the stored sent copy. recipient.* fields match against any recipient — including To, CC, BCC, and SMTP envelope recipients.

Inbound and outbound rules are isolated. Inbound rules never run during sends, and outbound rules never run on message receipt, so stored sent copies aren't re-evaluated against inbound rules.

Rules are evaluated in priority order (lower numbers first). Inbound rules are applied through the recipient grant's policy. Outbound rules are currently evaluated from the sending application's enabled outbound rules. The block action is terminal and cannot be combined with other actions.

Rules support the in_list condition operator, which checks field values against Lists (managed via the Lists API) for dynamic, maintainable allow and block lists. in_list works for from.* and recipient.* fields but not for outbound.type, which accepts only is and is_not.

Rule executions are audited per grant. List evaluation records with GET /v3/grants/{grant_id}/rule-evaluations to see which inbound or outbound rules ran, what normalized input was considered, and which actions were applied.

scheduling — Manage scheduling

templates — Manage templates

webhooks — Manage webhooks

workflows — Manage workflows

workspaces — Workspaces group and organize grants in a Nylas application by a common attribute, such as the email address domain (for example, nylas.com).

Assign grants to workspaces

Nylas offers two endpoints to manage workspaces and the grants they contain:

Workspace limitations

Finding the right command

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

nylas-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

Daily inbox triage across every grant

nylas-pp-cli sync --resources messages --since 24h
nylas-pp-cli since 2h --resource messages --agent --select id,subject,from,grant_id,unread | jq '.[] | select(.unread)'

Sync, then filter the mirror to the unread messages since 2h ago — answering 'what changed' from local data.

Find every reference to a topic across mailboxes

nylas-pp-cli search "renewal" --type messages --limit 100 --agent --select grant_id,subject,from,date

FTS5 full-text search across the local mirror; one query spans every connected grant.

SLA dashboard on first-response time

nylas-pp-cli response-time --group-by domain --since 30d --agent --select domain,p50,p90,n

Compute first-response latency from the local thread timeline, grouped by counterparty domain.

Safe send: preview before sending

nylas-pp-cli grants messages send 550e8400-e29b-41d4-a716-446655440000 --to PII_EMAIL_EXAMPLE --subject "Q3" --body "..." --dry-run
nylas-pp-cli grants messages send 550e8400-e29b-41d4-a716-446655440000 --to PII_EMAIL_EXAMPLE --subject "Q3" --body "..." --yes

Two-step send: --dry-run prints the wire payload without calling the API; re-run with --yes to actually send.

Replay a production webhook locally

nylas-pp-cli webhook-replay --since 24h --trigger message.created --to http://localhost:3000/hook

Re-fires every persisted message.created delivery from the last day into your local handler — no production wait required.

Auth Setup

Nylas V3 uses a bearer API key (Authorization: Bearer <NYLAS_API_KEY>) for application-level access to every grant. Set NYLAS_API_KEY in your environment or run nylas-pp-cli auth set-token. For per-user OAuth flows, NYLAS_ACCESS_TOKEN is also supported. The grant_id for each connected mailbox is a path parameter on every per-grant endpoint, not an auth header.

Run nylas-pp-cli doctor to verify setup.

Agent Mode

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

```bash

nylas-pp-cli applications get --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:

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

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

nylas-pp-cli profile save briefing --json
nylas-pp-cli --profile briefing applications get
nylas-pp-cli profile list --json
nylas-pp-cli profile show briefing
nylas-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.

Async Jobs

For endpoints that submit long-running work, the generator detects the submit-then-poll pattern (a job_id/task_id/operation_id field in the response plus a sibling status endpoint) and wires up three extra flags on the submitting command:

| Flag | Purpose |

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

| --wait | Block until the job reaches a terminal status instead of returning the job ID immediately |

| --wait-timeout | Maximum wait duration (default 10m, 0 means no timeout) |

| --wait-interval | Initial poll interval (default 2s; grows with exponential backoff up to 30s) |

Use async submission without --wait when you want to fire-and-forget; use --wait when you want one command to return the finished artifact.

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 nylas-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 nylas-pp-mcp -- nylas-pp-mcp

Verify: claude mcp list

Direct Use

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

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

```

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