Skip to content

Conversation

wastorga
Copy link

@wastorga wastorga commented Oct 3, 2025

Summary

This PR adds some Cisco Webex tools relating to messaging to the Sim Studio AI.

Type of Change

  • New feature

Testing

How has this been tested? What should reviewers focus on?

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)

Screenshots/Videos

Copy link

vercel bot commented Oct 3, 2025

@wastorga is attempting to deploy a commit to the Sim Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Overview

Summary

This PR adds comprehensive Cisco Webex messaging integration to the Sim Studio AI platform. The implementation introduces four core messaging capabilities: listing rooms, listing messages, creating messages, and editing messages. The integration follows the established patterns in the codebase by creating a complete WebexBlock configuration with UI components, OAuth authentication support, and proper tool mappings.

The changes span multiple layers of the application architecture. At the tool level, four new tools are implemented (webex_list_rooms, webex_list_messages, webex_create_message, webex_edit_message) that interact with the Webex API using OAuth Bearer token authentication. Each tool includes comprehensive parameter validation, URL construction with query parameters, and proper response transformation handling.

The WebexBlock provides a unified interface for all Webex operations through a dropdown selector that conditionally shows relevant UI fields. The block includes OAuth provider configuration, parameter transformation logic that converts UI form data to API-compatible formats, and proper error handling. The implementation supports advanced features like file attachments, message threading through parentId, and various message formats including text and markdown.

The OAuth integration is properly configured with appropriate scopes for messaging operations (spark:rooms_read, spark:messages_read, spark:messages_write) and includes a custom getUserInfo function that extracts user profile data from the Webex API. Environment variables are added to support OAuth client credentials, following the optional pattern used by other integrations.

Documentation is provided in MDX format with comprehensive tool specifications, parameter descriptions, and usage instructions. The integration is also made discoverable through updates to the landing page footer and follows the established naming conventions throughout the codebase.

Important Files Changed

Changed Files
Filename Score Overview
apps/sim/tools/webex/types.ts 3/5 Added TypeScript interfaces for Webex tools with potential type inconsistencies in optional properties
apps/sim/blocks/blocks/webex.ts 4/5 Created comprehensive WebexBlock with OAuth authentication and multi-operation UI support
apps/sim/tools/webex/create_message.ts 4/5 Implemented Webex message creation tool with parameter validation and file attachment support
apps/sim/tools/webex/edit_message.ts 4/5 Added message editing functionality following established codebase patterns
apps/sim/tools/webex/list_messages.ts 4/5 Created tool for listing Webex messages with query parameter filtering and error handling
apps/sim/tools/webex/list_rooms.ts 4/5 Implemented rooms listing tool with comprehensive filtering and OAuth authentication
apps/sim/lib/auth.ts 4/5 Added Webex OAuth provider configuration with proper PKCE flow and user profile extraction
apps/sim/lib/oauth/oauth.ts 4/5 Integrated Webex into OAuth system with messaging scopes and token management
apps/docs/content/docs/en/tools/webex.mdx 4/5 Added comprehensive documentation with extensive SVG branding and tool specifications
apps/sim/tools/webex/index.ts 5/5 Created clean export hub following established modular architecture patterns
apps/sim/tools/registry.ts 5/5 Registered four new Webex tools following established naming conventions and organization
apps/sim/blocks/registry.ts 5/5 Added WebexBlock to blocks registry maintaining alphabetical ordering
apps/sim/lib/env.ts 5/5 Added Webex OAuth environment variables following established optional configuration pattern
apps/sim/app/(landing)/components/footer/footer.tsx 5/5 Added Webex to tools list in landing page footer for discoverability

Confidence score: 4/5

  • This PR appears safe to merge with careful attention to a few implementation details that could cause issues
  • Score reflects comprehensive implementation following established patterns but with some type inconsistencies and parameter validation concerns
  • Pay close attention to apps/sim/tools/webex/types.ts for potential type mismatches and apps/sim/blocks/blocks/webex.ts for parameter parsing logic

Sequence Diagram

sequenceDiagram
    participant User
    participant WebApp as "Web App"
    participant AuthService as "Auth Service"
    participant WebexAPI as "Webex API"
    participant Database as "Database"

    User->>WebApp: "Select Webex block"
    WebApp->>User: "Display Webex operations (List Rooms, List Messages, etc.)"
    
    User->>WebApp: "Configure OAuth credential"
    WebApp->>AuthService: "Initiate Webex OAuth flow"
    AuthService->>WebexAPI: "Request authorization"
    WebexAPI->>User: "Redirect to Webex login"
    User->>WebexAPI: "Grant permissions"
    WebexAPI->>AuthService: "Return authorization code"
    AuthService->>WebexAPI: "Exchange code for tokens"
    WebexAPI->>AuthService: "Return access/refresh tokens"
    AuthService->>Database: "Store encrypted tokens"
    AuthService->>WebApp: "OAuth complete"
    
    User->>WebApp: "Execute workflow with Webex operation"
    WebApp->>Database: "Retrieve access token"
    Database->>WebApp: "Return decrypted token"
    WebApp->>WebexAPI: "API request (List Rooms/Messages, Create/Edit Message)"
    WebexAPI->>WebApp: "Return operation results"
    WebApp->>User: "Display results"
Loading

14 files reviewed, 10 comments

Edit Code Review Agent Settings | Greptile

| `text` | string | No | Text message |
| `toPersonEmail` | string | No | The recipient email address |
| `toPersonId` | string | No | The recipient person ID |
| `files` | string | No | Public URLs to binary files \(comma-separated\), currently only one file may be included |
Copy link
Contributor

Choose a reason for hiding this comment

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

syntax: The escaped parentheses in 'files' description ((comma-separated)) are unnecessary in MDX table content.

Suggested change
| `files` | string | No | Public URLs to binary files \(comma-separated\), currently only one file may be included |
| `files` | string | No | Public URLs to binary files (comma-separated), currently only one file may be included |
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/docs/content/docs/en/tools/webex.mdx
Line: 553:553

Comment:
**syntax:** The escaped parentheses in 'files' description (\(comma-separated\)) are unnecessary in MDX table content.

```suggestion
| `files` | string | No | Public URLs to binary files (comma-separated), currently only one file may be included |
```

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines +51 to +53
visibility: 'user-only',
description: 'Made public before this timestamp',
},
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Parameter description is unclear - 'Made public before this timestamp' doesn't match the parameter name 'beforeMessage'. Consider clarifying what this parameter actually filters.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/sim/tools/webex/list_messages.ts
Line: 51:53

Comment:
**style:** Parameter description is unclear - 'Made public before this timestamp' doesn't match the parameter name 'beforeMessage'. Consider clarifying what this parameter actually filters.

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines +70 to +73
/** Checks for truthiness, excluding parameters when they do not have value
* many of them are treated as strings
* 'max' is a number but it does not allow 0 as value
**/
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: The comment about 'max' not allowing 0 as value is inconsistent with the truthiness check on line 74. Zero would be filtered out but might be a valid limit value for some APIs.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/sim/tools/webex/list_messages.ts
Line: 70:73

Comment:
**logic:** The comment about 'max' not allowing 0 as value is inconsistent with the truthiness check on line 74. Zero would be filtered out but might be a valid limit value for some APIs.

How can I resolve this? If you propose a fix, please make it concise.

text?: string
toPersonEmail?: string
toPersonId?: string
files?: string
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: Type mismatch: files is defined as string here but as string[] in WebexSingleMessage (line 74). This inconsistency could cause runtime errors.

Suggested change
files?: string
files?: string[]
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/sim/tools/webex/types.ts
Line: 87:87

Comment:
**logic:** Type mismatch: `files` is defined as `string` here but as `string[]` in WebexSingleMessage (line 74). This inconsistency could cause runtime errors.

```suggestion
  files?: string[]
```

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines +44 to +48
roomId: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Room ID',
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: roomId is required but Webex API allows sending to individuals via toPersonEmail/toPersonId. Consider making roomId optional when person parameters are provided

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/sim/tools/webex/create_message.ts
Line: 44:48

Comment:
**logic:** roomId is required but Webex API allows sending to individuals via toPersonEmail/toPersonId. Consider making roomId optional when person parameters are provided

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines +135 to +136
// API returns messages in 'items' array
const item = data || {}
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Comment mentions 'items' array but code handles single message object. Update comment to match actual implementation

Suggested change
// API returns messages in 'items' array
const item = data || {}
// API returns single message object
const item = data || {}
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/sim/tools/webex/create_message.ts
Line: 135:136

Comment:
**style:** Comment mentions 'items' array but code handles single message object. Update comment to match actual implementation

```suggestion
      // API returns single message object
      const item = data || {}
```

How can I resolve this? If you propose a fix, please make it concise.

webex: {
id: 'webex',
name: 'Webex',
description: 'Manage Webex items.',
Copy link
Contributor

Choose a reason for hiding this comment

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

style: The description 'Manage Webex items.' is generic and uninformative. Consider being more specific about messaging capabilities.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/sim/lib/oauth/oauth.ts
Line: 514:514

Comment:
**style:** The description 'Manage Webex items.' is generic and uninformative. Consider being more specific about messaging capabilities.

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines +29 to +34
roomId: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Room ID',
},
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: roomId parameter is included but not used in the request body or URL - consider removing if not needed for Webex message editing API

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/sim/tools/webex/edit_message.ts
Line: 29:34

Comment:
**logic:** roomId parameter is included but not used in the request body or URL - consider removing if not needed for Webex message editing API

How can I resolve this? If you propose a fix, please make it concise.

placeholder: 'Room ID',
condition: {
field: 'operation',
// list_messages and edit_message do required it.
Copy link
Contributor

Choose a reason for hiding this comment

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

syntax: Comment has grammatical error: 'do required it' should be 'do require it' or 'require it'

Suggested change
// list_messages and edit_message do required it.
// list_messages and edit_message require it.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/sim/blocks/blocks/webex.ts
Line: 120:120

Comment:
**syntax:** Comment has grammatical error: 'do required it' should be 'do require it' or 'require it'

```suggestion
        // list_messages and edit_message require it.
```

How can I resolve this? If you propose a fix, please make it concise.

type: 'short-input',
layout: 'full',
placeholder: 'Message ID',
condition: { field: 'operation', value: 'edit_message' },
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Inconsistent condition format - should use array format ['edit_message'] for consistency with other conditions

Suggested change
condition: { field: 'operation', value: 'edit_message' },
condition: { field: 'operation', value: ['edit_message'] },
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/sim/blocks/blocks/webex.ts
Line: 251:251

Comment:
**style:** Inconsistent condition format - should use array format ['edit_message'] for consistency with other conditions

```suggestion
      condition: { field: 'operation', value: ['edit_message'] },
```

How can I resolve this? If you propose a fix, please make it concise.

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