workflows

A command-line tool for managing Nylas workflows, which connect booking events to hosted email templates. It also includes commands for viewing, changing, deleting, and testing these workflows, plus extracting one-time codes from email.

In plain words
What is it for?
Use it to create and manage application- or grant-level workflows, connect booking events to templates, preview rendered emails, and retrieve OTP codes from incoming messages.
Why use it?
It removes the need to manage these booking-to-email automations through separate manual API requests. It helps verify that a template renders correctly before sending it.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/nylas/cli/workflows
Clone the repo
git clone --depth 1 https://github.com/nylas/cli
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,642 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 3 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.03642
Opus 5 $0.00000 $0.01821
Sonnet 5 $0.00000 $0.00728
Haiku 4.5 $0.00000 $0.00364

Measured yesterday against content hash 4945ce1de0a5, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade B, and why

workflows scanned grade B with 3 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Sends data to an external URLmediumData exfiltration

A POST to an outside endpoint may be telemetry or may be exfiltration; either way the mod talks to somewhere, and you should know where.

curl -X POST "$SERVICE_URL/request-otp" -d "email=$USERNAME"

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

curl -X POST "$SERVICE_URL/request-otp" -d "email=$USERNAME"

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

result = subprocess.run(
docs/commands/workflows.md · 647 lines

How it starts

The opening of the file, as written. The whole thing — 647 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Hosted Workflows

Manage API-backed workflows that connect booking events to hosted templates.

nylas workflow list
nylas workflow create --name "Booking Confirmation" --template-id tpl_123 --trigger-event booking.created
nylas workflow show <workflow-id>
nylas workflow update <workflow-id> --disabled
nylas workflow delete <workflow-id> --yes

Scopes:

  • --scope app for application-level workflows
  • --scope grant --grant-id <id> for grant-level workflows

Typical flow:

  1. Create a hosted template with nylas template create
  2. Create a workflow that points at that template with nylas workflow create
  3. Verify the rendered email with nylas email send --template-id ... --render-only

Advanced Automation Workflows

Complex automation workflows and integration patterns that span multiple Nylas CLI commands.


OTP Extraction

Extract OTP codes from emails:

# Get latest OTP
nylas otp get

# Get OTP from specific service
nylas otp get --from "[email protected]"

# Watch for OTP (poll every 5 seconds)
while true; do
  otp=$(nylas otp get)
  if [ -n "$otp" ]; then
    echo "OTP received: $otp"
    echo "$otp" | pbcopy  # Copy to clipboard (macOS)
    break
  fi
  sleep 5
done

Automated login with OTP:

#!/bin/bash
# auto-login-with-otp.sh

SERVICE_URL="https://app.example.com/login"
USERNAME="[email protected]"

# Step 1: Request OTP
curl -X POST "$SERVICE_URL/request-otp" -d "email=$USERNAME"
echo "OTP requested. Waiting for email..."

# Step 2: Wait and extract OTP
sleep 10
OTP=$(nylas otp get --from "[email protected]")

if [ -z "$OTP" ]; then
  echo "Failed to receive OTP"
  exit 1
fi

# Step 3: Login with OTP
curl -X POST "$SERVICE_URL/login" -d "email=$USERNAME&otp=$OTP"
echo "Login successful!"

OTP monitoring service (Python):

#!/usr/bin/env python3
# otp-monitor.py

import subprocess
import time
import re

def get_latest_otp():
    """Get OTP using Nylas CLI"""
    result = subprocess.run(
        ['nylas', 'otp', 'get'],
        capture_output=True,
        text=True
    )

    if result.returncode == 0:
        match = re.search(r'\b\d{6}\b', result.stdout)
        if match:
            return match.group(0)
    return None

def monitor_otp(callback, timeout=60):
    """Monitor for OTP and call callback when received"""
    start_time = time.time()

    while time.time() - start_time < timeout:
        otp = get_latest_otp()
        if otp:
            callback(otp)
            return True
        time.sleep(5)

    return False

if __name__ == '__main__':
    print("Monitoring for OTP...")
    success = monitor_otp(lambda code: print(f"OTP: {code}"), timeout=120)
    if not success:
        print("Timeout waiting for OTP")

Read the full file on GitHub · 647 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 647 lines · 0 tokens per session scan B 4945ce1de0a5

Subscribe to this mod's changes

workflows is a command published in the GitHub repository nylas/cli (68 stars, last pushed 13d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 3,642 tokens. A static security scan graded it B with 3 findings (sends data to an external url, makes network calls, runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.