Command
nylas webhook create
Create a webhook for real-time event notifications.
Written by Qasim Muhammad Staff SRE
What does nylas webhook create do?
The nylas webhook create command registers a URL to receive real-time notifications when email, calendar, or contact events occur. Specify trigger types like message.created, event.updated, or contact.deleted. Webhooks fire within seconds of the event, replacing polling-based sync. Real-time delivery for agent account inboxes also runs through this command — replaces the deprecated nylas inbound monitor.
Usage
nylas webhook create --url URL --triggers TRIGGERSFlags
| Flag | Description |
|---|---|
| --json | Output as JSON |
| --no-color | Disable color output |
| --verbose(-v) | Enable verbose output |
| --config | Custom config file path |
| --help(-h) | Show help for the command |
| --limit | Limit results (most list commands) |
| --yes(-y) | Skip confirmations |
| --url | Webhook URL |
| --triggers | Comma-separated trigger types |
| --description(-d) | Webhook description |
| --notify(-n) | Notification email addresses |
Examples
Create webhook
nylas webhook create --url https://yourserver.com/webhook --triggers "message.created,event.updated"Subscribe to inbound mail for an agent account
nylas webhook create --url https://example.com/hook --triggers message.createdExample output
✓ Webhook created (webhook_abc123)
URL: https://example.com/webhooks
Triggers: message.created, event.created
Status: active
Save the signing secret shown above — it is only displayed once.Troubleshooting
Migrating from nylas inbound monitor
Use nylas webhook create --triggers message.created to subscribe to real-time inbound events. There is no agent equivalent of the streaming-to-terminal mode; expose a local tunnel (cloudflared, ngrok) and point --url at it for development.
Recommended guides
Build a Mastra Email Agent
Give a Mastra TypeScript agent email by wrapping the Nylas CLI as a createTool — one subprocess call, JSON in and out, across Gmail, Outlook, and more.
Send OTP and 2FA Codes by Email
Generate a cryptographically secure one-time code and send it by email from the terminal — no SMTP. Test the full round trip and learn email OTP's limits.
Build a Transactional Email Agent
Send receipts, confirmations, and alerts from a dedicated agent account — DKIM-signed, idempotent, and rate-capped by a workspace policy, no SMTP relay.
Trigger Agents on Inbound Email with Webhooks
Replace cron polling with webhooks: register a message.created hook so your agent account wakes the agent the instant mail arrives, signature-verified.
Build an Email Digest Agent
Send an opt-in digest to a subscriber group from an agent account — resolve the recipient list from contacts, honor unsubscribes, and send on a schedule.
Migrate from SMTP to Agent Accounts
Move an agent's email off a self-hosted SMTP server: map sends to one CLI command, replace your MX with managed inbound, and cut over with a safety net.
Run nylas webhook create --help for full help output.