- 
                Notifications
    
You must be signed in to change notification settings  - Fork 5.5k
 
New Components - vida #14143
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
          
     Merged
      
      
    
  
     Merged
                    New Components - vida #14143
Changes from all commits
      Commits
    
    
            Show all changes
          
          
            5 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      
    File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
        
          
          
            33 changes: 33 additions & 0 deletions
          
          33 
        
  components/vida/actions/provide-context/provide-context.mjs
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import vida from "../../vida.app.mjs"; | ||
| 
     | 
||
| export default { | ||
| key: "vida-provide-context", | ||
| name: "Add Context", | ||
| description: "Uploads additional context for a conversation with your AI agent. Helpful when integrating data from external CRMs. [See the documentation](https://vida.io/docs/api-reference/knowledge/add-context)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| vida, | ||
| target: { | ||
| type: "string", | ||
| label: "Target", | ||
| description: "Phone number in E.164 format or VIDA username of the user.", | ||
| }, | ||
| context: { | ||
| type: "string", | ||
| label: "Context", | ||
| description: "Context information to inject", | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.vida.addContext({ | ||
| $, | ||
| data: { | ||
| target: this.target, | ||
| context: this.context, | ||
| }, | ||
| }); | ||
| $.export("$summary", `Successfully uploaded additional context for target ${this.target}`); | ||
| return response; | ||
| }, | ||
| }; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| import vida from "../../vida.app.mjs"; | ||
| 
     | 
||
| export default { | ||
| props: { | ||
| vida, | ||
| http: { | ||
| type: "$.interface.http", | ||
| customResponse: false, | ||
| }, | ||
| db: "$.service.db", | ||
| label: { | ||
| type: "string", | ||
| label: "Label", | ||
| description: "Friendly label for webhook", | ||
| }, | ||
| }, | ||
| methods: { | ||
| filterEvent() { | ||
| return true; | ||
| }, | ||
| }, | ||
| hooks: { | ||
| async activate() { | ||
| await this.vida.createWebhook({ | ||
| data: { | ||
| url: this.http.endpoint, | ||
| label: this.label, | ||
| type: "conversation", | ||
| }, | ||
| }); | ||
| }, | ||
| async deactivate() { | ||
| await this.vida.deleteWebhook({ | ||
| data: { | ||
| url: this.http.endpoint, | ||
| }, | ||
| }); | ||
| }, | ||
| }, | ||
| async run({ body }) { | ||
| if (this.filterEvent(body)) { | ||
| this.$emit(body, { | ||
| id: body.uuid, | ||
| summary: this.getSummary(body), | ||
| ts: body.timestamp, | ||
| }); | ||
| } | ||
| }, | ||
| }; | ||
                
      
                  luancazarine marked this conversation as resolved.
               
          
            Show resolved
            Hide resolved
         | 
||
        
          
          
            19 changes: 19 additions & 0 deletions
          
          19 
        
  components/vida/sources/new-conversation-instant/new-conversation-instant.mjs
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import common from "../common/base.mjs"; | ||
| import sampleEmit from "./test-event.mjs"; | ||
| 
     | 
||
| export default { | ||
| ...common, | ||
| key: "vida-new-conversation-instant", | ||
| name: "New Conversation (Instant)", | ||
| description: "Emit new events after completion of any communication handled by your Vida AI agent, be it a call, text, or email.", | ||
| version: "0.0.1", | ||
| type: "source", | ||
| dedupe: "unique", | ||
| methods: { | ||
| ...common.methods, | ||
| getSummary(event) { | ||
| return `New conversation created: ${event.uuid}`; | ||
| }, | ||
| }, | ||
| sampleEmit, | ||
| }; | 
        
          
          
            50 changes: 50 additions & 0 deletions
          
          50 
        
  components/vida/sources/new-conversation-instant/test-event.mjs
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| export default { | ||
| "from": 999999999999, | ||
| "fromUser": "integrations__test", | ||
| "to": 1269579, | ||
| "toUser": "integrations", | ||
| "rate": 0, | ||
| "usdRate": 0, | ||
| "timestamp": 1727728969, | ||
| "date": "2024-09-30T20:42:49.000Z", | ||
| "message": "Call from integrations", | ||
| "content-type": "text/plain", | ||
| "disposition-notification": null, | ||
| "roomId": "1269579:1269579", | ||
| "status": "success", | ||
| "attachments": [], | ||
| "isLive": false, | ||
                
      
                  luancazarine marked this conversation as resolved.
               
          
            Show resolved
            Hide resolved
         | 
||
| "aiAgent": false, | ||
| "aiReward": null, | ||
| "aiRewardUsd": null, | ||
| "aiLeadRating": null, | ||
| "aiLeadRatingReason": null, | ||
| "aiAgentOverride": null, | ||
| "gift": false, | ||
| "source": "call", | ||
| "uuid": "86547d26-9b89-41a6-afd1-292085c9b846", | ||
| "campaignId": "campa861346f6104e3e4762ef5b936e2984fb", | ||
| "fromNumber": "+1234567890", | ||
| "toNumber": "integrations", | ||
| "notify": false, | ||
| "targetInbox": "inbox", | ||
| "type": "call", | ||
| "duration": 1, | ||
| "direction": "outbound", | ||
| "missedCall": false, | ||
| "bypassAgent": false, | ||
| "cnamSpam": false, | ||
| "selfCall": true, | ||
| "callingUserIsContact": false, | ||
| "agentOutcome": null, | ||
| "summary": null, | ||
| "callDialog": [], | ||
| "campaign": true, | ||
| "diversion": null, | ||
| "voicemailRecording": null, | ||
| "eventType": "outbound-call", | ||
| "forcedCampaign": true, | ||
| "conversation": "", | ||
| "collectedData": null, | ||
| "functionsRun": [] | ||
| } | ||
        
          
          
            22 changes: 22 additions & 0 deletions
          
          22 
        
  ...ents/vida/sources/new-incoming-conversation-instant/new-incoming-conversation-instant.mjs
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import common from "../common/base.mjs"; | ||
| import sampleEmit from "./test-event.mjs"; | ||
| 
     | 
||
| export default { | ||
| ...common, | ||
| key: "vida-new-incoming-conversation-instant", | ||
| name: "New Incoming Conversation (Instant)", | ||
| description: "Emit new event when an incoming call or message is received before answered by an agent. Useful for providing context about the caller or messenger to your agent before response.", | ||
| version: "0.0.1", | ||
| type: "source", | ||
| dedupe: "unique", | ||
| methods: { | ||
| ...common.methods, | ||
| getSummary(event) { | ||
| return `New incoming ${event.body.communicationSource} from ${event.body.source}`; | ||
| }, | ||
| filterEvents(body) { | ||
| return body.direction === "inbound"; | ||
| }, | ||
| }, | ||
| sampleEmit, | ||
| }; | 
        
          
          
            50 changes: 50 additions & 0 deletions
          
          50 
        
  components/vida/sources/new-incoming-conversation-instant/test-event.mjs
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| export default { | ||
| "from": 999999999999, | ||
| "fromUser": "integrations__test", | ||
| "to": 1269579, | ||
| "toUser": "integrations", | ||
| "rate": 0, | ||
| "usdRate": 0, | ||
| "timestamp": 1727728969, | ||
| "date": "2024-09-30T20:42:49.000Z", | ||
| "message": "Call from integrations", | ||
| "content-type": "text/plain", | ||
| "disposition-notification": null, | ||
| "roomId": "1269579:1269579", | ||
| "status": "success", | ||
| "attachments": [], | ||
| "isLive": false, | ||
                
      
                  luancazarine marked this conversation as resolved.
               
          
            Show resolved
            Hide resolved
         | 
||
| "aiAgent": false, | ||
| "aiReward": null, | ||
| "aiRewardUsd": null, | ||
| "aiLeadRating": null, | ||
| "aiLeadRatingReason": null, | ||
| "aiAgentOverride": null, | ||
| "gift": false, | ||
                
      
                  luancazarine marked this conversation as resolved.
               
          
            Show resolved
            Hide resolved
         | 
||
| "source": "call", | ||
| "uuid": "86547d26-9b89-41a6-afd1-292085c9b846", | ||
| "campaignId": "campa861346f6104e3e4762ef5b936e2984fb", | ||
| "fromNumber": "+1234567890", | ||
| "toNumber": "integrations", | ||
| "notify": false, | ||
| "targetInbox": "inbox", | ||
| "type": "call", | ||
| "duration": 1, | ||
| "direction": "inbound", | ||
| "missedCall": false, | ||
| "bypassAgent": false, | ||
| "cnamSpam": false, | ||
| "selfCall": true, | ||
| "callingUserIsContact": false, | ||
| "agentOutcome": null, | ||
| "summary": null, | ||
| "callDialog": [], | ||
| "campaign": true, | ||
| "diversion": null, | ||
| "voicemailRecording": null, | ||
| "eventType": "inbound-call", | ||
| "forcedCampaign": true, | ||
| "conversation": "", | ||
| "collectedData": null, | ||
| "functionsRun": [] | ||
| } | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,11 +1,47 @@ | ||
| import { axios } from "@pipedream/platform"; | ||
| 
     | 
||
| export default { | ||
| type: "app", | ||
| app: "vida", | ||
| propDefinitions: {}, | ||
| methods: { | ||
| // this.$auth contains connected account data | ||
| authKeys() { | ||
| console.log(Object.keys(this.$auth)); | ||
| _baseUrl() { | ||
| return "https://api.vida.dev/api/v2"; | ||
| }, | ||
| _params(params = {}) { | ||
| return { | ||
| ...params, | ||
| token: `${this.$auth.api_token}`, | ||
| }; | ||
| }, | ||
| _makeRequest({ | ||
| $ = this, path, params, ...opts | ||
| }) { | ||
| return axios($, { | ||
| url: this._baseUrl() + path, | ||
| params: this._params(params), | ||
| ...opts, | ||
| }); | ||
| }, | ||
| addContext(opts = {}) { | ||
| return this._makeRequest({ | ||
| method: "POST", | ||
| path: "/context", | ||
| ...opts, | ||
| }); | ||
| }, | ||
| createWebhook(opts = {}) { | ||
| return this._makeRequest({ | ||
| method: "POST", | ||
| path: "/webhooks", | ||
| ...opts, | ||
| }); | ||
| }, | ||
| deleteWebhook(opts = {}) { | ||
| return this._makeRequest({ | ||
| method: "DELETE", | ||
| path: "/webhooks", | ||
| ...opts, | ||
| }); | ||
| }, | ||
| }, | ||
                
      
                  luancazarine marked this conversation as resolved.
               
          
            Show resolved
            Hide resolved
         | 
||
| }; | ||
      
      Oops, something went wrong.
        
    
  
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.