Sign in

Published

Two-Way Gmail and Microsoft 365 Sync: Build It or Buy It?

Adding email to your SaaS looks straightforward: connect a mailbox, fetch messages, and send updates back. The API calls usually are straightforward. The difficult part is keeping your application correct when notifications arrive twice, credentials expire, messages move, or a sync cursor becomes unusable.

You have two practical choices: build on the Gmail API and Microsoft Graph, or use a commercial unified API such as Nylas or Aurinko. The decision is less about accessing email than about who owns synchronization reliability—and whether outsourcing it is worth a recurring fee per connected mailbox.

Define What “Two-Way Sync” Means

For an application integration, two-way synchronization generally means:

  1. Mailbox changes propagate into your application’s database.
  2. Actions in your application propagate back to the mailbox.

It does not necessarily mean copying messages between Gmail and Outlook. Cross-provider mailbox mirroring is a separate requirement with additional identity, routing, and conflict-handling problems.

Before choosing a library or service, define your supported operations:

CapabilityProvider → applicationApplication → provider
New messagesImport incoming and sent messagesSend messages or replies
Read stateObserve read/unread changesMark messages read or unread
OrganizationObserve labels or folder changesApply labels or move messages
DeletionRemove or mark deleted local recordsTrash or delete provider messages
DraftsImport draft changesCreate, update, or delete drafts

This contract determines both your implementation complexity and your OAuth permissions.

A client SDK helps you make API calls. It does not, by itself, give you a durable synchronization engine.

The same distinction matters with hosted services: a unified email API can normalize provider access without implementing every app-specific synchronization rule.

Your Two Main Integration Paths

Build directly on provider APIs

Use the Gmail API for Google mailboxes and Microsoft Graph for Microsoft 365 mailboxes.

Google provides official client libraries, including googleapis for Node.js. Microsoft provides Graph SDKs for JavaScript, Python, .NET, and other languages.

These libraries handle API interaction, not the full lifecycle of synchronization. You still own:

  • OAuth connections and token management.
  • Initial imports and incremental sync.
  • Notification processing.
  • Persistent cursors and recovery.
  • Outbound actions and reconciliation.
  • Retries, throttling, and operational monitoring.

The advantage is control: you choose what data to retain, how to represent mailbox state, and which infrastructure processes it.

Use a unified email API

Nylas and Aurinko provide hosted interfaces across Gmail and Microsoft 365. Both support reading mail, sending, changing message state, and receiving changes.

They reduce provider-specific integration work, but they introduce:

  • A recurring connected-account cost.
  • Another dependency in your request and synchronization paths.
  • An additional vendor whose data handling and security posture you must evaluate.
  • Service-specific abstractions and limits.

Neither is an open-source sync server that you can simply deploy yourself.

What a Direct Sync Engine Actually Needs

A reliable design separates discovering provider changes from executing application actions.

1. Connect with OAuth and minimum necessary scopes

Request only the permissions required by your feature contract. Sending-only access is not equivalent to reading or modifying mailbox contents.

Store the authorization state securely and plan for revoked access, expired credentials, and reconnect flows. A mailbox connection is an ongoing lifecycle, not a one-time setup operation.

2. Import an initial dataset and establish checkpoints

Choose an initial scope: the entire mailbox, selected folders, or a bounded history window.

Persist both the imported state and the provider-specific checkpoint needed to continue synchronization. Your bootstrap must account for changes occurring while the import runs; otherwise, the transition from initial import to incremental updates can leave gaps.

Keep provider cursors distinct rather than forcing them into one supposedly universal format.

3. Use notifications to trigger incremental synchronization

For Gmail, the usual pattern is:

  1. Register a mailbox watch through Cloud Pub/Sub.
  2. Persist a Gmail history cursor.
  3. Receive a notification.
  4. Fetch changes using history.list.
  5. Apply the changes and persist the updated checkpoint.

Gmail watches must be renewed at least every seven days. If the stored history cursor is no longer available, Gmail requires a new full synchronization. See Google’s sync guide and push notification guide.

Microsoft Graph supports change notifications and message delta queries. An important architectural difference is that message delta synchronization is per folder. Full-mailbox coverage therefore requires tracking more than a single Inbox cursor, including relevant folder changes and message moves. See Microsoft’s message delta documentation.

Treat a notification as “there may be changes to fetch,” not as your sole authoritative record of mailbox state.

Notifications can be duplicated, delayed, or missed. Subscriptions can expire or be removed. A robust engine needs renewal and recovery paths rather than relying exclusively on webhook delivery.

4. Write application actions back, then reconcile

When someone marks a message read in your application, submit the corresponding provider mutation and reconcile the resulting provider state into your database.

Retries need operation-specific handling:

  • Repeating “set read state to true” can be designed as an idempotent state assignment.
  • Retrying a send after an ambiguous timeout requires greater care: the original request might already have succeeded.
  • A move may affect identifiers and folder-scoped synchronization state.

Do not assume that every provider operation is inherently idempotent. Your action processing and retry policy must prevent duplicate effects where possible and handle uncertainty explicitly.

Gmail’s label model and Outlook’s folder model also differ. A normalized API—or your own adapter—does not eliminate those semantic differences.

5. Design recovery before broadening scope

Your production checklist should include:

  • Duplicate notifications and repeated updates.
  • Deletions and message moves.
  • Expired or invalid cursors.
  • Interrupted pagination and imports.
  • Subscription and watch renewal.
  • Provider throttling and transient failures.
  • Revoked credentials.
  • Safe reconciliation after outbound writes.

A narrow integration that recovers correctly is more valuable than a broad one that silently drifts out of sync.

Nylas vs. Aurinko

Both services provide a unified interface, but their documented synchronization surfaces differ.

DimensionNylasAurinko
Email interfaceNormalized Messages API and message webhooksUnified Email API with explicit incremental-sync methods
Change retrievalWebhook-led workflows, with backfill and local-state maintenanceExplicit updated- and deleted-message feeds, alongside webhooks
Webhook setupDocuments a webhook subscription spanning connected providersUses resource subscriptions; native Gmail push setup requires Cloud Pub/Sub configuration
Broader capabilitiesEmail, calendar, contacts, and schedulingEmail, calendar, contacts, and tasks
Separate integration productBroader packaged platformBrightSync for business-system integrations

Nylas is worth trialing first if you prefer its normalized API and webhook-led implementation. Aurinko is worth trialing first if explicit updated/deleted feeds, tasks support, or its transfer-based pricing fit your requirements.

Evaluate either service with the same test sequence:

  1. Receive a new message.
  2. Change its read state outside your app.
  3. Move or relabel it.
  4. Delete it.
  5. Repeat the relevant operations from your app and verify the mailbox result.

Also test interruption and reconnection—not just the happy path.

Aurinko Unified API is not BrightSync

This distinction is particularly important when comparing prices.

Aurinko Unified API is the API surface you use to build mailbox integration. BrightSync is a separately priced product whose documented email functionality includes one-way email logging into a CRM.

Do not assume BrightSync provides automatic two-way propagation of arbitrary edits from your application to Gmail or Outlook. Consult the Unified Email API documentation against your actual feature contract.

Pricing: Per Mailbox, Not Necessarily Per SaaS User

The commercial model generally scales with connected accounts.

A customer who connects Gmail and Microsoft 365 typically contributes two billable connections. Conversely, a SaaS user with no connected mailbox need not create the same integration cost.

The following published rates are useful planning examples, not permanent quotes. Verify the current Nylas pricing and Aurinko pricing before committing.

OfferingPublished pricing example
Nylas free planUp to 5 connected accounts
Nylas Essentials/month including 10 accounts; per additional account
Nylas Pro, monthly billing/month including 25 accounts; per additional account
Aurinko Unified APIStarting at /account/month for the lowest transfer tier; listed higher tiers at and
Aurinko BrightSync, email-only/user/month; a different product from Unified API

Aurinko’s listed transfer tiers distinguish under 1 GB, under 5 GB, and unlimited transfer. Confirm the applicable metering rules for your workload. Nylas annual commitments may have different rates.

Why the marginal price matters

The first ten Nylas Essentials accounts average each, but that is not the price of every additional account.

For 100 connected mailboxes, the quoted Nylas Pro monthly calculation is:

At Aurinko’s lowest quoted tier, assuming every account qualifies:

Both figures exclude your application infrastructure and engineering costs.

More generally, if customers connect an average of mailboxes, your connected-account count is:

That distinction matters for margins. A low-priced SaaS plan that includes several mailbox connections can absorb a substantial integration fee before you account for your own operating costs.

Open Source and “Free APIs” Are Different Questions

Nylas and Aurinko are commercial hosted services. An open-source SDK does not make their backend self-hostable. For example, Nylas’s Node.js SDK is MIT-licensed, while the service remains proprietary.

The Google and Microsoft client SDKs are also open source; Gmail and Microsoft 365 are not.

Direct integration avoids the intermediary’s per-mailbox fee. Standard provider API usage is generally available without that additional integration charge, subject to applicable limits and terms. It is not cost-free infrastructure:

  • You pay for workers, queues, storage, and monitoring.
  • Microsoft mailbox access may require an applicable subscription.
  • API quotas and billing policies can change.
  • You fund development, maintenance, and incident response.

For Gmail in particular, check the current quota documentation rather than assuming today’s billing policy is permanent.

A Week-Long MVP Is Plausible; Production Reliability Is a Separate Milestone

AI-assisted development can make a narrow implementation fast. It does not remove provider lifecycle requirements or public-launch obligations.

Gmail scopes that permit reading or modifying mailbox contents are generally restricted scopes. A public application may require Google verification, and server-side handling of restricted data may require a security assessment. Evaluate the scope requirements early, whether you integrate directly or through a vendor.

If you build directly, a sensible first contract is:

  • Inbox and Sent coverage.
  • Sending replies.
  • Read/unread updates.
  • Separate Gmail and Graph adapters.
  • Persisted checkpoints and explicit recovery.

Add drafts, moves, deletes, and broader mailbox coverage when customer requirements justify them.

Build directly when synchronization is central to your product, you can operate the reliability machinery, and per-mailbox pricing materially hurts your margins. Buy a unified API when speed and reduced provider-specific maintenance outweigh the recurring fee.

The meaningful comparison is not “one week of coding versus a monthly bill.” It is owning synchronization over the product’s lifetime versus paying to outsource part of that responsibility.