Guide
Install the OpenClaw Nylas Plugin
Install @nylas/openclaw-nylas-plugin to give OpenClaw native email, calendar, and contact tools with typed schemas, API-key auth, grant discovery, and no exec approvals.
Written by Qasim Muhammad Staff SRE
Reviewed by Hazik
What is the OpenClaw Nylas Plugin?
The @nylas/openclaw-nylas-plugin package is an npm-based plugin for OpenClaw that provides native tool schemas for email, calendar, and contacts. Instead of using OpenClaw's exec tool to run shell commands (as covered in the CLI exec guide), the plugin registers typed tools directly with the agent.
This means the agent calls tools like nylas_list_emails and nylas_send_email with structured parameters and gets JSON responses back — no command construction, no output parsing, and no exec-approvals.json.
Key advantages over the exec approach:
- Typed tool schemas — the agent sees parameter names, types, and descriptions, reducing errors
- Auto-discovery — the plugin finds all grants associated with your API key automatically
- Multi-account — work with multiple email accounts using named grants
- No shell security config — no exec-approvals.json, no PATH setup, no allowlists
- Works with OpenClaw, Moltbot, and Clawdbot
Prerequisites
- OpenClaw installed and running. See the existing guide for setup instructions.
- Nylas dashboard account — sign up at dashboard-v3.nylas.com if you don't have one.
- Nylas API key — create one in the dashboard under Settings → API Keys.
- At least one grant — connect an email account (Gmail, Outlook, Exchange, Yahoo, iCloud, or IMAP) in the dashboard under Grants.
1. Install the plugin
OpenClaw has a built-in plugin manager. Install the package directly:
openclaw plugins install @nylas/openclaw-nylas-pluginThis downloads the package from npm and registers it with OpenClaw in under 30 seconds. After installation, restart the gateway so the new plugin is loaded.
Verify the installation:
openclaw plugins list
openclaw gateway restartYou should see @nylas/openclaw-nylas-plugin in the output.
Newer OpenClaw versions sandbox plugins by default. Trust the plugin and expose its tools to agent sessions before configuring credentials:
# Trust the plugin and expose its tools to agent sessions
openclaw config set 'plugins.allow' '["nylas"]'
openclaw config set 'tools.alsoAllow' '["nylas"]'Skip this on older OpenClaw releases that allow all installed plugins by default — the config keys are no-ops if the runtime does not enforce them.
2. Configure your API key
The plugin needs your Nylas API key to authenticate. Set it via OpenClaw's config:
openclaw config set 'plugins.entries.nylas.config.apiKey' 'YOUR_NYLAS_API_KEY'
openclaw gateway restartAlternatively, set the NYLAS_API_KEY environment variable in your shell profile or OpenClaw's environment config.
If you want named multi-account aliases instead of relying on auto-discovery, configure them explicitly:
openclaw config set 'plugins.entries.nylas.config.grants' '{"work":"grant-id-1","personal":"grant-id-2"}'
openclaw gateway restart3. Verify it works
Verify the plugin is loaded and can see your connected accounts:
# Check the plugin is loaded
openclaw plugins list
# Verify grant discovery through the plugin
openclaw run "List my connected email accounts" --plugin nylasThe plugin auto-discovers grants linked to your API key at startup. If you add grants later, restart the gateway before verifying again.
4. What tools does the plugin provide?
Once installed, the plugin registers 16 native tools across four domains — email, calendar, contacts, and grant discovery:
Email tools
| Tool | Description |
|---|---|
nylas_list_emails | List recent messages with optional filters |
nylas_get_email | Read a specific message by ID |
nylas_send_email | Send an email |
nylas_create_draft | Create a draft message |
nylas_list_threads | List email threads |
nylas_list_folders | List mailbox folders/labels |
Calendar tools
| Tool | Description |
|---|---|
nylas_list_calendars | List all calendars |
nylas_list_events | List calendar events |
nylas_get_event | Get a specific calendar event |
nylas_create_event | Create a calendar event |
nylas_update_event | Update an existing event |
nylas_delete_event | Delete a calendar event |
nylas_check_availability | Check free/busy availability |
Contacts tools
| Tool | Description |
|---|---|
nylas_list_contacts | List contacts with optional search filters |
nylas_get_contact | Get a specific contact by ID |
Discovery tools
| Tool | Description |
|---|---|
nylas_discover_grants | Auto-discover grants connected to the configured API key |
5. Example conversations
Once the plugin is installed and configured, here are realistic prompts and the tool calls the agent makes under the hood:
Email examples
- "What are my unread emails?" — the agent calls
nylas_list_emailswith{ unread: true, limit: 20 }, then summarizes senders, subjects, and snippets. - "Find emails from Sarah about the Q4 budget" — the agent calls
nylas_list_emailswith{ query: "from:sarah Q4 budget" }, reads the matching threads, and pulls out the key points. - "Draft a reply to the latest email from Dave saying I'll review it by Friday" — the agent calls
nylas_list_emailsto find Dave's email, thennylas_create_draftwith the reply content. It shows you the draft before sending. - "Send Alice the meeting notes from yesterday" — the agent calls
nylas_list_contactswith a search query to resolve Alice's email address, composes the message, confirms with you, then callsnylas_send_email.
Calendar examples
- "What's on my calendar this week?" — the agent calls
nylas_list_eventswith start and end timestamps for the current week, then summarizes each day's schedule. - "Schedule a 30-minute meeting with bob@company.com on Tuesday at 2pm" — the agent calls
nylas_create_eventwith the title, participants, start time, and duration. It confirms the event details before creating it. - "Am I free Thursday afternoon?" — the agent calls
nylas_check_availabilityfor Thursday 12:00–18:00 and tells you which slots are open. - "Move my 3pm meeting to 4pm" — the agent calls
nylas_list_eventsto find the 3pm event, thennylas_update_eventto shift the start and end times by one hour.
Contacts examples
- "What's Sarah Chen's email address?" — the agent calls
nylas_list_contactswith{ query: "Sarah Chen" }and returns the matching contact details. - "Look up everyone from Acme Corp in my contacts" — the agent calls
nylas_list_contactswith{ query: "Acme Corp" }and lists all matching names and email addresses.
Combined workflow examples
- "Find a time to meet with alice@company.com this week and send her an invite" — the agent calls
nylas_check_availabilityto check both calendars, picks the first open slot, callsnylas_create_eventwith Alice as a participant, and confirms the invite was sent. - "Check if I have any emails from the attendees of tomorrow's standup" — the agent calls
nylas_list_eventsto find tomorrow's standup and its participants, then callsnylas_list_emailswith targeted queries for each attendee to surface recent threads. - "Email everyone in my 2pm meeting that I'll be 10 minutes late" — the agent calls
nylas_list_eventsto find the 2pm event, extracts the participant emails, composes a short message, confirms with you, then callsnylas_send_emailfor the outgoing message.
6. How do I use multiple email accounts?
If your API key has multiple grants (for example, a work Gmail and a personal Outlook account), the plugin supports named aliases. Configure the aliases in OpenClaw's config:
openclaw config set 'plugins.entries.nylas.config.grants' '{"work":"grant-id-1","personal":"grant-id-2"}'
openclaw gateway restartWith aliases configured, the plugin can target a specific account by name instead of a raw grant ID. If you do not configure aliases, the plugin auto-discovers grants from your Nylas application at startup.
The agent can then specify which account to use when calling tools. For example, "list my work emails" versus "send from my personal account."
7. Optional: Standalone usage
You can also use the plugin as a standalone npm package in your own TypeScript or JavaScript projects, outside of OpenClaw:
npm install @nylas/openclaw-nylas-pluginimport { createNylasClient } from "@nylas/openclaw-nylas-plugin"
const { client, discovered } = await createNylasClient({
apiKey: process.env.NYLAS_API_KEY!,
})
console.log(`Discovered ${discovered.length} grants`)
const emails = await client.listMessages({ limit: 5 })
console.log(emails)This is useful if you're building a custom agent with the agent tools guide pattern and want typed Nylas tools without the CLI.
8. Which approach should I choose: plugin, CLI exec, or MCP?
There are three ways to give an OpenClaw agent Nylas access. Here's how they compare:
| Feature | Plugin (this guide) | CLI exec | MCP server |
|---|---|---|---|
| Setup complexity | One command | PATH + exec-approvals | Config + running process |
| Tool schemas | Typed (auto-registered) | Text in TOOLS.md | Typed (MCP protocol) |
| Auth method | API key | CLI OAuth | CLI OAuth |
| Multi-account | Named grants | Single grant | Single grant |
| Auto-discovery | Yes | No | No |
| Shell access needed | No | Yes | No |
| Requires running process | No | No | Yes |
Recommendation: Use the plugin for the simplest setup and best multi-account support. Use the CLI exec approach if you already have the Nylas CLI authenticated and prefer OAuth-based auth. Use MCP if you need the same tools available to other MCP-compatible clients (Claude Desktop, Cursor, VS Code).
Troubleshooting
"apiKey is required"
The plugin cannot find your API key. Make sure you set it with openclaw config set 'plugins.entries.nylas.config.apiKey' or via the NYLAS_API_KEY environment variable. Check that the value is not empty:
openclaw config get 'plugins.entries.nylas.config.apiKey'"No grants found"
Your API key has no connected email accounts. Go to dashboard-v3.nylas.com → Grants and connect at least one email account. Then restart the gateway and verify the plugin again.
openclaw gateway restart
openclaw run "List my connected email accounts" --plugin nylas401 Unauthorized
The API key is invalid or expired. Generate a new one in the Nylas dashboard under Settings → API Keys and update it:
openclaw config set 'plugins.entries.nylas.config.apiKey' 'NEW_API_KEY'
openclaw gateway restart404 Not Found on grant operations
A named grant alias or raw grant ID is stale. Update plugins.entries.nylas.config.grants to point at valid grant IDs from your Nylas dashboard, then restart the gateway.
Plugin not showing up
If openclaw plugins list does not show the plugin, try reinstalling:
openclaw plugins uninstall @nylas/openclaw-nylas-plugin
openclaw plugins install @nylas/openclaw-nylas-plugin
openclaw config set 'plugins.allow' '["nylas"]'
openclaw config set 'tools.alsoAllow' '["nylas"]'
openclaw gateway restartIf the plugin is listed but its tools never appear in agent sessions, the plugin is installed but not trusted. Run the two openclaw config set commands above and restart the gateway.
Next steps
- Nylas CLI with OpenClaw (exec approach) — the alternative setup using shell commands and exec-approvals
- Give AI Agents Email Access via MCP — connect Claude, Cursor, or VS Code to your inbox
- Build an Agent with Email Tools — use Nylas tools in a custom LLM agent
- Send email from the terminal — use the Nylas CLI directly for scripting
- Manage calendar from the terminal — timezone handling, DST, and AI scheduling
- Organize Emails by Company — auto-label and sort messages by sender domain for multi-account workflows
- Export Email to HubSpot — sync email conversations to HubSpot contacts and deals
- Secure Email Handling with the CLI — token storage, grant scoping, and safe automation patterns
- List iCloud Emails — read and filter iCloud Mail from the command line
- List IMAP Emails — connect to any IMAP provider and list messages with the Nylas CLI
- OpenClaw CLI Setup Guide — install OpenClaw via npm, add plugins, and configure WhatsApp
- Fix OpenClaw CLI Errors — troubleshoot PATH, npm permissions, Node.js version, and Windows issues
- Command reference — every flag, subcommand, and example