--- title: Setup icon: TbServer image: /images/user-guide/table-views/table.png --- import OptionTable from '@site/src/theme/OptionTable' # Setup Messaging & Calendar sync Twenty offers integrations with Gmail and Google Calendar. ## For Gmail and Google Calendar ### Create a project in Google Cloud You will need to create a project in Google Cloud and get the credentials. Then you can set the following environment variables: - `MESSAGING_PROVIDER_GMAIL_ENABLED=true` - `CALENDAR_PROVIDER_GOOGLE_ENABLED=true` - `AUTH_GOOGLE_CLIENT_ID=` - `AUTH_GOOGLE_CLIENT_SECRET=` - `AUTH_GOOGLE_CALLBACK_URL=https:///auth/google/redirect` if you want to use Google SSO - `AUTH_GOOGLE_APIS_CALLBACK_URL=https:///auth/google-apis/get-access-token` ### Enable APIs On Google Cloud Console, go to [APIs & Services](https://console.cloud.google.com/apis/library/) and enable the following APIs: - [Gmail API](https://console.cloud.google.com/apis/library/gmail.googleapis.com) - [Google Calendar API](https://console.cloud.google.com/apis/library/calendar-json.googleapis.com) - [People API](https://console.cloud.google.com/apis/library/people.googleapis.com) ### Authorized redirect URIs Under [Credentials](https://console.cloud.google.com/apis/credentials), in OAuth 2.0 Client IDs, you need to add the following redirect URIs to your project: - `https:///auth/google/redirect` if you want to use Google SSO - `https:///auth/google-apis/get-access-token` ### If your app is in test mode If your app is in test mode, you will need to add test users to your project. Under [OAuth consent screen](https://console.cloud.google.com/apis/credentials/consent), add your test users to the "Test users" section. ### Start the cron jobs Register the following recurring jobs: ``` # from your worker container yarn command:prod cron:messaging:messages-import yarn command:prod cron:messaging:message-list-fetch yarn command:prod cron:calendar:calendar-event-list-fetch yarn command:prod cron:messaging:ongoing-stale yarn command:prod cron:calendar:ongoing-stale ``` # Setup Environment Variables ## Frontend ## Backend ### Config ### Security ### Tokens ', 'Secret used for encryption across the app'], ['ACCESS_TOKEN_EXPIRES_IN', '30m', 'Access token expiration time'], ['LOGIN_TOKEN_EXPIRES_IN', '15m', 'Login token expiration time'], ['REFRESH_TOKEN_EXPIRES_IN', '90d', 'Refresh token expiration time'], ['REFRESH_TOKEN_COOL_DOWN', '1m', 'Refresh token cooldown'], ['FILE_TOKEN_EXPIRES_IN', '1d', 'File token expiration time'], ]}> ### Auth ### Email #### Email SMTP Server configuration examples You will need to provision an [App Password](https://support.google.com/accounts/answer/185833). - EMAIL_DRIVER=smtp - EMAIL_SMTP_HOST=smtp.gmail.com - EMAIL_SMTP_PORT=465 - EMAIL_SMTP_USER=gmail_email_address - EMAIL_SMTP_PASSWORD='gmail_app_password' Keep in mind that if you have 2FA enabled, you will need to provision an [App Password](https://support.microsoft.com/en-us/account-billing/manage-app-passwords-for-two-step-verification-d6dc8c6d-4bf7-4851-ad95-6d07799387e9). - EMAIL_DRIVER=smtp - EMAIL_SMTP_HOST=smtp.office365.com - EMAIL_SMTP_PORT=587 - EMAIL_SMTP_USER=office365_email_address - EMAIL_SMTP_PASSWORD='office365_password' **smtp4dev** is a fake SMTP email server for development and testing. - Run the smtp4dev image: `docker run --rm -it -p 8090:80 -p 2525:25 rnwood/smtp4dev` - Access the smtp4dev ui here: [http://localhost:8090](http://localhost:8090) - Set the following env variables: - EMAIL_DRIVER=smtp - EMAIL_SMTP_HOST=localhost - EMAIL_SMTP_PORT=2525 ### Storage ### Custom Code Execution ### Message Queue ### Logging ### Data enrichment and AI ### Serverless functions This feature is WIP and is not yet useful for most users. ### Support Chat ', 'Support chat key'], ['SUPPORT_FRONT_CHAT_ID', '', 'Support chat id'], ]}> ### Telemetry ### Debug / Development ### Workspace Cleaning ### Captcha