- 
                Notifications
    You must be signed in to change notification settings 
- Fork 5.5k
New Components - vapi #15469
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New Components - vapi #15469
Conversation
| The latest updates on your projects. Learn more about Vercel for Git ↗︎ 3 Skipped Deployments
 | 
| WalkthroughThis pull request introduces several new modules and enhancements to the VAPI framework. New actions for creating calls, updating assistant settings, and uploading files have been added, each with defined properties and asynchronous run methods. Additional constants and utility functions have been introduced to support configuration and data processing. The event source system was extended with modules for managing new conversation events, and the core VAPI component now includes new properties and methods for API interactions and resource listing. Changes
 Sequence Diagram(s)sequenceDiagram
    participant U as User
    participant CC as Create-Call Action
    participant V as VAPI Instance
    participant API as External API
    U->>CC: Initiate "Create Call"
    CC->>V: Validate input (assistantId/squadId) & call startConversation
    V->>API: API request to create conversation
    API-->>V: Response (conversation ID)
    V-->>CC: Return summary with ID
    CC-->>U: Deliver conversation summary
sequenceDiagram
    participant U as User
    participant UF as Upload File Action
    participant V as VAPI Instance
    participant API as External API
    U->>UF: Trigger file upload (file path)
    UF->>V: Validate file path and create FormData
    V->>API: Upload file request
    API-->>V: File upload response (ID, status)
    V-->>UF: Return file summary
    UF-->>U: Deliver upload summary
Assessment against linked issues
 Suggested labels
 Poem
 📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (1)
 📒 Files selected for processing (1)
 🚧 Files skipped from review as they are similar to previous changes (1)
 ⏰ Context from checks skipped due to timeout of 90000ms (4)
 Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit: 
 Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
 Other keywords and placeholders
 CodeRabbit Configuration File ( | 
Sources - New Conversation Actions - Create Call - Update Assistant Settings - Upload File
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 7
🧹 Nitpick comments (6)
components/vapi/vapi.app.mjs (2)
7-61: Validate Option Fetching Logic & Parameter Use.Each asynchronous
optionsmethod (assistantId,squadId,phoneNumberId) paginates withLIMITto fetch data from the API. Verify that these definitions handle edge cases gracefully (e.g., no data returned, network failures, large data sets, etc.). Consider adding robust error handling or fallback logic if the remote calls fail or time out.
64-66: Parameterize_baseUrlfor Flexibility.Currently, the
_baseUrl()is hard-coded tohttps://api.vapi.ai. If you foresee test environments or staging endpoints, consider making this overridable with environment variables or component props.components/vapi/actions/update-assistant-settings/update-assistant-settings.mjs (1)
210-262: Graceful Error Handling inrun.While you sanitize and parse data before calling
updateAssistant, ensure that any exceptions thrown byupdateAssistant(e.g., invalid credentials, incomplete data) are caught or handled within the action. Logging or user-friendly error messages would make troubleshooting easier.components/vapi/sources/new-conversation/new-conversation.mjs (1)
12-20: Consider enhancing the getSummary method.While the current implementation is functional, consider including more meaningful information in the summary, such as timestamp or conversation status.
getSummary(item) { - return `New Conversation: ${item.id}`; + return `New Conversation: ${item.id} (Started: ${new Date(item.startTime).toLocaleString()})`; }components/vapi/sources/common/base.mjs (1)
17-19: Consider adding date validation in _getLastDate.The default date "1970-01-01" is used without validation.
Consider adding date validation:
_getLastDate() { - return this.db.get("lastDate") || "1970-01-01"; + const lastDate = this.db.get("lastDate"); + if (lastDate && !isNaN(Date.parse(lastDate))) { + return lastDate; + } + return "1970-01-01"; }components/vapi/actions/create-call/create-call.mjs (1)
50-59: Consider data cleanup before API call.The current implementation sends all props to the API, including undefined values.
Consider cleaning up the request data:
- const response = await this.vapi.startConversation({ + const data = { + assistantId: this.assistantId, + squadId: this.squadId, + phoneNumberId: this.phoneNumberId, + }; + + if (this.name) data.name = this.name; + if (this.customerId) data.customerId = this.customerId; + + const response = await this.vapi.startConversation({ $, - data: { - assistantId: this.assistantId, - squadId: this.squadId, - phoneNumberId: this.phoneNumberId, - name: this.name, - customerId: this.customerId, - }, + data, });
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
- pnpm-lock.yamlis excluded by- !**/pnpm-lock.yaml
📒 Files selected for processing (10)
- components/vapi/actions/create-call/create-call.mjs(1 hunks)
- components/vapi/actions/update-assistant-settings/update-assistant-settings.mjs(1 hunks)
- components/vapi/actions/upload-file/upload-file.mjs(1 hunks)
- components/vapi/common/constants.mjs(1 hunks)
- components/vapi/common/utils.mjs(1 hunks)
- components/vapi/package.json(2 hunks)
- components/vapi/sources/common/base.mjs(1 hunks)
- components/vapi/sources/new-conversation/new-conversation.mjs(1 hunks)
- components/vapi/sources/new-conversation/test-event.mjs(1 hunks)
- components/vapi/vapi.app.mjs(1 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
components/vapi/common/utils.mjs
[error] 43-43: Avoid the use of spread (...) syntax on accumulators.
Spread syntax should be avoided on accumulators (like those in .reduce) because it causes a time complexity of O(n^2).
Consider methods such as .splice or .push instead.
(lint/performance/noAccumulatingSpread)
🔇 Additional comments (12)
components/vapi/vapi.app.mjs (5)
1-2: Imports look good.No immediate issues found. The references to
axiosandLIMITare clear, and the usage appears consistent with the rest of the file.
67-72: Check for Potential Header Collisions.Merging the caller-supplied
headerswith_headers()is helpful, but ensure that user-provided headers do not override or conflict with crucial fields likeAuthorization. You may want to explicitly protect certain headers if needed.
82-128: Consistent Method Structures Look Good.Each method (
startConversation,listAssistants,listCalls,listSquads,listPhoneNumbers,updateAssistant, anduploadFile) correctly delegates to_makeRequestwith the appropriate HTTP verb and path. Just ensure any request body properties are accurately documented and typed.
129-158: Verify Pagination Approach and Edge Cases.The
paginategenerator utilizescurrent_pageandlast_pagechecks to determinehasMore. Confirm that the API always returns these fields. Also ensure large data sets or partial page results (e.g., ifmaxResultsis small) are handled properly.
160-160: No Additional Concerns.This line concludes your main export.
components/vapi/sources/new-conversation/test-event.mjs (1)
1-336: Review of Test Event JSON Structure.This appears to be a comprehensive mock event for testing inbound phone calls. Double-check that the
endedReasonfield (assistant-not-invalid) accurately reflects real-world scenarios. If this is just placeholder text, update it to prevent confusion during testing and logging.components/vapi/actions/update-assistant-settings/update-assistant-settings.mjs (2)
1-11: Imports and Constants Usage Are Clear.You’re importing relevant constants and utility functions. Ensure that future changes to
common/constants.mjsorcommon/utils.mjsremain backward-compatible since these are central to defining and parsing assistant properties.
13-19: Action Metadata Looks Good.The action key, name, description, and version provide clarity. Seemingly well-aligned with the VAPI update flow for assistant settings.
components/vapi/sources/new-conversation/new-conversation.mjs (1)
6-11: LGTM! Component metadata is well-defined.The component's metadata (key, name, description, version, type) is clear and follows naming conventions. The
dedupe: "unique"setting is appropriate for conversation events to prevent duplicates.components/vapi/common/utils.mjs (1)
8-31: LGTM! Robust JSON parsing implementation.The parseObject function handles different input types well and includes proper error handling for JSON parsing.
components/vapi/common/constants.mjs (1)
1-65: LGTM! Well-structured constants with clear categorization.The constants are well-organized and provide clear options for:
- First message modes
- Client message types
- Server message types
- Background sound settings
components/vapi/package.json (1)
3-17: LGTM! Version bump and dependency addition look correct.The version bump to 0.1.0 follows semver conventions for feature additions, and the @pipedream/platform dependency is correctly specified.
        
          
                components/vapi/actions/update-assistant-settings/update-assistant-settings.mjs
          
            Show resolved
            Hide resolved
        
      There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, I left a few comments to be checked. There are several more instances of some typos, such as "futher" instead of "further" - please ctrl+f for those to fix all of them!
        
          
                components/vapi/actions/update-assistant-settings/update-assistant-settings.mjs
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                components/vapi/actions/update-assistant-settings/update-assistant-settings.mjs
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                components/vapi/actions/update-assistant-settings/update-assistant-settings.mjs
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                components/vapi/actions/update-assistant-settings/update-assistant-settings.mjs
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                components/vapi/actions/update-assistant-settings/update-assistant-settings.mjs
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                components/vapi/actions/update-assistant-settings/update-assistant-settings.mjs
          
            Show resolved
            Hide resolved
        
      There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
components/vapi/actions/update-assistant-settings/update-assistant-settings.mjs (1)
212-264: Enhance error handling.The run method could benefit from:
- Try-catch block to handle parsing errors
- Validation of the API response
- More descriptive error messages
async run({ $ }) { + try { const { vapi, assistantId, ...data } = this; const response = await vapi.updateAssistant({ $, assistantId, data: clearObj({ ...data, transcriber: parseObject(transcriber), // ... other fields }), }); + if (!response || response.error) { + throw new Error(`Failed to update assistant: ${response?.error || 'Unknown error'}`); + } $.export("$summary", `Updated assistant ${this.assistantId} successfully`); return response; + } catch (error) { + throw new Error(`Error updating assistant settings: ${error.message}`); + } },
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
- components/vapi/actions/create-call/create-call.mjs(1 hunks)
- components/vapi/actions/update-assistant-settings/update-assistant-settings.mjs(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- components/vapi/actions/create-call/create-call.mjs
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: pnpm publish
- GitHub Check: Verify TypeScript components
- GitHub Check: Publish TypeScript components
🔇 Additional comments (4)
components/vapi/actions/update-assistant-settings/update-assistant-settings.mjs (4)
1-11: LGTM! Well-organized imports.The imports are properly structured, importing only the necessary constants and utilities.
171-174: Clarify future compatibility plan.The description mentions that
recordingEnabledwill be moved toartifactPlanin the future. Consider:
- Adding a deprecation notice for the current location
- Documenting the timeline for this change
- Implementing the new location while maintaining backward compatibility
78-95: LGTM! Well-defined numeric constraints.The
silenceTimeoutSecondsandmaxDurationSecondsprops have appropriate default values and constraints.
13-18: Consider version management strategy.The initial version is set to "0.0.1". Consider documenting the versioning strategy for future updates, especially since this component handles critical assistant configurations.
✅ Verification successful
Action: Document and standardize version management strategy
The update assistant settings action currently uses the initial version “0.0.1”, and our investigation indicates that version tracking is documented for some packages (e.g., in "./packages/connect-react/CHANGELOG.md" and "./packages/sdk/CHANGELOG.md") but no central version management guidance specifically covers these action components. It would improve consistency and future maintainability to document the versioning strategy (e.g., when and how to update the version number and related changelog entries) for these critical configurations.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check if there's a CHANGELOG.md or similar file tracking version changes fd -t f -e md -d 1 "CHANGELOG|VERSION|HISTORY" .Length of output: 50
Script:
#!/bin/bash # Search the entire repository for version tracking files (CHANGELOG, VERSION, or HISTORY) with markdown extension. fd -t f -e md "CHANGELOG|VERSION|HISTORY" .Length of output: 111
        
          
                components/vapi/actions/update-assistant-settings/update-assistant-settings.mjs
          
            Show resolved
            Hide resolved
        
      There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Resolves #15134.
Summary by CodeRabbit
New Features
Chores