Command

nylas email smart-compose

AI-powered email composition — generate a draft from a text prompt.

Written by Qasim Muhammad Staff SRE

What does nylas email smart-compose do?

The nylas email smart-compose command uses Nylas Smart Compose to generate an email draft from a natural language --prompt. Pass --message-id to generate a context-aware reply to an existing message instead of a brand-new email. Requires a Nylas Plus package subscription.

Usage

nylas email smart-compose --prompt PROMPT [--message-id MESSAGE_ID]

Flags

FlagDescription
--jsonOutput as JSON
--no-colorDisable color output
--verbose(-v)Enable verbose output
--configCustom config file path
--help(-h)Show help for the command
--limitLimit results (most list commands)
--yes(-y)Skip confirmations
--promptAI instruction for generating the email (required, max 1000 tokens)
--message-idMessage ID to reply to (optional, generates reply if provided)

Examples

The nylas email smart-compose command uses Nylas Smart Compose to generate an email draft from a natural language --prompt.

Generate a new email draft

nylas email smart-compose --prompt "Draft a thank you email for the meeting"

Generate a reply to a specific message

nylas email smart-compose --message-id msg_abc123 --prompt "Reply accepting the invitation"

Output the generated draft as JSON

nylas email smart-compose --prompt "Write a follow-up email" --json

Example output

Generated draft:

Hi Alice,

Thanks for the productive meeting today. I'll send over the Q3 roadmap by Friday as discussed.

Best,
Bob

Troubleshooting

Generated content is off-topic or generic

Pass --message-id to give the AI the original message as context. More specific prompts produce better results.

Command not available or returns a subscription error

Smart Compose requires a Nylas Plus package subscription. Confirm your application's plan in the Nylas dashboard.

Recommended guides

Run nylas email smart-compose --help for full help output.