Guide
CRM Email Workflows
Your inbox contains more CRM intelligence than most CRM databases — company domains, org hierarchy from CC patterns, job titles in signatures, relationship strength from reply frequency, and meeting context from calendar data. These 8 guides show you how to extract, organize, enrich, and act on that data using the Nylas CLI.
Why email is your richest CRM data source
Email metadata reveals company relationships through domains. Every business email address contains the company’s domain — group by domain and you instantly know which companies you communicate with most, how many people you know at each, and when you last interacted. A single nylas email list --json call gives you sender names, email addresses, timestamps, subject lines, and thread IDs. That is more context than most CRM records contain after months of manual entry.
CC patterns and calendar data expose org structure. When someone consistently CCs their manager, or organizes meetings with external stakeholders, those patterns reveal hierarchy, seniority, and decision-making authority — information that takes months to manually enter into a CRM. Calendar events add another dimension: recurring one-on-ones signal strong relationships, large meetings with many attendees suggest executive involvement, and meeting titles often contain project names that tie conversations to deals.
The Nylas CLI’s --json flag makes all of this programmable. List emails, contacts, and calendar events as structured JSON, then pipe through jq for quick analysis or into Python/TypeScript for production workflows. Every guide in this series builds on this foundation.
The pipeline: Extract → Organize → Enrich → Act
Each guide in this series handles one stage of the pipeline. You can use any guide independently, or chain them together for a complete CRM intelligence workflow. The example below shows the full pipeline in a single shell session — extract recent emails, group by company domain, pull contact details, and create a personalized follow-up draft.
# 1. Extract: list recent emails as JSON
nylas email list --json --limit 200 > emails.json
# 2. Organize: group by sender domain, filter freemail providers
cat emails.json | jq '[.[] | {from: .from[0].email, domain: (.from[0].email | split("@")[1])}]
| group_by(.domain)
| map({domain: .[0].domain, count: length})
| sort_by(-.count)
| [.[] | select(.domain | IN("gmail.com","yahoo.com","outlook.com","hotmail.com") | not)]'
# 3. Enrich: pull contacts with names and company associations
nylas contacts list --json --limit 200 > contacts.json
# 4. Act: create a personalized draft for your top contact
nylas email drafts create \
--to "partner@acme.com" \
--subject "Following up on our conversation" \
--body "Hi — wanted to circle back on what we discussed last week."The guides
New to the series? Start with Guide 1: Organize Emails by Company and Domain — it covers the fundamentals that every other guide builds on.
1. Organize Emails by Company and Domain
Group your inbox by sender domain to see which companies you email most. Filter freemail providers, normalize subsidiary domains, and export to CSV for CRM import. Includes Bash, Python, and TypeScript examples so you can pick the approach that fits your stack.
2. Build a Contact Hierarchy from Email
Map people to companies and infer reporting lines from CC patterns and calendar meeting data. Build org trees without manual data entry. Detect who reports to whom by analyzing which addresses consistently appear in CC when a manager sends to external contacts, and who organizes meetings versus who merely attends.
3. Enrich Contact and Company Info from Email
Extract job titles, phone numbers, and social links from email signatures. Infer seniority from email patterns — people who send fewer emails but are CC’d on important threads tend to be more senior. Build rich contact profiles without any external API by mining the data already sitting in your inbox.
4. Personalize Outbound Email from the CLI
Send personalized emails at scale. Merge contact data into templates, schedule sends by recipient timezone, and throttle delivery with built-in safety controls. Includes examples for sales follow-ups, event invitations, and re-engagement campaigns — all driven from a CSV or JSON contact list and a single CLI command.
5. Import Email into a Graph Database
Model sender-recipient relationships as a graph. Import into NetworkX for quick analysis or Neo4j for persistent queries. Find connectors (people who bridge otherwise separate groups), clusters (teams that communicate internally), and shortest introduction paths between any two contacts in your network.
6. Map Your Organization’s Contacts
Build a complete external contact map for your organization. Score relationship strength by email frequency, recency, and reciprocity. Find warm introduction paths between colleagues and target contacts. Detect single-threaded risk — accounts where only one person on your team has a relationship with the customer.
7. Build Email Autocomplete
Build a fast, fuzzy autocomplete from your contact and email history. Rank suggestions by communication frequency so the people you email most appear first. Integrate with fzf for terminal use, rapidfuzz for Python scripts, or Fuse.js for web UIs. Handles typos, partial names, and company-based lookups.
8. Auto-Create Email Drafts
Generate pre-filled drafts from templates and contact context. Batch-create follow-ups after meetings, pull in conversation history for context-aware replies, and queue drafts for review before sending. Pairs naturally with the personalization guide for high-volume outbound workflows where you want human review before delivery.
CRM-specific import guides
Once you’ve extracted and enriched your email data, push it into your CRM. Each guide below covers field mapping, CSV import, API import, and scheduled sync for a specific platform.
- Export Email Data to Salesforce — Leads, Contacts, Accounts, and Tasks via Data Loader or REST API.
- Export Email Data to HubSpot — Contacts, Companies, and Engagements via HubSpot API v3.
- Export Email Data to Pipedrive — Persons, Organizations, Deals, and Activities via REST API.
- Export Email Data to Zoho CRM — Leads, Contacts, and Accounts via REST API v2 with upsert.
- Export Email Data to Dynamics 365 — Contacts, Accounts, and Activities via OData Web API.
Related guides
- Send Email from the Terminal — covers the fundamentals of composing and sending email with the Nylas CLI, including attachments, HTML bodies, and batch sends.
- Build an LLM Agent with Email Tools — use the CLI as subprocess tools for an AI agent that can read, send, and schedule email autonomously.
- Give AI Agents Email Access via MCP — expose Nylas CLI capabilities through the Model Context Protocol so any MCP-compatible agent can use your mailbox.