Skip to content

Commit fd29b3a

Browse files
committed
init
1 parent d4b305f commit fd29b3a

File tree

3 files changed

+172
-0
lines changed

3 files changed

+172
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import flashSystem from "../../flash-by-veloraai.app.mjs";
2+
3+
export default {
4+
key: "flash-by-veloraai-add-feedback",
5+
name: "Add Feedback",
6+
description: "Send customer-related feedback to Flash System for comprehensive analysis.",
7+
version: "0.0.{{ts}}",
8+
type: "action",
9+
props: {
10+
flashSystem,
11+
feedbackContent: {
12+
propDefinition: [
13+
flashSystem,
14+
"feedbackContent",
15+
],
16+
},
17+
customerId: {
18+
propDefinition: [
19+
flashSystem,
20+
"customerId",
21+
],
22+
},
23+
customerEmail: {
24+
propDefinition: [
25+
flashSystem,
26+
"customerEmail",
27+
],
28+
optional: true,
29+
},
30+
},
31+
async run({ $ }) {
32+
const response = await this.flashSystem.sendFeedback({
33+
feedbackContent: this.feedbackContent,
34+
customerId: this.customerId,
35+
customerEmail: this.customerEmail,
36+
});
37+
$.export("$summary", `Successfully sent feedback for customer with ID: ${this.customerId}`);
38+
return response;
39+
},
40+
};
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import flashSystem from "../../flash-by-veloraai.app.mjs";
2+
3+
export default {
4+
key: "flash-by-veloraai-upload-transcript",
5+
name: "Upload Transcript",
6+
description: "Transfers a contact call transcript to the flash system for thorough analysis. [See the documentation]()",
7+
version: "0.0.{{ts}}",
8+
type: "action",
9+
props: {
10+
flashSystem,
11+
transcriptContent: {
12+
propDefinition: [
13+
flashSystem,
14+
"transcriptContent",
15+
],
16+
},
17+
callId: {
18+
propDefinition: [
19+
flashSystem,
20+
"callId",
21+
],
22+
},
23+
callerId: {
24+
propDefinition: [
25+
flashSystem,
26+
"callerId",
27+
(c) => ({
28+
callerId: c.callerId,
29+
}),
30+
],
31+
optional: true,
32+
},
33+
},
34+
async run({ $ }) {
35+
const response = await this.flashSystem.sendTranscript({
36+
transcriptContent: this.transcriptContent,
37+
callId: this.callId,
38+
callerId: this.callerId,
39+
});
40+
$.export("$summary", `Transcript for call ID ${this.callId} uploaded successfully`);
41+
return response;
42+
},
43+
};
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
import { axios } from "@pipedream/platform";
2+
3+
export default {
4+
type: "app",
5+
app: "flash_system",
6+
propDefinitions: {
7+
feedbackContent: {
8+
type: "string",
9+
label: "Feedback Content",
10+
description: "The content of the customer feedback",
11+
},
12+
customerId: {
13+
type: "string",
14+
label: "Customer ID",
15+
description: "ID of the customer providing the feedback",
16+
},
17+
customerEmail: {
18+
type: "string",
19+
label: "Customer Email",
20+
description: "Email of the customer providing the feedback",
21+
optional: true,
22+
},
23+
transcriptContent: {
24+
type: "string",
25+
label: "Transcript Content",
26+
description: "Content of the contact call transcript",
27+
},
28+
callId: {
29+
type: "string",
30+
label: "Call ID",
31+
description: "ID of the call for the transcript",
32+
},
33+
callerId: {
34+
type: "string",
35+
label: "Caller ID",
36+
description: "ID of the caller for the transcript",
37+
optional: true,
38+
},
39+
},
40+
methods: {
41+
_baseUrl() {
42+
return "https://api.flashsystem.com";
43+
},
44+
async _makeRequest(opts = {}) {
45+
const {
46+
$ = this,
47+
method = "GET",
48+
path,
49+
headers,
50+
...otherOpts
51+
} = opts;
52+
return axios($, {
53+
...otherOpts,
54+
method,
55+
url: this._baseUrl() + path,
56+
headers: {
57+
...headers,
58+
Authorization: `Bearer ${this.$auth.oauth_access_token}`,
59+
},
60+
});
61+
},
62+
async sendFeedback({
63+
feedbackContent, customerId, customerEmail,
64+
}) {
65+
return this._makeRequest({
66+
method: "POST",
67+
path: "/feedback",
68+
data: {
69+
feedback_content: feedbackContent,
70+
customer_id: customerId,
71+
customer_email: customerEmail,
72+
},
73+
});
74+
},
75+
async sendTranscript({
76+
transcriptContent, callId, callerId,
77+
}) {
78+
return this._makeRequest({
79+
method: "POST",
80+
path: "/transcripts",
81+
data: {
82+
transcript_content: transcriptContent,
83+
call_id: callId,
84+
caller_id: callerId,
85+
},
86+
});
87+
},
88+
},
89+
};

0 commit comments

Comments
 (0)