Skip to content

Commit 523b501

Browse files
authored
Added Basic Conversation API Functionality (#2393)
* Added Get Speech to Text action * Addressed optional previous PR feedback * Added GET Action Items action * Updated with getActionItems method * Added the GET Follow-ups action * Updated app with the getFollowUps method * Added GET Topics action * Adjusted action version * Updated optional parameters * Fixed ESLINT key-spacing * Added GET Questions action * Bumped get-job-status action version * Updated axios call params * Added count of items retrieved in the summary Added array of items return * Added conversationId as propDefinition * Fixed eslint formatting issue
1 parent 328e19f commit 523b501

File tree

7 files changed

+287
-8
lines changed

7 files changed

+287
-8
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import symblAIApp from "../../symbl_ai.app.mjs";
2+
3+
export default {
4+
key: "symbl_ai-get-action-items",
5+
name: "Get Action Items",
6+
description: "Get a list of all the action items generated from the conversation. See the doc [here](https://docs.symbl.ai/docs/conversation-api/action-items)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
symblAIApp,
11+
conversationId: {
12+
propDefinition: [
13+
symblAIApp,
14+
"conversationId",
15+
],
16+
},
17+
},
18+
async run({ $ }) {
19+
try {
20+
const { actionItems } = await this.symblAIApp.getActionItems({
21+
$,
22+
conversationId: this.conversationId,
23+
});
24+
$.export("$summary", `Successfully retrieved ${actionItems.length} Action Item${actionItems.length === 1
25+
? ""
26+
: "s"} from the conversation`);
27+
return actionItems;
28+
} catch (error) {
29+
console.log("Error: ", error);
30+
$.export("$summary", "Failed to retrieve Action Items from the conversation");
31+
}
32+
},
33+
};
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import symblAIApp from "../../symbl_ai.app.mjs";
2+
3+
export default {
4+
key: "symbl_ai-get-follow-ups",
5+
name: "Get Follow-Ups",
6+
description: "Get a list of all the follow-ups generated from the conversation. See the doc [here](https://docs.symbl.ai/docs/conversation-api/follow-ups)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
symblAIApp,
11+
conversationId: {
12+
propDefinition: [
13+
symblAIApp,
14+
"conversationId",
15+
],
16+
},
17+
},
18+
async run({ $ }) {
19+
try {
20+
const { followUps } = await this.symblAIApp.getFollowUps({
21+
$,
22+
conversationId: this.conversationId,
23+
});
24+
$.export("$summary", `Successfully retrieved ${followUps.length} Follow-up${followUps.length === 1
25+
? ""
26+
: "s"} from the conversation`);
27+
return followUps;
28+
} catch (error) {
29+
console.log("Error: ", error);
30+
$.export("$summary", "Failed to retrieve Follow-ups from the conversation");
31+
}
32+
},
33+
};

components/symbl_ai/actions/get-job-status/get-job-status.mjs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,22 @@ export default {
44
key: "symbl_ai-get-job-status",
55
name: "Get Job Status",
66
description: "Get the status of an Async job request. See the doc [here](https://docs.symbl.ai/docs/async-api/overview/jobs-api#http-request)",
7-
version: "0.0.1",
7+
version: "0.0.2",
88
type: "action",
99
props: {
1010
symblAIApp,
1111
jobId: {
1212
type: "string",
1313
label: "Job Id",
1414
description: "The Id of the job request",
15-
optional: false,
1615
},
1716
},
1817
async run({ $ }) {
1918
try {
20-
const response =
21-
await this.symblAIApp.getJobStatus({
22-
$,
23-
jobId: this.jobId,
24-
});
19+
const response = await this.symblAIApp.getJobStatus({
20+
$,
21+
jobId: this.jobId,
22+
});
2523
$.export("$summary", `Job status: ${response.status}`);
2624
return response;
2725
} catch (error) {
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import symblAIApp from "../../symbl_ai.app.mjs";
2+
3+
export default {
4+
key: "symbl_ai-get-questions",
5+
name: "Get Questions",
6+
description: "Get a list of requests for information or explicit questions recognized during the conversation. See the doc [here](https://docs.symbl.ai/docs/conversation-api/questions)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
symblAIApp,
11+
conversationId: {
12+
propDefinition: [
13+
symblAIApp,
14+
"conversationId",
15+
],
16+
},
17+
},
18+
async run({ $ }) {
19+
try {
20+
const { questions } = await this.symblAIApp.getQuestions({
21+
$,
22+
conversationId: this.conversationId,
23+
});
24+
$.export("$summary", `Successfully retrieved ${questions.length} Question${questions.length === 1
25+
? ""
26+
: "s"} from the conversation`);
27+
return questions;
28+
} catch (error) {
29+
console.log("Error: ", error);
30+
$.export("$summary", "Failed to retrieve Questions from the conversation");
31+
}
32+
},
33+
};
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import symblAIApp from "../../symbl_ai.app.mjs";
2+
3+
export default {
4+
key: "symbl_ai-get-speech-to-text",
5+
name: "Get Speech to Text",
6+
description: "Get a list of all the messages in a conversation. See the doc [here](https://docs.symbl.ai/docs/conversation-api/messages)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
symblAIApp,
11+
conversationId: {
12+
propDefinition: [
13+
symblAIApp,
14+
"conversationId",
15+
],
16+
},
17+
verbose: {
18+
type: "boolean",
19+
label: "Verbose",
20+
description: "Provides you the word level timestamps and score for each sentence",
21+
optional: true,
22+
default: false,
23+
},
24+
sentiment: {
25+
type: "boolean",
26+
label: "Sentiment",
27+
description: "Provides you the sentiment analysis for each sentence",
28+
optional: true,
29+
default: false,
30+
},
31+
},
32+
async run({ $ }) {
33+
try {
34+
const { messages } = await this.symblAIApp.getSpeechToText({
35+
$,
36+
conversationId: this.conversationId,
37+
params: {
38+
verbose: this.verbose,
39+
sentiment: this.sentiment,
40+
},
41+
});
42+
$.export("$summary", `Successfully retrieved ${messages.length} Speech to Text message${messages.length === 1
43+
? ""
44+
: "s"} from the conversation`);
45+
return messages;
46+
} catch (error) {
47+
console.log("Error: ", error);
48+
$.export("$summary", "Failed to retrieve Speech to Text messages from the conversation");
49+
}
50+
},
51+
};
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import symblAIApp from "../../symbl_ai.app.mjs";
2+
3+
export default {
4+
key: "symbl_ai-get-topics",
5+
name: "Get Topics",
6+
description: "Get a list of all the topics generated from the conversation. See the doc [here](https://docs.symbl.ai/docs/conversation-api/get-topics)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
symblAIApp,
11+
conversationId: {
12+
propDefinition: [
13+
symblAIApp,
14+
"conversationId",
15+
],
16+
},
17+
sentiment: {
18+
type: "boolean",
19+
label: "Sentiment",
20+
description: "Provides you sentiment analysis for each topic of the conversation",
21+
optional: true,
22+
default: false,
23+
},
24+
parentRefs: {
25+
type: "boolean",
26+
label: "Topic Hierarchy",
27+
description: "Provides you topic hierarchy for each topic of the conversation",
28+
optional: true,
29+
default: false,
30+
},
31+
},
32+
async run({ $ }) {
33+
try {
34+
const { topics } = await this.symblAIApp.getTopics({
35+
$,
36+
conversationId: this.conversationId,
37+
params: {
38+
sentiment: this.sentiment,
39+
parentRefs: this.parentRefs,
40+
},
41+
});
42+
$.export("$summary", `Successfully retrieved ${topics.length} Topic${topics.length === 1
43+
? ""
44+
: "s"} from the conversation`);
45+
return topics;
46+
} catch (error) {
47+
console.log("Error: ", error);
48+
$.export("$summary", "Failed to retrieve Topics from the conversation");
49+
}
50+
},
51+
};

components/symbl_ai/symbl_ai.app.mjs

Lines changed: 81 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,28 @@ import { axios } from "@pipedream/platform";
33
export default {
44
type: "app",
55
app: "symbl_ai",
6-
propDefinitions: {},
6+
propDefinitions: {
7+
conversationId: {
8+
type: "string",
9+
label: "Conversation Id",
10+
description: "The Id of the Conversation",
11+
async options({ page }) {
12+
const limit = 100;
13+
const params = {
14+
limit,
15+
offset: limit * page,
16+
order: "desc",
17+
};
18+
const { conversations } = await this.getConversations({
19+
params,
20+
});
21+
return conversations.map((conversation) => ({
22+
label: conversation.name,
23+
value: conversation.id,
24+
}));
25+
},
26+
},
27+
},
728
methods: {
829
getHeaders() {
930
return {
@@ -49,5 +70,64 @@ export default {
4970
path: `/job/${jobId}`,
5071
});
5172
},
73+
async getSpeechToText({
74+
$,
75+
conversationId,
76+
params,
77+
}) {
78+
return this.makeRequest({
79+
$,
80+
path: `/conversations/${conversationId}/messages`,
81+
params,
82+
});
83+
},
84+
async getActionItems({
85+
$,
86+
conversationId,
87+
}) {
88+
return this.makeRequest({
89+
$,
90+
path: `/conversations/${conversationId}/action-items`,
91+
});
92+
},
93+
async getFollowUps({
94+
$,
95+
conversationId,
96+
}) {
97+
return this.makeRequest({
98+
$,
99+
path: `/conversations/${conversationId}/follow-ups`,
100+
});
101+
},
102+
async getTopics({
103+
$,
104+
conversationId,
105+
params,
106+
}) {
107+
return this.makeRequest({
108+
$,
109+
path: `/conversations/${conversationId}/topics`,
110+
params,
111+
});
112+
},
113+
async getQuestions({
114+
$,
115+
conversationId,
116+
}) {
117+
return this.makeRequest({
118+
$,
119+
path: `/conversations/${conversationId}/questions`,
120+
});
121+
},
122+
async getConversations({
123+
$,
124+
params,
125+
}) {
126+
return this.makeRequest({
127+
$,
128+
path: "/conversations",
129+
params,
130+
});
131+
},
52132
},
53133
};

0 commit comments

Comments
 (0)