---
title: "Deploy Deploy Twenty CRM with Outlook Sync"
description: "Sync Outlook mail and Microsoft calendars into Twenty"
category: "Other"
url: https://railway.com/deploy/deploy-twenty-crm-with-outlook-sync
---

# Deploy Deploy Twenty CRM with Outlook Sync

Sync Outlook mail and Microsoft calendars into Twenty

**[Deploy Deploy Twenty CRM with Outlook Sync on Railway](https://railway.com/template/deploy-twenty-crm-with-outlook-sync)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/deploy-twenty-crm-with-outlook-sync/manifest.json

- **Creator:** onepush
- **Category:** Other

## Template content

### Postgres

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:16.15@sha256:34c3e49e7ed2aaef6c575fb23bb37b878007e97752d3bf27ccb550046f893ca7

### Redis

- **Image:** redis:8.2.10@sha256:47670742d7924adbcdb404d1288b6327815b23141969c0939b8e5d61f78c2634
- **Start command:** `/bin/sh -c "rm -rf $RAILWAY_VOLUME_MOUNT_PATH/lost+found/ && exec docker-entrypoint.sh redis-server --requirepass $REDIS_PASSWORD --save 60 1 --dir $RAILWAY_VOLUME_MOUNT_PATH --maxmemory-policy noeviction --bind '* -::*'"`

### twenty

- **Image:** twentycrm/twenty:v2.48.0@sha256:43fab4bffacdcd63ff3c9257b7f8985a4424d81e9eb43982b9c16a841d555e52
- **Health check:** /healthz
- **Public domain:** Yes

### twenty-worker

- **Image:** twentycrm/twenty:v2.48.0@sha256:43fab4bffacdcd63ff3c9257b7f8985a4424d81e9eb43982b9c16a841d555e52
- **Start command:** `/app/entrypoint.sh yarn worker:prod`

## Documentation

# Deploy and Host self hosted Twenty Outlook Sync (Open-Source CRM with Outlook and Microsoft 365 Sync) on Railway

This template runs Twenty CRM, its worker, Postgres and Redis on Railway, and covers the Microsoft Entra app registration, Graph permissions and config vars that sync Outlook mail and calendar events for Microsoft 365 teams.

## About Hosting Twenty Outlook Sync open-source software on Railway (self hosted Twenty CRM Outlook sync template)

Twenty Outlook Sync is just Twenty, the AGPL-3.0 CRM, wired so Microsoft 365 mail and calendar events land on your records.

This template runs four services: the twenty server and web app on port 3000, a twenty-worker that runs the email and calendar sync crons, Postgres 16 and Redis 8.2, both with volumes.

## Why Deploy Twenty Outlook Sync, the Microsoft Dynamics 365 alternative on Railway (Railway Free Trial)

Dynamics 365 bills per user per month before you touch mail sync, and Outlook integration is part of that stack. Twenty is AGPL-3.0, self hosted, and your mail and calendar data stay in your own Postgres.

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Twenty Outlook Sync on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.

### Railway vs Other Hosting Providers and VPS for Twenty Outlook Sync self hosting

Railway ships the four services, volume and cron registration wired; a VPS makes you build them.

| Provider | What You Get with Railway | What You Get with the Other Provider |
| --- | --- | --- |
| DigitalOcean | Postgres, Redis, server and worker as separate services with a domain and TLS. | A droplet to patch, Compose from packages/twenty-docker, plus proxy, certs and worker supervision. |
| AWS | Same four services, health checks on /healthz, volume for uploads. | ECS or EC2 plus RDS, ElastiCache, load balancer and IAM wiring you maintain. |
| Hetzner | One click, usage billing, Microsoft variables set after first sign up. | Cheap compute where you install Docker, Postgres and Redis yourself. |

## Common Use Cases for hosted Twenty Outlook Sync

- **Every thread on the record:** when a rep opens an account, the Outlook mail synced into Twenty sits next to the company, so handoffs don't start with "can you forward me that thread."
- **Meetings on the timeline:** calendar events pulled from Microsoft 365 show up on company and person records, so you can see how often a deal actually got time on the calendar.
- **Contacts from participants:** auto-create people from email participants, and the next inbound message from a new buyer already has a home instead of living in one rep's mailbox.
- **Metadata-only sharing:** choose subject and metadata only when body content is too sensitive, keeping activity timestamps without exposing what was written.
- **A team that lives in Outlook:** sales keeps working in Microsoft 365 and the CRM fills itself, which is the only way adoption survives a busy quarter.

## Dependencies for Twenty Outlook Sync Docker hosted on Railway

Four services ship here: twenty (server plus web, image v2.48.0, port 3000, health /healthz), twenty-worker on the same image, Postgres 16 and Redis 8.2 with volumes. Not included: Microsoft access.

### Deployment Dependencies for Managed Twenty Outlook Sync Service (CRM Email Sync)

Add delegated Graph permissions Mail.ReadWrite, Mail.Send, Calendars.ReadWrite, User.Read, openid, email, profile and offline_access, then Grant admin consent.

### Implementation Details for Twenty Outlook Sync (Using Twenty official docker image)

The twenty service builds SERVER_URL from RAILWAY_PUBLIC_DOMAIN, generates APP_SECRET and ENCRYPTION_KEY, wires PG_DATABASE_URL and REDIS_URL, and uses STORAGE_TYPE=local with uploads on the /app/packages/twenty-server/.local-storage volume.

## How does Twenty Outlook Sync compare against other CRMs that sync with Outlook

### Twenty vs Microsoft Dynamics 365 (Dynamics Alternative)

- **Cost:** Dynamics bundles Outlook sync but charges per user. Twenty is AGPL-3.0 and free to self host, so you pay Railway and nothing per seat.
- **Where Dynamics wins:** The native Outlook add-in and Entra SSO are tighter than Twenty's Settings > Accounts flow.
- **Data location:** Synced mail lands in your Postgres volume, not Microsoft's cloud.

### Twenty vs HubSpot (HubSpot Alternative)

- **Sync depth:** HubSpot's Outlook add-in logs email neatly; Twenty imports threads, participants and events as native objects you can query over GraphQL.
- **Where HubSpot wins:** Marketing automation and a mature app marketplace.
- **Permissions:** Twenty always asks for Mail.ReadWrite, Mail.Send and Calendars.ReadWrite, so cautious IT teams may balk.

### Twenty vs Salesforce (Salesforce Alternative)

- **Setup:** Salesforce with Outlook means a paid edition plus configuration. Twenty is one deploy and a worker.
- **Where Salesforce wins:** Reporting depth, AppExchange and enterprise governance Twenty hasn't built yet.
- **Exit cost:** Twenty is open source, so leaving Railway means taking the compose file with you.

### Twenty vs Pipedrive (Pipedrive Alternative)

- **Out of the box:** Pipedrive's Outlook sync is set-and-forget; Twenty makes you register the Entra app first.
- **Where Twenty wins:** Email and calendar are first-class objects, not attachments to a deal.
- **Ops burden:** You run Postgres, Redis and the twenty-worker. If nobody enjoys that, pick Pipedrive.

## How to use Twenty Outlook Sync (the OSS CRM)?

1. Register an Entra ID app and secret.
2. Add Mail.ReadWrite, Mail.Send, Calendars.ReadWrite, User.Read, openid, email, profile, offline_access; grant admin consent.
3. Redirect URIs: https://your-domain/auth/microsoft/redirect, https://your-domain/auth/microsoft-apis/get-access-token.
4. In Settings > Admin Panel > Configuration Variables set:

```
MESSAGING_PROVIDER_MICROSOFT_ENABLED=true
CALENDAR_PROVIDER_MICROSOFT_ENABLED=true
AUTH_MICROSOFT_ENABLED=true
AUTH_MICROSOFT_CLIENT_ID=
AUTH_MICROSOFT_CLIENT_SECRET=
AUTH_MICROSOFT_CALLBACK_URL=https://your-domain/auth/microsoft/redirect
AUTH_MICROSOFT_APIS_CALLBACK_URL=https://your-domain/auth/microsoft-apis/get-access-token
```

5. Connect Microsoft under Settings > Accounts; worker imports mail and events.

## How to self host Twenty Outlook Sync on other VPS Services (Twenty self hosting guide)

### Clone the Repository

Clone the official repo and work from packages/twenty-docker.

```
git clone https://github.com/twentyhq/twenty.git
cd twenty
```

### Install Dependencies

Install Docker and Compose, then point it at Postgres 16 and Redis 8.2. Plan 2 GB RAM minimum.

### Configure Environment Variables

Set the core vars, then the Microsoft ones; Outlook sync won't start without them.

```
SERVER_URL=https://your-domain
APP_SECRET=replace-with-32-chars
ENCRYPTION_KEY=replace-with-32-chars
STORAGE_TYPE=local
```

Add AUTH_MICROSOFT_CLIENT_ID, AUTH_MICROSOFT_CLIENT_SECRET, the two callback URLs, and the three _ENABLED flags. Never rotate APP_SECRET once data exists.

### Start the Twenty Outlook Sync Application

Run docker compose up -d and check /healthz. Run a second container with yarn worker:prod. If you skip it, cron jobs and Outlook imports never fire.

Railway runs all four services and wires the worker, cron and volumes for you.

## Official Pricing of Twenty Outlook Sync (Twenty pricing)

Twenty itself is free. It's AGPL-3.0 open source, so there's no licence fee and no per-seat charge for the Outlook sync, no matter how many teammates connect a Microsoft 365 mailbox.

What you pay for is infrastructure. Twenty Cloud exists with paid per-user plans listed on twenty.com/pricing.

## Twenty Outlook Sync cloud vs self hosted comparison (Pricing, features, costs, and more)

Twenty Cloud and Railway both run the same AGPL-3.0 code, so the Outlook sync behaves the same once the Entra ID app is registered. The real split is who pays per seat and who holds the tenant credentials.

### Monthly cost of self hosting Twenty Outlook Sync on Railway

Railway bills for usage, not seats. The trade is your time: the Azure app registration, admin consent and the sync worker are yours to watch.

### System Requirements for Hosting Twenty Outlook Sync on a VPS

Upstream suggests at least 2 GB RAM, and a worker plus Postgres and Redis makes 4 GB the comfortable floor for a team that actually syncs mail.

## Frequently Asked Questions (FAQs)

### Do users need a Microsoft 365 licence?

Yes. Twenty's Calendar and Messaging APIs are part of Microsoft 365, so a user without a licence can't connect their account or sync anything. Free personal Outlook.com accounts won't work either.

### Why do read-only permissions fail?

Twenty always requests Mail.ReadWrite, Mail.Send and Calendars.ReadWrite because it imports mail and can send from the CRM, so Mail.Read or Calendars.Read alone isn't enough.

### What does AADSTS90094 mean?

That's the tenant blocking user consent during the Microsoft sign-in. An admin fixes it by opening the app registration in Entra ID and clicking Grant admin consent under API permissions.

### Can I sync only calendars?

Not at the permission level: Twenty requests mail and calendar scopes together, so consent covers both. What each user shares is set per account under Settings > Accounts.

### How often does sync run?

The sync jobs are cron jobs the twenty-worker service runs on a schedule, covering message import, message list fetch, calendar event list fetch, calendar events import and stale checks.

### Can personal Outlook.com accounts connect?

No. The integration is built for Microsoft 365 work accounts in Entra ID. Personal accounts lack the tenant, admin consent and licensing the Graph permissions rely on.


## Similar templates

- [Rocky Linux](https://railway.com/deploy/rocky-linux) — Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀
- [Foundry Virtual Tabletop](https://railway.com/deploy/X5tR6G) — A Self-Hosted & Modern Roleplaying Platform
- [Letta Code Remote](https://railway.com/deploy/letta-code-remote) — Run a Letta Code agent 24/7. No inbound ports, just deploy.

Open this page in a browser: https://railway.com/deploy/deploy-twenty-crm-with-outlook-sync
