Skip to content

feat(slack): add views.open, views.update, views.push, views.publish tools#3436

Merged
waleedlatif1 merged 2 commits intostagingfrom
waleedlatif1/slack-views-open
Mar 6, 2026
Merged

feat(slack): add views.open, views.update, views.push, views.publish tools#3436
waleedlatif1 merged 2 commits intostagingfrom
waleedlatif1/slack-views-open

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • Add 4 new Slack view tools: open_view, update_view, push_view, publish_view
  • Support modal interactions for RVTech bot ticket creation and feedback flows
  • Includes full error handling with Slack-specific error codes
  • Reuses shared SlackView interface and VIEW_OUTPUT_PROPERTIES across all tools

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

vercel bot commented Mar 6, 2026

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

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Mar 6, 2026 6:05am

Request Review

@cursor
Copy link

cursor bot commented Mar 6, 2026

PR Summary

Medium Risk
Adds new Slack API integrations (views.open/update/push/publish) and wires them into the Slack block UI and tool registry; errors or missing Slack scopes/payload validation could surface at runtime when executing workflows.

Overview
Adds Slack Block Kit view support. Introduces new Slack tools slack_open_view, slack_update_view, slack_push_view, and slack_publish_view that call Slack’s views.* APIs, normalize the returned view into a shared SlackView/VIEW_OUTPUT_PROPERTIES, and provide Slack-specific error messages.

Wires the new operations into workflows and docs. Updates the Slack block to expose the new operations, collect the required inputs (trigger IDs, view identifiers, user ID, hash, and JSON viewPayload with a generator prompt), map them to tool params, and adds a view output; registers the tools in the central tool registry and documents them in slack.mdx. A small test-only change updates object access style in subblock-migrations.test.ts.

Written by Cursor Bugbot for commit 0f991e8. Configure here.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 6, 2026

Greptile Summary

This PR adds four new Slack view tools (slack_open_view, slack_update_view, slack_push_view, slack_publish_view) that wrap the Slack views.open, views.update, views.push, and views.publish APIs respectively. The tools follow the established Slack tool patterns in the codebase — shared types in types.ts, reused VIEW_OUTPUT_PROPERTIES, consistent error handling, and correct integration into the block config, tool index, and registry.

Key changes:

  • Four new tool files implementing Slack modal and Home tab view APIs with comprehensive Slack-specific error handling (expired trigger IDs, hash conflicts, push limit, etc.)
  • Shared SlackView interface and VIEW_OUTPUT_PROPERTIES constant added to types.ts and reused across all tools
  • Block config (slack.ts) extended with new operation options, subblock fields, and param/tool mappings for all four view operations
  • Documentation updated with input/output tables for each new tool

One logic issue found: update_view.ts marks both viewId and externalId as required: false without any client-side validation that at least one is provided — if neither is supplied the request silently proceeds and the resulting invalid_arguments from Slack produces a generic, unhelpful error message instead of a clear "missing view identifier" message.

Confidence Score: 4/5

  • Safe to merge after addressing the missing client-side validation in update_view.ts.
  • The implementation is well-structured and consistent with existing Slack tool patterns. Three of the four tools are clean. The one logic issue — update_view.ts sending a request without a required view identifier — results in a confusing Slack API error rather than a runtime crash, so it's low severity. The style inconsistency in open_view.ts is cosmetic. No tests were added (checklist unchecked), which slightly reduces confidence.
  • apps/sim/tools/slack/update_view.ts — missing guard ensuring at least one of viewId/externalId is provided

Important Files Changed

Filename Overview
apps/sim/tools/slack/open_view.ts Implements views.open tool correctly; minor inconsistency in view_too_large error message missing the "(max 250kb)" size hint present in the other three view tools.
apps/sim/tools/slack/update_view.ts Implements views.update; both viewId and externalId are optional with no client-side validation ensuring at least one is provided, which can lead to a confusing generic error from the Slack API instead of a clear missing-identifier message.
apps/sim/tools/slack/push_view.ts Implements views.push correctly with good error handling including push_limit_reached; no issues found.
apps/sim/tools/slack/publish_view.ts Implements views.publish correctly for Home tab; includes proper not_enabled and hash_conflict error handling.
apps/sim/tools/slack/types.ts Adds SlackView interface and four new param/response interfaces; VIEW_OUTPUT_PROPERTIES is well-structured and reused across all tools. Types are accurately added to SlackResponse union.
apps/sim/blocks/blocks/slack.ts Block config cleanly integrates the four new view operations with proper subblock conditions, shared viewPayload field, and correct param mappings in the params() config function.

Sequence Diagram

sequenceDiagram
    participant User
    participant SimWorkflow as Sim Workflow
    participant SlackTool as Slack Tool
    participant SlackAPI as Slack API

    Note over User, SlackAPI: views.open / views.push (requires trigger_id from interaction)
    User->>SimWorkflow: Interaction (button click / slash command)
    SimWorkflow->>SlackTool: open_view / push_view (triggerId, view payload)
    SlackTool->>SlackAPI: POST /views.open or /views.push
    SlackAPI-->>SlackTool: { ok: true, view: { id, type, blocks, ... } }
    SlackTool-->>SimWorkflow: { success: true, output: { view } }
    SimWorkflow-->>User: Modal displayed in Slack

    Note over User, SlackAPI: views.update (requires viewId or externalId)
    SimWorkflow->>SlackTool: update_view (viewId | externalId, view payload)
    SlackTool->>SlackAPI: POST /views.update
    SlackAPI-->>SlackTool: { ok: true, view: { id, hash, ... } }
    SlackTool-->>SimWorkflow: { success: true, output: { view } }

    Note over User, SlackAPI: views.publish (Home tab, requires userId)
    SimWorkflow->>SlackTool: publish_view (userId, view payload)
    SlackTool->>SlackAPI: POST /views.publish
    SlackAPI-->>SlackTool: { ok: true, view: { id, type: "home", ... } }
    SlackTool-->>SimWorkflow: { success: true, output: { view } }
Loading

Comments Outside Diff (2)

  1. apps/sim/tools/slack/update_view.ts, line 73-76 (link)

    Missing validation for required viewId/externalId

    The Slack views.update API requires at least one of view_id or external_id to identify the view to update — but both params are marked required: false and no client-side validation enforces this constraint. If neither is provided, the tool will silently build a body with only view and send it to Slack. The resulting error comes back as a generic invalid_arguments (caught at line 118–122), producing a confusing message like "Invalid view arguments: ..." rather than a clear, actionable message explaining that a view identifier is missing.

    A guard should be added before building the body:

  2. apps/sim/tools/slack/open_view.ts, line 101-103 (link)

    Inconsistent view_too_large error message missing size limit

    The view_too_large error message in open_view.ts omits the "(max 250kb)" size hint that is present in update_view.ts (line 110), push_view.ts (line 108), and publish_view.ts (line 97). Users debugging this error in open_view won't see the actionable limit, while they would in the other three tools.

Last reviewed commit: 0f991e8

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

@waleedlatif1 waleedlatif1 merged commit 127968d into staging Mar 6, 2026
12 checks passed
@waleedlatif1 waleedlatif1 deleted the waleedlatif1/slack-views-open branch March 6, 2026 06:10
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