Skip to content

The open alternative to Salesforce, designed for AI.

Add Microsoft Teams OAuth connection (#26266)

nitina8ea3994fe4e
diff --git a/packages/twenty-apps/public/teams-transcripts/CHANGELOG.md b/packages/twenty-apps/public/teams-transcripts/CHANGELOG.md
index f19a76486ad..6ec6bf78944 100644
--- a/packages/twenty-apps/public/teams-transcripts/CHANGELOG.md
+++ b/packages/twenty-apps/public/teams-transcripts/CHANGELOG.md
@@ -3,3 +3,4 @@
## 0.1.0
- Add the application identity, default role, and development tooling.
+- Add the Microsoft OAuth connection provider and server variables.
diff --git a/packages/twenty-apps/public/teams-transcripts/README.md b/packages/twenty-apps/public/teams-transcripts/README.md
index 4b9338d73ef..f02835afe95 100644
--- a/packages/twenty-apps/public/teams-transcripts/README.md
+++ b/packages/twenty-apps/public/teams-transcripts/README.md
@@ -1,6 +1,10 @@
# Teams Transcripts
-Application scaffold for a Microsoft Teams transcript integration with Twenty.
-Microsoft connections and transcript imports will be added in follow-up changes.
+Connect a Microsoft work or school account to Twenty through the application's
+native connection settings. Twenty manages the OAuth credentials and token
+refresh.
-See [SETUP.md](SETUP.md) for development commands.
+This version provides the connection only. Transcript imports and automatic
+synchronization will be added in follow-up changes.
+
+See [SETUP.md](SETUP.md) for Microsoft application setup and development commands.
diff --git a/packages/twenty-apps/public/teams-transcripts/SETUP.md b/packages/twenty-apps/public/teams-transcripts/SETUP.md
index afdcb6d2510..7e9d9343d65 100644
--- a/packages/twenty-apps/public/teams-transcripts/SETUP.md
+++ b/packages/twenty-apps/public/teams-transcripts/SETUP.md
@@ -1,4 +1,41 @@
-# Development
+# Setup
+
+## Microsoft application
+
+1. In Microsoft Entra, create an app registration supporting **Accounts in any
+ organizational directory**. The provider uses the `organizations` endpoint;
+ personal Microsoft accounts are not supported.
+2. Add a **Web** redirect URI:
+ `https://<your-twenty-host>/auth/apps/callback`.
+3. Create a client secret. Set `MICROSOFT_CLIENT_ID` and
+ `MICROSOFT_CLIENT_SECRET` in the Twenty application's server variables. Use
+ the secret **Value**, not its ID.
+4. Add the Microsoft Graph delegated permissions below and obtain administrator
+ consent where required by your organization.
+
+| Permission | Purpose |
+| --- | --- |
+| `User.Read` | Identify the connected Microsoft account |
+| `Calendars.ReadBasic` | Discover scheduled meetings in the upcoming import flow |
+| `OnlineMeetings.Read` | Read meeting metadata in the upcoming import flow |
+| `OnlineMeetingTranscript.Read.All` | Read transcripts in the upcoming import flow |
+
+The connection also requests `openid`, `profile`, `email`, and `offline_access`
+for account identity and refresh tokens. It uses the authorization code flow
+with PKCE through Twenty's connection provider.
+
+## Connect
+
+Open **Settings > Applications > Teams Transcripts > Settings**, select
+**Add connection**, and sign in with your Microsoft work or school account.
+
+This version stores the connection; it does not import transcripts or register
+webhooks. Those capabilities are added in later changes.
+
+References: [Microsoft authorization code flow](https://learn.microsoft.com/en-us/entra/identity-platform/v2-oauth2-auth-code-flow)
+and [transcript permissions](https://learn.microsoft.com/en-us/graph/api/onlinemeeting-list-transcripts?view=graph-rest-1.0).
+
+## Development
Use the Node version in `.nvmrc` and Yarn 4. From this directory:
diff --git a/packages/twenty-apps/public/teams-transcripts/src/application-config.ts b/packages/twenty-apps/public/teams-transcripts/src/application-config.ts
index 61603301e6d..6b507bcff5a 100644
--- a/packages/twenty-apps/public/teams-transcripts/src/application-config.ts
+++ b/packages/twenty-apps/public/teams-transcripts/src/application-config.ts
@@ -13,4 +13,17 @@ export default defineApplication({
logo: 'public/logo.svg',
author: 'Twenty',
category: 'Productivity',
+ serverVariables: {
+ MICROSOFT_CLIENT_ID: {
+ description: 'OAuth client ID from the Microsoft Entra app registration.',
+ isSecret: false,
+ isRequired: true,
+ },
+ MICROSOFT_CLIENT_SECRET: {
+ description:
+ 'OAuth client secret value from the Microsoft Entra app registration.',
+ isSecret: true,
+ isRequired: true,
+ },
+ },
});
diff --git a/packages/twenty-apps/public/teams-transcripts/src/connection-providers/microsoft-teams-connection.ts b/packages/twenty-apps/public/teams-transcripts/src/connection-providers/microsoft-teams-connection.ts
new file mode 100644
index 00000000000..844ce3b399b
--- /dev/null
+++ b/packages/twenty-apps/public/teams-transcripts/src/connection-providers/microsoft-teams-connection.ts
@@ -0,0 +1,31 @@
+import { defineConnectionProvider } from 'twenty-sdk/define';
+
+import { TEAMS_CONNECTION_PROVIDER_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
+
+export default defineConnectionProvider({
+ universalIdentifier: TEAMS_CONNECTION_PROVIDER_UNIVERSAL_IDENTIFIER,
+ name: 'microsoft-teams',
+ displayName: 'Microsoft Teams',
+ type: 'oauth',
+ oauth: {
+ authorizationEndpoint:
+ 'https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize',
+ tokenEndpoint:
+ 'https://login.microsoftonline.com/organizations/oauth2/v2.0/token',
+ scopes: [
+ 'openid',
+ 'profile',
+ 'email',
+ 'offline_access',
+ 'https://graph.microsoft.com/User.Read',
+ 'https://graph.microsoft.com/Calendars.ReadBasic',
+ 'https://graph.microsoft.com/OnlineMeetings.Read',
+ 'https://graph.microsoft.com/OnlineMeetingTranscript.Read.All',
+ ],
+ clientIdVariable: 'MICROSOFT_CLIENT_ID',
+ clientSecretVariable: 'MICROSOFT_CLIENT_SECRET',
+ authorizationParams: { prompt: 'select_account' },
+ tokenRequestContentType: 'form-urlencoded',
+ usePkce: true,
+ },
+});
diff --git a/packages/twenty-apps/public/teams-transcripts/src/constants/universal-identifiers.ts b/packages/twenty-apps/public/teams-transcripts/src/constants/universal-identifiers.ts
index 7a2a78de0a2..756300051e5 100644
--- a/packages/twenty-apps/public/teams-transcripts/src/constants/universal-identifiers.ts
+++ b/packages/twenty-apps/public/teams-transcripts/src/constants/universal-identifiers.ts
@@ -5,3 +5,5 @@ export const APPLICATION_UNIVERSAL_IDENTIFIER =
'428a3cd5-6c8e-47ae-820b-b8a672a0bee9';
export const DEFAULT_ROLE_UNIVERSAL_IDENTIFIER =
'babf1e4a-24e8-4f37-b7e0-2a8a69a519a4';
+export const TEAMS_CONNECTION_PROVIDER_UNIVERSAL_IDENTIFIER =
+ 'daf934d4-3609-41fc-9c8c-59d4d856139f';