Skip to content

The open alternative to Salesforce, designed for AI.

test(twenty-slack): cover the app end to end against a mocked Slack workspace (#24192)

Abdul Rahman774b5b54409c
diff --git a/packages/twenty-apps/public/slack/package.json b/packages/twenty-apps/public/slack/package.json
index 379c86a33f5..0a7cfffec19 100644
--- a/packages/twenty-apps/public/slack/package.json
+++ b/packages/twenty-apps/public/slack/package.json
@@ -29,6 +29,7 @@
"@types/node": "^24.7.2",
"@types/react": "^18.2.0",
"@typescript/native-preview": "^7.0.0-dev.20260116.1",
+ "msw": "^2.12.14",
"oxlint": "^0.16.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
diff --git a/packages/twenty-apps/public/slack/src/__tests__/README.md b/packages/twenty-apps/public/slack/src/__tests__/README.md
new file mode 100644
index 00000000000..60b904cacd9
--- /dev/null
+++ b/packages/twenty-apps/public/slack/src/__tests__/README.md
@@ -0,0 +1,46 @@
+# Slack app tests
+
+## Layers
+
+| Suite | Command | What it runs against |
+| ------------------------------------- | ---------------- | -------------------------------------------------------------------- |
+| Unit (`*.test.ts`) | `yarn test:unit` | Pure functions, with the modules around them mocked. No server. |
+| Integration (`*.integration-test.ts`) | `yarn test` | The real handlers, a live Twenty server, and a fake Slack workspace. |
+
+The integration suite needs a Twenty server; `src/__tests__/global-setup.ts`
+deploys and installs the app on it before the first test and uninstalls it
+after the last one. CI spawns that server (see `ci-twenty-apps.yaml`); locally,
+point `TWENTY_API_URL` / `TWENTY_API_KEY` at your own instance.
+
+## What is real and what is faked
+
+`setupSlackIntegrationTest()` starts an [MSW](https://mswjs.io) server for the
+calling test file. Slack does not publish a mock of its Web API, so the suite
+carries its own:
+
+- **Slack Web API** (`utils/create-slack-api-mock.util.ts`) - a small stateful fake of the
+ endpoints the app uses (channels, messages, threads, reactions, ephemerals,
+ assistant statuses, `auth.test`). The app talks to it through the real
+ `@slack/web-api` client, so argument serialization, pagination, token
+ handling and the `ok: false` error shapes are all exercised. Tests assert on
+ what landed in the fake workspace, and can inject Slack failures with
+ `failNextCall()` or `rejectMarkdownText()`.
+- **App runtime services** (`utils/create-app-runtime-mock.util.ts`) - `kv`,
+ `listConnections`, `getConnection` and `runAgent` are GraphQL calls the
+ server only answers for an application-scoped token, which a workspace API
+ key is not. They are answered in-memory with the same semantics the server
+ implements (including the cross-workspace `SERVER` key claim rules).
+- **Everything else is real**: Slack Assistant Request records are created,
+ read and updated on the live server through `CoreApiClient`. Localhost
+ traffic passes through to that server; any other unmocked request fails the
+ test with a 500, the way `http-mock.util.ts` does in `twenty-server`.
+
+Helpers follow the `twenty-server` integration test layout, one export per
+file: `utils/*.util.ts` for behaviour, `types/*.type.ts` for shared shapes,
+`constants/*.constant.ts` for shared test values.
+
+`slack-deployed-functions.integration-test.ts` sits one level further out: it
+uses `functionExecute` from `twenty-sdk/cli` to run the functions the way the
+server runs them - deployed, in the app runtime, with the app's own access
+token and server variables - and asserts on the returned status, data and
+error.
diff --git a/packages/twenty-apps/public/slack/src/__tests__/constants/slack-test-connected-account-id.constant.ts b/packages/twenty-apps/public/slack/src/__tests__/constants/slack-test-connected-account-id.constant.ts
new file mode 100644
index 00000000000..1c8e12db70e
--- /dev/null
+++ b/packages/twenty-apps/public/slack/src/__tests__/constants/slack-test-connected-account-id.constant.ts
@@ -0,0 +1 @@
+export const SLACK_TEST_CONNECTED_ACCOUNT_ID = 'connected-account-slack-1';
diff --git a/packages/twenty-apps/public/slack/src/__tests__/constants/slack-test-webhook-secret.constant.ts b/packages/twenty-apps/public/slack/src/__tests__/constants/slack-test-webhook-secret.constant.ts
new file mode 100644
index 00000000000..af9f27cedfd
--- /dev/null
+++ b/packages/twenty-apps/public/slack/src/__tests__/constants/slack-test-webhook-secret.constant.ts
@@ -0,0 +1 @@
+export const SLACK_TEST_WEBHOOK_SECRET = 'slack-test-signing-secret';
diff --git a/packages/twenty-apps/public/slack/src/__tests__/slack-agent-tools.integration-test.ts b/packages/twenty-apps/public/slack/src/__tests__/slack-agent-tools.integration-test.ts
new file mode 100644
index 00000000000..91bd63d9d03
--- /dev/null
+++ b/packages/twenty-apps/public/slack/src/__tests__/slack-agent-tools.integration-test.ts
@@ -0,0 +1,360 @@
+import { describe, expect, it } from 'vitest';
+
+import { setupSlackIntegrationTest } from 'src/__tests__/utils/setup-slack-integration-test.util';
+import { slackAddReactionHandler } from 'src/logic-functions/handlers/slack-add-reaction-handler';
+import { slackDeleteMessageHandler } from 'src/logic-functions/handlers/slack-delete-message-handler';
+import { slackListChannelsHandler } from 'src/logic-functions/handlers/slack-list-channels-handler';
+import { slackPostEphemeralMessageHandler } from 'src/logic-functions/handlers/slack-post-ephemeral-message-handler';
+import { slackPostMessageHandler } from 'src/logic-functions/handlers/slack-post-message-handler';
+import { slackUpdateMessageHandler } from 'src/logic-functions/handlers/slack-update-message-handler';
+
+const CHANNEL_ID = 'C0TOOLTEST';
+
+describe('Slack agent tools', () => {
+ const { slack, appRuntime } = setupSlackIntegrationTest();
+
+ describe('post message', () => {
+ it('should post a markdown message in a thread', async () => {
+ slack.addChannel({ id: CHANNEL_ID, name: 'tools' });
+
+ const result = await slackPostMessageHandler({
+ slackChannelId: CHANNEL_ID,
+ messageText: '**Deal closed**',
+ messageFormat: 'markdown',
+ parentMessageTimestamp: '1700000000.000100',
+ });
+
+ expect(result).toEqual(
+ expect.objectContaining({ success: true, channel: CHANNEL_ID }),
+ );
+ expect(slack.messagesIn(CHANNEL_ID)).toEqual([
+ expect.objectContaining({
+ markdownText: '**Deal closed**',
+ threadTimestamp: '1700000000.000100',
+ }),
+ ]);
+ });
+
+ it('should retry as plain text in a workspace that rejects markdown_text', async () => {
+ slack.addChannel({ id: CHANNEL_ID, name: 'tools' });
+ slack.rejectMarkdownText();
+
+ const result = await slackPostMessageHandler({
+ slackChannelId: CHANNEL_ID,
+ messageText: '**Deal closed**',
+ messageFormat: 'markdown',
+ });
+
+ expect(result.success).toBe(true);
+ expect(slack.callsTo('chat.postMessage')).toHaveLength(2);
+ expect(slack.messagesIn(CHANNEL_ID)).toEqual([
+ expect.objectContaining({ text: '**Deal closed**' }),
+ ]);
+ });
+
+ it('should report the Slack error when the channel does not exist', async () => {
+ const result = await slackPostMessageHandler({
+ slackChannelId: 'C0MISSING',
+ messageText: 'hello',
+ });
+
+ expect(result).toEqual({
+ success: false,
+ message: 'Failed to post Slack message',
+ error: 'An API error occurred: channel_not_found',
+ });
+ });
+ });
+
+ describe('update and delete message', () => {
+ it('should update an existing message', async () => {
+ slack.addChannel({ id: CHANNEL_ID, name: 'tools' });
+ const message = slack.addMessage({
+ channelId: CHANNEL_ID,
+ text: 'first draft',
+ });
+
+ const result = await slackUpdateMessageHandler({
+ slackChannelId: CHANNEL_ID,
+ messageTimestamp: message.timestamp,
+ newMessageText: 'final wording',
+ });
+
+ expect(result).toEqual(
+ expect.objectContaining({
+ success: true,
+ message: 'Slack message updated.',
+ }),
+ );
+ expect(slack.messagesIn(CHANNEL_ID)).toEqual([
+ expect.objectContaining({ text: 'final wording' }),
+ ]);
+ });
+
+ it('should retry an update without blocks in a workspace that rejects them', async () => {
+ slack.addChannel({ id: CHANNEL_ID, name: 'tools' });
+ slack.rejectBlocks();
+ const message = slack.addMessage({
+ channelId: CHANNEL_ID,
+ text: 'first draft',
+ });
+
+ const result = await slackUpdateMessageHandler({
+ slackChannelId: CHANNEL_ID,
+ messageTimestamp: message.timestamp,
+ newMessageText: 'final wording',
+ messageBlocks: [{ type: 'markdown', text: 'final wording' }],
+ });
+
+ expect(result.success).toBe(true);
+ expect(slack.callsTo('chat.update')).toHaveLength(2);
+ expect(slack.messagesIn(CHANNEL_ID)).toEqual([
+ expect.objectContaining({
+ markdownText: 'final wording',
+ blocks: undefined,
+ }),
+ ]);
+ });
+
+ it('should delete an existing message', async () => {
+ slack.addChannel({ id: CHANNEL_ID, name: 'tools' });
+ const message = slack.addMessage({
+ channelId: CHANNEL_ID,
+ text: 'oops',
+ });
+
+ const result = await slackDeleteMessageHandler({
+ slackChannelId: CHANNEL_ID,
+ messageTimestamp: message.timestamp,
+ });
+
+ expect(result.success).toBe(true);
+ expect(slack.messagesIn(CHANNEL_ID)).toEqual([]);
+ });
+
+ it('should report a failure when the message to delete is gone', async () => {
+ slack.addChannel({ id: CHANNEL_ID, name: 'tools' });
+
+ const result = await slackDeleteMessageHandler({
+ slackChannelId: CHANNEL_ID,
+ messageTimestamp: '1700000000.999999',
+ });
+
+ expect(result).toEqual({
+ success: false,
+ message: 'Failed to delete Slack message',
+ error: 'An API error occurred: message_not_found',
+ });
+ });
+ });
+
+ describe('reactions and ephemeral messages', () => {
+ it('should add a reaction to a message', async () => {
+ slack.addChannel({ id: CHANNEL_ID, name: 'tools' });
+ const message = slack.addMessage({
+ channelId: CHANNEL_ID,
+ text: 'shipped',
+ });
+
+ const result = await slackAddReactionHandler({
+ slackChannelId: CHANNEL_ID,
+ messageTimestamp: message.timestamp,
+ emojiName: ' tada ',
+ });
+
+ expect(result).toEqual(
+ expect.objectContaining({
+ success: true,
+ message: 'Reaction "tada" added to the message.',
+ }),
+ );
+ expect(slack.reactions).toEqual([
+ {
+ channelId: CHANNEL_ID,
+ messageTimestamp: message.timestamp,
+ emojiName: 'tada',
+ },
+ ]);
+ });
+
+ it('should report the Slack error when the reaction is already there', async () => {
+ slack.addChannel({ id: CHANNEL_ID, name: 'tools' });
+ const message = slack.addMessage({
+ channelId: CHANNEL_ID,
+ text: 'shipped',
+ });
+ const reactionInput = {
+ slackChannelId: CHANNEL_ID,
+ messageTimestamp: message.timestamp,
+ emojiName: 'tada',
+ };
+
+ await slackAddReactionHandler(reactionInput);
+ const result = await slackAddReactionHandler(reactionInput);
+
+ expect(result).toEqual({
+ success: false,
+ message: 'Failed to add Slack reaction',
+ error: 'An API error occurred: already_reacted',
+ });
+ });
+
+ it('should send an ephemeral message to one user in a thread', async () => {
+ slack.addChannel({ id: CHANNEL_ID, name: 'tools' });
+
+ const result = await slackPostEphemeralMessageHandler({
+ slackChannelId: CHANNEL_ID,
+ recipientSlackUserId: 'U0REQUESTER',
+ messageText: 'only you can see this',
+ parentMessageTimestamp: ' 1700000000.000100 ',
+ });
+
+ expect(result.success).toBe(true);
+ expect(slack.ephemeralMessages).toEqual([
+ {
+ channelId: CHANNEL_ID,
+ recipientUserId: 'U0REQUESTER',
+ threadTimestamp: '1700000000.000100',
+ text: 'only you can see this',
+ markdownText: undefined,
+ },
+ ]);
+ });
+ });
+
+ describe('list channels', () => {
+ const addChannels = (count: number): void => {
+ for (let index = 0; index < count; index++) {
+ slack.addChannel({
+ id: `C0LIST${index}`,
+ name: `channel-${index}`,
+ numMembers: index,
+ });
+ }
+ };
+
+ it('should page through Slack until the requested limit is filled', async () => {
+ addChannels(250);
+
+ const result = await slackListChannelsHandler({ limit: 210 });
+
+ expect(result.success).toBe(true);
+ expect(result.count).toBe(210);
+ expect(slack.callsTo('conversations.list')).toHaveLength(2);
+ expect(slack.callsTo('conversations.list')[1].args.cursor).toBe('200');
+ expect(result.channels[0]).toEqual({
+ id: 'C0LIST0',
+ name: 'channel-0',
+ isPrivate: false,
+ isArchived: false,
+ isMember: true,
+ numMembers: 0,
+ topic: '',
+ purpose: '',
+ });
+ });
+
+ it('should stop when Slack runs out of channels', async () => {
+ addChannels(3);
+
+ const result = await slackListChannelsHandler({});
+
+ expect(result.count).toBe(3);
+ expect(slack.callsTo('conversations.list')).toHaveLength(1);
+ });
+
+ it('should ask Slack for private channels only and keep archived ones out by default', async () => {
+ slack.addChannel({ id: 'C0PUBLIC', name: 'public' });
+ slack.addChannel({ id: 'C0PRIVATE', name: 'private', isPrivate: true });
+ slack.addChannel({
+ id: 'C0ARCHIVED',
+ name: 'archived',
+ isPrivate: true,
+ isArchived: true,
+ });
+
+ const result = await slackListChannelsHandler({ channelType: 'Private' });
+
+ expect(slack.lastCallTo('conversations.list')?.args).toEqual(
+ expect.objectContaining({
+ types: 'private_channel',
+ exclude_archived: true,
+ }),
+ );
+ expect(result.channels.map((channel) => channel.id)).toEqual([
+ 'C0PRIVATE',
+ ]);
+ });
+ });
+
+ describe('without a Slack connection', () => {
+ it('should return a failure result instead of calling Slack', async () => {
+ appRuntime.setConnections([]);
+
+ const results = await Promise.all([
+ slackPostMessageHandler({
+ slackChannelId: CHANNEL_ID,
+ messageText: 'hello',
+ }),
+ slackUpdateMessageHandler({
+ slackChannelId: CHANNEL_ID,
+ messageTimestamp: '1700000000.000100',
+ newMessageText: 'hello',
+ }),
+ slackDeleteMessageHandler({
+ slackChannelId: CHANNEL_ID,
+ messageTimestamp: '1700000000.000100',
+ }),
+ slackAddReactionHandler({
+ slackChannelId: CHANNEL_ID,
+ messageTimestamp: '1700000000.000100',
+ emojiName: 'tada',
+ }),
+ slackPostEphemeralMessageHandler({
+ slackChannelId: CHANNEL_ID,
+ recipientSlackUserId: 'U0REQUESTER',
+ messageText: 'hello',
+ }),
+ ]);
+
+ for (const result of results) {
+ expect(result.success).toBe(false);
+ expect(result.error).toContain('Slack is not connected');
+ }
+
+ const listChannelsResult = await slackListChannelsHandler({});
+
+ expect(listChannelsResult).toEqual(
+ expect.objectContaining({ success: false, channels: [], count: 0 }),
+ );
+ expect(slack.calls).toHaveLength(0);
+ });
+
+ it('should surface an expired Slack token as a failure result', async () => {
+ appRuntime.setConnections([
+ {
+ id: 'connected-account-slack-1',
+ providerName: 'slack',
+ name: 'Twenty Test workspace',
+ handle: 'twenty-test',
+ visibility: 'workspace',
+ userWorkspaceId: 'user-workspace-1',
+ accessToken: 'xoxb-revoked-token',
+ scopes: [],
+ authFailedAt: null,
+ },
+ ]);
+
+ const result = await slackPostMessageHandler({
+ slackChannelId: CHANNEL_ID,
+ messageText: 'hello',
+ });
+
+ expect(result).toEqual({
+ success: false,
+ message: 'Failed to post Slack message',
+ error: 'An API error occurred: invalid_auth',
+ });
+ });
+ });
+});
diff --git a/packages/twenty-apps/public/slack/src/__tests__/slack-assistant-worker.integration-test.ts b/packages/twenty-apps/public/slack/src/__tests__/slack-assistant-worker.integration-test.ts
new file mode 100644
index 00000000000..cbd697cc4d4
--- /dev/null
+++ b/packages/twenty-apps/public/slack/src/__tests__/slack-assistant-worker.integration-test.ts
@@ -0,0 +1,428 @@
+import { afterEach, describe, expect, it } from 'vitest';
+
+import { createSlackMessageTimestampSequence } from 'src/__tests__/utils/create-slack-message-timestamp-sequence.util';
+import { requireDefinedOrThrow } from 'src/__tests__/utils/require-defined-or-throw.util';
+import { setupSlackIntegrationTest } from 'src/__tests__/utils/setup-slack-integration-test.util';
+import { SLACK_ASSISTANT_FAILURE_TEXT } from 'src/logic-functions/constants/slack-assistant-failure-text';
+import { SLACK_ASSISTANT_FEEDBACK_ACTION_ID } from 'src/logic-functions/constants/slack-assistant-feedback-action-id';
+import { SLACK_ASSISTANT_REQUEST_STATUS } from 'src/logic-functions/constants/slack-assistant-request-status';
+import { SLACK_ASSISTANT_INITIAL_STATUS } from 'src/logic-functions/constants/slack-assistant-status-steps';
+import { SLACK_MARKDOWN_BLOCK_MAX_LENGTH } from 'src/logic-functions/constants/slack-markdown-block-max-length';
+import { slackAssistantWorkerHandler } from 'src/logic-functions/slack-assistant-worker';
+import { getSlackThreadKvKey } from 'src/logic-functions/utils/get-slack-thread-kv-key';
+
+const CHANNEL_ID = 'C0WORKERTEST';
+const DIRECT_MESSAGE_CHANNEL_ID = 'D0WORKERTEST';
+const REQUESTER_USER_ID = 'U0REQUESTER';
+
+type SlackAssistantRequestStatus =
+ (typeof SLACK_ASSISTANT_REQUEST_STATUS)[keyof typeof SLACK_ASSISTANT_REQUEST_STATUS];
+
+type SlackAssistantRequestRecordFields = {
+ id?: string;
+ status?: string | null;
+ requestText?: string | null;
+ responseText?: string | null;
+ errorMessage?: string | null;
+};
+
+type WorkerEvent = Parameters<typeof slackAssistantWorkerHandler>[0];
+
+describe('Slack assistant worker', () => {
+ const { slack, appRuntime, coreClient, workspaceId } =
+ setupSlackIntegrationTest();
+
+ const createdRequestIds: string[] = [];
+ const nextMessageTimestamp = createSlackMessageTimestampSequence(1);
+
+ // Records are stored as PROCESSING so that the deployed worker on the test
+ // server leaves them alone; the handler under test gets its PENDING record
+ // from the database event payload, exactly like the real trigger does.
+ const createRequestRecord = async (fields: {
+ slackChannelId: string;
+ slackMessageTimestamp: string;
+ requestText: string;
+ slackChannelType?: string;
+ slackThreadTimestamp?: string;
+ }): Promise<{ id: string }> => {
+ const mutationResult = await coreClient.mutation({
+ createSlackAssistantRequest: {
+ __args: {
+ data: {
+ name: fields.requestText,
+ status: SLACK_ASSISTANT_REQUEST_STATUS.PROCESSING,
+ slackChannelType: 'channel',
+ slackThreadTimestamp: '',
+ slackUserId: REQUESTER_USER_ID,
+ slackEventId: `Ev${fields.slackMessageTimestamp}`,
+ ...fields,
+ },
+ },
+ id: true,
+ },
+ });
+
+ const createdRequest = requireDefinedOrThrow(
+ mutationResult.createSlackAssistantRequest,
+ 'The created Slack Assistant Request was not returned by the Twenty API',
+ );
+
+ createdRequestIds.push(createdRequest.id);
+
+ return createdRequest;
+ };
+
+ const readRequest = async (
+ requestId: string,
+ ): Promise<SlackAssistantRequestRecordFields> => {
+ const queryResult = await coreClient.query({
+ slackAssistantRequest: {
+ __args: { filter: { id: { eq: requestId } } },
+ id: true,
+ status: true,
+ requestText: true,
+ responseText: true,
+ errorMessage: true,
+ },
+ });
+
+ return requireDefinedOrThrow(
+ queryResult.slackAssistantRequest,
+ 'The Slack Assistant Request was not returned by the Twenty API',
+ );
+ };
+
+ // The worker only reads `properties.after`; the surrounding database event
+ // metadata is irrelevant to its behavior.
+ const buildRequestCreatedEvent = (record: {
+ id: string;
+ slackChannelId: string;
+ slackMessageTimestamp: string;
+ requestText: string;
+ slackChannelType?: string;
+ slackThreadTimestamp?: string;
+ status?: SlackAssistantRequestStatus;
+ }): WorkerEvent =>
+ ({
+ name: 'slackAssistantRequest.created',
+ workspaceId,
+ properties: {
+ after: {
+ status: SLACK_ASSISTANT_REQUEST_STATUS.PENDING,
+ slackChannelType: 'channel',
+ slackThreadTimestamp: '',
+ slackUserId: REQUESTER_USER_ID,
+ ...record,
+ },
+ },
+ }) as unknown as WorkerEvent;
+
+ afterEach(async () => {
+ for (const requestId of createdRequestIds) {
+ await coreClient.mutation({
+ destroySlackAssistantRequest: { __args: { id: requestId }, id: true },
+ });
+ }
+
+ createdRequestIds.length = 0;
+ });
+
+ it('should answer a channel request in its thread, store the answer and subscribe the thread', async () => {
+ slack.addChannel({ id: CHANNEL_ID, name: 'sales' });
+ slack.addUser({ id: REQUESTER_USER_ID, displayName: 'Ada' });
+ const slackMessageTimestamp = nextMessageTimestamp();
+
+ slack.addMessage({
+ channelId: CHANNEL_ID,
+ timestamp: slackMessageTimestamp,
+ userId: REQUESTER_USER_ID,
+ text: 'how many open deals does Acme have?',
+ });
+ slack.addMessage({
+ channelId: CHANNEL_ID,
+ threadTimestamp: slackMessageTimestamp,
+ userId: 'U0COLLEAGUE',
+ text: 'good question',
+ });
+ slack.addMessage({
+ channelId: CHANNEL_ID,
+ threadTimestamp: slackMessageTimestamp,
+ userId: slack.botUserId,
+ text: 'Acme has 2 open deals.\n\n_Answered in 4s_',
+ });
+
+ appRuntime.setAgentResult({
+ success: true,
+ result: { response: 'Acme has 3 open deals.' },
+ error: null,
+ });
+
+ const request = await createRequestRecord({
+ slackChannelId: CHANNEL_ID,
+ slackMessageTimestamp,
+ requestText: 'how many open deals does Acme have?',
+ });
+
+ const result = await slackAssistantWorkerHandler(
+ buildRequestCreatedEvent({
+ ...request,
+ slackChannelId: CHANNEL_ID,
+ slackMessageTimestamp,
+ requestText: 'how many open deals does Acme have?',
+ }),
+ );
+
+ expect(result).toEqual({ done: true });
+
+ // The thread is replayed as turns, the bot's own earlier reply as an
+ // assistant turn without its footer, and the message that triggered this
+ // run is left out of its own context.
+ expect(appRuntime.lastAgentMessages).toEqual([
+ { role: 'user', content: '<@U0COLLEAGUE>: good question' },
+ { role: 'assistant', content: 'Acme has 2 open deals.' },
+ {
+ role: 'user',
+ content: expect.stringContaining(
+ 'Ada asks from Slack:\nhow many open deals does Acme have?',
+ ),
+ },
+ ]);
+ // A request record the app did not write earns no run-as, so the agent
+ // keeps its own role.
+ const agentMessages = appRuntime.lastAgentMessages;
+ const agentRuns = appRuntime.agentRuns;
+
+ expect(agentMessages[agentMessages.length - 1]?.content).toContain(
+ "You are answering with the app's own role",
+ );
+ expect(
+ agentRuns[agentRuns.length - 1]?.runAsWorkspaceMemberId,
+ ).toBeUndefined();
+
+ expect(slack.assistantStatuses).toEqual([
+ {
+ channelId: CHANNEL_ID,
+ threadTimestamp: slackMessageTimestamp,
+ status: SLACK_ASSISTANT_INITIAL_STATUS,
+ },
+ ]);
+
+ const postedAnswer = slack
+ .messagesIn(CHANNEL_ID)
+ .find(
+ (message) =>
+ message.threadTimestamp === slackMessageTimestamp &&
+ message.botId !== undefined &&
+ message.blocks !== undefined,
+ );
+
+ expect(postedAnswer?.blocks).toEqual([
+ { type: 'markdown', text: 'Acme has 3 open deals.' },
+ {
+ type: 'context',
+ elements: [
+ { type: 'mrkdwn', text: expect.stringMatching(/^Answered in \d+s$/) },
+ ],
+ },
+ // The feedback buttons carry the request record id, which is how a click
+ // finds the answer it rates.
+ expect.objectContaining({
+ type: 'context_actions',
+ block_id: request.id,
+ elements: [
+ expect.objectContaining({
+ type: 'feedback_buttons',
+ action_id: SLACK_ASSISTANT_FEEDBACK_ACTION_ID,
+ }),
+ ],
+ }),
+ ]);
+ // Record links in the answer must not turn into Slack previews.
+ expect(slack.lastCallTo('chat.postMessage')?.args).toEqual(
+ expect.objectContaining({ unfurl_links: false, unfurl_media: false }),
+ );
+
+ await expect(readRequest(request.id)).resolves.toEqual(
+ expect.objectContaining({
+ status: SLACK_ASSISTANT_REQUEST_STATUS.DONE,
+ responseText: 'Acme has 3 open deals.',
+ }),
+ );
+
+ expect(
+ appRuntime.getKeyValue(
+ getSlackThreadKvKey({
+ channelId: CHANNEL_ID,
+ threadTimestamp: slackMessageTimestamp,
+ }),
+ 'WORKSPACE',
+ ),
+ ).toEqual({ expiresAt: expect.any(Number) });
+ });
+
+ it('should title the assistant thread of a first direct message instead of subscribing it', async () => {
+ slack.addChannel({ id: DIRECT_MESSAGE_CHANNEL_ID, name: 'twenty' });
+ const slackMessageTimestamp = nextMessageTimestamp();
+
+ const request = await createRequestRecord({
+ slackChannelId: DIRECT_MESSAGE_CHANNEL_ID,
+ slackChannelType: 'im',
+ slackMessageTimestamp,
+ requestText: 'list my tasks for today',
+ });
+
+ await slackAssistantWorkerHandler(
+ buildRequestCreatedEvent({
+ ...request,
+ slackChannelId: DIRECT_MESSAGE_CHANNEL_ID,
+ slackChannelType: 'im',
+ slackMessageTimestamp,
+ requestText: 'list my tasks for today',
+ }),
+ );
+
+ expect(slack.assistantTitles).toEqual([
+ {
+ channelId: DIRECT_MESSAGE_CHANNEL_ID,
+ threadTimestamp: slackMessageTimestamp,
+ title: 'list my tasks for today',
+ },
+ ]);
+ expect(
+ appRuntime.getKeyValue(
+ getSlackThreadKvKey({
+ channelId: DIRECT_MESSAGE_CHANNEL_ID,
+ threadTimestamp: slackMessageTimestamp,
+ }),
+ 'WORKSPACE',
+ ),
+ ).toBeNull();
+ });
+
+ it('should post the failure notice and fail the request when the agent errors', async () => {
+ slack.addChannel({ id: CHANNEL_ID, name: 'sales' });
+ const slackMessageTimestamp = nextMessageTimestamp();
+
+ appRuntime.setAgentResult({
+ success: false,
+ result: null,
+ error: 'Agent is not available',
+ });
+
+ const request = await createRequestRecord({
+ slackChannelId: CHANNEL_ID,
+ slackMessageTimestamp,
+ requestText: 'who owns Acme?',
+ });
+
+ const result = await slackAssistantWorkerHandler(
+ buildRequestCreatedEvent({
+ ...request,
+ slackChannelId: CHANNEL_ID,
+ slackMessageTimestamp,
+ requestText: 'who owns Acme?',
+ }),
+ );
+
+ expect(result).toEqual({
+ failed: true,
+ reason: 'Agent is not available',
+ });
+ expect(slack.messagesIn(CHANNEL_ID)).toEqual([
+ expect.objectContaining({
+ text: SLACK_ASSISTANT_FAILURE_TEXT,
+ threadTimestamp: slackMessageTimestamp,
+ }),
+ ]);
+ await expect(readRequest(request.id)).resolves.toEqual(
+ expect.objectContaining({
+ status: SLACK_ASSISTANT_REQUEST_STATUS.FAILED,
+ errorMessage: 'Agent is not available',
+ }),
+ );
+ });
+
+ it('should fail the request when Slack refuses to deliver the answer', async () => {
+ slack.addChannel({ id: CHANNEL_ID, name: 'sales' });
+ slack.failNextCall('chat.postMessage', 'channel_not_found');
+ const slackMessageTimestamp = nextMessageTimestamp();
+
+ const request = await createRequestRecord({
+ slackChannelId: CHANNEL_ID,
+ slackMessageTimestamp,
+ requestText: 'summarize the Acme thread',
+ });
+
+ const result = await slackAssistantWorkerHandler(
+ buildRequestCreatedEvent({
+ ...request,
+ slackChannelId: CHANNEL_ID,
+ slackMessageTimestamp,
+ requestText: 'summarize the Acme thread',
+ }),
+ );
+
+ expect(result).toEqual({
+ failed: true,
+ reason: expect.stringContaining('Could not deliver Slack answer'),
+ });
+ await expect(readRequest(request.id)).resolves.toEqual(
+ expect.objectContaining({
+ status: SLACK_ASSISTANT_REQUEST_STATUS.FAILED,
+ }),
+ );
+ });
+
+ it('should send a long answer as markdown text because Slack blocks cannot hold it', async () => {
+ slack.addChannel({ id: CHANNEL_ID, name: 'sales' });
+ const slackMessageTimestamp = nextMessageTimestamp();
+ const longResponse = 'a'.repeat(SLACK_MARKDOWN_BLOCK_MAX_LENGTH + 1);
+
+ appRuntime.setAgentResult({
+ success: true,
+ result: { response: longResponse },
+ error: null,
+ });
+
+ const request = await createRequestRecord({
+ slackChannelId: CHANNEL_ID,
+ slackMessageTimestamp,
+ requestText: 'give me the full account history',
+ });
+
+ await slackAssistantWorkerHandler(
+ buildRequestCreatedEvent({
+ ...request,
+ slackChannelId: CHANNEL_ID,
+ slackMessageTimestamp,
+ requestText: 'give me the full account history',
+ }),
+ );
+
+ const channelMessages = slack.messagesIn(CHANNEL_ID);
+ const postedAnswer = channelMessages[channelMessages.length - 1];
+
+ expect(postedAnswer?.blocks).toBeUndefined();
+ expect(postedAnswer?.markdownText).toContain(longResponse);
+ });
+
+ it('should skip a request that another worker already picked up', async () => {
+ const slackMessageTimestamp = nextMessageTimestamp();
+
+ const result = await slackAssistantWorkerHandler(
+ buildRequestCreatedEvent({
+ id: 'not-persisted',
+ status: SLACK_ASSISTANT_REQUEST_STATUS.PROCESSING,
+ slackChannelId: CHANNEL_ID,
+ slackMessageTimestamp,
+ requestText: 'anything',
+ }),
+ );
+
+ expect(result).toEqual({
+ skipped: true,
+ reason: 'Request is not pending',
+ });
+ expect(slack.calls).toHaveLength(0);
+ });
+});
diff --git a/packages/twenty-apps/public/slack/src/__tests__/slack-connection-lifecycle.integration-test.ts b/packages/twenty-apps/public/slack/src/__tests__/slack-connection-lifecycle.integration-test.ts
new file mode 100644
index 00000000000..de7b8ad6b7e
--- /dev/null
+++ b/packages/twenty-apps/public/slack/src/__tests__/slack-connection-lifecycle.integration-test.ts
@@ -0,0 +1,276 @@
+import { describe, expect, it } from 'vitest';
+
+import { buildSlackAppHomeOpenedEventBody } from 'src/__tests__/utils/build-slack-app-home-opened-event-body.util';
+import { buildSlackMemberJoinedChannelEventBody } from 'src/__tests__/utils/build-slack-member-joined-channel-event-body.util';
+import { SLACK_TEST_CONNECTED_ACCOUNT_ID } from 'src/__tests__/constants/slack-test-connected-account-id.constant';
+import { buildSlackAppConnection } from 'src/__tests__/utils/build-slack-app-connection.util';
+import { setupSlackIntegrationTest } from 'src/__tests__/utils/setup-slack-integration-test.util';
+import { SLACK_BOT_USER_ID_KV_KEY } from 'src/logic-functions/constants/slack-bot-user-id-kv-key';
+import { SLACK_CHANNEL_WELCOME_TEXT } from 'src/logic-functions/constants/slack-channel-welcome-text';
+import { SLACK_CHANNEL_WELCOME_THREAD_TEXT } from 'src/logic-functions/constants/slack-channel-welcome-thread-text';
+import {
+ SLACK_SUGGESTED_PROMPTS,
+ SLACK_SUGGESTED_PROMPTS_TITLE,
+} from 'src/logic-functions/constants/slack-suggested-prompts';
+import { slackAppUninstallHandler } from 'src/logic-functions/handlers/slack-app-uninstall-handler';
+import { slackRegisterConnectionHandler } from 'src/logic-functions/handlers/slack-register-connection-handler';
+import { slackTeamReleaseHandler } from 'src/logic-functions/handlers/slack-team-release-handler';
+import { getSlackChannelWelcomeKvKey } from 'src/logic-functions/utils/get-slack-channel-welcome-kv-key';
+import { getSlackConnectedAccountTeamKvKey } from 'src/logic-functions/utils/get-slack-connected-account-team-kv-key';
+import { getSlackTeamKvKey } from 'src/logic-functions/utils/get-slack-team-kv-key';
+import { postSlackChannelWelcome } from 'src/logic-functions/utils/post-slack-channel-welcome';
+import { setSlackSuggestedPrompts } from 'src/logic-functions/utils/set-slack-suggested-prompts';
+
+const CHANNEL_ID = 'C0WELCOME';
+const DIRECT_MESSAGE_CHANNEL_ID = 'D0WELCOME';
+const SECOND_CONNECTED_ACCOUNT_ID = 'connected-account-slack-2';
+
+const buildConnectionHookPayload = (connectedAccountId: string) => ({
+ connectionProviderId: 'connection-provider-slack',
+ connectionProviderName: 'slack',
+ connectedAccountId,
+});
+
+describe('Slack connection lifecycle', () => {
+ const { slack, appRuntime, workspaceId } = setupSlackIntegrationTest();
+
+ describe('registering a connection', () => {
+ it('should claim the Slack team for this workspace and cache the bot identity', async () => {
+ const result = await slackRegisterConnectionHandler(
+ buildConnectionHookPayload(SLACK_TEST_CONNECTED_ACCOUNT_ID),
+ );
+
+ expect(result).toEqual({ ok: true, teamId: slack.teamId });
+ expect(
+ appRuntime.getKeyValue(getSlackTeamKvKey(slack.teamId), 'SERVER'),
+ ).toBe(workspaceId);
+ expect(
+ appRuntime.getKeyValue(
+ getSlackConnectedAccountTeamKvKey(SLACK_TEST_CONNECTED_ACCOUNT_ID),
+ 'WORKSPACE',
+ ),
+ ).toBe(slack.teamId);
+ expect(
+ appRuntime.getKeyValue(SLACK_BOT_USER_ID_KV_KEY, 'WORKSPACE'),
+ ).toEqual({
+ botUserId: slack.botUserId,
+ expiresAt: expect.any(Number),
+ });
+ });
+
+ it('should refuse to register when another workspace already connected the same Slack team', async () => {
+ appRuntime.seedKeyValue(
+ getSlackTeamKvKey(slack.teamId),
+ 'another-workspace-id',
+ 'SERVER',
+ );
+
+ await expect(
+ slackRegisterConnectionHandler(
+ buildConnectionHookPayload(SLACK_TEST_CONNECTED_ACCOUNT_ID),
+ ),
+ ).rejects.toThrow('already claimed by another workspace');
+ });
+
+ it('should refuse a connection hook payload without a connected account', async () => {
+ await expect(
+ slackRegisterConnectionHandler(buildConnectionHookPayload('')),
+ ).rejects.toThrow('missing connectedAccountId');
+ expect(slack.calls).toHaveLength(0);
+ });
+ });
+
+ describe('removing a connection', () => {
+ it('should release the team claim so another workspace can connect it', async () => {
+ await slackRegisterConnectionHandler(
+ buildConnectionHookPayload(SLACK_TEST_CONNECTED_ACCOUNT_ID),
+ );
+ appRuntime.setConnections([]);
+
+ const result = await slackTeamReleaseHandler(
+ buildConnectionHookPayload(SLACK_TEST_CONNECTED_ACCOUNT_ID),
+ );
+
+ expect(result).toEqual({ ok: true, releasedTeamId: slack.teamId });
+ expect(
+ appRuntime.getKeyValue(getSlackTeamKvKey(slack.teamId), 'SERVER'),
+ ).toBeNull();
+ expect(
+ appRuntime.getKeyValue(
+ getSlackConnectedAccountTeamKvKey(SLACK_TEST_CONNECTED_ACCOUNT_ID),
+ 'WORKSPACE',
+ ),
+ ).toBeNull();
+ });
+
+ it('should keep the team claim while another connection of this workspace still uses it', async () => {
+ appRuntime.setConnections([
+ buildSlackAppConnection(slack.botToken),
+ buildSlackAppConnection(slack.botToken, {
+ id: SECOND_CONNECTED_ACCOUNT_ID,
+ }),
+ ]);
+ await slackRegisterConnectionHandler(
+ buildConnectionHookPayload(SLACK_TEST_CONNECTED_ACCOUNT_ID),
+ );
+ await slackRegisterConnectionHandler(
+ buildConnectionHookPayload(SECOND_CONNECTED_ACCOUNT_ID),
+ );
+
+ const result = await slackTeamReleaseHandler(
+ buildConnectionHookPayload(SLACK_TEST_CONNECTED_ACCOUNT_ID),
+ );
+
+ expect(result).toEqual({ ok: true, releasedTeamId: null });
+ expect(
+ appRuntime.getKeyValue(getSlackTeamKvKey(slack.teamId), 'SERVER'),
+ ).toBe(workspaceId);
+ });
+ });
+
+ describe('uninstalling the app', () => {
+ it('should release the team claim of every remaining connection', async () => {
+ await slackRegisterConnectionHandler(
+ buildConnectionHookPayload(SLACK_TEST_CONNECTED_ACCOUNT_ID),
+ );
+
+ const result = await slackAppUninstallHandler();
+
+ expect(result).toEqual({ ok: true, releasedTeamIds: [slack.teamId] });
+ expect(
+ appRuntime.getKeyValue(getSlackTeamKvKey(slack.teamId), 'SERVER'),
+ ).toBeNull();
+ });
+ });
+
+ describe('channel welcome', () => {
+ it('should introduce itself once when the bot is added to a channel', async () => {
+ slack.addChannel({ id: CHANNEL_ID, name: 'sales' });
+
+ const result = await postSlackChannelWelcome(
+ buildSlackMemberJoinedChannelEventBody({
+ channelId: CHANNEL_ID,
+ userId: slack.botUserId,
+ }),
+ );
+
+ expect(result).toEqual({ ok: true });
+
+ const [channelMessage, threadReply] = slack.messagesIn(CHANNEL_ID);
+
+ expect(channelMessage.markdownText).toBe(SLACK_CHANNEL_WELCOME_TEXT);
+ expect(threadReply).toEqual(
+ expect.objectContaining({
+ markdownText: SLACK_CHANNEL_WELCOME_THREAD_TEXT,
+ threadTimestamp: channelMessage.timestamp,
+ }),
+ );
+ });
+
+ it('should stay quiet when the bot is re-added to a channel it already welcomed', async () => {
+ slack.addChannel({ id: CHANNEL_ID, name: 'sales' });
+ const eventBody = buildSlackMemberJoinedChannelEventBody({
+ channelId: CHANNEL_ID,
+ userId: slack.botUserId,
+ });
+
+ await postSlackChannelWelcome(eventBody);
+ const secondResult = await postSlackChannelWelcome(eventBody);
+
+ expect(secondResult).toEqual({
+ ok: true,
+ skipped: 'Channel was already welcomed',
+ });
+ expect(slack.messagesIn(CHANNEL_ID)).toHaveLength(2);
+ });
+
+ it('should stay quiet when somebody else joins the channel', async () => {
+ slack.addChannel({ id: CHANNEL_ID, name: 'sales' });
+
+ const result = await postSlackChannelWelcome(
+ buildSlackMemberJoinedChannelEventBody({
+ channelId: CHANNEL_ID,
+ userId: 'U0COLLEAGUE',
+ }),
+ );
+
+ expect(result).toEqual({
+ ok: true,
+ skipped: 'Someone other than the bot joined',
+ });
+ expect(slack.messagesIn(CHANNEL_ID)).toHaveLength(0);
+ });
+
+ it('should reuse the cached bot user id instead of asking Slack again', async () => {
+ slack.addChannel({ id: CHANNEL_ID, name: 'sales' });
+ appRuntime.seedKeyValue(SLACK_BOT_USER_ID_KV_KEY, {
+ botUserId: slack.botUserId,
+ expiresAt: Date.now() + 60_000,
+ });
+
+ await postSlackChannelWelcome(
+ buildSlackMemberJoinedChannelEventBody({
+ channelId: CHANNEL_ID,
+ userId: slack.botUserId,
+ }),
+ );
+
+ expect(slack.callsTo('auth.test')).toHaveLength(0);
+ });
+
+ it('should give the welcome claim back when Slack refuses the message', async () => {
+ slack.addChannel({ id: CHANNEL_ID, name: 'sales' });
+ slack.failNextCall('chat.postMessage', 'not_in_channel');
+
+ await expect(
+ postSlackChannelWelcome(
+ buildSlackMemberJoinedChannelEventBody({
+ channelId: CHANNEL_ID,
+ userId: slack.botUserId,
+ }),
+ ),
+ ).rejects.toThrow('Failed to post the Slack welcome');
+
+ expect(
+ appRuntime.getKeyValue(
+ getSlackChannelWelcomeKvKey(CHANNEL_ID),
+ 'WORKSPACE',
+ ),
+ ).toBeNull();
+ });
+ });
+
+ describe('app home', () => {
+ it('should set the suggested prompts when a member opens the messages tab', async () => {
+ const result = await setSlackSuggestedPrompts(
+ buildSlackAppHomeOpenedEventBody({
+ channelId: DIRECT_MESSAGE_CHANNEL_ID,
+ }),
+ );
+
+ expect(result).toEqual({ ok: true });
+ expect(slack.suggestedPrompts).toEqual([
+ {
+ channelId: DIRECT_MESSAGE_CHANNEL_ID,
+ title: SLACK_SUGGESTED_PROMPTS_TITLE,
+ prompts: SLACK_SUGGESTED_PROMPTS,
+ },
+ ]);
+ });
+
+ it('should ignore the home tab', async () => {
+ const result = await setSlackSuggestedPrompts(
+ buildSlackAppHomeOpenedEventBody({
+ channelId: DIRECT_MESSAGE_CHANNEL_ID,
+ tab: 'home',
+ }),
+ );
+
+ expect(result).toEqual({
+ ok: true,
+ skipped: 'Unhandled app home tab: home',
+ });
+ expect(slack.calls).toHaveLength(0);
+ });
+ });
+});
diff --git a/packages/twenty-apps/public/slack/src/__tests__/slack-deployed-functions.integration-test.ts b/packages/twenty-apps/public/slack/src/__tests__/slack-deployed-functions.integration-test.ts
new file mode 100644
index 00000000000..3470c6fcaf1
--- /dev/null
+++ b/packages/twenty-apps/public/slack/src/__tests__/slack-deployed-functions.integration-test.ts
@@ -0,0 +1,234 @@
+import * as fs from 'fs';
+import * as path from 'path';
+
+import { MetadataApiClient } from 'twenty-client-sdk/metadata';
+import { functionExecute } from 'twenty-sdk/cli';
+import { beforeAll, describe, expect, it } from 'vitest';
+
+import { buildSlackAppMentionEventBody } from 'src/__tests__/utils/build-slack-app-mention-event-body.util';
+import { buildSlackRoutePayload } from 'src/__tests__/utils/build-slack-route-payload.util';
+import { requireDefinedOrThrow } from 'src/__tests__/utils/require-defined-or-throw.util';
+import { SLACK_TEST_WEBHOOK_SECRET } from 'src/__tests__/constants/slack-test-webhook-secret.constant';
+import { APPLICATION_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
+
+// These scenarios run the functions the way the server runs them - deployed,
+// in the app runtime, with the app's own access token and server variables -
+// which nothing running in the test process can prove on its own.
+const APP_PATH = process.cwd();
+
+const executeDeployedFunction = async (
+ functionName: string,
+ payload: Record<string, unknown>,
+) => {
+ const result = await functionExecute({
+ appPath: APP_PATH,
+ functionName,
+ payload,
+ });
+
+ if (!result.success) {
+ throw new Error(
+ `Could not execute ${functionName}: ${result.error.message}`,
+ );
+ }
+
+ return result.data;
+};
+
+const readManifestLogicFunctionNames = (): string[] => {
+ const manifest = JSON.parse(
+ fs.readFileSync(
+ path.join(APP_PATH, '.twenty', 'output', 'manifest.json'),
+ 'utf8',
+ ),
+ ) as { logicFunctions: { name: string }[] };
+
+ return manifest.logicFunctions.map((logicFunction) => logicFunction.name);
+};
+
+describe('Slack app deployed functions', () => {
+ const metadataClient = new MetadataApiClient();
+
+ let webhookSecretVariableId: string | undefined;
+
+ const writeWebhookSecret = async (value: string): Promise<void> => {
+ await metadataClient.mutation({
+ updateApplicationRegistrationVariable: {
+ __args: {
+ input: {
+ id: requireDefinedOrThrow(
+ webhookSecretVariableId,
+ 'The SLACK_WEBHOOK_SECRET variable id was not found on the test workspace',
+ ),
+ update: { value },
+ },
+ },
+ id: true,
+ },
+ });
+ };
+
+ // Narrows the window in which the instance verifies Slack signatures against
+ // a value published in this repository to the block that needs it.
+ const withTestWebhookSecret = async (
+ run: () => Promise<void>,
+ ): Promise<void> => {
+ await writeWebhookSecret(SLACK_TEST_WEBHOOK_SECRET);
+
+ try {
+ await run();
+ } finally {
+ await writeWebhookSecret('');
+ }
+ };
+
+ const verifiesTestWebhookSecret = async (): Promise<boolean> => {
+ const execution = await executeDeployedFunction('slack-events-resolver', {
+ ...buildSlackRoutePayload({
+ type: 'url_verification',
+ challenge: 'leftover-secret-probe',
+ }),
+ });
+
+ return execution.status === 'SUCCESS';
+ };
+
+ beforeAll(async () => {
+ const applicationsResult = await metadataClient.query({
+ findManyApplications: {
+ id: true,
+ universalIdentifier: true,
+ applicationRegistrationId: true,
+ },
+ });
+
+ const slackApplication = requireDefinedOrThrow(
+ applicationsResult.findManyApplications.find(
+ (application: { universalIdentifier: string }) =>
+ application.universalIdentifier === APPLICATION_UNIVERSAL_IDENTIFIER,
+ ),
+ 'The Slack application was not found on the test workspace',
+ );
+
+ const variablesResult = await metadataClient.query({
+ findApplicationRegistrationVariables: {
+ __args: {
+ applicationRegistrationId: requireDefinedOrThrow(
+ slackApplication.applicationRegistrationId,
+ 'The Slack application registration was not found on the test workspace',
+ ),
+ },
+ id: true,
+ key: true,
+ isFilled: true,
+ },
+ });
+
+ const webhookSecretVariable = requireDefinedOrThrow(
+ variablesResult.findApplicationRegistrationVariables.find(
+ (variable: { key: string }) => variable.key === 'SLACK_WEBHOOK_SECRET',
+ ),
+ 'The SLACK_WEBHOOK_SECRET application variable was not found on the test workspace',
+ );
+
+ webhookSecretVariableId = webhookSecretVariable.id;
+
+ // The stored secret is write-only, so a real one could not be put back
+ // afterwards: refuse to overwrite it rather than leaving the instance
+ // verifying Slack signatures against a public test value. A secret this
+ // suite left behind when it was interrupted is the one exception, and it
+ // is recognisable because it verifies the public test signature.
+ if (webhookSecretVariable.isFilled) {
+ if (!(await verifiesTestWebhookSecret())) {
+ throw new Error(
+ 'SLACK_WEBHOOK_SECRET is already set on this instance. Run the integration suite against a disposable Twenty instance.',
+ );
+ }
+
+ await writeWebhookSecret('');
+ }
+ });
+
+ it('should deploy every logic function the manifest declares', async () => {
+ const deployedFunctionsResult = await metadataClient.query({
+ findManyLogicFunctions: { id: true, name: true },
+ });
+
+ const deployedFunctionNames: string[] =
+ deployedFunctionsResult.findManyLogicFunctions.map(
+ (logicFunction: { name: string }) => logicFunction.name,
+ );
+
+ for (const manifestFunctionName of readManifestLogicFunctionNames()) {
+ expect(deployedFunctionNames).toContain(manifestFunctionName);
+ }
+ });
+
+ it('should answer the Slack url_verification handshake from the deployed events route', async () => {
+ await withTestWebhookSecret(async () => {
+ const execution = await executeDeployedFunction('slack-events-resolver', {
+ ...buildSlackRoutePayload({
+ type: 'url_verification',
+ challenge: 'deployed-challenge-token',
+ }),
+ });
+
+ expect(execution.status).toBe('SUCCESS');
+ expect(execution.data).toEqual(
+ expect.objectContaining({
+ body: { challenge: 'deployed-challenge-token' },
+ }),
+ );
+ });
+ });
+
+ it('should reject an unsigned Slack request from the deployed events route', async () => {
+ await withTestWebhookSecret(async () => {
+ const execution = await executeDeployedFunction('slack-events-resolver', {
+ ...buildSlackRoutePayload(
+ { type: 'url_verification', challenge: 'deployed-challenge-token' },
+ { secret: 'not-the-signing-secret' },
+ ),
+ });
+
+ expect(execution.status).toBe('ERROR');
+ expect(execution.error?.errorMessage).toContain(
+ 'Invalid Slack signature',
+ );
+ });
+ });
+
+ // The team claim lives in a SERVER scoped key value entry, which only the app
+ // access token can read. Reaching the refusal proves the real runtime answers
+ // the scoped read the way the in-process app runtime fake pretends it does.
+ it('should refuse an event from an unclaimed Slack team through the real key value store', async () => {
+ await withTestWebhookSecret(async () => {
+ const execution = await executeDeployedFunction('slack-events-resolver', {
+ ...buildSlackRoutePayload(
+ buildSlackAppMentionEventBody({
+ channelId: 'C0DEPLOYED',
+ text: 'hello',
+ teamId: 'T0UNCLAIMED',
+ }),
+ ),
+ });
+
+ expect(execution.status).toBe('ERROR');
+ expect(execution.error?.errorMessage).toContain(
+ 'No workspace has claimed Slack team T0UNCLAIMED',
+ );
+ });
+ });
+
+ it('should report the missing Slack connection from the deployed channel list tool', async () => {
+ const execution = await executeDeployedFunction('slack-list-channels', {});
+
+ expect(execution.status).toBe('SUCCESS');
+ expect(execution.data).toEqual({
+ success: false,
+ channels: [],
+ count: 0,
+ error: expect.stringContaining('Slack is not connected'),
+ });
+ });
+});
diff --git a/packages/twenty-apps/public/slack/src/__tests__/slack-inbound-events.integration-test.ts b/packages/twenty-apps/public/slack/src/__tests__/slack-inbound-events.integration-test.ts
new file mode 100644
index 00000000000..366e0ed1513
--- /dev/null
+++ b/packages/twenty-apps/public/slack/src/__tests__/slack-inbound-events.integration-test.ts
@@ -0,0 +1,456 @@
+import { Response } from 'twenty-sdk/logic-function';
+import { afterEach, describe, expect, it } from 'vitest';
+
+import { buildSlackAppHomeOpenedEventBody } from 'src/__tests__/utils/build-slack-app-home-opened-event-body.util';
+import { buildSlackAppMentionEventBody } from 'src/__tests__/utils/build-slack-app-mention-event-body.util';
+import { buildSlackMemberJoinedChannelEventBody } from 'src/__tests__/utils/build-slack-member-joined-channel-event-body.util';
+import { buildSlackMessageEventBody } from 'src/__tests__/utils/build-slack-message-event-body.util';
+import { buildSlackRoutePayload } from 'src/__tests__/utils/build-slack-route-payload.util';
+import { createSlackMessageTimestampSequence } from 'src/__tests__/utils/create-slack-message-timestamp-sequence.util';
+import { setupSlackIntegrationTest } from 'src/__tests__/utils/setup-slack-integration-test.util';
+import {
+ SLACK_CHANNEL_WELCOME_UNIVERSAL_IDENTIFIER,
+ SLACK_EVENTS_ENQUEUE_UNIVERSAL_IDENTIFIER,
+ SLACK_HOME_OPENED_UNIVERSAL_IDENTIFIER,
+} from 'src/constants/universal-identifiers';
+import { SLACK_ASSISTANT_EMPTY_REQUEST_TEXT } from 'src/logic-functions/constants/slack-assistant-empty-request-text';
+import { SLACK_ASSISTANT_EXPIRED_THREAD_TEXT } from 'src/logic-functions/constants/slack-assistant-expired-thread-text';
+import { slackEventsResolverHandler } from 'src/logic-functions/slack-events-resolver';
+import { enqueueSlackAssistantRequest } from 'src/logic-functions/utils/enqueue-slack-assistant-request';
+import { getSlackTeamKvKey } from 'src/logic-functions/utils/get-slack-team-kv-key';
+import { getSlackThreadKvKey } from 'src/logic-functions/utils/get-slack-thread-kv-key';
+
+const CHANNEL_ID = 'C0INTEGRATION';
+const DIRECT_MESSAGE_CHANNEL_ID = 'D0INTEGRATION';
+const REQUESTER_USER_ID = 'U0REQUESTER';
+
+type SlackAssistantRequestNode = {
+ id: string;
+ name?: string;
+ status?: string;
+ requestText?: string;
+ slackChannelId?: string;
+ slackChannelType?: string;
+ slackThreadTimestamp?: string;
+ slackUserId?: string;
+};
+
+describe('Slack inbound events', () => {
+ const { slack, appRuntime, coreClient, workspaceId } =
+ setupSlackIntegrationTest();
+
+ const nextMessageTimestamp = createSlackMessageTimestampSequence(0);
+
+ const claimSlackTeamForThisWorkspace = (): void => {
+ appRuntime.seedKeyValue(
+ getSlackTeamKvKey(slack.teamId),
+ workspaceId,
+ 'SERVER',
+ );
+ };
+
+ const findRequestByMessageTimestamp = async (
+ slackMessageTimestamp: string,
+ ): Promise<SlackAssistantRequestNode | undefined> => {
+ const queryResult = await coreClient.query({
+ slackAssistantRequests: {
+ __args: {
+ filter: { slackMessageTimestamp: { eq: slackMessageTimestamp } },
+ first: 2,
+ },
+ edges: {
+ node: {
+ id: true,
+ name: true,
+ status: true,
+ requestText: true,
+ slackChannelId: true,
+ slackChannelType: true,
+ slackThreadTimestamp: true,
+ slackUserId: true,
+ },
+ },
+ },
+ });
+
+ const nodes: SlackAssistantRequestNode[] = (
+ queryResult.slackAssistantRequests?.edges ?? []
+ ).map((edge: { node: SlackAssistantRequestNode }) => edge.node);
+
+ expect(nodes.length).toBeLessThanOrEqual(1);
+
+ return nodes[0];
+ };
+
+ const destroyRequestsCreatedInTest = async (): Promise<void> => {
+ const queryResult = await coreClient.query({
+ slackAssistantRequests: {
+ __args: {
+ filter: {
+ slackChannelId: { in: [CHANNEL_ID, DIRECT_MESSAGE_CHANNEL_ID] },
+ },
+ },
+ edges: { node: { id: true } },
+ },
+ });
+
+ for (const edge of queryResult.slackAssistantRequests?.edges ?? []) {
+ await coreClient.mutation({
+ destroySlackAssistantRequest: {
+ __args: { id: edge.node.id },
+ id: true,
+ },
+ });
+ }
+ };
+
+ afterEach(async () => {
+ await destroyRequestsCreatedInTest();
+ });
+
+ describe('events route', () => {
+ it('should answer the url_verification handshake with the challenge', async () => {
+ const result = await slackEventsResolverHandler(
+ buildSlackRoutePayload({
+ type: 'url_verification',
+ challenge: 'challenge-token',
+ }),
+ );
+
+ if (!(result instanceof Response)) {
+ throw new Error('The handshake did not answer with an HTTP response');
+ }
+
+ expect(result.body).toEqual({ challenge: 'challenge-token' });
+ });
+
+ it('should reject a request that is not signed with the workspace signing secret', async () => {
+ const routePayload = buildSlackRoutePayload(
+ { type: 'url_verification', challenge: 'challenge-token' },
+ { secret: 'another-signing-secret' },
+ );
+
+ await expect(slackEventsResolverHandler(routePayload)).rejects.toThrow(
+ 'Invalid Slack signature',
+ );
+ });
+
+ it('should reject a replayed request signed more than five minutes ago', async () => {
+ const routePayload = buildSlackRoutePayload(
+ { type: 'url_verification', challenge: 'challenge-token' },
+ { timestampSeconds: Math.floor(Date.now() / 1000) - 600 },
+ );
+
+ await expect(slackEventsResolverHandler(routePayload)).rejects.toThrow(
+ 'Invalid Slack signature',
+ );
+ });
+
+ it('should reject a request whose body was tampered with after signing', async () => {
+ const routePayload = buildSlackRoutePayload({
+ type: 'url_verification',
+ challenge: 'challenge-token',
+ });
+
+ await expect(
+ slackEventsResolverHandler({
+ ...routePayload,
+ rawBody: '{"type":"url_verification","challenge":"stolen"}',
+ }),
+ ).rejects.toThrow('Invalid Slack signature');
+ });
+
+ it('should route a mention to the assistant enqueue function of the claiming workspace', async () => {
+ claimSlackTeamForThisWorkspace();
+
+ const result = await slackEventsResolverHandler(
+ buildSlackRoutePayload(
+ buildSlackAppMentionEventBody({
+ channelId: CHANNEL_ID,
+ text: 'hello',
+ teamId: slack.teamId,
+ }),
+ ),
+ );
+
+ expect(result).toEqual(
+ expect.objectContaining({
+ workspaceId,
+ targetLogicFunctionUniversalIdentifier:
+ SLACK_EVENTS_ENQUEUE_UNIVERSAL_IDENTIFIER,
+ }),
+ );
+ });
+
+ it('should route a channel join to the welcome function', async () => {
+ claimSlackTeamForThisWorkspace();
+
+ const result = await slackEventsResolverHandler(
+ buildSlackRoutePayload(
+ buildSlackMemberJoinedChannelEventBody({
+ channelId: CHANNEL_ID,
+ userId: slack.botUserId,
+ teamId: slack.teamId,
+ }),
+ ),
+ );
+
+ expect(result).toEqual(
+ expect.objectContaining({
+ targetLogicFunctionUniversalIdentifier:
+ SLACK_CHANNEL_WELCOME_UNIVERSAL_IDENTIFIER,
+ }),
+ );
+ });
+
+ it('should route an app home opening to the suggested prompts function', async () => {
+ claimSlackTeamForThisWorkspace();
+
+ const result = await slackEventsResolverHandler(
+ buildSlackRoutePayload(
+ buildSlackAppHomeOpenedEventBody({
+ channelId: DIRECT_MESSAGE_CHANNEL_ID,
+ teamId: slack.teamId,
+ }),
+ ),
+ );
+
+ expect(result).toEqual(
+ expect.objectContaining({
+ targetLogicFunctionUniversalIdentifier:
+ SLACK_HOME_OPENED_UNIVERSAL_IDENTIFIER,
+ }),
+ );
+ });
+
+ it('should refuse events from a Slack team no workspace has connected', async () => {
+ const routePayload = buildSlackRoutePayload(
+ buildSlackAppMentionEventBody({
+ channelId: CHANNEL_ID,
+ text: 'hello',
+ teamId: 'T0UNCLAIMED',
+ }),
+ );
+
+ await expect(slackEventsResolverHandler(routePayload)).rejects.toThrow(
+ 'No workspace has claimed Slack team T0UNCLAIMED',
+ );
+ });
+ });
+
+ describe('assistant request enqueue', () => {
+ it('should queue a mention as a pending request without the bot mention', async () => {
+ const slackMessageTimestamp = nextMessageTimestamp();
+
+ const result = await enqueueSlackAssistantRequest(
+ buildSlackAppMentionEventBody({
+ channelId: CHANNEL_ID,
+ text: `<@${slack.botUserId}> how many companies do we have?`,
+ messageTimestamp: slackMessageTimestamp,
+ botUserId: slack.botUserId,
+ }),
+ );
+
+ expect(result).toEqual({ ok: true });
+
+ const request = await findRequestByMessageTimestamp(
+ slackMessageTimestamp,
+ );
+
+ // The status is not asserted here: on a server running a worker, the
+ // deployed assistant worker picks the record up right away.
+ expect(request).toEqual(
+ expect.objectContaining({
+ name: 'how many companies do we have?',
+ requestText: 'how many companies do we have?',
+ slackChannelId: CHANNEL_ID,
+ slackChannelType: 'channel',
+ slackUserId: REQUESTER_USER_ID,
+ }),
+ );
+ });
+
+ it('should ignore a redelivery of the same Slack message', async () => {
+ const slackMessageTimestamp = nextMessageTimestamp();
+ const eventBody = buildSlackAppMentionEventBody({
+ channelId: CHANNEL_ID,
+ text: `<@${slack.botUserId}> who owns Acme?`,
+ messageTimestamp: slackMessageTimestamp,
+ botUserId: slack.botUserId,
+ });
+
+ await enqueueSlackAssistantRequest(eventBody);
+ const redeliveryResult = await enqueueSlackAssistantRequest(eventBody);
+
+ expect(redeliveryResult).toEqual({
+ ok: true,
+ skipped: 'Slack message is already queued',
+ });
+ await expect(
+ findRequestByMessageTimestamp(slackMessageTimestamp),
+ ).resolves.toBeDefined();
+ });
+
+ it('should ignore messages posted by another bot', async () => {
+ const slackMessageTimestamp = nextMessageTimestamp();
+
+ const result = await enqueueSlackAssistantRequest(
+ buildSlackMessageEventBody({
+ channelId: DIRECT_MESSAGE_CHANNEL_ID,
+ text: 'a bot is talking',
+ messageTimestamp: slackMessageTimestamp,
+ botId: 'B0OTHERBOT',
+ }),
+ );
+
+ expect(result).toEqual({
+ ok: true,
+ skipped: 'Not a plain user message',
+ });
+ await expect(
+ findRequestByMessageTimestamp(slackMessageTimestamp),
+ ).resolves.toBeUndefined();
+ });
+
+ it('should answer a mention with no question in Slack instead of queueing it', async () => {
+ slack.addChannel({ id: CHANNEL_ID, name: 'integration' });
+ const slackMessageTimestamp = nextMessageTimestamp();
+
+ const result = await enqueueSlackAssistantRequest(
+ buildSlackAppMentionEventBody({
+ channelId: CHANNEL_ID,
+ text: `<@${slack.botUserId}>`,
+ messageTimestamp: slackMessageTimestamp,
+ botUserId: slack.botUserId,
+ }),
+ );
+
+ expect(result).toEqual({ ok: true });
+ expect(slack.messagesIn(CHANNEL_ID)).toEqual([
+ expect.objectContaining({
+ markdownText: SLACK_ASSISTANT_EMPTY_REQUEST_TEXT,
+ threadTimestamp: slackMessageTimestamp,
+ }),
+ ]);
+ await expect(
+ findRequestByMessageTimestamp(slackMessageTimestamp),
+ ).resolves.toBeUndefined();
+ });
+
+ it('should answer an empty mention only once', async () => {
+ slack.addChannel({ id: CHANNEL_ID, name: 'integration' });
+ const eventBody = buildSlackAppMentionEventBody({
+ channelId: CHANNEL_ID,
+ text: `<@${slack.botUserId}> `,
+ messageTimestamp: nextMessageTimestamp(),
+ botUserId: slack.botUserId,
+ });
+
+ await enqueueSlackAssistantRequest(eventBody);
+ const secondResult = await enqueueSlackAssistantRequest(eventBody);
+
+ expect(secondResult).toEqual({
+ ok: true,
+ skipped: 'Empty request was already answered',
+ });
+ expect(slack.messagesIn(CHANNEL_ID)).toHaveLength(1);
+ });
+
+ it('should ignore an unmentioned thread reply when the thread is not subscribed', async () => {
+ const slackMessageTimestamp = nextMessageTimestamp();
+
+ const result = await enqueueSlackAssistantRequest(
+ buildSlackMessageEventBody({
+ channelId: CHANNEL_ID,
+ channelType: 'channel',
+ text: 'and what about last month?',
+ messageTimestamp: slackMessageTimestamp,
+ threadTimestamp: '1700000000.000001',
+ }),
+ );
+
+ expect(result).toEqual({
+ ok: true,
+ skipped: 'Thread is not subscribed for unmentioned follow-ups',
+ });
+ await expect(
+ findRequestByMessageTimestamp(slackMessageTimestamp),
+ ).resolves.toBeUndefined();
+ });
+
+ it('should queue an unmentioned thread reply while the thread subscription is active', async () => {
+ const threadTimestamp = '1700000000.000002';
+ const slackMessageTimestamp = nextMessageTimestamp();
+
+ appRuntime.seedKeyValue(
+ getSlackThreadKvKey({
+ channelId: CHANNEL_ID,
+ threadTimestamp,
+ }),
+ { expiresAt: Date.now() + 60_000 },
+ );
+
+ const result = await enqueueSlackAssistantRequest(
+ buildSlackMessageEventBody({
+ channelId: CHANNEL_ID,
+ channelType: 'channel',
+ text: 'and what about last month?',
+ messageTimestamp: slackMessageTimestamp,
+ threadTimestamp,
+ }),
+ );
+
+ expect(result).toEqual({ ok: true });
+
+ const request = await findRequestByMessageTimestamp(
+ slackMessageTimestamp,
+ );
+
+ expect(request).toEqual(
+ expect.objectContaining({
+ requestText: 'and what about last month?',
+ slackThreadTimestamp: threadTimestamp,
+ }),
+ );
+ });
+
+ it('should nudge the requester and drop the subscription when it has expired', async () => {
+ slack.addChannel({ id: CHANNEL_ID, name: 'integration' });
+ const threadTimestamp = '1700000000.000003';
+ const threadKey = getSlackThreadKvKey({
+ channelId: CHANNEL_ID,
+ threadTimestamp,
+ });
+ const slackMessageTimestamp = nextMessageTimestamp();
+
+ appRuntime.seedKeyValue(threadKey, { expiresAt: Date.now() - 1 });
+
+ const result = await enqueueSlackAssistantRequest(
+ buildSlackMessageEventBody({
+ channelId: CHANNEL_ID,
+ channelType: 'channel',
+ text: 'still there?',
+ messageTimestamp: slackMessageTimestamp,
+ threadTimestamp,
+ }),
+ );
+
+ expect(result).toEqual({
+ ok: true,
+ skipped: 'Thread subscription expired; nudged the requester',
+ });
+ expect(slack.ephemeralMessages).toEqual([
+ expect.objectContaining({
+ channelId: CHANNEL_ID,
+ recipientUserId: REQUESTER_USER_ID,
+ threadTimestamp,
+ text: SLACK_ASSISTANT_EXPIRED_THREAD_TEXT,
+ }),
+ ]);
+ expect(appRuntime.getKeyValue(threadKey, 'WORKSPACE')).toBeNull();
+ await expect(
+ findRequestByMessageTimestamp(slackMessageTimestamp),
+ ).resolves.toBeUndefined();
+ });
+ });
+});
diff --git a/packages/twenty-apps/public/slack/src/__tests__/types/app-key-value-scope.type.ts b/packages/twenty-apps/public/slack/src/__tests__/types/app-key-value-scope.type.ts
new file mode 100644
index 00000000000..f4d4ea5a911
--- /dev/null
+++ b/packages/twenty-apps/public/slack/src/__tests__/types/app-key-value-scope.type.ts
@@ -0,0 +1 @@
+export type AppKeyValueScope = 'WORKSPACE' | 'SERVER';
diff --git a/packages/twenty-apps/public/slack/src/__tests__/types/app-runtime-mock.type.ts b/packages/twenty-apps/public/slack/src/__tests__/types/app-runtime-mock.type.ts
new file mode 100644
index 00000000000..80e6dc746be
--- /dev/null
+++ b/packages/twenty-apps/public/slack/src/__tests__/types/app-runtime-mock.type.ts
@@ -0,0 +1,22 @@
+import { type RequestHandler } from 'msw';
+import {
+ type AppConnection,
+ type RunAgentInput,
+ type RunAgentResult,
+} from 'twenty-sdk/logic-function';
+
+import { type AppKeyValueScope } from 'src/__tests__/types/app-key-value-scope.type';
+
+export type AppRuntimeMock = {
+ handlers: RequestHandler[];
+ workspaceId: string;
+ setConnections: (connections: AppConnection[]) => void;
+ setAgentResult: (
+ implementation: RunAgentResult | ((input: RunAgentInput) => RunAgentResult),
+ ) => void;
+ readonly agentRuns: RunAgentInput[];
+ readonly lastAgentMessages: NonNullable<RunAgentInput['messages']>;
+ getKeyValue: (key: string, scope: AppKeyValueScope) => unknown;
+ seedKeyValue: (key: string, value: unknown, scope?: AppKeyValueScope) => void;
+ reset: () => void;
+};
diff --git a/packages/twenty-apps/public/slack/src/__tests__/types/fake-slack-assistant-status.type.ts b/packages/twenty-apps/public/slack/src/__tests__/types/fake-slack-assistant-status.type.ts
new file mode 100644
index 00000000000..9d034c55b2b
--- /dev/null
+++ b/packages/twenty-apps/public/slack/src/__tests__/types/fake-slack-assistant-status.type.ts
@@ -0,0 +1,5 @@
+export type FakeSlackAssistantStatus = {
+ channelId: string;
+ threadTimestamp: string;
+ status: string;
+};
diff --git a/packages/twenty-apps/public/slack/src/__tests__/types/fake-slack-assistant-title.type.ts b/packages/twenty-apps/public/slack/src/__tests__/types/fake-slack-assistant-title.type.ts
new file mode 100644
index 00000000000..01d5662ee53
--- /dev/null
+++ b/packages/twenty-apps/public/slack/src/__tests__/types/fake-slack-assistant-title.type.ts
@@ -0,0 +1,5 @@
+export type FakeSlackAssistantTitle = {
+ channelId: string;
+ threadTimestamp: string;
+ title: string;
+};
diff --git a/packages/twenty-apps/public/slack/src/__tests__/types/fake-slack-channel.type.ts b/packages/twenty-apps/public/slack/src/__tests__/types/fake-slack-channel.type.ts
new file mode 100644
index 00000000000..25554dc5614
--- /dev/null
+++ b/packages/twenty-apps/public/slack/src/__tests__/types/fake-slack-channel.type.ts
@@ -0,0 +1,11 @@
+export type FakeSlackChannel = {
+ id: string;
+ name: string;
+ isPrivate: boolean;
+ isArchived: boolean;
+ isMember: boolean;
+ isDirectMessage: boolean;
+ numMembers: number;
+ topic: string;
+ purpose: string;
+};
diff --git a/packages/twenty-apps/public/slack/src/__tests__/types/fake-slack-ephemeral-message.type.ts b/packages/twenty-apps/public/slack/src/__tests__/types/fake-slack-ephemeral-message.type.ts
new file mode 100644
index 00000000000..6a9fc164b1a
--- /dev/null
+++ b/packages/twenty-apps/public/slack/src/__tests__/types/fake-slack-ephemeral-message.type.ts
@@ -0,0 +1,7 @@
+export type FakeSlackEphemeralMessage = {
+ channelId: string;
+ recipientUserId: string;
+ threadTimestamp?: string;
+ text?: string;
+ markdownText?: string;
+};
diff --git a/packages/twenty-apps/public/slack/src/__tests__/types/fake-slack-message.type.ts b/packages/twenty-apps/public/slack/src/__tests__/types/fake-slack-message.type.ts
new file mode 100644
index 00000000000..4d75583b8f6
--- /dev/null
+++ b/packages/twenty-apps/public/slack/src/__tests__/types/fake-slack-message.type.ts
@@ -0,0 +1,10 @@
+export type FakeSlackMessage = {
+ channelId: string;
+ timestamp: string;
+ threadTimestamp?: string;
+ userId?: string;
+ botId?: string;
+ text?: string;
+ markdownText?: string;
+ blocks?: unknown[];
+};
diff --git a/packages/twenty-apps/public/slack/src/__tests__/types/fake-slack-reaction.type.ts b/packages/twenty-apps/public/slack/src/__tests__/types/fake-slack-reaction.type.ts
new file mode 100644
index 00000000000..bd3cca855bd
--- /dev/null
+++ b/packages/twenty-apps/public/slack/src/__tests__/types/fake-slack-reaction.type.ts
@@ -0,0 +1,5 @@
+export type FakeSlackReaction = {
+ channelId: string;
+ messageTimestamp: string;
+ emojiName: string;
+};
diff --git a/packages/twenty-apps/public/slack/src/__tests__/types/fake-slack-suggested-prompts.type.ts b/packages/twenty-apps/public/slack/src/__tests__/types/fake-slack-suggested-prompts.type.ts
new file mode 100644
index 00000000000..433fb020fe4
--- /dev/null
+++ b/packages/twenty-apps/public/slack/src/__tests__/types/fake-slack-suggested-prompts.type.ts
@@ -0,0 +1,5 @@
+export type FakeSlackSuggestedPrompts = {
+ channelId: string;
+ title: string;
+ prompts: unknown[];
+};
diff --git a/packages/twenty-apps/public/slack/src/__tests__/types/fake-slack-user.type.ts b/packages/twenty-apps/public/slack/src/__tests__/types/fake-slack-user.type.ts
new file mode 100644
index 00000000000..17bfed73aa0
--- /dev/null
+++ b/packages/twenty-apps/public/slack/src/__tests__/types/fake-slack-user.type.ts
@@ -0,0 +1,12 @@
+export type FakeSlackUser = {
+ id: string;
+ displayName?: string;
+ realName?: string;
+ email?: string;
+ teamId?: string;
+ isBot?: boolean;
+ isDeleted?: boolean;
+ isRestricted?: boolean;
+ isUltraRestricted?: boolean;
+ isEmailConfirmed?: boolean;
+};
diff --git a/packages/twenty-apps/public/slack/src/__tests__/types/slack-api-call.type.ts b/packages/twenty-apps/public/slack/src/__tests__/types/slack-api-call.type.ts
new file mode 100644
index 00000000000..a3c38e2c3cc
--- /dev/null
+++ b/packages/twenty-apps/public/slack/src/__tests__/types/slack-api-call.type.ts
@@ -0,0 +1,4 @@
+export type SlackApiCall = {
+ method: string;
+ args: Record<string, unknown>;
+};
diff --git a/packages/twenty-apps/public/slack/src/__tests__/types/slack-api-mock.type.ts b/packages/twenty-apps/public/slack/src/__tests__/types/slack-api-mock.type.ts
new file mode 100644
index 00000000000..d44a8715fae
--- /dev/null
+++ b/packages/twenty-apps/public/slack/src/__tests__/types/slack-api-mock.type.ts
@@ -0,0 +1,38 @@
+import { type RequestHandler } from 'msw';
+
+import { type FakeSlackAssistantStatus } from 'src/__tests__/types/fake-slack-assistant-status.type';
+import { type FakeSlackAssistantTitle } from 'src/__tests__/types/fake-slack-assistant-title.type';
+import { type FakeSlackChannel } from 'src/__tests__/types/fake-slack-channel.type';
+import { type FakeSlackEphemeralMessage } from 'src/__tests__/types/fake-slack-ephemeral-message.type';
+import { type FakeSlackMessage } from 'src/__tests__/types/fake-slack-message.type';
+import { type FakeSlackReaction } from 'src/__tests__/types/fake-slack-reaction.type';
+import { type FakeSlackSuggestedPrompts } from 'src/__tests__/types/fake-slack-suggested-prompts.type';
+import { type FakeSlackUser } from 'src/__tests__/types/fake-slack-user.type';
+import { type SlackApiCall } from 'src/__tests__/types/slack-api-call.type';
+
+export type SlackApiMock = {
+ handlers: RequestHandler[];
+ botToken: string;
+ botUserId: string;
+ teamId: string;
+ addChannel: (
+ channel: Pick<FakeSlackChannel, 'id' | 'name'> & Partial<FakeSlackChannel>,
+ ) => FakeSlackChannel;
+ addUser: (user: FakeSlackUser) => void;
+ addMessage: (
+ message: Pick<FakeSlackMessage, 'channelId'> & Partial<FakeSlackMessage>,
+ ) => FakeSlackMessage;
+ failNextCall: (method: string, errorCode: string) => void;
+ rejectMarkdownText: () => void;
+ rejectBlocks: () => void;
+ readonly calls: SlackApiCall[];
+ callsTo: (method: string) => SlackApiCall[];
+ lastCallTo: (method: string) => SlackApiCall | undefined;
+ messagesIn: (channelId: string) => FakeSlackMessage[];
+ readonly ephemeralMessages: FakeSlackEphemeralMessage[];
+ readonly reactions: FakeSlackReaction[];
+ readonly assistantStatuses: FakeSlackAssistantStatus[];
+ readonly assistantTitles: FakeSlackAssistantTitle[];
+ readonly suggestedPrompts: FakeSlackSuggestedPrompts[];
+ reset: () => void;
+};
diff --git a/packages/twenty-apps/public/slack/src/__tests__/types/slack-message-event-options.type.ts b/packages/twenty-apps/public/slack/src/__tests__/types/slack-message-event-options.type.ts
new file mode 100644
index 00000000000..ede67f5221b
--- /dev/null
+++ b/packages/twenty-apps/public/slack/src/__tests__/types/slack-message-event-options.type.ts
@@ -0,0 +1,13 @@
+export type SlackMessageEventOptions = {
+ channelId: string;
+ text: string;
+ userId?: string;
+ messageTimestamp?: string;
+ threadTimestamp?: string;
+ channelType?: string;
+ eventId?: string;
+ teamId?: string;
+ botUserId?: string;
+ botId?: string;
+ subtype?: string;
+};
diff --git a/packages/twenty-apps/public/slack/src/__tests__/utils/build-slack-app-connection.util.ts b/packages/twenty-apps/public/slack/src/__tests__/utils/build-slack-app-connection.util.ts
new file mode 100644
index 00000000000..8ee8476e6d5
--- /dev/null
+++ b/packages/twenty-apps/public/slack/src/__tests__/utils/build-slack-app-connection.util.ts
@@ -0,0 +1,19 @@
+import { type AppConnection } from 'twenty-sdk/logic-function';
+
+import { SLACK_TEST_CONNECTED_ACCOUNT_ID } from 'src/__tests__/constants/slack-test-connected-account-id.constant';
+
+export const buildSlackAppConnection = (
+ accessToken: string,
+ overrides: Partial<AppConnection> = {},
+): AppConnection => ({
+ id: SLACK_TEST_CONNECTED_ACCOUNT_ID,
+ providerName: 'slack',
+ name: 'Twenty Test workspace',
+ handle: 'twenty-test',
+ visibility: 'workspace',
+ userWorkspaceId: 'user-workspace-1',
+ accessToken,
+ scopes: ['chat:write', 'channels:read'],
+ authFailedAt: null,
+ ...overrides,
+});
diff --git a/packages/twenty-apps/public/slack/src/__tests__/utils/build-slack-app-home-opened-event-body.util.ts b/packages/twenty-apps/public/slack/src/__tests__/utils/build-slack-app-home-opened-event-body.util.ts
new file mode 100644
index 00000000000..c66db900cca
--- /dev/null
+++ b/packages/twenty-apps/public/slack/src/__tests__/utils/build-slack-app-home-opened-event-body.util.ts
@@ -0,0 +1,18 @@
+import { buildSlackEventCallback } from 'src/__tests__/utils/build-slack-event-callback.util';
+import { type SlackEventsRequestBody } from 'src/logic-functions/types/slack-events-request-body.type';
+
+export const buildSlackAppHomeOpenedEventBody = ({
+ channelId,
+ userId = 'U0REQUESTER',
+ tab = 'messages',
+ teamId,
+}: {
+ channelId: string;
+ userId?: string;
+ tab?: string;
+ teamId?: string;
+}): SlackEventsRequestBody =>
+ buildSlackEventCallback(
+ { type: 'app_home_opened', channel: channelId, user: userId, tab },
+ { teamId },
+ );
diff --git a/packages/twenty-apps/public/slack/src/__tests__/utils/build-slack-app-mention-event-body.util.ts b/packages/twenty-apps/public/slack/src/__tests__/utils/build-slack-app-mention-event-body.util.ts
new file mode 100644
index 00000000000..bb77a685416
--- /dev/null
+++ b/packages/twenty-apps/public/slack/src/__tests__/utils/build-slack-app-mention-event-body.util.ts
@@ -0,0 +1,27 @@
+import { type SlackMessageEventOptions } from 'src/__tests__/types/slack-message-event-options.type';
+import { buildSlackEventCallback } from 'src/__tests__/utils/build-slack-event-callback.util';
+import { type SlackEventsRequestBody } from 'src/logic-functions/types/slack-events-request-body.type';
+
+export const buildSlackAppMentionEventBody = ({
+ channelId,
+ text,
+ userId = 'U0REQUESTER',
+ messageTimestamp = '1700000100.000100',
+ threadTimestamp,
+ channelType = 'channel',
+ eventId,
+ teamId,
+ botUserId,
+}: SlackMessageEventOptions): SlackEventsRequestBody =>
+ buildSlackEventCallback(
+ {
+ type: 'app_mention',
+ channel: channelId,
+ channel_type: channelType,
+ user: userId,
+ text,
+ ts: messageTimestamp,
+ thread_ts: threadTimestamp,
+ },
+ { eventId, teamId, botUserId },
+ );
diff --git a/packages/twenty-apps/public/slack/src/__tests__/utils/build-slack-event-callback.util.ts b/packages/twenty-apps/public/slack/src/__tests__/utils/build-slack-event-callback.util.ts
new file mode 100644
index 00000000000..324adc3d589
--- /dev/null
+++ b/packages/twenty-apps/public/slack/src/__tests__/utils/build-slack-event-callback.util.ts
@@ -0,0 +1,19 @@
+import { type SlackEventsRequestBody } from 'src/logic-functions/types/slack-events-request-body.type';
+
+export const buildSlackEventCallback = (
+ event: NonNullable<SlackEventsRequestBody['event']>,
+ {
+ eventId = `Ev${Math.random().toString(36).slice(2, 12).toUpperCase()}`,
+ teamId,
+ botUserId,
+ }: { eventId?: string; teamId?: string; botUserId?: string },
+): SlackEventsRequestBody => ({
+ type: 'event_callback',
+ event_id: eventId,
+ team_id: teamId,
+ authorizations:
+ botUserId === undefined
+ ? undefined
+ : [{ user_id: botUserId, is_bot: true }],
+ event,
+});
diff --git a/packages/twenty-apps/public/slack/src/__tests__/utils/build-slack-member-joined-channel-event-body.util.ts b/packages/twenty-apps/public/slack/src/__tests__/utils/build-slack-member-joined-channel-event-body.util.ts
new file mode 100644
index 00000000000..839d491526c
--- /dev/null
+++ b/packages/twenty-apps/public/slack/src/__tests__/utils/build-slack-member-joined-channel-event-body.util.ts
@@ -0,0 +1,16 @@
+import { buildSlackEventCallback } from 'src/__tests__/utils/build-slack-event-callback.util';
+import { type SlackEventsRequestBody } from 'src/logic-functions/types/slack-events-request-body.type';
+
+export const buildSlackMemberJoinedChannelEventBody = ({
+ channelId,
+ userId,
+ teamId,
+}: {
+ channelId: string;
+ userId: string;
+ teamId?: string;
+}): SlackEventsRequestBody =>
+ buildSlackEventCallback(
+ { type: 'member_joined_channel', channel: channelId, user: userId },
+ { teamId },
+ );
diff --git a/packages/twenty-apps/public/slack/src/__tests__/utils/build-slack-message-event-body.util.ts b/packages/twenty-apps/public/slack/src/__tests__/utils/build-slack-message-event-body.util.ts
new file mode 100644
index 00000000000..eeb8b7792d6
--- /dev/null
+++ b/packages/twenty-apps/public/slack/src/__tests__/utils/build-slack-message-event-body.util.ts
@@ -0,0 +1,31 @@
+import { type SlackMessageEventOptions } from 'src/__tests__/types/slack-message-event-options.type';
+import { buildSlackEventCallback } from 'src/__tests__/utils/build-slack-event-callback.util';
+import { type SlackEventsRequestBody } from 'src/logic-functions/types/slack-events-request-body.type';
+
+export const buildSlackMessageEventBody = ({
+ channelId,
+ text,
+ userId = 'U0REQUESTER',
+ messageTimestamp = '1700000100.000200',
+ threadTimestamp,
+ channelType = 'im',
+ eventId,
+ teamId,
+ botUserId,
+ botId,
+ subtype,
+}: SlackMessageEventOptions): SlackEventsRequestBody =>
+ buildSlackEventCallback(
+ {
+ type: 'message',
+ channel: channelId,
+ channel_type: channelType,
+ user: userId,
+ text,
+ ts: messageTimestamp,
+ thread_ts: threadTimestamp,
+ bot_id: botId,
+ subtype,
+ },
+ { eventId, teamId, botUserId },
+ );
diff --git a/packages/twenty-apps/public/slack/src/__tests__/utils/build-slack-route-payload.util.ts b/packages/twenty-apps/public/slack/src/__tests__/utils/build-slack-route-payload.util.ts
new file mode 100644
index 00000000000..4ab19be3660
--- /dev/null
+++ b/packages/twenty-apps/public/slack/src/__tests__/utils/build-slack-route-payload.util.ts
@@ -0,0 +1,57 @@
+import { createHmac } from 'crypto';
+
+import { type RoutePayload } from 'twenty-sdk/define';
+
+import { SLACK_TEST_WEBHOOK_SECRET } from 'src/__tests__/constants/slack-test-webhook-secret.constant';
+
+import { type SlackEventsRequestBody } from 'src/logic-functions/types/slack-events-request-body.type';
+
+const signSlackRequest = ({
+ rawBody,
+ timestampSeconds,
+ secret = SLACK_TEST_WEBHOOK_SECRET,
+}: {
+ rawBody: string;
+ timestampSeconds: number;
+ secret?: string;
+}): string =>
+ `v0=${createHmac('sha256', secret)
+ .update(`v0:${timestampSeconds}:${rawBody}`, 'utf8')
+ .digest('hex')}`;
+
+export const buildSlackRoutePayload = (
+ body: SlackEventsRequestBody,
+ {
+ secret,
+ timestampSeconds = Math.floor(Date.now() / 1000),
+ signature,
+ rawBody,
+ }: {
+ secret?: string;
+ timestampSeconds?: number;
+ signature?: string;
+ rawBody?: string;
+ } = {},
+): RoutePayload<SlackEventsRequestBody> => {
+ const serializedBody = rawBody ?? JSON.stringify(body);
+
+ return {
+ headers: {
+ 'x-slack-signature':
+ signature ??
+ signSlackRequest({
+ rawBody: serializedBody,
+ timestampSeconds,
+ secret,
+ }),
+ 'x-slack-request-timestamp': String(timestampSeconds),
+ },
+ queryStringParameters: {},
+ pathParameters: {},
+ body,
+ rawBody: serializedBody,
+ isBase64Encoded: false,
+ requestContext: { http: { method: 'POST', path: '/slack/events' } },
+ userWorkspaceId: null,
+ };
+};
diff --git a/packages/twenty-apps/public/slack/src/__tests__/utils/create-app-runtime-mock.util.ts b/packages/twenty-apps/public/slack/src/__tests__/utils/create-app-runtime-mock.util.ts
new file mode 100644
index 00000000000..1c1a80645d7
--- /dev/null
+++ b/packages/twenty-apps/public/slack/src/__tests__/utils/create-app-runtime-mock.util.ts
@@ -0,0 +1,268 @@
+import { http, HttpResponse, passthrough, type RequestHandler } from 'msw';
+import {
+ type AppConnection,
+ type RunAgentInput,
+ type RunAgentResult,
+} from 'twenty-sdk/logic-function';
+import { isDefined } from 'twenty-sdk/utils';
+
+import { type AppKeyValueScope } from 'src/__tests__/types/app-key-value-scope.type';
+import { type AppRuntimeMock } from 'src/__tests__/types/app-runtime-mock.type';
+
+// The app runtime services (`kv`, `listConnections`, `getConnection`,
+// `runAgent`) are GraphQL calls the server only answers for an
+// application-scoped token, which a test workspace API key is not. They are
+// answered here instead, with the same semantics the server implements, while
+// every other request to /metadata and /graphql reaches the real server.
+const buildKeyValueStoreKey = (key: string, scope: AppKeyValueScope): string =>
+ scope === 'SERVER' ? `SERVER:${key}` : `WORKSPACE:${key}`;
+
+const readOperationName = (query: string): string | undefined =>
+ query.match(/(?:query|mutation)\s+(\w+)/)?.[1];
+
+const graphqlError = (message: string) =>
+ HttpResponse.json({ errors: [{ message }] });
+
+type AppRuntimeMockOptions = {
+ apiUrl: string;
+ workspaceId: string;
+ connections?: AppConnection[];
+};
+
+type StoredKeyValueEntry = {
+ value: unknown;
+ workspaceId: string | null;
+};
+
+export const createAppRuntimeMock = ({
+ apiUrl,
+ workspaceId,
+ connections = [],
+}: AppRuntimeMockOptions): AppRuntimeMock => {
+ let appConnections = connections;
+ let keyValueStore = new Map<string, StoredKeyValueEntry>();
+ let agentRuns: RunAgentInput[] = [];
+ let runAgentImplementation: (
+ input: RunAgentInput,
+ ) => RunAgentResult = () => ({
+ success: true,
+ result: { response: 'Agent answer.' },
+ error: null,
+ });
+
+ const getKeyValue = (key: string, scope: AppKeyValueScope): unknown => {
+ const entry = keyValueStore.get(buildKeyValueStoreKey(key, scope));
+
+ return isDefined(entry) ? entry.value : null;
+ };
+
+ // SERVER keys are a cross-workspace claim registry: the stored value is
+ // always the claiming workspace id, and only that workspace can overwrite
+ // or delete the key.
+ const claimServerKey = (key: string) => {
+ const storeKey = buildKeyValueStoreKey(key, 'SERVER');
+ const existingEntry = keyValueStore.get(storeKey);
+
+ if (!isDefined(existingEntry)) {
+ keyValueStore.set(storeKey, { value: workspaceId, workspaceId: null });
+
+ return { key, value: workspaceId, scope: 'SERVER' };
+ }
+
+ if (existingEntry.value !== workspaceId) {
+ return null;
+ }
+
+ return { key, value: existingEntry.value, scope: 'SERVER' };
+ };
+
+ const setKeyValue = (
+ key: string,
+ value: unknown,
+ scope: AppKeyValueScope,
+ ) => {
+ if (scope === 'SERVER') {
+ return claimServerKey(key);
+ }
+
+ keyValueStore.set(buildKeyValueStoreKey(key, 'WORKSPACE'), {
+ value,
+ workspaceId,
+ });
+
+ return { key, value, scope };
+ };
+
+ const deleteKeyValue = (key: string, scope: AppKeyValueScope): boolean => {
+ const storeKey = buildKeyValueStoreKey(key, scope);
+ const entry = keyValueStore.get(storeKey);
+
+ if (!isDefined(entry)) {
+ return false;
+ }
+
+ if (scope === 'SERVER' && entry.value !== workspaceId) {
+ return false;
+ }
+
+ keyValueStore.delete(storeKey);
+
+ return true;
+ };
+
+ const handleOperation = (
+ operationName: string,
+ variables: Record<string, unknown>,
+ ) => {
+ switch (operationName) {
+ case 'ListAppConnections': {
+ const filter = (variables.filter ?? {}) as { providerName?: string };
+
+ return HttpResponse.json({
+ data: {
+ appConnections: appConnections.filter(
+ (connection) =>
+ filter.providerName === undefined ||
+ connection.providerName === filter.providerName,
+ ),
+ },
+ });
+ }
+ case 'GetAppConnection': {
+ const connection = appConnections.find(
+ (candidate) => candidate.id === variables.id,
+ );
+
+ if (!isDefined(connection)) {
+ return graphqlError(`App connection ${variables.id} not found`);
+ }
+
+ return HttpResponse.json({ data: { appConnection: connection } });
+ }
+ case 'GetAppKeyValue': {
+ const key = String(variables.key);
+ const scope = (variables.scope ?? 'WORKSPACE') as AppKeyValueScope;
+ const storedValue = getKeyValue(key, scope);
+
+ return HttpResponse.json({
+ data: {
+ appKeyValue:
+ storedValue === null ? null : { key, value: storedValue, scope },
+ },
+ });
+ }
+ case 'SetAppKeyValue': {
+ const input = variables.input as {
+ key: string;
+ value: unknown;
+ scope?: AppKeyValueScope;
+ };
+ const result = setKeyValue(
+ input.key,
+ input.value,
+ input.scope ?? 'WORKSPACE',
+ );
+
+ if (!isDefined(result)) {
+ return graphqlError(
+ `Server key "${input.key}" is already claimed by another workspace`,
+ );
+ }
+
+ return HttpResponse.json({ data: { setAppKeyValue: result } });
+ }
+ case 'DeleteAppKeyValue':
+ return HttpResponse.json({
+ data: {
+ deleteAppKeyValue: deleteKeyValue(
+ String(variables.key),
+ (variables.scope ?? 'WORKSPACE') as AppKeyValueScope,
+ ),
+ },
+ });
+ case 'RunAgent': {
+ const input = variables.input as RunAgentInput;
+
+ agentRuns.push(input);
+
+ return HttpResponse.json({
+ data: { runAgent: runAgentImplementation(input) },
+ });
+ }
+ default:
+ return passthrough();
+ }
+ };
+
+ const handlers: RequestHandler[] = [
+ http.post(`${apiUrl}/metadata`, async ({ request }) => {
+ const body = (await request.clone().json()) as {
+ query?: string;
+ variables?: Record<string, unknown>;
+ };
+ const operationName = readOperationName(body.query ?? '');
+
+ if (!isDefined(operationName)) {
+ return passthrough();
+ }
+
+ return handleOperation(operationName, body.variables ?? {});
+ }),
+ ];
+
+ return {
+ handlers,
+ workspaceId,
+
+ setConnections: (nextConnections: AppConnection[]): void => {
+ appConnections = nextConnections;
+ },
+
+ setAgentResult: (
+ implementation:
+ | RunAgentResult
+ | ((input: RunAgentInput) => RunAgentResult),
+ ): void => {
+ runAgentImplementation =
+ typeof implementation === 'function'
+ ? implementation
+ : () => implementation;
+ },
+
+ get agentRuns(): RunAgentInput[] {
+ return agentRuns;
+ },
+
+ get lastAgentMessages(): NonNullable<RunAgentInput['messages']> {
+ return agentRuns[agentRuns.length - 1]?.messages ?? [];
+ },
+
+ getKeyValue,
+
+ // Test-only back door that writes the store directly, unlike `kv.set`,
+ // which goes through the claim rules above. Seeding a SERVER key takes the
+ // claiming workspace id as its value, so a test can hand a team claim to
+ // another workspace.
+ seedKeyValue: (
+ key: string,
+ value: unknown,
+ scope: AppKeyValueScope = 'WORKSPACE',
+ ): void => {
+ keyValueStore.set(buildKeyValueStoreKey(key, scope), {
+ value,
+ workspaceId: scope === 'SERVER' ? null : workspaceId,
+ });
+ },
+
+ reset: (): void => {
+ appConnections = connections;
+ keyValueStore = new Map();
+ agentRuns = [];
+ runAgentImplementation = () => ({
+ success: true,
+ result: { response: 'Agent answer.' },
+ error: null,
+ });
+ },
+ };
+};
diff --git a/packages/twenty-apps/public/slack/src/__tests__/utils/create-slack-api-mock.util.ts b/packages/twenty-apps/public/slack/src/__tests__/utils/create-slack-api-mock.util.ts
new file mode 100644
index 00000000000..cad00169316
--- /dev/null
+++ b/packages/twenty-apps/public/slack/src/__tests__/utils/create-slack-api-mock.util.ts
@@ -0,0 +1,574 @@
+import { http, HttpResponse, type RequestHandler } from 'msw';
+import { isDefined } from 'twenty-sdk/utils';
+
+import { type FakeSlackAssistantStatus } from 'src/__tests__/types/fake-slack-assistant-status.type';
+import { type FakeSlackAssistantTitle } from 'src/__tests__/types/fake-slack-assistant-title.type';
+import { type FakeSlackChannel } from 'src/__tests__/types/fake-slack-channel.type';
+import { type FakeSlackEphemeralMessage } from 'src/__tests__/types/fake-slack-ephemeral-message.type';
+import { type FakeSlackMessage } from 'src/__tests__/types/fake-slack-message.type';
+import { type FakeSlackReaction } from 'src/__tests__/types/fake-slack-reaction.type';
+import { type FakeSlackSuggestedPrompts } from 'src/__tests__/types/fake-slack-suggested-prompts.type';
+import { type FakeSlackUser } from 'src/__tests__/types/fake-slack-user.type';
+import { type SlackApiCall } from 'src/__tests__/types/slack-api-call.type';
+import { type SlackApiMock } from 'src/__tests__/types/slack-api-mock.type';
+
+const SLACK_API_BASE_URL = 'https://slack.com/api';
+
+const DEFAULT_SLACK_BOT_TOKEN = 'xoxb-test-token';
+const DEFAULT_SLACK_BOT_USER_ID = 'U0BOTTEST0';
+const DEFAULT_SLACK_TEAM_ID = 'T0TESTTEAM';
+
+// Slack answers logical failures with HTTP 200 and `ok: false`; @slack/web-api
+// turns those into thrown errors carrying `data.error`.
+const slackError = (errorCode: string) =>
+ HttpResponse.json({ ok: false, error: errorCode });
+
+// The arguments @slack/web-api serializes as JSON before form-encoding them.
+// Everything else stays the verbatim string a real workspace would receive,
+// including a message whose text happens to look like JSON.
+const JSON_ENCODED_ARGUMENT_NAMES = new Set([
+ 'attachments',
+ 'blocks',
+ 'metadata',
+ 'prompts',
+]);
+
+// The boolean flags the app sends; converting only these keeps a message
+// whose text happens to be "true" the verbatim string it was sent as.
+const BOOLEAN_ENCODED_ARGUMENT_NAMES = new Set([
+ 'exclude_archived',
+ 'unfurl_links',
+ 'unfurl_media',
+]);
+
+const parseSlackArgumentValue = (name: string, value: string): unknown => {
+ if (BOOLEAN_ENCODED_ARGUMENT_NAMES.has(name)) {
+ return value === 'true';
+ }
+
+ if (!JSON_ENCODED_ARGUMENT_NAMES.has(name)) {
+ return value;
+ }
+
+ try {
+ return JSON.parse(value);
+ } catch {
+ return value;
+ }
+};
+
+const parseSlackRequestArgs = async (
+ request: Request,
+): Promise<Record<string, unknown>> => {
+ const args: Record<string, unknown> = {};
+
+ new URLSearchParams(await request.text()).forEach((value, key) => {
+ args[key] = parseSlackArgumentValue(key, value);
+ });
+
+ return args;
+};
+
+const asString = (value: unknown): string | undefined =>
+ typeof value === 'string' ? value : undefined;
+
+type SlackApiMockOptions = {
+ botToken?: string;
+ botUserId?: string;
+ teamId?: string;
+};
+
+export const createSlackApiMock = ({
+ botToken = DEFAULT_SLACK_BOT_TOKEN,
+ botUserId = DEFAULT_SLACK_BOT_USER_ID,
+ teamId = DEFAULT_SLACK_TEAM_ID,
+}: SlackApiMockOptions = {}): SlackApiMock => {
+ let timestampSequence = 0;
+ let channels: FakeSlackChannel[] = [];
+ let messages: FakeSlackMessage[] = [];
+ let users: FakeSlackUser[] = [];
+ let ephemeralMessages: FakeSlackEphemeralMessage[] = [];
+ let reactions: FakeSlackReaction[] = [];
+ let assistantStatuses: FakeSlackAssistantStatus[] = [];
+ let assistantTitles: FakeSlackAssistantTitle[] = [];
+ let suggestedPrompts: FakeSlackSuggestedPrompts[] = [];
+ let calls: SlackApiCall[] = [];
+ let queuedErrorsByMethod = new Map<string, string[]>();
+ let rejectsMarkdownText = false;
+ let rejectsBlocks = false;
+
+ const nextTimestamp = (): string => {
+ timestampSequence += 1;
+
+ return `1700000000.${String(timestampSequence).padStart(6, '0')}`;
+ };
+
+ const findChannel = (channelId: unknown): FakeSlackChannel | undefined =>
+ channels.find((channel) => channel.id === channelId);
+
+ const findMessage = (
+ channelId: unknown,
+ timestamp: unknown,
+ ): FakeSlackMessage | undefined =>
+ messages.find(
+ (message) =>
+ message.channelId === channelId && message.timestamp === timestamp,
+ );
+
+ const takeQueuedError = (method: string): string | undefined =>
+ queuedErrorsByMethod.get(method)?.shift();
+
+ const paginate = <TItem>(
+ items: TItem[],
+ { limit, cursor }: { limit: unknown; cursor: unknown },
+ ): { page: TItem[]; nextCursor: string } => {
+ const offset = Number(asString(cursor) ?? '0');
+ const pageSize = Number(asString(limit) ?? String(items.length));
+ const page = items.slice(offset, offset + pageSize);
+ const nextOffset = offset + page.length;
+
+ return {
+ page,
+ nextCursor: nextOffset < items.length ? String(nextOffset) : '',
+ };
+ };
+
+ const postMessage = (args: Record<string, unknown>) => {
+ if (rejectsMarkdownText && isDefined(args.markdown_text)) {
+ return slackError('invalid_arguments');
+ }
+
+ if (rejectsBlocks && isDefined(args.blocks)) {
+ return slackError('invalid_blocks');
+ }
+
+ const channel = findChannel(args.channel);
+
+ if (!isDefined(channel)) {
+ return slackError('channel_not_found');
+ }
+
+ const message: FakeSlackMessage = {
+ channelId: channel.id,
+ timestamp: nextTimestamp(),
+ threadTimestamp: asString(args.thread_ts),
+ botId: 'B0TESTBOT0',
+ text: asString(args.text),
+ markdownText: asString(args.markdown_text),
+ blocks: Array.isArray(args.blocks) ? args.blocks : undefined,
+ };
+
+ messages.push(message);
+
+ return HttpResponse.json({
+ ok: true,
+ channel: channel.id,
+ ts: message.timestamp,
+ message: { ts: message.timestamp, text: message.text },
+ });
+ };
+
+ const updateMessage = (args: Record<string, unknown>) => {
+ if (rejectsMarkdownText && isDefined(args.markdown_text)) {
+ return slackError('invalid_arguments');
+ }
+
+ if (rejectsBlocks && isDefined(args.blocks)) {
+ return slackError('invalid_blocks');
+ }
+
+ const message = findMessage(args.channel, args.ts);
+
+ if (!isDefined(message)) {
+ return slackError('message_not_found');
+ }
+
+ message.text = asString(args.text);
+ message.markdownText = asString(args.markdown_text);
+ message.blocks = Array.isArray(args.blocks) ? args.blocks : undefined;
+
+ return HttpResponse.json({
+ ok: true,
+ channel: message.channelId,
+ ts: message.timestamp,
+ });
+ };
+
+ const deleteMessage = (args: Record<string, unknown>) => {
+ const message = findMessage(args.channel, args.ts);
+
+ if (!isDefined(message)) {
+ return slackError('message_not_found');
+ }
+
+ messages = messages.filter((candidate) => candidate !== message);
+
+ return HttpResponse.json({
+ ok: true,
+ channel: message.channelId,
+ ts: message.timestamp,
+ });
+ };
+
+ const postEphemeralMessage = (args: Record<string, unknown>) => {
+ const channel = findChannel(args.channel);
+
+ if (!isDefined(channel)) {
+ return slackError('channel_not_found');
+ }
+
+ ephemeralMessages.push({
+ channelId: channel.id,
+ recipientUserId: asString(args.user) ?? '',
+ threadTimestamp: asString(args.thread_ts),
+ text: asString(args.text),
+ markdownText: asString(args.markdown_text),
+ });
+
+ return HttpResponse.json({ ok: true, message_ts: nextTimestamp() });
+ };
+
+ const changeReaction = (
+ operation: 'add' | 'remove',
+ args: Record<string, unknown>,
+ ) => {
+ const message = findMessage(args.channel, args.timestamp);
+
+ if (!isDefined(message)) {
+ return slackError('message_not_found');
+ }
+
+ const emojiName = asString(args.name) ?? '';
+ const existingReaction = reactions.find(
+ (reaction) =>
+ reaction.channelId === message.channelId &&
+ reaction.messageTimestamp === message.timestamp &&
+ reaction.emojiName === emojiName,
+ );
+
+ if (operation === 'add') {
+ if (isDefined(existingReaction)) {
+ return slackError('already_reacted');
+ }
+
+ reactions.push({
+ channelId: message.channelId,
+ messageTimestamp: message.timestamp,
+ emojiName,
+ });
+
+ return HttpResponse.json({ ok: true });
+ }
+
+ if (!isDefined(existingReaction)) {
+ return slackError('no_reaction');
+ }
+
+ reactions = reactions.filter((reaction) => reaction !== existingReaction);
+
+ return HttpResponse.json({ ok: true });
+ };
+
+ const listChannels = (args: Record<string, unknown>) => {
+ const requestedTypes = (asString(args.types) ?? 'public_channel').split(
+ ',',
+ );
+ const matchingChannels = channels.filter((channel) => {
+ const matchesType = requestedTypes.includes(
+ channel.isPrivate ? 'private_channel' : 'public_channel',
+ );
+
+ return (
+ matchesType && !(args.exclude_archived === true && channel.isArchived)
+ );
+ });
+
+ const { page, nextCursor } = paginate(matchingChannels, {
+ limit: args.limit,
+ cursor: args.cursor,
+ });
+
+ return HttpResponse.json({
+ ok: true,
+ channels: page.map((channel) => ({
+ id: channel.id,
+ name: channel.name,
+ is_private: channel.isPrivate,
+ is_archived: channel.isArchived,
+ is_member: channel.isMember,
+ num_members: channel.numMembers,
+ topic: { value: channel.topic },
+ purpose: { value: channel.purpose },
+ })),
+ response_metadata: { next_cursor: nextCursor },
+ });
+ };
+
+ const listThreadReplies = (args: Record<string, unknown>) => {
+ const threadTimestamp = asString(args.ts);
+ const threadMessages = messages.filter(
+ (message) =>
+ message.channelId === args.channel &&
+ (message.timestamp === threadTimestamp ||
+ message.threadTimestamp === threadTimestamp),
+ );
+
+ const { page, nextCursor } = paginate(threadMessages, {
+ limit: args.limit,
+ cursor: args.cursor,
+ });
+
+ return HttpResponse.json({
+ ok: true,
+ messages: page.map((message) => ({
+ ts: message.timestamp,
+ thread_ts: message.threadTimestamp,
+ user: message.userId,
+ bot_id: message.botId,
+ text: message.text ?? message.markdownText,
+ })),
+ response_metadata: { next_cursor: nextCursor },
+ });
+ };
+
+ const getUserInfo = (args: Record<string, unknown>) => {
+ const user = users.find((candidate) => candidate.id === args.user);
+
+ if (!isDefined(user)) {
+ return slackError('users_not_found');
+ }
+
+ return HttpResponse.json({
+ ok: true,
+ user: {
+ id: user.id,
+ team_id: user.teamId ?? teamId,
+ real_name: user.realName,
+ is_bot: user.isBot ?? false,
+ deleted: user.isDeleted ?? false,
+ is_restricted: user.isRestricted ?? false,
+ is_ultra_restricted: user.isUltraRestricted ?? false,
+ is_email_confirmed: user.isEmailConfirmed ?? true,
+ profile: { display_name: user.displayName, email: user.email },
+ },
+ });
+ };
+
+ const getChannelInfo = (args: Record<string, unknown>) => {
+ const channel = findChannel(args.channel);
+
+ if (!isDefined(channel)) {
+ return slackError('channel_not_found');
+ }
+
+ return HttpResponse.json({
+ ok: true,
+ channel: {
+ id: channel.id,
+ name: channel.name,
+ is_im: channel.isDirectMessage,
+ is_private: channel.isPrivate,
+ is_archived: channel.isArchived,
+ is_member: channel.isMember,
+ },
+ });
+ };
+
+ const handleSlackMethod = (method: string, args: Record<string, unknown>) => {
+ switch (method) {
+ case 'auth.test':
+ return HttpResponse.json({
+ ok: true,
+ url: 'https://twenty-test.slack.com/',
+ team: 'Twenty Test',
+ team_id: teamId,
+ user: 'twenty',
+ user_id: botUserId,
+ bot_id: 'B0TESTBOT0',
+ });
+ case 'chat.postMessage':
+ return postMessage(args);
+ case 'chat.update':
+ return updateMessage(args);
+ case 'chat.delete':
+ return deleteMessage(args);
+ case 'chat.postEphemeral':
+ return postEphemeralMessage(args);
+ case 'reactions.add':
+ return changeReaction('add', args);
+ case 'reactions.remove':
+ return changeReaction('remove', args);
+ case 'conversations.info':
+ return getChannelInfo(args);
+ case 'conversations.list':
+ return listChannels(args);
+ case 'conversations.replies':
+ return listThreadReplies(args);
+ case 'users.info':
+ return getUserInfo(args);
+ case 'assistant.threads.setStatus':
+ assistantStatuses.push({
+ channelId: asString(args.channel_id) ?? '',
+ threadTimestamp: asString(args.thread_ts) ?? '',
+ status: asString(args.status) ?? '',
+ });
+
+ return HttpResponse.json({ ok: true });
+ case 'assistant.threads.setTitle':
+ assistantTitles.push({
+ channelId: asString(args.channel_id) ?? '',
+ threadTimestamp: asString(args.thread_ts) ?? '',
+ title: asString(args.title) ?? '',
+ });
+
+ return HttpResponse.json({ ok: true });
+ case 'assistant.threads.setSuggestedPrompts':
+ suggestedPrompts.push({
+ channelId: asString(args.channel_id) ?? '',
+ title: asString(args.title) ?? '',
+ prompts: Array.isArray(args.prompts) ? args.prompts : [],
+ });
+
+ return HttpResponse.json({ ok: true });
+ default:
+ return slackError('unknown_method');
+ }
+ };
+
+ const handlers: RequestHandler[] = [
+ http.post(`${SLACK_API_BASE_URL}/:method`, async ({ request, params }) => {
+ const method = String(params.method);
+ const args = await parseSlackRequestArgs(request);
+
+ calls.push({ method, args });
+
+ if (request.headers.get('authorization') !== `Bearer ${botToken}`) {
+ return slackError('invalid_auth');
+ }
+
+ const queuedError = takeQueuedError(method);
+
+ if (isDefined(queuedError)) {
+ return slackError(queuedError);
+ }
+
+ return handleSlackMethod(method, args);
+ }),
+ ];
+
+ return {
+ handlers,
+ botToken,
+ botUserId,
+ teamId,
+
+ addChannel: (
+ channel: Pick<FakeSlackChannel, 'id' | 'name'> &
+ Partial<FakeSlackChannel>,
+ ): FakeSlackChannel => {
+ const fakeChannel: FakeSlackChannel = {
+ isPrivate: false,
+ isArchived: false,
+ isMember: true,
+ // Slack direct message channel ids start with a D, and the app asks
+ // Slack rather than trusting the request record.
+ isDirectMessage: channel.id.startsWith('D'),
+ numMembers: 3,
+ topic: '',
+ purpose: '',
+ ...channel,
+ };
+
+ channels.push(fakeChannel);
+
+ return fakeChannel;
+ },
+
+ addUser: (user: FakeSlackUser): void => {
+ users.push(user);
+ },
+
+ addMessage: (
+ message: Pick<FakeSlackMessage, 'channelId'> & Partial<FakeSlackMessage>,
+ ): FakeSlackMessage => {
+ const fakeMessage: FakeSlackMessage = {
+ timestamp: nextTimestamp(),
+ ...message,
+ };
+
+ messages.push(fakeMessage);
+
+ return fakeMessage;
+ },
+
+ // Makes the next call to `method` answer with a Slack error code, the way
+ // a real workspace rejects a call it cannot serve.
+ failNextCall: (method: string, errorCode: string): void => {
+ queuedErrorsByMethod.set(method, [
+ ...(queuedErrorsByMethod.get(method) ?? []),
+ errorCode,
+ ]);
+ },
+
+ // Older Slack workspaces reject `markdown_text` and `blocks` payloads.
+ rejectMarkdownText: (): void => {
+ rejectsMarkdownText = true;
+ },
+
+ rejectBlocks: (): void => {
+ rejectsBlocks = true;
+ },
+
+ get calls(): SlackApiCall[] {
+ return calls;
+ },
+
+ callsTo: (method: string): SlackApiCall[] =>
+ calls.filter((call) => call.method === method),
+
+ lastCallTo: (method: string): SlackApiCall | undefined => {
+ const matchingCalls = calls.filter((call) => call.method === method);
+
+ return matchingCalls[matchingCalls.length - 1];
+ },
+
+ messagesIn: (channelId: string): FakeSlackMessage[] =>
+ messages.filter((message) => message.channelId === channelId),
+
+ get ephemeralMessages(): FakeSlackEphemeralMessage[] {
+ return ephemeralMessages;
+ },
+
+ get reactions(): FakeSlackReaction[] {
+ return reactions;
+ },
+
+ get assistantStatuses(): FakeSlackAssistantStatus[] {
+ return assistantStatuses;
+ },
+
+ get assistantTitles(): FakeSlackAssistantTitle[] {
+ return assistantTitles;
+ },
+
+ get suggestedPrompts(): FakeSlackSuggestedPrompts[] {
+ return suggestedPrompts;
+ },
+
+ reset: (): void => {
+ timestampSequence = 0;
+ channels = [];
+ messages = [];
+ users = [];
+ ephemeralMessages = [];
+ reactions = [];
+ assistantStatuses = [];
+ assistantTitles = [];
+ suggestedPrompts = [];
+ calls = [];
+ queuedErrorsByMethod = new Map();
+ rejectsMarkdownText = false;
+ rejectsBlocks = false;
+ },
+ };
+};
diff --git a/packages/twenty-apps/public/slack/src/__tests__/utils/create-slack-message-timestamp-sequence.util.ts b/packages/twenty-apps/public/slack/src/__tests__/utils/create-slack-message-timestamp-sequence.util.ts
new file mode 100644
index 00000000000..26b985b814d
--- /dev/null
+++ b/packages/twenty-apps/public/slack/src/__tests__/utils/create-slack-message-timestamp-sequence.util.ts
@@ -0,0 +1,20 @@
+// Slack message timestamps double as record lookup keys on the live test
+// server. The whole part is the run's start second, shifted by a per-suite
+// offset so two suites in one run cannot meet, and the fraction carries the
+// millisecond and the message counter. Epoch seconds never wrap, so no rerun
+// can reproduce an earlier run's keys.
+export const createSlackMessageTimestampSequence = (
+ suiteOffsetSeconds: number,
+): (() => string) => {
+ const startedAt = Date.now();
+ const runSecond = Math.floor(startedAt / 1000) + suiteOffsetSeconds;
+ const runMillisecond = String(startedAt % 1000).padStart(3, '0');
+
+ let sequence = 0;
+
+ return () => {
+ sequence += 1;
+
+ return `${runSecond}.${runMillisecond}${String(sequence).padStart(3, '0')}`;
+ };
+};
diff --git a/packages/twenty-apps/public/slack/src/__tests__/utils/require-defined-or-throw.util.ts b/packages/twenty-apps/public/slack/src/__tests__/utils/require-defined-or-throw.util.ts
new file mode 100644
index 00000000000..29d7658df2e
--- /dev/null
+++ b/packages/twenty-apps/public/slack/src/__tests__/utils/require-defined-or-throw.util.ts
@@ -0,0 +1,10 @@
+export const requireDefinedOrThrow = <TValue>(
+ value: TValue | undefined,
+ errorMessage: string,
+): TValue => {
+ if (value === undefined) {
+ throw new Error(errorMessage);
+ }
+
+ return value;
+};
diff --git a/packages/twenty-apps/public/slack/src/__tests__/utils/setup-slack-integration-test.util.ts b/packages/twenty-apps/public/slack/src/__tests__/utils/setup-slack-integration-test.util.ts
new file mode 100644
index 00000000000..63444b5f4e5
--- /dev/null
+++ b/packages/twenty-apps/public/slack/src/__tests__/utils/setup-slack-integration-test.util.ts
@@ -0,0 +1,105 @@
+import { http, HttpResponse, passthrough } from 'msw';
+import { setupServer } from 'msw/node';
+import { CoreApiClient } from 'twenty-client-sdk/core';
+import { afterAll, afterEach, beforeAll, beforeEach, vi } from 'vitest';
+
+import { SLACK_TEST_WEBHOOK_SECRET } from 'src/__tests__/constants/slack-test-webhook-secret.constant';
+import { type AppRuntimeMock } from 'src/__tests__/types/app-runtime-mock.type';
+import { type SlackApiMock } from 'src/__tests__/types/slack-api-mock.type';
+import { buildSlackAppConnection } from 'src/__tests__/utils/build-slack-app-connection.util';
+import { createAppRuntimeMock } from 'src/__tests__/utils/create-app-runtime-mock.util';
+import { createSlackApiMock } from 'src/__tests__/utils/create-slack-api-mock.util';
+
+type SlackIntegrationTestContext = {
+ slack: SlackApiMock;
+ appRuntime: AppRuntimeMock;
+ coreClient: CoreApiClient;
+ workspaceId: string;
+};
+
+const readWorkspaceIdFromTokenOrThrow = (token: string): string => {
+ const payload = ((): { workspaceId?: string } => {
+ try {
+ return JSON.parse(
+ Buffer.from(token.split('.')[1] ?? '', 'base64url').toString('utf8'),
+ );
+ } catch (error) {
+ throw new Error(
+ `TWENTY_API_KEY is not a readable JWT: ${
+ error instanceof Error ? error.message : String(error)
+ }`,
+ );
+ }
+ })();
+
+ if (payload.workspaceId === undefined) {
+ throw new Error('TWENTY_API_KEY carries no workspaceId claim');
+ }
+
+ return payload.workspaceId;
+};
+
+const localhostPassthroughHandlers = [
+ http.all('http://127.0.0.1*', () => passthrough()),
+ http.all('http://localhost*', () => passthrough()),
+];
+
+// With onUnhandledRequest: 'error', msw throws an uncaught InternalError inside
+// the interceptor and the pending request never settles, which hangs the caller
+// forever. Responding 500 instead makes the caller fail immediately with an
+// attributable error.
+const unmockedRequestCatchAllHandler = http.all('*', ({ request }) => {
+ const message = `Unmocked external request in integration test: ${request.method} ${request.url}`;
+
+ console.error(message);
+
+ return HttpResponse.json({ error: { message } }, { status: 500 });
+});
+
+// Wires the Slack Web API and the app runtime services to in-memory fakes for
+// the calling test file. Everything else - the Slack Assistant Request records
+// the app reads and writes - goes to the live Twenty server the integration
+// suite runs against.
+export const setupSlackIntegrationTest = (): SlackIntegrationTestContext => {
+ const apiUrl = process.env.TWENTY_API_URL ?? '';
+ const apiKey = process.env.TWENTY_API_KEY ?? '';
+ const workspaceId = readWorkspaceIdFromTokenOrThrow(apiKey);
+
+ const slack = createSlackApiMock();
+ const appRuntime = createAppRuntimeMock({
+ apiUrl,
+ workspaceId,
+ connections: [buildSlackAppConnection(slack.botToken)],
+ });
+
+ const mockServer = setupServer(
+ ...slack.handlers,
+ ...appRuntime.handlers,
+ ...localhostPassthroughHandlers,
+ unmockedRequestCatchAllHandler,
+ );
+
+ beforeAll(() => {
+ mockServer.listen({ onUnhandledRequest: 'error' });
+ });
+
+ beforeEach(() => {
+ // Logic functions run with an app access token; the workspace API key is a
+ // token with the same workspaceId claim.
+ vi.stubEnv('TWENTY_APP_ACCESS_TOKEN', apiKey);
+ vi.stubEnv('SLACK_WEBHOOK_SECRET', SLACK_TEST_WEBHOOK_SECRET);
+ });
+
+ afterEach(() => {
+ vi.unstubAllEnvs();
+ slack.reset();
+ appRuntime.reset();
+ mockServer.resetHandlers();
+ });
+
+ afterAll(() => {
+ mockServer.close();
+ });
+
+ return { slack, appRuntime, coreClient: new CoreApiClient(), workspaceId };
+};
diff --git a/packages/twenty-apps/public/slack/yarn.lock b/packages/twenty-apps/public/slack/yarn.lock
index 9310444d125..7d3bf5f6902 100644
--- a/packages/twenty-apps/public/slack/yarn.lock
+++ b/packages/twenty-apps/public/slack/yarn.lock
@@ -523,7 +523,7 @@ __metadata:
languageName: node
linkType: hard
-"@inquirer/confirm@npm:^6.1.1":
+"@inquirer/confirm@npm:^6.0.11, @inquirer/confirm@npm:^6.1.1":
version: 6.1.1
resolution: "@inquirer/confirm@npm:6.1.1"
dependencies:
@@ -756,6 +756,20 @@ __metadata:
languageName: node
linkType: hard
+"@mswjs/interceptors@npm:^0.41.3":
+ version: 0.41.9
+ resolution: "@mswjs/interceptors@npm:0.41.9"
+ dependencies:
+ "@open-draft/deferred-promise": "npm:^2.2.0"
+ "@open-draft/logger": "npm:^0.3.0"
+ "@open-draft/until": "npm:^2.0.0"
+ is-node-process: "npm:^1.2.0"
+ outvariant: "npm:^1.4.3"
+ strict-event-emitter: "npm:^0.5.1"
+ checksum: 10c0/2efff40877e07ce29846be76c2683177308a72a3ccfe4c096b496412a279acd92b5b9cdad40ad71c36b149a4a7d9e9b4e7d295893a8ba9661b43334f5784ecd8
+ languageName: node
+ linkType: hard
+
"@napi-rs/wasm-runtime@npm:^1.1.4":
version: 1.1.5
resolution: "@napi-rs/wasm-runtime@npm:1.1.5"
@@ -768,6 +782,37 @@ __metadata:
languageName: node
linkType: hard
+"@open-draft/deferred-promise@npm:^2.2.0":
+ version: 2.2.0
+ resolution: "@open-draft/deferred-promise@npm:2.2.0"
+ checksum: 10c0/eafc1b1d0fc8edb5e1c753c5e0f3293410b40dde2f92688211a54806d4136887051f39b98c1950370be258483deac9dfd17cf8b96557553765198ef2547e4549
+ languageName: node
+ linkType: hard
+
+"@open-draft/deferred-promise@npm:^3.0.0":
+ version: 3.0.0
+ resolution: "@open-draft/deferred-promise@npm:3.0.0"
+ checksum: 10c0/4dd697e55495e436be9536413cc9975e792e9ca7472e81e3d3d69e9b65cb678465aac90b463ac02f2b490c0581c4e9aa8a33d2a5857decbe2c6d9ffb310f8e1f
+ languageName: node
+ linkType: hard
+
+"@open-draft/logger@npm:^0.3.0":
+ version: 0.3.0
+ resolution: "@open-draft/logger@npm:0.3.0"
+ dependencies:
+ is-node-process: "npm:^1.2.0"
+ outvariant: "npm:^1.4.0"
+ checksum: 10c0/90010647b22e9693c16258f4f9adb034824d1771d3baa313057b9a37797f571181005bc50415a934eaf7c891d90ff71dcd7a9d5048b0b6bb438f31bef2c7c5c1
+ languageName: node
+ linkType: hard
+
+"@open-draft/until@npm:^2.0.0":
+ version: 2.1.0
+ resolution: "@open-draft/until@npm:2.1.0"
+ checksum: 10c0/61d3f99718dd86bb393fee2d7a785f961dcaf12f2055f0c693b27f4d0cd5f7a03d498a6d9289773b117590d794a43cd129366fd8e99222e4832f67b1653d54cf
+ languageName: node
+ linkType: hard
+
"@oxc-project/types@npm:=0.133.0":
version: 0.133.0
resolution: "@oxc-project/types@npm:0.133.0"
@@ -1005,6 +1050,7 @@ __metadata:
"@types/node": "npm:^24.7.2"
"@types/react": "npm:^18.2.0"
"@typescript/native-preview": "npm:^7.0.0-dev.20260116.1"
+ msw: "npm:^2.12.14"
oxlint: "npm:^0.16.0"
react: "npm:^18.2.0"
react-dom: "npm:^18.2.0"
@@ -1098,6 +1144,22 @@ __metadata:
languageName: node
linkType: hard
+"@types/set-cookie-parser@npm:^2.4.10":
+ version: 2.4.10
+ resolution: "@types/set-cookie-parser@npm:2.4.10"
+ dependencies:
+ "@types/node": "npm:*"
+ checksum: 10c0/010b0c582ea70a2088618b4725808e80c30cce296c19ec58e51d94e0fd1038201b7b99238bf3ea74e1894163c8037d10a4f1729de62b2801ce240ff070f43e76
+ languageName: node
+ linkType: hard
+
+"@types/statuses@npm:^2.0.6":
+ version: 2.0.6
+ resolution: "@types/statuses@npm:2.0.6"
+ checksum: 10c0/dd88c220b0e2c6315686289525fd61472d2204d2e4bef4941acfb76bda01d3066f749ac74782aab5b537a45314fcd7d6261eefa40b6ec872691f5803adaa608d
+ languageName: node
+ linkType: hard
+
"@types/ws@npm:^6.0.1":
version: 6.0.4
resolution: "@types/ws@npm:6.0.4"
@@ -1295,6 +1357,13 @@ __metadata:
languageName: node
linkType: hard
+"ansi-regex@npm:^5.0.1":
+ version: 5.0.1
+ resolution: "ansi-regex@npm:5.0.1"
+ checksum: 10c0/9a64bb8627b434ba9327b60c027742e5d17ac69277960d041898596271d992d4d52ba7267a63ca10232e29f6107fc8a835f6ce8d719b88c5f8493f8254813737
+ languageName: node
+ linkType: hard
+
"ansi-regex@npm:^6.2.2":
version: 6.2.2
resolution: "ansi-regex@npm:6.2.2"
@@ -1302,6 +1371,15 @@ __metadata:
languageName: node
linkType: hard
+"ansi-styles@npm:^4.0.0":
+ version: 4.3.0
+ resolution: "ansi-styles@npm:4.3.0"
+ dependencies:
+ color-convert: "npm:^2.0.1"
+ checksum: 10c0/895a23929da416f2bd3de7e9cb4eabd340949328ab85ddd6e484a637d8f6820d485f53933446f5291c3b760cbc488beb8e88573dd0f9c7daf83dccc8fe81b041
+ languageName: node
+ linkType: hard
+
"ansi-styles@npm:^6.2.1, ansi-styles@npm:^6.2.3":
version: 6.2.3
resolution: "ansi-styles@npm:6.2.3"
@@ -1450,6 +1528,17 @@ __metadata:
languageName: node
linkType: hard
+"cliui@npm:^8.0.1":
+ version: 8.0.1
+ resolution: "cliui@npm:8.0.1"
+ dependencies:
+ string-width: "npm:^4.2.0"
+ strip-ansi: "npm:^6.0.1"
+ wrap-ansi: "npm:^7.0.0"
+ checksum: 10c0/4bda0f09c340cbb6dfdc1ed508b3ca080f12992c18d68c6be4d9cf51756033d5266e61ec57529e610dacbf4da1c634423b0c1b11037709cc6b09045cbd815df5
+ languageName: node
+ linkType: hard
+
"code-excerpt@npm:^4.0.0":
version: 4.0.0
resolution: "code-excerpt@npm:4.0.0"
@@ -1459,6 +1548,22 @@ __metadata:
languageName: node
linkType: hard
+"color-convert@npm:^2.0.1":
+ version: 2.0.1
+ resolution: "color-convert@npm:2.0.1"
+ dependencies:
+ color-name: "npm:~1.1.4"
+ checksum: 10c0/37e1150172f2e311fe1b2df62c6293a342ee7380da7b9cfdba67ea539909afbd74da27033208d01d6d5cfc65ee7868a22e18d7e7648e004425441c0f8a15a7d7
+ languageName: node
+ linkType: hard
+
+"color-name@npm:~1.1.4":
+ version: 1.1.4
+ resolution: "color-name@npm:1.1.4"
+ checksum: 10c0/a1a3f914156960902f46f7f56bc62effc6c94e84b2cae157a526b1c1f74b677a47ec602bf68a61abfa2b42d15b7c5651c6dbe72a43af720bc588dff885b10f95
+ languageName: node
+ linkType: hard
+
"combined-stream@npm:^1.0.8":
version: 1.0.8
resolution: "combined-stream@npm:1.0.8"
@@ -1489,6 +1594,13 @@ __metadata:
languageName: node
linkType: hard
+"cookie@npm:^1.1.1":
+ version: 1.1.1
+ resolution: "cookie@npm:1.1.1"
+ checksum: 10c0/79c4ddc0fcad9c4f045f826f42edf54bcc921a29586a4558b0898277fa89fb47be95bc384c2253f493af7b29500c830da28341274527328f18eba9f58afa112c
+ languageName: node
+ linkType: hard
+
"csstype@npm:^3.2.2":
version: 3.2.3
resolution: "csstype@npm:3.2.3"
@@ -1540,6 +1652,13 @@ __metadata:
languageName: node
linkType: hard
+"emoji-regex@npm:^8.0.0":
+ version: 8.0.0
+ resolution: "emoji-regex@npm:8.0.0"
+ checksum: 10c0/b6053ad39951c4cf338f9092d7bfba448cdfd46fe6a2a034700b149ac9ffbc137e361cbd3c442297f86bed2e5f7576c1b54cc0a6bf8ef5106cc62f496af35010
+ languageName: node
+ linkType: hard
+
"env-paths@npm:^2.2.0":
version: 2.2.1
resolution: "env-paths@npm:2.2.1"
@@ -1697,6 +1816,13 @@ __metadata:
languageName: node
linkType: hard
+"escalade@npm:^3.1.1":
+ version: 3.2.0
+ resolution: "escalade@npm:3.2.0"
+ checksum: 10c0/ced4dd3a78e15897ed3be74e635110bbf3b08877b0a41be50dcb325ee0e0b5f65fc2d50e9845194d7c4633f327e2e1c6cce00a71b617c5673df0374201d67f65
+ languageName: node
+ linkType: hard
+
"escape-string-regexp@npm:^2.0.0":
version: 2.0.0
resolution: "escape-string-regexp@npm:2.0.0"
@@ -1841,6 +1967,13 @@ __metadata:
languageName: node
linkType: hard
+"get-caller-file@npm:^2.0.5":
+ version: 2.0.5
+ resolution: "get-caller-file@npm:2.0.5"
+ checksum: 10c0/c6c7b60271931fa752aeb92f2b47e355eac1af3a2673f47c9589e8f8a41adc74d45551c1bc57b5e66a80609f10ffb72b6f575e4370d61cc3f7f3aaff01757cde
+ languageName: node
+ linkType: hard
+
"get-east-asian-width@npm:^1.0.0, get-east-asian-width@npm:^1.3.1, get-east-asian-width@npm:^1.5.0":
version: 1.5.0
resolution: "get-east-asian-width@npm:1.5.0"
@@ -1916,6 +2049,13 @@ __metadata:
languageName: node
linkType: hard
+"graphql@npm:^16.13.2":
+ version: 16.14.2
+ resolution: "graphql@npm:16.14.2"
+ checksum: 10c0/a95a96961eaff55cc9fe9d31fae6f33499ac988b972d07ea5085024cb1333f515b902f376e7393a5489aa82200a8aff3eb96580e4d1b69d702ed19b6eb1ce97a
+ languageName: node
+ linkType: hard
+
"graphql@npm:^16.8.1":
version: 16.13.2
resolution: "graphql@npm:16.13.2"
@@ -1957,6 +2097,16 @@ __metadata:
languageName: node
linkType: hard
+"headers-polyfill@npm:^5.0.1":
+ version: 5.0.1
+ resolution: "headers-polyfill@npm:5.0.1"
+ dependencies:
+ "@types/set-cookie-parser": "npm:^2.4.10"
+ set-cookie-parser: "npm:^3.0.1"
+ checksum: 10c0/c269730a88a12c88718037aa71f178601f2b193ba8a37e276b6ced6b8f7e06fc1ac051f2a7acb0a8b4cc878407066555fdcdbb270e90374baaa472cb26af0c30
+ languageName: node
+ linkType: hard
+
"https-proxy-agent@npm:^5.0.1":
version: 5.0.1
resolution: "https-proxy-agent@npm:5.0.1"
@@ -2051,6 +2201,13 @@ __metadata:
languageName: node
linkType: hard
+"is-fullwidth-code-point@npm:^3.0.0":
+ version: 3.0.0
+ resolution: "is-fullwidth-code-point@npm:3.0.0"
+ checksum: 10c0/bb11d825e049f38e04c06373a8d72782eee0205bda9d908cc550ccb3c59b99d750ff9537982e01733c1c94a58e35400661f57042158ff5e8f3e90cf936daf0fc
+ languageName: node
+ linkType: hard
+
"is-fullwidth-code-point@npm:^5.0.0, is-fullwidth-code-point@npm:^5.1.0":
version: 5.1.0
resolution: "is-fullwidth-code-point@npm:5.1.0"
@@ -2069,6 +2226,13 @@ __metadata:
languageName: node
linkType: hard
+"is-node-process@npm:^1.2.0":
+ version: 1.2.0
+ resolution: "is-node-process@npm:1.2.0"
+ checksum: 10c0/5b24fda6776d00e42431d7bcd86bce81cb0b6cabeb944142fe7b077a54ada2e155066ad06dbe790abdb397884bdc3151e04a9707b8cd185099efbc79780573ed
+ languageName: node
+ linkType: hard
+
"is-stream@npm:^2":
version: 2.0.1
resolution: "is-stream@npm:2.0.1"
@@ -2314,6 +2478,39 @@ __metadata:
languageName: node
linkType: hard
+"msw@npm:^2.12.14":
+ version: 2.15.0
+ resolution: "msw@npm:2.15.0"
+ dependencies:
+ "@inquirer/confirm": "npm:^6.0.11"
+ "@mswjs/interceptors": "npm:^0.41.3"
+ "@open-draft/deferred-promise": "npm:^3.0.0"
+ "@types/statuses": "npm:^2.0.6"
+ cookie: "npm:^1.1.1"
+ graphql: "npm:^16.13.2"
+ headers-polyfill: "npm:^5.0.1"
+ is-node-process: "npm:^1.2.0"
+ outvariant: "npm:^1.4.3"
+ path-to-regexp: "npm:^6.3.0"
+ picocolors: "npm:^1.1.1"
+ rettime: "npm:^0.11.11"
+ statuses: "npm:^2.0.2"
+ strict-event-emitter: "npm:^0.5.1"
+ tough-cookie: "npm:^6.0.1"
+ type-fest: "npm:^5.5.0"
+ until-async: "npm:^3.0.2"
+ yargs: "npm:^17.7.2"
+ peerDependencies:
+ typescript: ">= 4.8.x"
+ peerDependenciesMeta:
+ typescript:
+ optional: true
+ bin:
+ msw: cli/index.js
+ checksum: 10c0/0d3dbf1b062a82b3711ff195e10ffd9e6f2a5e337b4a0f08cabdb8d0b96c5c0c057f1cdcb67da14c356612554ea463fb5ad8f9c618b5ac009fc4eee43a83c94e
+ languageName: node
+ linkType: hard
+
"mute-stream@npm:^3.0.0":
version: 3.0.0
resolution: "mute-stream@npm:3.0.0"
@@ -2391,6 +2588,13 @@ __metadata:
languageName: node
linkType: hard
+"outvariant@npm:^1.4.0, outvariant@npm:^1.4.3":
+ version: 1.4.3
+ resolution: "outvariant@npm:1.4.3"
+ checksum: 10c0/5976ca7740349cb8c71bd3382e2a762b1aeca6f33dc984d9d896acdf3c61f78c3afcf1bfe9cc633a7b3c4b295ec94d292048f83ea2b2594fae4496656eba992c
+ languageName: node
+ linkType: hard
+
"oxlint@npm:^0.16.0":
version: 0.16.12
resolution: "oxlint@npm:0.16.12"
@@ -2470,6 +2674,13 @@ __metadata:
languageName: node
linkType: hard
+"path-to-regexp@npm:^6.3.0":
+ version: 6.3.0
+ resolution: "path-to-regexp@npm:6.3.0"
+ checksum: 10c0/73b67f4638b41cde56254e6354e46ae3a2ebc08279583f6af3d96fe4664fc75788f74ed0d18ca44fa4a98491b69434f9eee73b97bb5314bd1b5adb700f5c18d6
+ languageName: node
+ linkType: hard
+
"pathe@npm:^2.0.3":
version: 2.0.3
resolution: "pathe@npm:2.0.3"
@@ -2589,6 +2800,13 @@ __metadata:
languageName: node
linkType: hard
+"require-directory@npm:^2.1.1":
+ version: 2.1.1
+ resolution: "require-directory@npm:2.1.1"
+ checksum: 10c0/83aa76a7bc1531f68d92c75a2ca2f54f1b01463cb566cf3fbc787d0de8be30c9dbc211d1d46be3497dac5785fe296f2dd11d531945ac29730643357978966e99
+ languageName: node
+ linkType: hard
+
"restore-cursor@npm:^4.0.0":
version: 4.0.0
resolution: "restore-cursor@npm:4.0.0"
@@ -2606,6 +2824,13 @@ __metadata:
languageName: node
linkType: hard
+"rettime@npm:^0.11.11":
+ version: 0.11.11
+ resolution: "rettime@npm:0.11.11"
+ checksum: 10c0/021fc9d9870ce04f032952e63fc5576f3f8e7c9c15513b1a479a64646df90239802eef6d60a98cbfb6ac87bb623d4f120a8ee71193d02984e3d2915c28695f6e
+ languageName: node
+ linkType: hard
+
"rolldown@npm:1.0.3":
version: 1.0.3
resolution: "rolldown@npm:1.0.3"
@@ -2721,6 +2946,13 @@ __metadata:
languageName: node
linkType: hard
+"set-cookie-parser@npm:^3.0.1":
+ version: 3.1.2
+ resolution: "set-cookie-parser@npm:3.1.2"
+ checksum: 10c0/ea3d4fba5affd57f2a4c2e5172d701c4c17645879f9fddf1331622ae556210d840cdcb6666f0d71288ad545e31db5927bf49696051928e0186e079588cd5ddb0
+ languageName: node
+ linkType: hard
+
"sharp@npm:^0.35.3":
version: 0.35.3
resolution: "sharp@npm:0.35.3"
@@ -2865,6 +3097,13 @@ __metadata:
languageName: node
linkType: hard
+"statuses@npm:^2.0.2":
+ version: 2.0.2
+ resolution: "statuses@npm:2.0.2"
+ checksum: 10c0/a9947d98ad60d01f6b26727570f3bcceb6c8fa789da64fe6889908fe2e294d57503b14bf2b5af7605c2d36647259e856635cd4c49eab41667658ec9d0080ec3f
+ languageName: node
+ linkType: hard
+
"std-env@npm:^4.0.0-rc.1":
version: 4.1.0
resolution: "std-env@npm:4.1.0"
@@ -2872,6 +3111,24 @@ __metadata:
languageName: node
linkType: hard
+"strict-event-emitter@npm:^0.5.1":
+ version: 0.5.1
+ resolution: "strict-event-emitter@npm:0.5.1"
+ checksum: 10c0/f5228a6e6b6393c57f52f62e673cfe3be3294b35d6f7842fc24b172ae0a6e6c209fa83241d0e433fc267c503bc2f4ffdbe41a9990ff8ffd5ac425ec0489417f7
+ languageName: node
+ linkType: hard
+
+"string-width@npm:^4.1.0, string-width@npm:^4.2.0, string-width@npm:^4.2.3":
+ version: 4.2.3
+ resolution: "string-width@npm:4.2.3"
+ dependencies:
+ emoji-regex: "npm:^8.0.0"
+ is-fullwidth-code-point: "npm:^3.0.0"
+ strip-ansi: "npm:^6.0.1"
+ checksum: 10c0/1e525e92e5eae0afd7454086eed9c818ee84374bb80328fc41217ae72ff5f065ef1c9d7f72da41de40c75fa8bb3dee63d92373fd492c84260a552c636392a47b
+ languageName: node
+ linkType: hard
+
"string-width@npm:^7.0.0":
version: 7.2.0
resolution: "string-width@npm:7.2.0"
@@ -2893,6 +3150,15 @@ __metadata:
languageName: node
linkType: hard
+"strip-ansi@npm:^6.0.0, strip-ansi@npm:^6.0.1":
+ version: 6.0.1
+ resolution: "strip-ansi@npm:6.0.1"
+ dependencies:
+ ansi-regex: "npm:^5.0.1"
+ checksum: 10c0/1ae5f212a126fe5b167707f716942490e3933085a5ff6c008ab97ab2f272c8025d3aa218b7bd6ab25729ca20cc81cddb252102f8751e13482a5199e873680952
+ languageName: node
+ linkType: hard
+
"strip-ansi@npm:^7.1.0, strip-ansi@npm:^7.1.2":
version: 7.2.0
resolution: "strip-ansi@npm:7.2.0"
@@ -2992,6 +3258,33 @@ __metadata:
languageName: node
linkType: hard
+"tldts-core@npm:^7.4.10":
+ version: 7.4.10
+ resolution: "tldts-core@npm:7.4.10"
+ checksum: 10c0/a5f42aad8aa8adfc57d33e9bd5c43094e9de226dce4851867ea7014d8679040b4c01c500b9947595ab22cdfe9783ea5d88a7c0be2092d19a14f75c7cd4671181
+ languageName: node
+ linkType: hard
+
+"tldts@npm:^7.0.5":
+ version: 7.4.10
+ resolution: "tldts@npm:7.4.10"
+ dependencies:
+ tldts-core: "npm:^7.4.10"
+ bin:
+ tldts: bin/cli.js
+ checksum: 10c0/a9a85d260bd0bfd046794f140667aae0975da4a3aa805d180b0808b672a6fa7de0fc9f36110c3bdeed87ad780e961e1e5bb1ed8b41f8aa3ad5d5fb469e70ba38
+ languageName: node
+ linkType: hard
+
+"tough-cookie@npm:^6.0.1":
+ version: 6.0.2
+ resolution: "tough-cookie@npm:6.0.2"
+ dependencies:
+ tldts: "npm:^7.0.5"
+ checksum: 10c0/5ff521a476a3c540821352125a5d481c8d2fe16035de7e0efda4df120f290c95500a0e9b51ea0aa56343955be482e014c30f5ba73e04b93ba138e4e855cb9e89
+ languageName: node
+ linkType: hard
+
"tr46@npm:~0.0.3":
version: 0.0.3
resolution: "tr46@npm:0.0.3"
@@ -3079,6 +3372,15 @@ __metadata:
languageName: node
linkType: hard
+"type-fest@npm:^5.5.0":
+ version: 5.8.0
+ resolution: "type-fest@npm:5.8.0"
+ dependencies:
+ tagged-tag: "npm:^1.0.0"
+ checksum: 10c0/c8aae118a763d550a9552a511dff6b71840a23dab4edf693cf1c4df22596942794e6f6723389bd9036a90182249d915158bacf0815a1ae87f05f901b1d5f574e
+ languageName: node
+ linkType: hard
+
"typescript@npm:^5.9.3":
version: 5.9.3
resolution: "typescript@npm:5.9.3"
@@ -3127,6 +3429,13 @@ __metadata:
languageName: node
linkType: hard
+"until-async@npm:^3.0.2":
+ version: 3.0.2
+ resolution: "until-async@npm:3.0.2"
+ checksum: 10c0/61c8b03895dbe18fe3d90316d0a1894e0c131ea4b1673f6ce78eed993d0bb81bbf4b7adf8477e9ff7725782a76767eed9d077561cfc9f89b4a1ebe61f7c9828e
+ languageName: node
+ linkType: hard
+
"utility-types@npm:^3.10.0":
version: 3.11.0
resolution: "utility-types@npm:3.11.0"
@@ -3333,6 +3642,17 @@ __metadata:
languageName: node
linkType: hard
+"wrap-ansi@npm:^7.0.0":
+ version: 7.0.0
+ resolution: "wrap-ansi@npm:7.0.0"
+ dependencies:
+ ansi-styles: "npm:^4.0.0"
+ string-width: "npm:^4.1.0"
+ strip-ansi: "npm:^6.0.0"
+ checksum: 10c0/d15fc12c11e4cbc4044a552129ebc75ee3f57aa9c1958373a4db0292d72282f54373b536103987a4a7594db1ef6a4f10acf92978f79b98c49306a4b58c77d4da
+ languageName: node
+ linkType: hard
+
"wrap-ansi@npm:^9.0.0":
version: 9.0.2
resolution: "wrap-ansi@npm:9.0.2"
@@ -3383,6 +3703,13 @@ __metadata:
languageName: node
linkType: hard
+"y18n@npm:^5.0.5":
+ version: 5.0.8
+ resolution: "y18n@npm:5.0.8"
+ checksum: 10c0/4df2842c36e468590c3691c894bc9cdbac41f520566e76e24f59401ba7d8b4811eb1e34524d57e54bc6d864bcb66baab7ffd9ca42bf1eda596618f9162b91249
+ languageName: node
+ linkType: hard
+
"yallist@npm:^5.0.0":
version: 5.0.0
resolution: "yallist@npm:5.0.0"
@@ -3390,6 +3717,28 @@ __metadata:
languageName: node
linkType: hard
+"yargs-parser@npm:^21.1.1":
+ version: 21.1.1
+ resolution: "yargs-parser@npm:21.1.1"
+ checksum: 10c0/f84b5e48169479d2f402239c59f084cfd1c3acc197a05c59b98bab067452e6b3ea46d4dd8ba2985ba7b3d32a343d77df0debd6b343e5dae3da2aab2cdf5886b2
+ languageName: node
+ linkType: hard
+
+"yargs@npm:^17.7.2":
+ version: 17.7.3
+ resolution: "yargs@npm:17.7.3"
+ dependencies:
+ cliui: "npm:^8.0.1"
+ escalade: "npm:^3.1.1"
+ get-caller-file: "npm:^2.0.5"
+ require-directory: "npm:^2.1.1"
+ string-width: "npm:^4.2.3"
+ y18n: "npm:^5.0.5"
+ yargs-parser: "npm:^21.1.1"
+ checksum: 10c0/7a28572f7e785a57886e34fdbddb9b28756dec552e1453d5f6e7cdd00ad8721a4e8c4321d33683f5e61cacb36ad43258adbb48396b71ec4ed14abee0fc0d0c1f
+ languageName: node
+ linkType: hard
+
"yoga-layout@npm:~3.2.1":
version: 3.2.1
resolution: "yoga-layout@npm:3.2.1"