Microsoft email and calendar integration
Hi guys, looking for some help. I did look into the github issues and find a lot of information about the microsoft integration for office365 email and calendar. I am looking to integrate it into our twenty environment, as all our email and calendar are on microsoft (We are 4 users).
I came across Github issue# 8473. https://github.com/twentyhq/twenty/issues/8473
We do not use Google, and my env variables are not set for Google either, only the microsoft environment variable. I did verify the server and worker docker, and both env does contain my microsoft configuration information. However, the front end only display the "connect with google" button under the emails and calendar setting.
Does any of you guys have a work around this problem temporarely? We are really looking forward to integrate our email in our environment. Could I use a service style zapier or something of the sort to synch our email and calendar ? Or create the google cloud environment to CRUD our microsoft emails and calendar temporarily until the issue is corrected?
GitHub
Can't link Microsoft account if there is no linked Google account ·...
Scenario: Log in Go to Settings > Accounts Actual: If there's no Google account linked, user can't link Microsoft account as it's hidden behind the "New account" button whi...
57 Replies
About Microsoft connection, it's now being implemented by the core team so probably next release after 0.40 (which will be released in the next couple of days) it'll be available https://github.com/twentyhq/core-team-issues/issues/61
Probably integrating all emails is possible with API, webhooks and middleware like n8n but never tried that before
Thanks for you insight, I will be looking toward this function. Great job guys on this wonderfull application.
I am doing a follow up on this, I have lately updated to 0.40.0 and I still cannot manage to make it work.
The Microsoft option is not available in the "setting / Email".
I have set variable environment:
IS_MICROSOFT_SYNC_ENABLED=true
AUTH_MICROSOFT_CALLBACK_URL=
AUTH_MICROSOFT_APIS_CALLBACK_URL=
AUTH_MICROSOFT_CLIENT_SECRET=
AUTH_MICROSOFT_CLIENT_ID=
AUTH_MICROSOFT_TENANT_ID=
AUTH_MICROSOFT_ENABLE=true
Obviously, the proper information is enter for the above microsoft settings, matching my application credential on microsoft.
What am I missing here? Should any other variables be set?
Thanks for your help.
@Guillaume
Hello,
Just a quick question, did you activate Microsoft in the settings ?

HI @Guillaume , thanks for taking to time to check this.
I do not have this option on my settings
Here's my full environment variables.
AUTH_MICROSOFT_TENANT_ID=xxxxxxxxxxxxx
AUTH_GOOGLE_CLIENT_ID=xxxxxxxxxx
AUTH_MICROSOFT_APIS_CALLBACK_URL=xxxxxxxxxxx
AUTH_GOOGLE_ENABLED=true
PORT=3000
IS_MICROSOFT_SYNC_ENABLED=true
EMAIL_FROM_NAME=xxxxxxxxx
AUTH_MICROSOFT_CLIENT_SECRET=xxxxxxxxxxxxx
EMAIL_SMTP_PORT=587
AUTH_GOOGLE_CALLBACK_URL=xxxxxxxxxxxx
PASSWORD_RESET_TOKEN_EXPIRES_IN=1m
STORAGE_S3_NAME=
AUTH_GOOGLE_APIS_CALLBACK_URL=xxxxxxxxxxx
PG_DATABASE_URL=postgres://postgres:e4a34adeb1fd6dcac4c4ae913bbc555a@db:5432/default
AUTH_GOOGLE_CLIENT_SECRET=xxxxxxxxx
APP_SECRET=xxxxxxxxxxx
EMAIL_SMTP_HOST=smtp.office365.com
CALENDAR_PROVIDER_GOOGLE_ENABLED=true
EMAIL_SMTP_PASSWORD=xxxxxxxxx
STORAGE_S3_ENDPOINT=
MESSAGING_PROVIDER_GMAIL_ENABLED=true
EMAIL_SMTP_USER=xxxxxxxxxx
STORAGE_TYPE=local
STORAGE_S3_REGION=
AUTH_MICROSOFT_ENABLE=true
AUTH_MICROSOFT_CLIENT_ID=xxxxxxxx
EMAIL_DRIVER=smtp
REDIS_URL=redis://redis:6379
SIGN_IN_PREFILLED=false
EMAIL_SYSTEM_ADDRESS=noreply@xxxxx
IS_SSO_ENABLED=true
AUTH_MICROSOFT_CALLBACK_URL=xxxxxx
EMAIL_MTP_ENCRYPTION=STARTTLS
SERVER_URL=xxxxxxxx
AUTH_PASSWORD_ENABLED=true
[email protected]
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
NODE_VERSION=18.17.1
YARN_VERSION=1.22.19
REACT_APP_SERVER_BASE_URL=
SENTRY_RELEASE=
I set xxxxxxx to confidential information

let me compare to my .env file
looks good to me. I think I have an idea: it might be related to a database thinkg.
Please, have a look at your "workspace" table and tell me if you see
"isMicrosoftAuthEnabled":true
next to your own workspace (It will be in core schema, not your postgres workspace schema)Ok I will be looking into the workspace table, if that can give you any insight, I upgraded from 0.35.6.
Will get back to you asap
I have been looking into the DB container.
I can't seem to find the tables of the database where this information would be located.
postgres=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | ICU Locale | Locale Provider | Access privileges
-----------+----------+----------+-------------+-------------+------------+-----------------+-----------------------
default | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | libc |
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | libc |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | libc | =c/postgres +
| | | | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | libc | =c/postgres +
| | | | | | | postgres=CTc/postgres
(4 rows)
Is there a DB schema available somewhere that I can reference to find the information related to my workspace.
Now reading back your previous message, you did mention is it in the core schema and not my workspace schema.
if you look in the default database (the first one of your list), in the core schema
do you see a workspace table ?
postgres=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | ICU Locale | Locale Provider | Access privileges
-----------+----------+----------+-------------+-------------+------------+-----------------+-----------------------
default | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | libc |
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | libc |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | libc | =c/postgres +
| | | | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | libc | =c/postgres +
| | | | | | | postgres=CTc/postgres
(4 rows)
postgres=# \c default
You are now connected to database "default" as user "postgres".
default=# \dn
List of schemas
Name | Owner
------------------------------------+-------------------
core | postgres
metadata | postgres
metric_helpers | postgres
public | pg_database_owner
user_management | postgres
workspace_56qwd1092bhew0345kdzzbq3 | postgres
(6 rows)
default=#
I have the "Core" and "workspace_xxxxxx" schema. look like I was circling around it.
What table I should be looking for now ?
workspace
in the core schema
look like it is disabled

I think that’s it. Please enable it and try again
I enable it on the workspace and on the default core.
Should I rebuild the docker? I can't see the update on the interface

You should simply restart the server
I did a shut down the dockers and rebuilds all the dockers, and restart. No change on the interface.
found this in the logs for server

this error has nothing to do with your issue, you can forget about it.
so now, you can see the "connect with microsoft" ?

@Guillaume Unfortunately it did not resolve the issue.


ok. since you are on an aold version, you may need to add a special row in the table featureFlag. Please add a row IS_MICROSOFT_SYNC_ENABLED, true, and your workspaceid.... and fill the othe paramters

I am on version 0.40.0 if that matter.
ok good
can you send me screenshots of the tables feature flags ?
this is what I get in those tables

@Guillaume I got back on this after lunch, here's a few things I notice, the core.featureflag tables does not seems to contain much. And my workspace seems to have the flags enables.
If that make any difference, I upgraded from 0.35.6 to 0.40.0
I did install pgadmin, going into the container in bash was a bit exhaustive.


Great I see the featureFlag table is still empty. Can you add the row I mentioned earlier ?
@Guillaume That did the trick 🙂
Microsoft is now an option in the email and calendar setting
Thanks for your help.
no worries !glad i could help !
@Guillaume I tried to synchronized and get the emails from microsoft, and I get this metadata error in my server logs.
I do have a successful connection to microsoft in my logs on office 365.
Where should I look next ?
I also had the issue of a table without feature flags after going from 0.36 to 0.40
Please see my solution here https://discord.com/channels/1130383047699738754/1130383048173682821/1331335862729834630
Can we close this issue then ? @David
@Guillaume , I did all the flags that @Antonio Pinto discuss in the generale, they are now inserted into the db.
How ever upon connection in the environment I am missing the workflow version. So I set workflow=false, and it is back online.
I connect to microsoft, it do get the connection in the microsoft office 365 app logs and it is successful.
In the Worker container, I get a "fetching full message list", but it just loop and no message is being imported.


if that can give any insight.

I think you forgot to run the worker, didn’t you ?
You must run the process that does this in the background. To do so, the documentation should help you out. Something like yarn command:prod worker
Let me know if you manage to do it ! You are almost there 🙂
Nothing more to do I think, except run the worker.
so freaking close LOL, just ran the yarn command from the documentation and it works 🙂
what was the command you ran?
@David
Thank you so much all resolve
I'm asking because I have the same error if I activate workflows.
https://discord.com/channels/1130383047699738754/1334863261946085466
I ran:
sudo docker exec -it twenty-worker-1 yarn command:prod cron:messaging:messages-import
sudo docker exec -it twenty-worker-1 yarn command:prod cron:messaging:message-list-fetch
sudo docker exec -it twenty-worker-1 yarn command:prod cron📆calendar-event-list-fetch
sudo docker exec -it twenty-worker-1 yarn command:prod cron📆calendar-events-import
sudo docker exec -it twenty-worker-1 yarn command:prod cron:messaging:ongoing-stale
sudo docker exec -it twenty-worker-1 yarn command:prod cron📆ongoing-stale
In the documentation here (see attached) picture, I run those to make the sync start and work

For the workflow error, I set the flag to false:

that resolve the error in the interface
ok, so we have the same issue 🙂
Thank you!
It is now resolve for me
I thought you fixed it
I mean, with workflow enabled
haa don't know about work flow, sorry. But my email and calendar are working
I am going to close this thread since the origin pb is now resolved, but feel free to open a new ticket if there are new issues rising !!!
Glad you could make it work David
Thank you for this thread. I had the same issue, but reading this solved it 🙂
By the way, in 0.41, this is no longer needed. Workflows work perfectly.
@Guillaume I did the update to 0.41 and now the sync is broken 🫣
I did saw in the update documentation that the .env Variable "AUTH_MICROSOFT_TENANT_ID" is now removed.
Could it have anything to do with?
The microsoft option as an account is now gone from the account screen in the setting.
Just checking if anyone else have this problem, and if their is a fix
About the Microsoft option that disappeared: it’s in settings , security tab ? If yes:
Can you make sure you have setup the environment variable called AUTH_MICROSOFT_ENABLED=true ?
Have a look at your .env file
If it’s on the settings, account, add new account:
check that you have the var that looks like this one (see the .env.example)
MICROSOFT_SYNC_ENABLED to true
Hi @Guillaume here's my environment variables. AUTH_MICROSOFT_ENABLE=true is there.
Microsoft is not either in security or email setting page.
I am wondering what I broke with that update 🤣




AUTH_MICROSOFT_ENABLED not AUTH_MICROSOFT_ENABLE
good catch! my .env file was correct, but my docker file had the typo 🙂
I see now Microsoft in the Security Setting
@Guillaume I am able to log in with my microsoft credential on the login in page now. But should I new see my microsoft account in the setting "account"?

make sure you have the
MESSAGING_PROVIDER_MICROSOFT_ENABLED=true
if you want microsfot emails to be sync
and CALENDAR_PROVIDER_MICROSOFT_ENABLED=true
if you want microsoft events to be sync@Guillaume You are a machine, it is resolved 🙂
I guess I missed those value change in the update, it was not on the update documentation page, but they are in the environment variable page.
If this thread can help any other person doing this upgrade.