From fd29b3a90f51b987484b4e6101c52aaa8a75dace Mon Sep 17 00:00:00 2001 From: michelle0927 Date: Mon, 28 Oct 2024 11:49:10 -0400 Subject: [PATCH 1/3] init --- .../actions/add-feedback/add-feedback.mjs | 40 +++++++++ .../upload-transcript/upload-transcript.mjs | 43 +++++++++ .../flash-by-veloraai.app.mjs | 89 +++++++++++++++++++ 3 files changed, 172 insertions(+) create mode 100644 components/flash-by-veloraai/actions/add-feedback/add-feedback.mjs create mode 100644 components/flash-by-veloraai/actions/upload-transcript/upload-transcript.mjs create mode 100644 components/flash-by-veloraai/flash-by-veloraai.app.mjs diff --git a/components/flash-by-veloraai/actions/add-feedback/add-feedback.mjs b/components/flash-by-veloraai/actions/add-feedback/add-feedback.mjs new file mode 100644 index 0000000000000..845c45509a1ac --- /dev/null +++ b/components/flash-by-veloraai/actions/add-feedback/add-feedback.mjs @@ -0,0 +1,40 @@ +import flashSystem from "../../flash-by-veloraai.app.mjs"; + +export default { + key: "flash-by-veloraai-add-feedback", + name: "Add Feedback", + description: "Send customer-related feedback to Flash System for comprehensive analysis.", + version: "0.0.{{ts}}", + type: "action", + props: { + flashSystem, + feedbackContent: { + propDefinition: [ + flashSystem, + "feedbackContent", + ], + }, + customerId: { + propDefinition: [ + flashSystem, + "customerId", + ], + }, + customerEmail: { + propDefinition: [ + flashSystem, + "customerEmail", + ], + optional: true, + }, + }, + async run({ $ }) { + const response = await this.flashSystem.sendFeedback({ + feedbackContent: this.feedbackContent, + customerId: this.customerId, + customerEmail: this.customerEmail, + }); + $.export("$summary", `Successfully sent feedback for customer with ID: ${this.customerId}`); + return response; + }, +}; diff --git a/components/flash-by-veloraai/actions/upload-transcript/upload-transcript.mjs b/components/flash-by-veloraai/actions/upload-transcript/upload-transcript.mjs new file mode 100644 index 0000000000000..48bc734421cb2 --- /dev/null +++ b/components/flash-by-veloraai/actions/upload-transcript/upload-transcript.mjs @@ -0,0 +1,43 @@ +import flashSystem from "../../flash-by-veloraai.app.mjs"; + +export default { + key: "flash-by-veloraai-upload-transcript", + name: "Upload Transcript", + description: "Transfers a contact call transcript to the flash system for thorough analysis. [See the documentation]()", + version: "0.0.{{ts}}", + type: "action", + props: { + flashSystem, + transcriptContent: { + propDefinition: [ + flashSystem, + "transcriptContent", + ], + }, + callId: { + propDefinition: [ + flashSystem, + "callId", + ], + }, + callerId: { + propDefinition: [ + flashSystem, + "callerId", + (c) => ({ + callerId: c.callerId, + }), + ], + optional: true, + }, + }, + async run({ $ }) { + const response = await this.flashSystem.sendTranscript({ + transcriptContent: this.transcriptContent, + callId: this.callId, + callerId: this.callerId, + }); + $.export("$summary", `Transcript for call ID ${this.callId} uploaded successfully`); + return response; + }, +}; diff --git a/components/flash-by-veloraai/flash-by-veloraai.app.mjs b/components/flash-by-veloraai/flash-by-veloraai.app.mjs new file mode 100644 index 0000000000000..b36cc014cc614 --- /dev/null +++ b/components/flash-by-veloraai/flash-by-veloraai.app.mjs @@ -0,0 +1,89 @@ +import { axios } from "@pipedream/platform"; + +export default { + type: "app", + app: "flash_system", + propDefinitions: { + feedbackContent: { + type: "string", + label: "Feedback Content", + description: "The content of the customer feedback", + }, + customerId: { + type: "string", + label: "Customer ID", + description: "ID of the customer providing the feedback", + }, + customerEmail: { + type: "string", + label: "Customer Email", + description: "Email of the customer providing the feedback", + optional: true, + }, + transcriptContent: { + type: "string", + label: "Transcript Content", + description: "Content of the contact call transcript", + }, + callId: { + type: "string", + label: "Call ID", + description: "ID of the call for the transcript", + }, + callerId: { + type: "string", + label: "Caller ID", + description: "ID of the caller for the transcript", + optional: true, + }, + }, + methods: { + _baseUrl() { + return "https://api.flashsystem.com"; + }, + async _makeRequest(opts = {}) { + const { + $ = this, + method = "GET", + path, + headers, + ...otherOpts + } = opts; + return axios($, { + ...otherOpts, + method, + url: this._baseUrl() + path, + headers: { + ...headers, + Authorization: `Bearer ${this.$auth.oauth_access_token}`, + }, + }); + }, + async sendFeedback({ + feedbackContent, customerId, customerEmail, + }) { + return this._makeRequest({ + method: "POST", + path: "/feedback", + data: { + feedback_content: feedbackContent, + customer_id: customerId, + customer_email: customerEmail, + }, + }); + }, + async sendTranscript({ + transcriptContent, callId, callerId, + }) { + return this._makeRequest({ + method: "POST", + path: "/transcripts", + data: { + transcript_content: transcriptContent, + call_id: callId, + caller_id: callerId, + }, + }); + }, + }, +}; From 4703afa7971b720e41329a58c3711bd5b4a8973b Mon Sep 17 00:00:00 2001 From: michelle0927 Date: Mon, 28 Oct 2024 12:41:48 -0400 Subject: [PATCH 2/3] new components --- .../actions/add-feedback/add-feedback.mjs | 40 --------- .../upload-transcript/upload-transcript.mjs | 43 --------- .../flash-by-veloraai.app.mjs | 89 ------------------- .../actions/add-feedback/add-feedback.mjs | 41 +++++++++ .../upload-transcript/upload-transcript.mjs | 39 ++++++++ .../flash_by_velora_ai.app.mjs | 37 ++++++-- components/flash_by_velora_ai/package.json | 7 +- 7 files changed, 117 insertions(+), 179 deletions(-) delete mode 100644 components/flash-by-veloraai/actions/add-feedback/add-feedback.mjs delete mode 100644 components/flash-by-veloraai/actions/upload-transcript/upload-transcript.mjs delete mode 100644 components/flash-by-veloraai/flash-by-veloraai.app.mjs create mode 100644 components/flash_by_velora_ai/actions/add-feedback/add-feedback.mjs create mode 100644 components/flash_by_velora_ai/actions/upload-transcript/upload-transcript.mjs diff --git a/components/flash-by-veloraai/actions/add-feedback/add-feedback.mjs b/components/flash-by-veloraai/actions/add-feedback/add-feedback.mjs deleted file mode 100644 index 845c45509a1ac..0000000000000 --- a/components/flash-by-veloraai/actions/add-feedback/add-feedback.mjs +++ /dev/null @@ -1,40 +0,0 @@ -import flashSystem from "../../flash-by-veloraai.app.mjs"; - -export default { - key: "flash-by-veloraai-add-feedback", - name: "Add Feedback", - description: "Send customer-related feedback to Flash System for comprehensive analysis.", - version: "0.0.{{ts}}", - type: "action", - props: { - flashSystem, - feedbackContent: { - propDefinition: [ - flashSystem, - "feedbackContent", - ], - }, - customerId: { - propDefinition: [ - flashSystem, - "customerId", - ], - }, - customerEmail: { - propDefinition: [ - flashSystem, - "customerEmail", - ], - optional: true, - }, - }, - async run({ $ }) { - const response = await this.flashSystem.sendFeedback({ - feedbackContent: this.feedbackContent, - customerId: this.customerId, - customerEmail: this.customerEmail, - }); - $.export("$summary", `Successfully sent feedback for customer with ID: ${this.customerId}`); - return response; - }, -}; diff --git a/components/flash-by-veloraai/actions/upload-transcript/upload-transcript.mjs b/components/flash-by-veloraai/actions/upload-transcript/upload-transcript.mjs deleted file mode 100644 index 48bc734421cb2..0000000000000 --- a/components/flash-by-veloraai/actions/upload-transcript/upload-transcript.mjs +++ /dev/null @@ -1,43 +0,0 @@ -import flashSystem from "../../flash-by-veloraai.app.mjs"; - -export default { - key: "flash-by-veloraai-upload-transcript", - name: "Upload Transcript", - description: "Transfers a contact call transcript to the flash system for thorough analysis. [See the documentation]()", - version: "0.0.{{ts}}", - type: "action", - props: { - flashSystem, - transcriptContent: { - propDefinition: [ - flashSystem, - "transcriptContent", - ], - }, - callId: { - propDefinition: [ - flashSystem, - "callId", - ], - }, - callerId: { - propDefinition: [ - flashSystem, - "callerId", - (c) => ({ - callerId: c.callerId, - }), - ], - optional: true, - }, - }, - async run({ $ }) { - const response = await this.flashSystem.sendTranscript({ - transcriptContent: this.transcriptContent, - callId: this.callId, - callerId: this.callerId, - }); - $.export("$summary", `Transcript for call ID ${this.callId} uploaded successfully`); - return response; - }, -}; diff --git a/components/flash-by-veloraai/flash-by-veloraai.app.mjs b/components/flash-by-veloraai/flash-by-veloraai.app.mjs deleted file mode 100644 index b36cc014cc614..0000000000000 --- a/components/flash-by-veloraai/flash-by-veloraai.app.mjs +++ /dev/null @@ -1,89 +0,0 @@ -import { axios } from "@pipedream/platform"; - -export default { - type: "app", - app: "flash_system", - propDefinitions: { - feedbackContent: { - type: "string", - label: "Feedback Content", - description: "The content of the customer feedback", - }, - customerId: { - type: "string", - label: "Customer ID", - description: "ID of the customer providing the feedback", - }, - customerEmail: { - type: "string", - label: "Customer Email", - description: "Email of the customer providing the feedback", - optional: true, - }, - transcriptContent: { - type: "string", - label: "Transcript Content", - description: "Content of the contact call transcript", - }, - callId: { - type: "string", - label: "Call ID", - description: "ID of the call for the transcript", - }, - callerId: { - type: "string", - label: "Caller ID", - description: "ID of the caller for the transcript", - optional: true, - }, - }, - methods: { - _baseUrl() { - return "https://api.flashsystem.com"; - }, - async _makeRequest(opts = {}) { - const { - $ = this, - method = "GET", - path, - headers, - ...otherOpts - } = opts; - return axios($, { - ...otherOpts, - method, - url: this._baseUrl() + path, - headers: { - ...headers, - Authorization: `Bearer ${this.$auth.oauth_access_token}`, - }, - }); - }, - async sendFeedback({ - feedbackContent, customerId, customerEmail, - }) { - return this._makeRequest({ - method: "POST", - path: "/feedback", - data: { - feedback_content: feedbackContent, - customer_id: customerId, - customer_email: customerEmail, - }, - }); - }, - async sendTranscript({ - transcriptContent, callId, callerId, - }) { - return this._makeRequest({ - method: "POST", - path: "/transcripts", - data: { - transcript_content: transcriptContent, - call_id: callId, - caller_id: callerId, - }, - }); - }, - }, -}; diff --git a/components/flash_by_velora_ai/actions/add-feedback/add-feedback.mjs b/components/flash_by_velora_ai/actions/add-feedback/add-feedback.mjs new file mode 100644 index 0000000000000..76cc99d8267b3 --- /dev/null +++ b/components/flash_by_velora_ai/actions/add-feedback/add-feedback.mjs @@ -0,0 +1,41 @@ +import flashByVeloraAi from "../../flash_by_velora_ai.app.mjs"; + +export default { + key: "flash_by_velora_ai-add-feedback", + name: "Add Feedback", + description: "Send customer-related feedback to Flash System for comprehensive analysis.", + version: "0.0.1", + type: "action", + props: { + flashByVeloraAi, + feedback: { + type: "string", + label: "Feedback", + description: "Actual text customer feedback", + }, + title: { + type: "string", + label: "Title", + description: "Title of the customer feedback, if any", + optional: true, + }, + source: { + type: "string", + label: "Source", + description: "Source where the feedback was received. For example, GitHub, Slack etc.", + optional: true, + }, + }, + async run({ $ }) { + const response = await this.flashByVeloraAi.sendFeedback({ + $, + data: { + feedback: this.feedback, + title: this.title, + source: this.source, + }, + }); + $.export("$summary", "Successfully sent feedback"); + return response; + }, +}; diff --git a/components/flash_by_velora_ai/actions/upload-transcript/upload-transcript.mjs b/components/flash_by_velora_ai/actions/upload-transcript/upload-transcript.mjs new file mode 100644 index 0000000000000..4b2165301a01e --- /dev/null +++ b/components/flash_by_velora_ai/actions/upload-transcript/upload-transcript.mjs @@ -0,0 +1,39 @@ +import flashByVeloraAi from "../../flash_by_velora_ai.app.mjs"; + +export default { + key: "flash_by_velora_ai-upload-transcript", + name: "Upload Transcript", + description: "Transfers a contact call transcript to the flash system for thorough analysis. [See the documentation](https://flash.velora.ai/developers/documentation/api)", + version: "0.0.1", + type: "action", + props: { + flashByVeloraAi, + title: { + type: "string", + label: "Title", + description: "Title of the meeting", + }, + fileUrl: { + type: "string", + label: "File URL", + description: "Transcript file (supported types: text/plain, pdf, vtt) or transcript text", + }, + sourceType: { + type: "string", + label: "Source Type", + description: "Type of the source system of the file. For example, Google Drive, Fireflies.ai etc.", + }, + }, + async run({ $ }) { + const response = await this.flashByVeloraAi.sendTranscript({ + $, + data: { + title: this.title, + file_url: this.fileUrl, + source_type: this.sourceType, + }, + }); + $.export("$summary", "Transcript uploaded successfully"); + return response; + }, +}; diff --git a/components/flash_by_velora_ai/flash_by_velora_ai.app.mjs b/components/flash_by_velora_ai/flash_by_velora_ai.app.mjs index 49a2f099ce71e..19d9a086c6a4e 100644 --- a/components/flash_by_velora_ai/flash_by_velora_ai.app.mjs +++ b/components/flash_by_velora_ai/flash_by_velora_ai.app.mjs @@ -1,11 +1,38 @@ +import { axios } from "@pipedream/platform"; + export default { type: "app", app: "flash_by_velora_ai", - propDefinitions: {}, methods: { - // this.$auth contains connected account data - authKeys() { - console.log(Object.keys(this.$auth)); + _baseUrl() { + return "https://flash-api.velora.ai/v1/api"; + }, + _makeRequest(opts = {}) { + const { + $ = this, + path, + ...otherOpts + } = opts; + return axios($, { + ...otherOpts, + method: "POST", + url: `${this._baseUrl()}${path}`, + headers: { + "x-api-key": `${this.$auth.api_key}`, + }, + }); + }, + sendFeedback(opts = {}) { + return this._makeRequest({ + path: "/add-feedback", + ...opts, + }); + }, + sendTranscript(opts = {}) { + return this._makeRequest({ + path: "/upload-transcript", + ...opts, + }); }, }, -}; \ No newline at end of file +}; diff --git a/components/flash_by_velora_ai/package.json b/components/flash_by_velora_ai/package.json index f349318edc68b..0aa8144ff4e77 100644 --- a/components/flash_by_velora_ai/package.json +++ b/components/flash_by_velora_ai/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/flash_by_velora_ai", - "version": "0.0.1", + "version": "0.1.0", "description": "Pipedream Flash (by Velora AI) Components", "main": "flash_by_velora_ai.app.mjs", "keywords": [ @@ -11,5 +11,8 @@ "author": "Pipedream (https://pipedream.com/)", "publishConfig": { "access": "public" + }, + "dependencies": { + "@pipedream/platform": "^3.0.3" } -} \ No newline at end of file +} From e7028eda7f1792cc8ac63fe2be2a630f246bf4b7 Mon Sep 17 00:00:00 2001 From: michelle0927 Date: Mon, 28 Oct 2024 12:44:26 -0400 Subject: [PATCH 3/3] pnpm-lock.yaml --- pnpm-lock.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 38e0661abe6b8..8d7257eb8a803 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -3490,7 +3490,10 @@ importers: specifiers: {} components/flash_by_velora_ai: - specifiers: {} + specifiers: + '@pipedream/platform': ^3.0.3 + dependencies: + '@pipedream/platform': 3.0.3 components/flexmail: specifiers: