Skip to content

feat(slack): add new tools and user selectors#3420

Merged
waleedlatif1 merged 9 commits intostagingfrom
waleedlatif1/belo-horizonte-v1
Mar 5, 2026
Merged

feat(slack): add new tools and user selectors#3420
waleedlatif1 merged 9 commits intostagingfrom
waleedlatif1/belo-horizonte-v1

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • Add 4 new Slack tools: get channel info, get user presence, edit canvas, create channel canvas
  • Add user-selector dropdowns for ephemeral user, get user, and get user presence operations
  • User selectors follow the same canonical param pattern as the channel selector for full backwards compatibility

Type of Change

  • New feature

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@cursor
Copy link

cursor bot commented Mar 5, 2026

PR Summary

Medium Risk
Adds multiple new Slack API-backed tools and expands the Slack block parameter mapping/UI, which could affect existing workflow configurations and Slack permission requirements. Also slightly changes chat-execution detection logic, which could alter execution/streaming behavior for nonstandard callers.

Overview
Slack integration gains 4 new capabilities: slack_get_channel_info, slack_get_user_presence, slack_edit_canvas, and slack_create_channel_canvas, all registered in the tool registry and documented in docs/tools/slack.

Slack block UX and parameter mapping updated to expose these operations, add Slack user-selector inputs for ephemeral messages, user lookup, and presence checks (with advanced manual-ID fallbacks via canonicalParamId), and add canvas edit/create inputs. Includes a small download param fix to read the canonical fileName override.

Behavioral tweak: workflow execution logging/branching now treats “executing from chat” strictly as overrideTriggerType === 'chat' (removing inference from workflowInput).

Written by Cursor Bugbot for commit 1673fc0. Configure here.

@vercel
Copy link

vercel bot commented Mar 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Mar 5, 2026 6:11am

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 5, 2026

Greptile Summary

This PR adds four new Slack tools (slack_get_channel_info, slack_get_user_presence, slack_edit_canvas, slack_create_channel_canvas) and upgrades three existing param fields (ephemeralUser, userId, presenceUserId) from plain text inputs to user-selector dropdowns with canonical param IDs for backward compatibility. The overall structure follows established patterns in the codebase well.

Key concerns:

  • rename operation will always fail at runtimecanvases.edit does not accept a rename operation; valid operations are insert_at_start, insert_at_end, insert_after, insert_before, replace, and delete. Canvas renaming requires a separate canvases.update API call. The title_content markdown-object format used in the rename branch is also not part of the canvases.edit change schema.
  • Unrelated behavioral changeuse-workflow-execution.ts drops the workflowInput-shape check from isExecutingFromChat. While the simplification is likely correct, it is entirely unrelated to Slack tools and should be a separate PR so the intent is clearly documented.
  • Output naming inconsistencycreate_channel_canvas returns canvas_id (snake_case) while every other output property in Slack tools uses camelCase.
  • canvas.ts bug fix — a welcome addition: the existing canvas tool was missing a !data.ok check, silently swallowing API errors.

Confidence Score: 2/5

  • Not safe to merge as-is — the Rename Canvas operation will consistently fail at the Slack API level for all users who select it.
  • Three of the four new tools (get_channel_info, get_user_presence, create_channel_canvas) are solid. However, the edit_canvas tool includes a rename operation that targets the wrong Slack API endpoint and uses an incorrect payload shape, meaning it will always return an API error for end users. The unrelated isExecutingFromChat change, while likely benign, adds review surface without corresponding context or tests.
  • apps/sim/tools/slack/edit_canvas.ts requires a fix to either remove the rename operation or route it to canvases.update.

Important Files Changed

Filename Overview
apps/sim/tools/slack/edit_canvas.ts New tool for editing Slack canvases — the rename operation is not valid for the canvases.edit API endpoint and will fail at runtime; the rename flow should target canvases.update instead.
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-workflow-execution.ts Simplifies isExecutingFromChat to only check overrideTriggerType; while likely a valid fix for false positives, this change is completely unrelated to the Slack tools being added and should be in a separate PR.
apps/sim/tools/slack/create_channel_canvas.ts New tool for creating channel-pinned canvases via conversations.canvases.create; correct API usage and error handling, minor naming inconsistency (canvas_id vs camelCase convention).
apps/sim/tools/slack/get_channel_info.ts New tool fetching channel metadata via conversations.info; correct error handling for channel_not_found and missing_scope, reuses CHANNEL_OUTPUT_PROPERTIES for output schema.
apps/sim/tools/slack/get_user_presence.ts New tool checking user presence via users.getPresence; correctly marks detailed fields as optional with documented limitation that they're only available when checking own presence.
apps/sim/blocks/blocks/slack.ts Adds 4 new operations and user-selector dropdowns with canonical param pattern; param routing to the 4 new tools looks correct, includeNumMembers string-to-boolean conversion handled properly.

Sequence Diagram

sequenceDiagram
    participant UI as Slack Block UI
    participant Block as slack.ts (config)
    participant Registry as tools/registry.ts
    participant Tool as Slack Tool
    participant API as Slack API

    UI->>Block: operation = get_channel_info
    Block->>Registry: resolve → slack_get_channel_info
    Registry->>Tool: slackGetChannelInfoTool
    Tool->>API: GET conversations.info?channel=C123
    API-->>Tool: { ok: true, channel: {...} }
    Tool-->>UI: channelInfo object

    UI->>Block: operation = get_user_presence
    Block->>Registry: resolve → slack_get_user_presence
    Registry->>Tool: slackGetUserPresenceTool
    Tool->>API: GET users.getPresence?user=U123
    API-->>Tool: { ok: true, presence: "active" }
    Tool-->>UI: presence (+ null detail fields for non-self)

    UI->>Block: operation = edit_canvas (insert_at_end)
    Block->>Registry: resolve → slack_edit_canvas
    Registry->>Tool: slackEditCanvasTool
    Tool->>API: POST canvases.edit { canvas_id, changes:[{operation}] }
    API-->>Tool: { ok: true }
    Tool-->>UI: "Successfully edited canvas"

    UI->>Block: operation = edit_canvas (rename) ❌
    Block->>Registry: resolve → slack_edit_canvas
    Registry->>Tool: slackEditCanvasTool
    Tool->>API: POST canvases.edit { changes:[{operation:"rename"}] }
    API-->>Tool: { ok: false, error: "invalid_arguments" }
    Tool-->>UI: Error thrown

    UI->>Block: operation = create_channel_canvas
    Block->>Registry: resolve → slack_create_channel_canvas
    Registry->>Tool: slackCreateChannelCanvasTool
    Tool->>API: POST conversations.canvases.create { channel_id }
    API-->>Tool: { ok: true, canvas_id: "F123" }
    Tool-->>UI: canvas_id
Loading

Last reviewed commit: 1673fc0

Comments Outside Diff (3)

  1. apps/sim/tools/slack/edit_canvas.ts, line 84-93 (link)

    rename is not a valid canvases.edit operation

    The Slack canvases.edit API only accepts the following operations in its changes array: insert_at_start, insert_at_end, insert_after, insert_before, replace, and delete. The rename operation is not supported by this endpoint — passing it will result in an invalid_arguments error from Slack.

    To rename a canvas, the correct endpoint is canvases.update (POST https://slack.com/api/canvases.update) with canvas_id and title in the body:

    // Rename canvas - canvases.update endpoint
    if (params.operation === 'rename') {
      return fetch('https://slack.com/api/canvases.update', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${params.accessToken || params.botToken}` },
        body: JSON.stringify({ canvas_id: params.canvasId.trim(), title: params.title }),
      })
    }

    Additionally, the title_content field used here ({ type: 'markdown', markdown: params.title }) is also not part of the canvases.edit changes schema — canvas titles are plain strings, not markdown content objects.

    Consider either removing rename from the canvasOperation dropdown or routing it to the correct canvases.update endpoint.

  2. apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-workflow-execution.ts, line undefined (link)

    Unrelated behavioral change bundled with Slack tools PR

    This change drops the second branch of the original isExecutingFromChat condition:

    // Before
    const isExecutingFromChat =
      overrideTriggerType === 'chat' ||
      (workflowInput && typeof workflowInput === 'object' && 'input' in workflowInput)

    The removed check caused any execution where workflowInput happened to have an input key (e.g. certain webhook or API payloads) to be misidentified as a chat execution — which would then try to locate a chat trigger block and throw a WorkflowValidationError if none was found. So the simplification may actually be a valid fix, but it is completely unrelated to the Slack tool additions in this PR.

    Please consider splitting this into a separate commit or PR so the intent is documented and the change is reviewable in isolation.

  3. apps/sim/tools/slack/create_channel_canvas.ts, line 98-100 (link)

    Output key naming inconsistency (canvas_id vs camelCase)

    The output property is named canvas_id (snake_case), whereas every other output property across the Slack tools uses camelCase (e.g., channelInfo, autoAway, connectionCount). This inconsistency will be surfaced to users who reference the output in subsequent workflow steps.

    If you wish to align with the codebase convention, consider mapping it:

            canvasId: data.canvas_id,

    and updating the corresponding outputs definition and documentation accordingly.

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@waleedlatif1
Copy link
Collaborator Author

@cursor review

@waleedlatif1
Copy link
Collaborator Author

@greptile

…hat guard (#3419)

* fix(chat): use explicit trigger type check instead of heuristic for chat guard

* fix(chat): remove heuristic fallback from isExecutingFromChat

Use only overrideTriggerType === 'chat' instead of also checking
for 'input' in workflowInput, which can false-positive on manual
executions with workflow input.

* fix(chat): use isExecutingFromChat variable consistently in callbacks

Replace inline overrideTriggerType !== 'chat' checks with
!isExecutingFromChat to stay consistent with the rest of the function.
@waleedlatif1
Copy link
Collaborator Author

@greptile

@waleedlatif1
Copy link
Collaborator Author

@cursor review

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Provide required output fields on error path to match SlackCanvasResponse type.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The error field belongs on ToolResponse, not inside the output object.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@waleedlatif1 waleedlatif1 merged commit 0a6a2ee into staging Mar 5, 2026
11 checks passed
@waleedlatif1 waleedlatif1 deleted the waleedlatif1/belo-horizonte-v1 branch March 5, 2026 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant