Skip to content

feat(slack): canvas related operations#4306

Merged
icecrasher321 merged 2 commits intostagingfrom
feat/slack-canvas-ops
Apr 27, 2026
Merged

feat(slack): canvas related operations#4306
icecrasher321 merged 2 commits intostagingfrom
feat/slack-canvas-ops

Conversation

@icecrasher321
Copy link
Copy Markdown
Collaborator

Summary

New slack operations for -- get canvas info, list canvases, lookup canvas sections, delete canvas

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)

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 27, 2026

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Apr 27, 2026 6:51pm

Request Review

@cursor
Copy link
Copy Markdown

cursor Bot commented Apr 27, 2026

PR Summary

Medium Risk
Adds new Slack API tools (including delete) and expands required OAuth scopes, which can affect permissions and runtime behavior of Slack integrations. Most changes are additive but introduce new external API calls and response mapping that need validation against Slack edge cases.

Overview
Extends the Slack integration with new canvas management operations: get_canvas (via files.info), list_canvases (via files.list with types=canvas), lookup_canvas_sections (via canvases.sections.lookup), and delete_canvas (via canvases.delete).

Updates the Slack block UI/config to expose these operations, add their inputs, route each operation to the new tool IDs, and surface new outputs (canvas, canvases, paging, sections, ok).

Expands Slack OAuth configuration by adding the canvases:read scope and refreshes scope/service descriptions; registers the new tools in the tool registry and adds shared canvas file typing/mapping utilities.

Reviewed by Cursor Bugbot for commit a58ecb7. Configure here.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 27, 2026

Greptile Summary

This PR adds four new Slack canvas operations — Get Canvas Info, List Canvases, Lookup Canvas Sections, and Delete Canvas — implemented as individual tool files following the existing Slack tool patterns. The new canvases:read OAuth scope is correctly added for the canvases.sections.lookup call, all tools are registered in the registry, and the block wiring is complete.

Confidence Score: 4/5

Safe to merge — all findings are P2 style and quality issues with no impact on runtime correctness.

P2-only findings: one duplicate function across two files, a redundant always-true output field, and a minor defensive gap in the JSON criteria parser. No logic bugs, no security concerns, and the OAuth scope additions are correct.

apps/sim/tools/slack/get_canvas.ts and apps/sim/tools/slack/list_canvases.ts share an identical mapCanvasFile helper that should be extracted.

Important Files Changed

Filename Overview
apps/sim/tools/slack/get_canvas.ts New tool that fetches canvas file metadata via files.info. Correct auth/scope usage. mapCanvasFile is duplicated from list_canvases.ts.
apps/sim/tools/slack/list_canvases.ts New tool listing canvases via files.list?types=canvas. Pagination and filter params handled correctly. mapCanvasFile is duplicated from get_canvas.ts.
apps/sim/tools/slack/lookup_canvas_sections.ts New tool using canvases.sections.lookup. parseCriteria handles string/object duality but doesn't guard against null/unexpected types.
apps/sim/tools/slack/delete_canvas.ts New tool that deletes a canvas via canvases.delete. The ok output is always true due to error-throw-before-return pattern, making the field redundant.
apps/sim/tools/slack/types.ts Well-structured additions: new interfaces, response types, and output property constants for all four new operations.
apps/sim/blocks/blocks/slack.ts Correctly wires all four new operations into the block's operation list, field definitions, tool mappings, param destructuring, and inputs/outputs schemas.
apps/sim/lib/oauth/oauth.ts Adds canvases:read scope required for canvases.sections.lookup; description updated to reflect expanded capability.
apps/sim/lib/oauth/utils.ts Adds human-readable description for the new canvases:read scope and updates the canvases:write description to include deletion.
apps/sim/tools/registry.ts All four new tools imported and registered in alphabetical order without issues.
apps/sim/tools/slack/index.ts Re-exports four new tools and adds export * from './types' for convenience.

Sequence Diagram

sequenceDiagram
    participant U as User/LLM
    participant B as SlackBlock
    participant T as Tool (registry)
    participant S as Slack API

    U->>B: operation = get_canvas (canvasId)
    B->>T: slack_get_canvas {canvasId, accessToken}
    T->>S: GET files.info?file={canvasId}
    S-->>T: {ok, file: SlackCanvasFile}
    T-->>B: {output: {canvas}}

    U->>B: operation = list_canvases (filters)
    B->>T: slack_list_canvases {channel?, count?, page?, ...}
    T->>S: GET files.list?types=canvas&...
    S-->>T: {ok, files[], paging}
    T-->>B: {output: {canvases[], paging}}

    U->>B: operation = lookup_canvas_sections (canvasId, criteria)
    B->>T: slack_lookup_canvas_sections {canvasId, criteria}
    T->>S: POST canvases.sections.lookup
    S-->>T: {ok, sections[]}
    T-->>B: {output: {sections[]}}

    U->>B: operation = delete_canvas (canvasId)
    B->>T: slack_delete_canvas {canvasId, accessToken}
    T->>S: POST canvases.delete {canvas_id}
    S-->>T: {ok: true}
    T-->>B: {output: {ok: true}}
Loading

Comments Outside Diff (3)

  1. apps/sim/tools/slack/get_canvas.ts, line 490-515 (link)

    P2 Duplicated mapCanvasFile function

    mapCanvasFile is defined identically in both get_canvas.ts and list_canvases.ts. If the SlackCanvasFile shape evolves (e.g., a new field is added), both copies must be updated in sync — an easy mistake to miss. This function (and the shared type imports it relies on) should live in types.ts or a dedicated canvas_utils.ts helper and be imported by both tools.

  2. apps/sim/tools/slack/delete_canvas.ts, line 463-470 (link)

    P2 ok output is always true

    The transformResponse throws before returning when !data.ok, so the returned ok value is unconditionally true. Exposing it as a named output is misleading — downstream consumers reading output.ok will never see false, making the field useless. Consider removing ok from the returned output and relying solely on the thrown error to signal failure, consistent with how delete_message and similar tools signal success.

  3. apps/sim/tools/slack/lookup_canvas_sections.ts, line 833-843 (link)

    P2 parseCriteria silently drops non-object non-string values

    If criteria is neither a string nor a plain object (e.g., null, a number, or an array coming from a mis-wired upstream block), the early-return branch typeof criteria !== 'string' passes it through unchanged. Slack's canvases.sections.lookup API will then receive an invalid criteria value and return an opaque error. A guard like if (typeof criteria !== 'string' && typeof criteria === 'object' && criteria !== null) (or a zod parse) would make this fail fast with a clear user-facing message.

Reviews (1): Last reviewed commit: "feat(slack): canvas related operations" | Re-trigger Greptile

Comment thread apps/sim/tools/slack/list_canvases.ts
Comment thread apps/sim/tools/slack/get_canvas.ts Outdated
@icecrasher321
Copy link
Copy Markdown
Collaborator Author

bugbot run

Copy link
Copy Markdown

@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.

Fix All in Cursor

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

Reviewed by Cursor Bugbot for commit a58ecb7. Configure here.

Comment thread apps/sim/blocks/blocks/slack.ts
@icecrasher321 icecrasher321 merged commit 2a52141 into staging Apr 27, 2026
14 checks passed
@icecrasher321 icecrasher321 deleted the feat/slack-canvas-ops branch April 27, 2026 19:00
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