Skip to content

Commit 284420c

Browse files
fix(slack-search): simplify setup and subscribe to app home events
1 parent d1add4f commit 284420c

7 files changed

Lines changed: 38 additions & 34 deletions

File tree

apps/sim/app/o/[organizationId]/settings/components/organization-search-slack.test.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,14 @@ async function action(label: string) {
104104
}
105105

106106
describe('Slack Search settings and shared wizard', () => {
107-
it('starts with one setup action and the prefilled manifest, with no name or token form', async () => {
107+
it('starts with one setup action and a Slack app link, with no manifest preview or form', async () => {
108108
await render()
109109
expect(container.querySelectorAll('button')).toHaveLength(1)
110110
await click('Set up')
111-
expect(document.querySelector('[role="dialog"]')).toHaveTextContent('App manifest')
111+
expect(document.querySelector('[role="dialog"]')).not.toHaveTextContent('App manifest')
112+
expect(document.querySelector('a[href="https://api.slack.com/apps"]')).toHaveTextContent(
113+
'Create app in Slack'
114+
)
112115
expect(document.querySelectorAll('input')).toHaveLength(0)
113116
expect(mocks.manifest).toHaveBeenCalledWith('org-1', 'Sim Search')
114117
expect(mocks.install).not.toHaveBeenCalled()

apps/sim/components/integrations/slack-search-setup-wizard.tsx

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import {
1212
ChipModalHeader,
1313
} from '@sim/emcn'
1414
import { SlackIcon } from '@/components/icons'
15-
import { SlackAppManifest } from '@/components/integrations/slack-app-manifest'
1615
import {
1716
SLACK_SEARCH_DEFAULT_DESCRIPTION,
1817
SLACK_SEARCH_DEFAULT_NAME,
@@ -101,32 +100,22 @@ export function SlackSearchSetupWizard({
101100
</p>
102101
)}
103102
{step === 'manifest' && prepare.data && (
104-
<>
105-
<ChipModalField
106-
type='custom'
107-
title={installationId ? 'Update your Slack app' : 'Create your Slack app'}
103+
<ChipModalField
104+
type='custom'
105+
title={installationId ? 'Update your Slack app' : 'Create your Slack app'}
106+
>
107+
<ChipLink
108+
href={
109+
configuredAppId
110+
? `https://api.slack.com/apps/${encodeURIComponent(configuredAppId)}`
111+
: prepare.data.createAppUrl
112+
}
113+
target='_blank'
114+
rel='noopener noreferrer'
108115
>
109-
<ChipLink
110-
href={
111-
configuredAppId
112-
? `https://api.slack.com/apps/${encodeURIComponent(configuredAppId)}`
113-
: prepare.data.createAppUrl
114-
}
115-
target='_blank'
116-
rel='noopener noreferrer'
117-
>
118-
{configuredAppId ? 'Open Slack app settings' : 'Create app in Slack'}
119-
</ChipLink>
120-
<p className='text-[var(--text-secondary)] text-caption'>
121-
{configuredAppId
122-
? 'Open App Manifest in your existing app and apply the updated configuration.'
123-
: 'Choose your Slack workspace, review the prepared manifest, then create the app.'}
124-
</p>
125-
</ChipModalField>
126-
<ChipModalField type='custom' title='App manifest'>
127-
<SlackAppManifest manifest={prepare.data.manifest} />
128-
</ChipModalField>
129-
</>
116+
{configuredAppId ? 'Open Slack app settings' : 'Create app in Slack'}
117+
</ChipLink>
118+
</ChipModalField>
130119
)}
131120
{step === 'credentials' && (
132121
<>

apps/sim/ee/credential-groups/components/slack-managed-users-access.test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,8 @@ describe('Slack member access selection', () => {
323323
const dialog = appSetupDialog(true)
324324
expect(dialog).toBeDefined()
325325
expect(dialog?.textContent).toContain('Step 1 of 3')
326-
expect(dialog?.textContent).toContain('App manifest')
326+
expect(dialog?.textContent).not.toContain('App manifest')
327+
expect(dialog?.textContent).toContain('Create app in Slack')
327328
expect(mocks.manifest).toHaveBeenCalledWith('org-1', 'Sim Search')
328329
expect(mocks.start).not.toHaveBeenCalled()
329330
expect(mocks.create).not.toHaveBeenCalled()

apps/sim/lib/slack-search/README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ separate agent framework is involved.
1111
1. The wizard generates the **Sim Search** app manifest with the default
1212
description, “Ask questions about your organization’s knowledge and get
1313
answers with sources.” Create the app in your Slack workspace using the
14-
prepared link or copyable JSON preview.
14+
**Create app in Slack** button. The app configuration is prefilled in Slack.
1515
2. Copy **Client ID**, **Client Secret**, and **Signing Secret** from Slack’s
1616
**Basic Information** page into the wizard.
1717
3. Choose **Install in Slack** and complete Slack OAuth. The bot token comes from
@@ -29,8 +29,12 @@ their individual accounts through the existing source connection flow.
2929
Every installation uses one code-defined app configuration. The wizard has no
3030
feature switches and stores no per-app capabilities. The bot grants
3131
`assistant:write`, `chat:write`, `im:history`, `im:write`, `app_mentions:read`,
32-
`users:read`, and `users:read.email`. Agent View is enabled, with `message.im`,
33-
`app_mention`, and `agent_session_stopped` subscriptions.
32+
`users:read`, and `users:read.email`. Agent View is enabled, with `app_home_opened`,
33+
`message.im`, `app_mention`, and `agent_session_stopped` subscriptions. Opening the
34+
app is acknowledged without starting a search; a message starts the conversation.
35+
Existing apps need the `app_home_opened` bot event added in Slack's Event
36+
Subscriptions. If Slack reports changed permission scopes, complete the wizard's
37+
OAuth installation again to grant them.
3438

3539
The same app supplies separate member OAuth grants for channel and DM indexing:
3640
`users:read`, `users:read.email`, and the read/history scopes for channels,

apps/sim/lib/slack-search/manifest.test.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,12 @@ describe('Search app manifest', () => {
2929
])
3030
)
3131
expect(manifest.settings.event_subscriptions.bot_events).toEqual(
32-
expect.arrayContaining(['message.im', 'app_mention', 'agent_session_stopped'])
32+
expect.arrayContaining([
33+
'app_home_opened',
34+
'message.im',
35+
'app_mention',
36+
'agent_session_stopped',
37+
])
3338
)
3439
expect(manifest.settings.event_subscriptions.bot_events).not.toContain('message.channels')
3540
expect(manifest.features.app_home.messages_tab_read_only_enabled).toBe(false)
@@ -63,6 +68,7 @@ describe('Search app manifest', () => {
6368
'https://search-test.ngrok.app/api/webhooks/slack'
6469
)
6570
expect(manifest.settings.event_subscriptions.bot_events).toEqual([
71+
'app_home_opened',
6672
'message.im',
6773
'app_mention',
6874
'agent_session_stopped',

apps/sim/lib/slack-search/manifest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export function createSlackSearchManifest(
5252
settings: {
5353
event_subscriptions: {
5454
request_url: webhookUrl,
55-
bot_events: ['message.im', 'app_mention', 'agent_session_stopped'],
55+
bot_events: ['app_home_opened', 'message.im', 'app_mention', 'agent_session_stopped'],
5656
},
5757
interactivity: { is_enabled: true, request_url: webhookUrl },
5858
org_deploy_enabled: false,

apps/sim/lib/slack-search/types.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ describe('Slack Search message dispatch', () => {
6767
})
6868
})
6969
it.each([
70+
{ type: 'app_home_opened', tab: 'messages' },
7071
{ channel_type: 'channel' },
7172
{ channel_type: 'mpim' },
7273
{ bot_id: 'B1' },

0 commit comments

Comments
 (0)