Skip to content

The open alternative to Salesforce, designed for AI.

Make transcript summaries the only Teams setting for V1 (#28227)

nitin0967ec1d766e
diff --git a/packages/twenty-apps/public/teams/README.md b/packages/twenty-apps/public/teams/README.md
index cd9cdfc8932..572d2b9c55b 100644
--- a/packages/twenty-apps/public/teams/README.md
+++ b/packages/twenty-apps/public/teams/README.md
@@ -7,8 +7,7 @@
- **A Microsoft connection** for your work or school account
- **List My Teams Transcripts**, an AI and workflow action for the meetings you organized
- **Sync Teams Transcript**, an AI and workflow action that imports one of those transcripts into a Call Recording
-- **Import history**, a settings section that imports the transcripts of up to the last year
-- **AI summary** of each imported transcript, written on its Call Recording
+- **AI summary** of each imported transcript, written on its Call Recording and turned off from the app settings
## πŸ“Œ Heads up
diff --git a/packages/twenty-apps/public/teams/SETUP.md b/packages/twenty-apps/public/teams/SETUP.md
index 8bc89ca9146..82bdedafb66 100644
--- a/packages/twenty-apps/public/teams/SETUP.md
+++ b/packages/twenty-apps/public/teams/SETUP.md
@@ -91,9 +91,8 @@ account matched on email is linked again on its next message.
Open **Settings > Applications > Microsoft Teams > Settings**, select
**Add connection**, and sign in with your Microsoft work or school account.
-The transcript release flag and workspace setting are off by default, and
-connecting an account does not enable them. With both on, connecting an account
-also creates a Microsoft Graph subscription to the transcripts of the meetings
+The transcript release flag is off by default, and connecting an account does
+not enable it. With it on, connecting an account also creates a Microsoft Graph subscription to the transcripts of the meetings
that account organizes. Graph delivers its notifications to
`https://<your-twenty-host>/webhooks/server/d62e36e1-82bb-4f78-b2ab-54a31faaafab`,
so the Twenty server must be reachable from the internet over HTTPS. New
@@ -104,28 +103,21 @@ account or uninstalling the app deletes the subscription.
Connecting also imports the transcripts of the last 31 days, once per
connection. Reconnecting starts it again only when that import failed or
-stalled. For older ones, use **Import history** in **Settings > Applications >
-Microsoft Teams > Settings**: count the transcripts of up to the last 365 days
-first, then import them. Only members who can open the app settings see this
-section, and it imports the meetings of a connection they added themselves:
-their personal one, or a workspace-shared one they created. Every member's
-connection still imports its last 31 days when it connects. The import runs in
-the background, newest first, waiting a minute after each calendar page that
-imported transcripts. Use the **Sync Teams Transcript** action for a single
-transcript, such as one that Microsoft had not published about two and a half
+stalled. Use the **Sync Teams Transcript** action for a single transcript, such as one that Microsoft had not published about two and a half
hours after the meeting or whose import keeps failing.
Transcripts link to the meeting's calendar event when that calendar is synced in
Twenty. An occurrence of a recurring meeting links to the series' event.
Each Call Recording that Microsoft Teams imports gets an AI summary, including
-the 31-day import on connect and **Import history** runs. Each summary uses AI
-credits.
+the 31-day import on connect. Each summary uses AI credits; turn off **Enable
+transcript summaries** in **Settings > Applications > Microsoft Teams >
+Settings** to stop them.
## Test the transcript actions
-1. For a development build, set `IS_TRANSCRIPT_IMPORT_ENABLED` to `true`, rebuild
- and deploy the app, then enable transcripts in the Microsoft Teams settings.
+1. For a development build, set `IS_TRANSCRIPT_IMPORT_ENABLED` to `true`, then
+ rebuild and deploy the app.
2. Schedule a Teams meeting with the connected account, join it at its
scheduled time, start transcription, speak, and end the meeting. Microsoft
publishes the transcript a few minutes later.
@@ -155,19 +147,23 @@ plus [Teams transcript API access settings](https://learn.microsoft.com/en-us/mi
- **Features** are the product areas: chat and transcripts. Their code, settings
components, identifiers, and tests live in `src/features/chat` and
`src/features/transcripts` respectively.
-- **Settings** are workspace choices. `TEAMS_CHAT_ENABLED` and
- `TEAMS_TRANSCRIPTS_ENABLED` are Boolean application variables managed through
- **Settings β†’ Applications β†’ Microsoft Teams β†’ Settings**. Updates use the
- metadata API, which requires permission to manage applications.
+- **Settings** are workspace choices. `TEAMS_CHAT_ENABLED`,
+ `TEAMS_TRANSCRIPTS_ENABLED` and `TEAMS_TRANSCRIPT_SUMMARY_ENABLED` are Boolean
+ application variables. **Settings β†’ Applications β†’ Microsoft Teams β†’
+ Settings** manages chat and transcript summaries; transcripts are on by
+ default and have no switch. Updates use the metadata API, which requires
+ permission to manage applications.
- **Feature flags** are developer-controlled release decisions, defined in
`src/constants/feature-flags.ts`. They follow the server's
`IS_…_ENABLED` naming and are bundled with the app. Changing them requires a
new build and deployment; a workspace setting cannot override them.
-`IS_CHAT_ASSISTANT_ENABLED` controls availability of chat in this scaffold, and
-`IS_TRANSCRIPT_IMPORT_ENABLED` controls transcript imports. Both start as
-`false`. A disabled feature is shown as unavailable in settings, retaining any
-saved workspace preference.
+`IS_CHAT_ASSISTANT_ENABLED` controls availability of chat in this scaffold,
+`IS_TRANSCRIPT_IMPORT_ENABLED` controls transcript imports and summaries, and
+`IS_TRANSCRIPT_HISTORY_IMPORT_ENABLED` shows the Import history section. All
+start as `false`. Settings hides chat and Import history until their flags are
+on, and shows transcript summaries as unavailable until transcripts are,
+retaining any saved workspace preference.
The frontend and handlers share
`isFeatureEnabled({ isAvailable, settingValue })`. Pass the feature's development
@@ -225,7 +221,7 @@ workspace. Public apps use the monorepo CI workflows.
- Admin approval required: the Microsoft tenant administrator must consent to
the delegated permissions before the connection can finish.
- `Teams transcripts are not enabled`: enable the transcript release flag in
- the build and the workspace transcript setting.
+ the build.
- `Microsoft Teams is not connected`: the requesting user has no personal
connection and the workspace has no shared one.
- `GraphAccessToTranscriptsDisabled`: enable Microsoft Graph transcript access
diff --git a/packages/twenty-apps/public/teams/src/application.config.ts b/packages/twenty-apps/public/teams/src/application.config.ts
index f2bcfd725d3..4c59078f619 100644
--- a/packages/twenty-apps/public/teams/src/application.config.ts
+++ b/packages/twenty-apps/public/teams/src/application.config.ts
@@ -3,8 +3,12 @@ import { defineApplication, FieldType } from 'twenty-sdk/define';
import { APPLICATION_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
import { CHAT_ENABLED_APPLICATION_VARIABLE_KEY } from 'src/features/chat/constants/chat-enabled-application-variable-key';
import { CHAT_ENABLED_APPLICATION_VARIABLE_UNIVERSAL_IDENTIFIER } from 'src/features/chat/constants/universal-identifiers';
+import { TRANSCRIPT_SUMMARY_ENABLED_APPLICATION_VARIABLE_KEY } from 'src/features/transcripts/constants/transcript-summary-enabled-application-variable-key';
import { TRANSCRIPTS_ENABLED_APPLICATION_VARIABLE_KEY } from 'src/features/transcripts/constants/transcripts-enabled-application-variable-key';
-import { TRANSCRIPTS_ENABLED_APPLICATION_VARIABLE_UNIVERSAL_IDENTIFIER } from 'src/features/transcripts/constants/universal-identifiers';
+import {
+ TRANSCRIPT_SUMMARY_ENABLED_APPLICATION_VARIABLE_UNIVERSAL_IDENTIFIER,
+ TRANSCRIPTS_ENABLED_APPLICATION_VARIABLE_UNIVERSAL_IDENTIFIER,
+} from 'src/features/transcripts/constants/universal-identifiers';
export default defineApplication({
universalIdentifier: APPLICATION_UNIVERSAL_IDENTIFIER,
@@ -38,7 +42,17 @@ export default defineApplication({
'Import Microsoft Teams meeting transcripts into this workspace.',
type: FieldType.BOOLEAN,
isSecret: false,
- value: false,
+ value: true,
+ },
+ [TRANSCRIPT_SUMMARY_ENABLED_APPLICATION_VARIABLE_KEY]: {
+ universalIdentifier:
+ TRANSCRIPT_SUMMARY_ENABLED_APPLICATION_VARIABLE_UNIVERSAL_IDENTIFIER,
+ label: 'Enable transcript summaries',
+ description:
+ 'Write an AI summary on each Call Recording imported from Microsoft Teams. Each summary uses AI credits.',
+ type: FieldType.BOOLEAN,
+ isSecret: false,
+ value: true,
},
},
serverVariables: {
diff --git a/packages/twenty-apps/public/teams/src/constants/feature-flags.ts b/packages/twenty-apps/public/teams/src/constants/feature-flags.ts
index 87bab360b5e..a8fd00f6a57 100644
--- a/packages/twenty-apps/public/teams/src/constants/feature-flags.ts
+++ b/packages/twenty-apps/public/teams/src/constants/feature-flags.ts
@@ -1,4 +1,5 @@
export const FEATURE_FLAGS = {
IS_CHAT_ASSISTANT_ENABLED: false,
IS_TRANSCRIPT_IMPORT_ENABLED: false,
+ IS_TRANSCRIPT_HISTORY_IMPORT_ENABLED: false,
} as const;
diff --git a/packages/twenty-apps/public/teams/src/features/transcripts/constants/transcript-summary-enabled-application-variable-key.ts b/packages/twenty-apps/public/teams/src/features/transcripts/constants/transcript-summary-enabled-application-variable-key.ts
new file mode 100644
index 00000000000..6fbccade490
--- /dev/null
+++ b/packages/twenty-apps/public/teams/src/features/transcripts/constants/transcript-summary-enabled-application-variable-key.ts
@@ -0,0 +1,2 @@
+export const TRANSCRIPT_SUMMARY_ENABLED_APPLICATION_VARIABLE_KEY =
+ 'TEAMS_TRANSCRIPT_SUMMARY_ENABLED';
diff --git a/packages/twenty-apps/public/teams/src/features/transcripts/constants/universal-identifiers.ts b/packages/twenty-apps/public/teams/src/features/transcripts/constants/universal-identifiers.ts
index 65d06198b71..b2b5dda7175 100644
--- a/packages/twenty-apps/public/teams/src/features/transcripts/constants/universal-identifiers.ts
+++ b/packages/twenty-apps/public/teams/src/features/transcripts/constants/universal-identifiers.ts
@@ -37,6 +37,9 @@ export const TEAMS_TRANSCRIPT_HISTORY_IMPORT_UNIVERSAL_IDENTIFIER =
export const TEAMS_TRANSCRIPT_HISTORY_STATUS_UNIVERSAL_IDENTIFIER =
'4b39d2ea-7b16-4e68-a93c-bfb628ae5431';
+export const TRANSCRIPT_SUMMARY_ENABLED_APPLICATION_VARIABLE_UNIVERSAL_IDENTIFIER =
+ '0c9eb9b3-8424-4090-8f2d-17d34d01e9bd';
+
export const TEAMS_TRANSCRIPT_SUMMARIZER_AGENT_UNIVERSAL_IDENTIFIER =
'8be80a69-c787-4a37-989e-92131b0d79dd';
diff --git a/packages/twenty-apps/public/teams/src/features/transcripts/front-components/TranscriptSettings.tsx b/packages/twenty-apps/public/teams/src/features/transcripts/front-components/TranscriptSettings.tsx
index 457fae2c0e7..4b10d2bf240 100644
--- a/packages/twenty-apps/public/teams/src/features/transcripts/front-components/TranscriptSettings.tsx
+++ b/packages/twenty-apps/public/teams/src/features/transcripts/front-components/TranscriptSettings.tsx
@@ -1,7 +1,7 @@
import { useTranslate } from 'twenty-sdk/front-component';
import { FEATURE_FLAGS } from 'src/constants/feature-flags';
-import { TRANSCRIPTS_ENABLED_APPLICATION_VARIABLE_KEY } from 'src/features/transcripts/constants/transcripts-enabled-application-variable-key';
+import { TRANSCRIPT_SUMMARY_ENABLED_APPLICATION_VARIABLE_KEY } from 'src/features/transcripts/constants/transcript-summary-enabled-application-variable-key';
import { TranscriptImportHistorySection } from 'src/features/transcripts/front-components/TranscriptImportHistorySection';
import { FeatureSettingsSection } from 'src/front-components/components/FeatureSettingsSection';
import { useFeatureSetting } from 'src/front-components/hooks/use-feature-setting';
@@ -11,13 +11,9 @@ export const TranscriptSettings = () => {
const { t } = useTranslate();
const { settingValue, isSaving, hasSaveError, updateSetting } =
useFeatureSetting({
- variableKey: TRANSCRIPTS_ENABLED_APPLICATION_VARIABLE_KEY,
+ variableKey: TRANSCRIPT_SUMMARY_ENABLED_APPLICATION_VARIABLE_KEY,
isAvailable: FEATURE_FLAGS.IS_TRANSCRIPT_IMPORT_ENABLED,
});
- const isTranscriptImportEnabled = isFeatureEnabled({
- isAvailable: FEATURE_FLAGS.IS_TRANSCRIPT_IMPORT_ENABLED,
- settingValue,
- });
const handleChange = (isEnabled: boolean) => {
void updateSetting(isEnabled);
@@ -27,17 +23,23 @@ export const TranscriptSettings = () => {
<>
<FeatureSettingsSection
title={t('Transcripts')}
- label={t('Enable transcripts')}
+ label={t('Enable transcript summaries')}
description={t(
- 'Import Microsoft Teams meeting transcripts into this workspace.',
+ 'Write an AI summary on each Call Recording imported from Microsoft Teams. Each summary uses AI credits.',
)}
isAvailable={FEATURE_FLAGS.IS_TRANSCRIPT_IMPORT_ENABLED}
- isEnabled={isTranscriptImportEnabled}
+ isEnabled={isFeatureEnabled({
+ isAvailable: FEATURE_FLAGS.IS_TRANSCRIPT_IMPORT_ENABLED,
+ settingValue,
+ })}
isSaving={isSaving}
hasSaveError={hasSaveError}
onChange={handleChange}
/>
- {isTranscriptImportEnabled && <TranscriptImportHistorySection />}
+ {FEATURE_FLAGS.IS_TRANSCRIPT_IMPORT_ENABLED &&
+ FEATURE_FLAGS.IS_TRANSCRIPT_HISTORY_IMPORT_ENABLED && (
+ <TranscriptImportHistorySection />
+ )}
</>
);
};
diff --git a/packages/twenty-apps/public/teams/src/features/transcripts/front-components/utils/get-teams-transcript-history-route-error-message.ts b/packages/twenty-apps/public/teams/src/features/transcripts/front-components/utils/get-teams-transcript-history-route-error-message.ts
index c3b6af106a9..04e59da629f 100644
--- a/packages/twenty-apps/public/teams/src/features/transcripts/front-components/utils/get-teams-transcript-history-route-error-message.ts
+++ b/packages/twenty-apps/public/teams/src/features/transcripts/front-components/utils/get-teams-transcript-history-route-error-message.ts
@@ -12,7 +12,7 @@ export const getTeamsTranscriptHistoryRouteErrorMessage = ({
}): string => {
switch (errorCode) {
case 'transcripts-not-enabled':
- return t('Turn on transcripts to import their history.');
+ return t('Importing transcript history is not available yet.');
case 'not-connected':
return t(
'Add your own Microsoft Teams connection to import its history.',
diff --git a/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/__tests__/teams-transcript-history-routes.test.ts b/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/__tests__/teams-transcript-history-routes.test.ts
index 69dcf6fddf1..a2beef1492a 100644
--- a/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/__tests__/teams-transcript-history-routes.test.ts
+++ b/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/__tests__/teams-transcript-history-routes.test.ts
@@ -5,14 +5,19 @@ import { teamsTranscriptHistoryCountHandler } from 'src/features/transcripts/log
import { teamsTranscriptHistoryImportHandler } from 'src/features/transcripts/logic-functions/teams-transcript-history-import';
import { teamsTranscriptHistoryStatusHandler } from 'src/features/transcripts/logic-functions/teams-transcript-history-status';
-const { kvStore, listConnectionsMock, enqueueJobsMock } = vi.hoisted(() => ({
- kvStore: new Map<string, unknown>(),
- listConnectionsMock: vi.fn(),
- enqueueJobsMock: vi.fn(),
-}));
+const { featureFlags, kvStore, listConnectionsMock, enqueueJobsMock } =
+ vi.hoisted(() => ({
+ featureFlags: {
+ IS_TRANSCRIPT_IMPORT_ENABLED: true,
+ IS_TRANSCRIPT_HISTORY_IMPORT_ENABLED: true,
+ },
+ kvStore: new Map<string, unknown>(),
+ listConnectionsMock: vi.fn(),
+ enqueueJobsMock: vi.fn(),
+ }));
vi.mock('src/constants/feature-flags', () => ({
- FEATURE_FLAGS: { IS_TRANSCRIPT_IMPORT_ENABLED: true },
+ FEATURE_FLAGS: featureFlags,
}));
vi.mock('twenty-sdk/logic-function', async (importOriginal) => ({
@@ -75,11 +80,45 @@ describe('Teams transcript history routes', () => {
beforeEach(() => {
vi.clearAllMocks();
kvStore.clear();
+ featureFlags.IS_TRANSCRIPT_HISTORY_IMPORT_ENABLED = true;
process.env[TRANSCRIPTS_ENABLED_APPLICATION_VARIABLE_KEY] = 'true';
listConnectionsMock.mockResolvedValue([ADMIN_CONNECTION]);
enqueueJobsMock.mockResolvedValue(undefined);
});
+ it('should refuse every history route until history import is released', async () => {
+ featureFlags.IS_TRANSCRIPT_HISTORY_IMPORT_ENABLED = false;
+
+ await expect(
+ teamsTranscriptHistoryCountHandler(
+ buildRoutePayload({ days: 30 }),
+ OWNER_CONTEXT,
+ ),
+ ).resolves.toEqual({
+ success: false,
+ errorCode: 'transcripts-not-enabled',
+ });
+ await expect(
+ teamsTranscriptHistoryImportHandler(
+ buildRoutePayload({ runId: 'counted-run' }),
+ OWNER_CONTEXT,
+ ),
+ ).resolves.toEqual({
+ success: false,
+ errorCode: 'transcripts-not-enabled',
+ });
+ await expect(
+ teamsTranscriptHistoryStatusHandler(
+ buildRoutePayload(null),
+ OWNER_CONTEXT,
+ ),
+ ).resolves.toEqual({
+ success: false,
+ errorCode: 'transcripts-not-enabled',
+ });
+ expect(enqueueJobsMock).not.toHaveBeenCalled();
+ });
+
it.each([0, 366, 1.5, '30', undefined])(
'should refuse to count %s days',
async (days) => {
diff --git a/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/utils/handle-teams-transcript-history-route.ts b/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/utils/handle-teams-transcript-history-route.ts
index 6be4149cfc8..fe3bb9c22d6 100644
--- a/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/utils/handle-teams-transcript-history-route.ts
+++ b/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/utils/handle-teams-transcript-history-route.ts
@@ -20,6 +20,7 @@ export const handleTeamsTranscriptHistoryRoute = async ({
) => Promise<TeamsTranscriptHistoryRouteResult>;
}): Promise<TeamsTranscriptHistoryRouteResult> => {
if (
+ !FEATURE_FLAGS.IS_TRANSCRIPT_HISTORY_IMPORT_ENABLED ||
!isFeatureEnabled({
isAvailable: FEATURE_FLAGS.IS_TRANSCRIPT_IMPORT_ENABLED,
settingValue: process.env[TRANSCRIPTS_ENABLED_APPLICATION_VARIABLE_KEY],
diff --git a/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/utils/is-teams-transcript-summary-enabled.ts b/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/utils/is-teams-transcript-summary-enabled.ts
index 0702e321c40..8a9a7bef3c3 100644
--- a/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/utils/is-teams-transcript-summary-enabled.ts
+++ b/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/utils/is-teams-transcript-summary-enabled.ts
@@ -1,10 +1,15 @@
import { FEATURE_FLAGS } from 'src/constants/feature-flags';
+import { TRANSCRIPT_SUMMARY_ENABLED_APPLICATION_VARIABLE_KEY } from 'src/features/transcripts/constants/transcript-summary-enabled-application-variable-key';
import { TRANSCRIPTS_ENABLED_APPLICATION_VARIABLE_KEY } from 'src/features/transcripts/constants/transcripts-enabled-application-variable-key';
import { isFeatureEnabled } from 'src/utils/is-feature-enabled';
-// TODO(@ehconitin): gate on a workspace summary setting once Teams has settings; V1 summarizes every imported transcript
export const isTeamsTranscriptSummaryEnabled = (): boolean =>
isFeatureEnabled({
isAvailable: FEATURE_FLAGS.IS_TRANSCRIPT_IMPORT_ENABLED,
settingValue: process.env[TRANSCRIPTS_ENABLED_APPLICATION_VARIABLE_KEY],
+ }) &&
+ isFeatureEnabled({
+ isAvailable: FEATURE_FLAGS.IS_TRANSCRIPT_IMPORT_ENABLED,
+ settingValue:
+ process.env[TRANSCRIPT_SUMMARY_ENABLED_APPLICATION_VARIABLE_KEY],
});
diff --git a/packages/twenty-apps/public/teams/src/front-components/components/TeamsSettings.tsx b/packages/twenty-apps/public/teams/src/front-components/components/TeamsSettings.tsx
index f6497655c02..613029c315e 100644
--- a/packages/twenty-apps/public/teams/src/front-components/components/TeamsSettings.tsx
+++ b/packages/twenty-apps/public/teams/src/front-components/components/TeamsSettings.tsx
@@ -5,6 +5,7 @@ import 'twenty-ui/theme-light.css';
import styled from '@emotion/styled';
import { themeCssVariables } from 'twenty-ui/theme';
+import { FEATURE_FLAGS } from 'src/constants/feature-flags';
import { ChatSettings } from 'src/features/chat/front-components/ChatSettings';
import { TranscriptSettings } from 'src/features/transcripts/front-components/TranscriptSettings';
@@ -17,7 +18,7 @@ const StyledContainer = styled.div`
export const TeamsSettings = () => (
<StyledContainer>
- <ChatSettings />
+ {FEATURE_FLAGS.IS_CHAT_ASSISTANT_ENABLED && <ChatSettings />}
<TranscriptSettings />
</StyledContainer>
);
diff --git a/packages/twenty-apps/public/teams/src/front-components/components/__tests__/TeamsSettings.test.tsx b/packages/twenty-apps/public/teams/src/front-components/components/__tests__/TeamsSettings.test.tsx
index 367be990d44..6eda4cf28c9 100644
--- a/packages/twenty-apps/public/teams/src/front-components/components/__tests__/TeamsSettings.test.tsx
+++ b/packages/twenty-apps/public/teams/src/front-components/components/__tests__/TeamsSettings.test.tsx
@@ -6,7 +6,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { APPLICATION_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
import { CHAT_ENABLED_APPLICATION_VARIABLE_KEY } from 'src/features/chat/constants/chat-enabled-application-variable-key';
-import { TRANSCRIPTS_ENABLED_APPLICATION_VARIABLE_KEY } from 'src/features/transcripts/constants/transcripts-enabled-application-variable-key';
+import { TRANSCRIPT_SUMMARY_ENABLED_APPLICATION_VARIABLE_KEY } from 'src/features/transcripts/constants/transcript-summary-enabled-application-variable-key';
import { TeamsSettings } from 'src/front-components/components/TeamsSettings';
const { featureFlags, variables, queryMock, mutationMock, restGetMock } =
@@ -17,6 +17,7 @@ const { featureFlags, variables, queryMock, mutationMock, restGetMock } =
featureFlags: {
IS_CHAT_ASSISTANT_ENABLED: false,
IS_TRANSCRIPT_IMPORT_ENABLED: false,
+ IS_TRANSCRIPT_HISTORY_IMPORT_ENABLED: false,
},
variables,
queryMock: vi.fn(),
@@ -43,7 +44,7 @@ vi.mock('twenty-sdk/front-component', () => ({
vi.mock(
'src/features/transcripts/front-components/TranscriptImportHistorySection',
- () => ({ TranscriptImportHistorySection: () => null }),
+ () => ({ TranscriptImportHistorySection: () => <p>Import history</p> }),
);
vi.mock('twenty-client-sdk/metadata', () => ({
@@ -69,8 +70,9 @@ describe('TeamsSettings', () => {
vi.resetAllMocks();
featureFlags.IS_CHAT_ASSISTANT_ENABLED = false;
featureFlags.IS_TRANSCRIPT_IMPORT_ENABLED = false;
+ featureFlags.IS_TRANSCRIPT_HISTORY_IMPORT_ENABLED = false;
variables[CHAT_ENABLED_APPLICATION_VARIABLE_KEY] = 'false';
- variables[TRANSCRIPTS_ENABLED_APPLICATION_VARIABLE_KEY] = 'false';
+ variables[TRANSCRIPT_SUMMARY_ENABLED_APPLICATION_VARIABLE_KEY] = 'false';
queryMock.mockResolvedValue({
findOneApplication: { id: 'teams-application' },
});
@@ -80,24 +82,26 @@ describe('TeamsSettings', () => {
afterEach(cleanup);
- it('keeps unfinished features inactive even when workspace settings are enabled', async () => {
+ it('hides chat and keeps transcript summaries inactive before their release', async () => {
variables[CHAT_ENABLED_APPLICATION_VARIABLE_KEY] = 'true';
- variables[TRANSCRIPTS_ENABLED_APPLICATION_VARIABLE_KEY] = 'true';
+ variables[TRANSCRIPT_SUMMARY_ENABLED_APPLICATION_VARIABLE_KEY] = 'true';
const user = userEvent.setup();
render(<TeamsSettings />);
- for (const label of ['Enable chat', 'Enable transcripts']) {
- const control = screen.getByRole('switch', { name: label });
+ expect(screen.queryByRole('switch', { name: 'Enable chat' })).toBeNull();
- expect(control.getAttribute('aria-checked')).toBe('false');
- expect(control.hasAttribute('disabled')).toBe(true);
- await user.click(control);
- }
+ const summaries = screen.getByRole('switch', {
+ name: 'Enable transcript summaries',
+ });
+
+ expect(summaries.getAttribute('aria-checked')).toBe('false');
+ expect(summaries.hasAttribute('disabled')).toBe(true);
+ await user.click(summaries);
expect(
screen.getAllByText('Not available in this version yet.'),
- ).toHaveLength(2);
+ ).toHaveLength(1);
expect(queryMock).not.toHaveBeenCalled();
expect(mutationMock).not.toHaveBeenCalled();
});
@@ -113,21 +117,20 @@ describe('TeamsSettings', () => {
featureFlags.IS_CHAT_ASSISTANT_ENABLED = isChatAvailable;
featureFlags.IS_TRANSCRIPT_IMPORT_ENABLED = isTranscriptsAvailable;
variables[CHAT_ENABLED_APPLICATION_VARIABLE_KEY] = 'true';
- variables[TRANSCRIPTS_ENABLED_APPLICATION_VARIABLE_KEY] = 'true';
+ variables[TRANSCRIPT_SUMMARY_ENABLED_APPLICATION_VARIABLE_KEY] = 'true';
render(<TeamsSettings />);
- const chat = screen.getByRole('switch', { name: 'Enable chat' });
- const transcripts = screen.getByRole('switch', {
- name: 'Enable transcripts',
+ const chat = screen.queryByRole('switch', { name: 'Enable chat' });
+ const summaries = screen.getByRole('switch', {
+ name: 'Enable transcript summaries',
});
- expect(chat.hasAttribute('disabled')).toBe(!isChatAvailable);
- expect(transcripts.hasAttribute('disabled')).toBe(
- !isTranscriptsAvailable,
+ expect(chat?.getAttribute('aria-checked')).toBe(
+ isChatAvailable ? 'true' : undefined,
);
- expect(chat.getAttribute('aria-checked')).toBe(String(isChatAvailable));
- expect(transcripts.getAttribute('aria-checked')).toBe(
+ expect(summaries.hasAttribute('disabled')).toBe(!isTranscriptsAvailable);
+ expect(summaries.getAttribute('aria-checked')).toBe(
String(isTranscriptsAvailable),
);
expect(queryMock).not.toHaveBeenCalled();
@@ -135,13 +138,33 @@ describe('TeamsSettings', () => {
},
);
+ it.each([
+ [false, false],
+ [true, false],
+ [false, true],
+ [true, true],
+ ])(
+ 'shows Import history only when transcripts (%s) and history import (%s) are released',
+ (isTranscriptsAvailable, isHistoryImportAvailable) => {
+ featureFlags.IS_TRANSCRIPT_IMPORT_ENABLED = isTranscriptsAvailable;
+ featureFlags.IS_TRANSCRIPT_HISTORY_IMPORT_ENABLED =
+ isHistoryImportAvailable;
+
+ render(<TeamsSettings />);
+
+ expect(screen.queryByText('Import history') !== null).toBe(
+ isTranscriptsAvailable && isHistoryImportAvailable,
+ );
+ },
+ );
+
it.each([undefined, '', 'false', 'TRUE'])(
'keeps available features off for workspace value %s',
(value) => {
featureFlags.IS_CHAT_ASSISTANT_ENABLED = true;
featureFlags.IS_TRANSCRIPT_IMPORT_ENABLED = true;
variables[CHAT_ENABLED_APPLICATION_VARIABLE_KEY] = value;
- variables[TRANSCRIPTS_ENABLED_APPLICATION_VARIABLE_KEY] = value;
+ variables[TRANSCRIPT_SUMMARY_ENABLED_APPLICATION_VARIABLE_KEY] = value;
render(<TeamsSettings />);
@@ -178,8 +201,8 @@ describe('TeamsSettings', () => {
render(<TeamsSettings />);
const chat = screen.getByRole('switch', { name: 'Enable chat' });
- const transcripts = screen.getByRole('switch', {
- name: 'Enable transcripts',
+ const summaries = screen.getByRole('switch', {
+ name: 'Enable transcript summaries',
});
expect(queryMock).not.toHaveBeenCalled();
expect(mutationMock).not.toHaveBeenCalled();
@@ -187,7 +210,7 @@ describe('TeamsSettings', () => {
await user.click(chat);
await waitFor(() => expect(chat.getAttribute('aria-checked')).toBe('true'));
- expect(transcripts.getAttribute('aria-checked')).toBe('false');
+ expect(summaries.getAttribute('aria-checked')).toBe('false');
expect(queryMock.mock.calls).toEqual([[APPLICATION_QUERY]]);
expect(mutationMock).toHaveBeenCalledTimes(1);
expect(mutationMock).toHaveBeenNthCalledWith(1, {
@@ -200,9 +223,9 @@ describe('TeamsSettings', () => {
},
});
- await user.click(transcripts);
+ await user.click(summaries);
await waitFor(() =>
- expect(transcripts.getAttribute('aria-checked')).toBe('true'),
+ expect(summaries.getAttribute('aria-checked')).toBe('true'),
);
expect(chat.getAttribute('aria-checked')).toBe('true');
expect(queryMock.mock.calls).toEqual([
@@ -214,7 +237,7 @@ describe('TeamsSettings', () => {
updateOneApplicationVariable: {
__args: {
applicationId: 'teams-application',
- key: TRANSCRIPTS_ENABLED_APPLICATION_VARIABLE_KEY,
+ key: TRANSCRIPT_SUMMARY_ENABLED_APPLICATION_VARIABLE_KEY,
value: 'true',
},
},
@@ -224,7 +247,7 @@ describe('TeamsSettings', () => {
await waitFor(() =>
expect(chat.getAttribute('aria-checked')).toBe('false'),
);
- expect(transcripts.getAttribute('aria-checked')).toBe('true');
+ expect(summaries.getAttribute('aria-checked')).toBe('true');
expect(queryMock.mock.calls).toEqual([
[APPLICATION_QUERY],
[APPLICATION_QUERY],
diff --git a/packages/twenty-apps/public/teams/src/roles/default-function.role.ts b/packages/twenty-apps/public/teams/src/roles/default-function.role.ts
index 798c85dacf9..106fbcc7a56 100644
--- a/packages/twenty-apps/public/teams/src/roles/default-function.role.ts
+++ b/packages/twenty-apps/public/teams/src/roles/default-function.role.ts
@@ -14,7 +14,7 @@ export default defineApplicationRole({
universalIdentifier: DEFAULT_ROLE_UNIVERSAL_IDENTIFIER,
label: 'Twenty Microsoft Teams tools role',
description:
- 'Reads calendar events and their calendar channel associations to match Teams meetings, writes imported transcripts to Call Recordings, and writes the summary from the Teams Transcript Summarizer agent on them. Tracks assistant requests received from Teams, reads workspace members to match a Teams sender by email, keeps Teams user links so a matched sender is remembered and can be unlinked, and runs the Teams Assistant agent as that member, with the permissions of that member. Chat tools only forward requests to Microsoft Teams using the configured bot credentials.',
+ 'Reads calendar events and their calendar channel associations to match Teams meetings, writes imported transcripts to Call Recordings, and writes the summary from the Teams Transcript Summarizer agent on them. Tracks assistant requests received from Teams, reads workspace members to match a Teams sender by email, keeps Teams user links so a matched sender is remembered and can be unlinked, and runs the Teams Assistant agent as that member, with the permissions of that member. Chat tools only forward requests to Microsoft Teams using the configured bot credentials. Saves the Microsoft Teams settings of this workspace.',
canReadAllObjectRecords: false,
canUpdateAllObjectRecords: false,
canSoftDeleteAllObjectRecords: false,
@@ -75,5 +75,8 @@ export default defineApplicationRole({
},
],
fieldPermissions: [],
- permissionFlagUniversalIdentifiers: [SystemPermissionFlag.AI],
+ permissionFlagUniversalIdentifiers: [
+ SystemPermissionFlag.AI,
+ SystemPermissionFlag.APPLICATIONS,
+ ],
});