Skip to content

Conversation

@icecrasher321
Copy link
Collaborator

Summary

DMs were not showing up in agent tool input

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Other: ___________

Testing

Tested with @Sg312

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 Jan 17, 2026

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

1 Skipped Deployment
Project Deployment Review Updated (UTC)
docs Skipped Skipped Jan 17, 2026 1:56am

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 17, 2026

Greptile Summary

Fixed Slack DM functionality by properly routing user selections through the agent tool input parameters.

  • Added destinationType ('channel' | 'dm') and dmUserId parameters to Slack message and message reader tools
  • Refactored UI component from ChannelSelectorSyncWrapper to SlackSelectorSyncWrapper to support both channel and user selection via a selectorType parameter
  • Added new user-selector case in tool input rendering to enable user selection UI
  • Implemented conditional routing logic in request bodies: when destinationType === 'dm', routes to dmUserId instead of channel
  • Maintained backward compatibility for standalone blocks that set userId directly without destinationType
  • Bonus: Performance improvement in environment utils by moving regex pattern creation outside nested loop

Confidence Score: 5/5

  • This PR is safe to merge with no risk
  • All changes are well-structured with proper backward compatibility. The conditional logic correctly handles both agent tool usage (with destinationType) and standalone block usage (without destinationType). Type definitions are properly extended, UI components correctly refactored, and the performance improvement is a nice bonus with no side effects.
  • No files require special attention

Important Files Changed

Filename Overview
apps/sim/tools/slack/message.ts Added destinationType and dmUserId parameters to support DM selection in agent tools. Body logic correctly routes to dmUserId for DMs while maintaining backward compatibility with standalone blocks.
apps/sim/tools/slack/message_reader.ts Added destinationType and dmUserId parameters to support DM reading in agent tools. Body logic correctly routes to dmUserId for DMs while maintaining backward compatibility with standalone blocks.
apps/sim/tools/slack/types.ts Added destinationType and dmUserId fields to SlackMessageParams and SlackMessageReaderParams interfaces. All fields properly optional for backward compatibility.
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/tool-input.tsx Renamed ChannelSelectorSyncWrapper to SlackSelectorSyncWrapper and added selectorType parameter. Added new user-selector case. Changes enable both channel and user selection with proper typing.
apps/sim/lib/environment/utils.ts Performance improvement: moved envVarPattern creation outside the nested loop, avoiding redundant regex compilation for each subblock.

Sequence Diagram

sequenceDiagram
    participant User
    participant ToolInput
    participant SlackSelector
    participant SlackMessage
    participant SlackAPI

    User->>ToolInput: Select destinationType = 'dm'
    User->>SlackSelector: Select user via user-selector
    SlackSelector->>ToolInput: Set dmUserId parameter
    
    User->>ToolInput: Execute Slack Message tool
    ToolInput->>SlackMessage: params {destinationType, dmUserId, text}
    
    alt destinationType === 'dm'
        SlackMessage->>SlackMessage: Set userId = dmUserId
        SlackMessage->>SlackMessage: Set channel = undefined
    else destinationType !== 'dm' or undefined
        SlackMessage->>SlackMessage: Set userId = userId (standalone)
        SlackMessage->>SlackMessage: Set channel = channel
    end
    
    SlackMessage->>SlackAPI: POST with {userId, text}
    SlackAPI-->>SlackMessage: Success response
    SlackMessage-->>ToolInput: Message sent
    ToolInput-->>User: Display result
Loading

@icecrasher321 icecrasher321 merged commit fd23220 into staging Jan 17, 2026
10 checks passed
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.

2 participants