Skip to content

Commit da24b62

Browse files
fix(slack): stop requesting the unapproved mention/assistant/DM scopes
1 parent 49adf91 commit da24b62

2 files changed

Lines changed: 7 additions & 26 deletions

File tree

apps/sim/blocks/blocks/slack.ts

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,6 @@ import { normalizeFileInput } from '@/blocks/utils'
77
import type { SlackResponse } from '@/tools/slack/types'
88
import { getTrigger } from '@/triggers'
99

10-
/**
11-
* Scopes added for the native Sim Slack app trigger (`slack_oauth`): the shared
12-
* app's `app_mention`, assistant-thread, and DM events don't deliver without
13-
* them. Advertised by `slack_v2` and the trigger only — the legacy block has no
14-
* feature that needs them, and listing them there would flag every existing
15-
* Slack credential as missing scopes and prompt a reconnect.
16-
*
17-
* This only controls what each picker *advertises* and treats as missing. The
18-
* authorization request itself is provider-wide
19-
* (`getCanonicalScopesForProvider('slack')`), so any reconnect grants the full
20-
* set regardless of which block started it.
21-
*/
22-
const SLACK_V2_ONLY_SCOPES = new Set(['app_mentions:read', 'assistant:write', 'im:history'])
23-
24-
/** Slack scopes the legacy v1 block advertises — the set from before the trigger expansion. */
25-
const SLACK_V1_ADVERTISED_SCOPES = getScopesForService('slack').filter(
26-
(scope) => !SLACK_V2_ONLY_SCOPES.has(scope)
27-
)
28-
2910
export const SlackBlock: BlockConfig<SlackResponse> = {
3011
type: 'slack',
3112
name: 'Slack',
@@ -126,7 +107,7 @@ export const SlackBlock: BlockConfig<SlackResponse> = {
126107
canonicalParamId: 'oauthCredential',
127108
mode: 'basic',
128109
serviceId: 'slack',
129-
requiredScopes: SLACK_V1_ADVERTISED_SCOPES,
110+
requiredScopes: getScopesForService('slack'),
130111
placeholder: 'Select Slack workspace',
131112
dependsOn: ['authMethod'],
132113
condition: {
@@ -2661,9 +2642,6 @@ function adaptSubBlockForV2(sb: SubBlockConfig): SubBlockConfig {
26612642
...rest,
26622643
credentialKind: 'any',
26632644
placeholder: 'Select Slack account or bot',
2664-
// Full set, unlike v1: v2 hosts the native Sim app trigger, whose events
2665-
// need the mention/assistant/DM scopes.
2666-
requiredScopes: getScopesForService('slack'),
26672645
credentialLabels: {
26682646
oauthGroup: 'Sim app',
26692647
oauthConnect: 'Connect the Sim app',

apps/sim/lib/oauth/oauth.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -782,9 +782,12 @@ export const OAUTH_PROVIDERS: Record<string, OAuthProviderConfig> = {
782782
'groups:write',
783783
'chat:write',
784784
'chat:write.public',
785-
'assistant:write',
786-
'app_mentions:read',
787-
'im:history',
785+
// TODO: Re-add once Slack app review approves these. Requesting a scope
786+
// the app is not yet approved for makes Slack reject the entire
787+
// authorization with "unapproved permissions requested", breaking connect.
788+
// 'assistant:write',
789+
// 'app_mentions:read',
790+
// 'im:history',
788791
'im:write',
789792
'im:read',
790793
'users:read',

0 commit comments

Comments
 (0)