@pipedream/trint 0.0.2 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/actions/get-transcript/get-transcript.mjs +39 -0
- package/actions/upload-file/upload-file.mjs +101 -0
- package/common/download-formats.mjs +66 -0
- package/common/languages.mjs +218 -0
- package/package.json +5 -5
- package/sources/common/base-webhook.mjs +53 -0
- package/sources/new-transcript-complete/new-transcript-complete.mjs +21 -0
- package/sources/new-transcript-complete/test-event.mjs +7 -0
- package/sources/new-transcript-verified/new-transcript-verified.mjs +21 -0
- package/sources/new-transcript-verified/test-event.mjs +7 -0
- package/sources/new-transcript-version/new-transcript-version.mjs +20 -0
- package/sources/new-transcript-version/test-event.mjs +6 -0
- package/trint.app.mjs +124 -0
package/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Overview
|
|
2
|
+
|
|
3
|
+
The Trint API allows you to harness the power of automated transcription and translation. With Trint, you can convert audio and video files into searchable, editable text. It supports multiple languages and provides features like speaker identification and timestamping. Using the Trint API within Pipedream, you can create automated workflows that process media files, extract valuable insights, and integrate transcribed content into databases, content management systems, or other third-party services.
|
|
4
|
+
|
|
5
|
+
# Example Use Cases
|
|
6
|
+
|
|
7
|
+
- **Automated Podcast Transcription**: Set up a workflow where each new podcast episode uploaded to a cloud storage (like Dropbox or Google Drive) triggers a Pipedream event, which then sends the file to Trint for transcription. Once transcribed, the text can be automatically formatted and published on your blog or website.
|
|
8
|
+
|
|
9
|
+
- **Video Content Analysis and Archiving**: Whenever a new video is added to a CMS, Pipedream can catch this event, send the video to Trint for transcription and translation, and then store the results in a database. This can be linked with AI services to analyze sentiment or extract topics, enriching your video archive with searchable metadata.
|
|
10
|
+
|
|
11
|
+
- **Multilingual Support for Customer Service Calls**: Record customer service calls and use Pipedream to send these recordings to Trint for transcription and translation. Integrate this with a CRM system to append transcripts to customer profiles, aiding in support and ensuring clear communication across different languages.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import trint from "../../trint.app.mjs";
|
|
2
|
+
import downloadFormats from "../../common/download-formats.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
key: "trint-get-transcript",
|
|
6
|
+
name: "Get Transcript",
|
|
7
|
+
description: "Retrieve the full transcription of a processed media file. [See the documentation](https://dev.trint.com/reference/get-file)",
|
|
8
|
+
version: "0.0.1",
|
|
9
|
+
type: "action",
|
|
10
|
+
annotations: {
|
|
11
|
+
destructiveHint: false,
|
|
12
|
+
openWorldHint: true,
|
|
13
|
+
readOnlyHint: true,
|
|
14
|
+
},
|
|
15
|
+
props: {
|
|
16
|
+
trint,
|
|
17
|
+
transcriptId: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
trint,
|
|
20
|
+
"transcriptId",
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
format: {
|
|
24
|
+
type: "string",
|
|
25
|
+
label: "Format",
|
|
26
|
+
description: "The format to export the transcript in. Will return JSON, HTML, or a URL to the transcript in the selected format.",
|
|
27
|
+
options: downloadFormats,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
async run({ $ }) {
|
|
31
|
+
const response = await this.trint.getTranscript({
|
|
32
|
+
$,
|
|
33
|
+
format: this.format,
|
|
34
|
+
transcriptId: this.transcriptId,
|
|
35
|
+
});
|
|
36
|
+
$.export("$summary", `Successfully retrieved transcript for transcript ID: ${this.transcriptId}`);
|
|
37
|
+
return response;
|
|
38
|
+
},
|
|
39
|
+
};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import trint from "../../trint.app.mjs";
|
|
2
|
+
import { getFileStreamAndMetadata } from "@pipedream/platform";
|
|
3
|
+
import languages from "../../common/languages.mjs";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
key: "trint-upload-file",
|
|
7
|
+
name: "Upload File",
|
|
8
|
+
description: "Upload media files directly to Trint for immediate transcription. [See the documentation](https://dev.trint.com/reference/upload)",
|
|
9
|
+
version: "0.0.1",
|
|
10
|
+
type: "action",
|
|
11
|
+
annotations: {
|
|
12
|
+
destructiveHint: false,
|
|
13
|
+
openWorldHint: true,
|
|
14
|
+
readOnlyHint: false,
|
|
15
|
+
},
|
|
16
|
+
props: {
|
|
17
|
+
trint,
|
|
18
|
+
filePath: {
|
|
19
|
+
type: "string",
|
|
20
|
+
label: "File Path or URL",
|
|
21
|
+
description: "The file to upload. Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/myFile.mp4`)",
|
|
22
|
+
},
|
|
23
|
+
language: {
|
|
24
|
+
type: "string",
|
|
25
|
+
label: "Language",
|
|
26
|
+
description: "The language to transcribe",
|
|
27
|
+
options: languages,
|
|
28
|
+
optional: true,
|
|
29
|
+
},
|
|
30
|
+
detectSpeakerChange: {
|
|
31
|
+
type: "boolean",
|
|
32
|
+
label: "Detect Speaker Change",
|
|
33
|
+
description: "Automatically split paragraphs based on change of speaker. If the parameter is not specified it defaults to `true`.",
|
|
34
|
+
optional: true,
|
|
35
|
+
},
|
|
36
|
+
workspaceId: {
|
|
37
|
+
propDefinition: [
|
|
38
|
+
trint,
|
|
39
|
+
"workspaceId",
|
|
40
|
+
],
|
|
41
|
+
optional: true,
|
|
42
|
+
},
|
|
43
|
+
folderId: {
|
|
44
|
+
propDefinition: [
|
|
45
|
+
trint,
|
|
46
|
+
"folderId",
|
|
47
|
+
(c) => ({
|
|
48
|
+
workspaceId: c.workspaceId,
|
|
49
|
+
}),
|
|
50
|
+
],
|
|
51
|
+
optional: true,
|
|
52
|
+
},
|
|
53
|
+
customDictionary: {
|
|
54
|
+
type: "boolean",
|
|
55
|
+
label: "Custom Dictionary",
|
|
56
|
+
description: "Use the Vocab Builder during the transcription of the file. If the parameter is not specified it defaults to `true`.",
|
|
57
|
+
optional: true,
|
|
58
|
+
},
|
|
59
|
+
syncDir: {
|
|
60
|
+
type: "dir",
|
|
61
|
+
accessMode: "read",
|
|
62
|
+
sync: true,
|
|
63
|
+
optional: true,
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
methods: {
|
|
67
|
+
streamToBuffer(stream) {
|
|
68
|
+
return new Promise((resolve, reject) => {
|
|
69
|
+
const chunks = [];
|
|
70
|
+
stream.on("data", (chunk) => chunks.push(chunk));
|
|
71
|
+
stream.on("end", () => resolve(Buffer.concat(chunks)));
|
|
72
|
+
stream.on("error", reject);
|
|
73
|
+
});
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
async run({ $ }) {
|
|
77
|
+
const {
|
|
78
|
+
stream, metadata,
|
|
79
|
+
} = await getFileStreamAndMetadata(this.filePath);
|
|
80
|
+
const fileBinary = await this.streamToBuffer(stream);
|
|
81
|
+
|
|
82
|
+
const response = await this.trint.uploadFile({
|
|
83
|
+
$,
|
|
84
|
+
params: {
|
|
85
|
+
"filename": metadata.name,
|
|
86
|
+
"language": this.language,
|
|
87
|
+
"detect-speaker-change": this.detectSpeakerChange,
|
|
88
|
+
"custom-dictionary": this.customDictionary,
|
|
89
|
+
"workspace-id": this.workspaceId,
|
|
90
|
+
"folder-id": this.folderId,
|
|
91
|
+
},
|
|
92
|
+
headers: {
|
|
93
|
+
"Content-Type": metadata.contentType || "application/octet-stream",
|
|
94
|
+
},
|
|
95
|
+
data: Buffer.from(fileBinary, "binary"),
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
$.export("$summary", `Successfully uploaded file to Trint: ${response.trintId}`);
|
|
99
|
+
return response;
|
|
100
|
+
},
|
|
101
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export default [
|
|
2
|
+
{
|
|
3
|
+
label: "JSON",
|
|
4
|
+
value: "json",
|
|
5
|
+
},
|
|
6
|
+
{
|
|
7
|
+
label: "HTML",
|
|
8
|
+
value: "html",
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
label: "Edit Decision List",
|
|
12
|
+
value: "edl",
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
label: "Comments",
|
|
16
|
+
value: "csv/comments",
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
label: "Avid DS",
|
|
20
|
+
value: "avid-ds",
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
label: "Highlights",
|
|
24
|
+
value: "csv/highlights",
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
label: "Transcript",
|
|
28
|
+
value: "csv/full",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
label: "Markers",
|
|
32
|
+
value: "csv/markers",
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
label: "Microsoft Word",
|
|
36
|
+
value: "docx",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
label: "XML",
|
|
40
|
+
value: "xml",
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
label: "Premiere XML",
|
|
44
|
+
value: "premiere-xml",
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
label: "Spruce STL",
|
|
48
|
+
value: "spruce-stl",
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
label: "SubRip SRT",
|
|
52
|
+
value: "srt",
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
label: "Telestream Vantage XML",
|
|
56
|
+
value: "vantage-xml",
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
label: "Text",
|
|
60
|
+
value: "text",
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
label: "WebVTT",
|
|
64
|
+
value: "webvtt",
|
|
65
|
+
},
|
|
66
|
+
];
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
export default [
|
|
2
|
+
{
|
|
3
|
+
value: "en-GB",
|
|
4
|
+
label: "English (British spelling)",
|
|
5
|
+
},
|
|
6
|
+
{
|
|
7
|
+
value: "en",
|
|
8
|
+
label: "English (American spelling)",
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
value: "es",
|
|
12
|
+
label: "Spanish",
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
value: "de",
|
|
16
|
+
label: "German",
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
value: "ar",
|
|
20
|
+
label: "Arabic",
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
value: "bg",
|
|
24
|
+
label: "Bulgarian",
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
value: "bn",
|
|
28
|
+
label: "Bengali",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
value: "ca",
|
|
32
|
+
label: "Catalan",
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
value: "cmn",
|
|
36
|
+
label: "Chinese Mandarin",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
value: "hr",
|
|
40
|
+
label: "Croatian",
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
value: "cs",
|
|
44
|
+
label: "Czech",
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
value: "da",
|
|
48
|
+
label: "Danish",
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
value: "nl",
|
|
52
|
+
label: "Dutch",
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
value: "fa",
|
|
56
|
+
label: "Farsi (Persian)",
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
value: "fi",
|
|
60
|
+
label: "Finnish",
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
value: "fr",
|
|
64
|
+
label: "French",
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
value: "el",
|
|
68
|
+
label: "Greek",
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
value: "he",
|
|
72
|
+
label: "Hebrew",
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
value: "hi",
|
|
76
|
+
label: "Hindi",
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
value: "hu",
|
|
80
|
+
label: "Hungarian",
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
value: "it",
|
|
84
|
+
label: "Italian",
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
value: "ja",
|
|
88
|
+
label: "Japanese",
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
value: "ko",
|
|
92
|
+
label: "Korean",
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
value: "lv",
|
|
96
|
+
label: "Latvian",
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
value: "lt",
|
|
100
|
+
label: "Lithuanian",
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
value: "ms",
|
|
104
|
+
label: "Malay",
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
value: "no",
|
|
108
|
+
label: "Norwegian",
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
value: "pl",
|
|
112
|
+
label: "Polish",
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
value: "pt",
|
|
116
|
+
label: "Portuguese",
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
value: "ro",
|
|
120
|
+
label: "Romanian",
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
value: "ru",
|
|
124
|
+
label: "Russian",
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
value: "sk",
|
|
128
|
+
label: "Slovakian",
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
value: "sl",
|
|
132
|
+
label: "Slovenian",
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
value: "sv",
|
|
136
|
+
label: "Swedish",
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
value: "sw",
|
|
140
|
+
label: "Swahili",
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
value: "tr",
|
|
144
|
+
label: "Turkish",
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
value: "id",
|
|
148
|
+
label: "Indonesian",
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
value: "uk",
|
|
152
|
+
label: "Ukrainian",
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
value: "yue",
|
|
156
|
+
label: "Cantonese",
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
value: "cy",
|
|
160
|
+
label: "Welsh",
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
value: "ba",
|
|
164
|
+
label: "Bashkir",
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
value: "eu",
|
|
168
|
+
label: "Basque",
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
value: "be",
|
|
172
|
+
label: "Belarusian",
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
value: "et",
|
|
176
|
+
label: "Estonian",
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
value: "ga",
|
|
180
|
+
label: "Irish",
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
value: "gl",
|
|
184
|
+
label: "Galician",
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
value: "mn",
|
|
188
|
+
label: "Mongolian",
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
value: "mr",
|
|
192
|
+
label: "Marathi",
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
value: "mt",
|
|
196
|
+
label: "Maltese",
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
value: "ta",
|
|
200
|
+
label: "Tamil",
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
value: "th",
|
|
204
|
+
label: "Thai",
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
value: "ug",
|
|
208
|
+
label: "Uyghur",
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
value: "ur",
|
|
212
|
+
label: "Urdu",
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
value: "vi",
|
|
216
|
+
label: "Vietnamese",
|
|
217
|
+
},
|
|
218
|
+
];
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pipedream/trint",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Pipedream Trint Components",
|
|
5
|
-
"main": "
|
|
5
|
+
"main": "trint.app.mjs",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"pipedream",
|
|
8
8
|
"trint"
|
|
9
9
|
],
|
|
10
|
-
"files": [
|
|
11
|
-
"dist"
|
|
12
|
-
],
|
|
13
10
|
"homepage": "https://pipedream.com/apps/trint",
|
|
14
11
|
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
|
|
15
12
|
"publishConfig": {
|
|
16
13
|
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@pipedream/platform": "^3.2.2"
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import trint from "../../trint.app.mjs";
|
|
2
|
+
import { ConfigurationError } from "@pipedream/platform";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
props: {
|
|
6
|
+
trint,
|
|
7
|
+
http: {
|
|
8
|
+
type: "$.interface.http",
|
|
9
|
+
customResponse: true,
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
hooks: {
|
|
13
|
+
async activate() {
|
|
14
|
+
await this.trint.registerWebhook({
|
|
15
|
+
data: {
|
|
16
|
+
callbackUrl: this.http.endpoint,
|
|
17
|
+
callbackSubscriptions: this.getEventTypes(),
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
},
|
|
21
|
+
async deactivate() {
|
|
22
|
+
await this.trint.deregisterWebhook({
|
|
23
|
+
data: {
|
|
24
|
+
callbackUrl: this.http.endpoint,
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
methods: {
|
|
30
|
+
getEventTypes() {
|
|
31
|
+
throw new ConfigurationError("getEventTypes is not implemented");
|
|
32
|
+
},
|
|
33
|
+
generateMeta(body) {
|
|
34
|
+
return {
|
|
35
|
+
id: body.transcriptId,
|
|
36
|
+
summary: `New ${body.eventType} event`,
|
|
37
|
+
ts: Date.now(),
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
async run({ body }) {
|
|
42
|
+
this.http.respond({
|
|
43
|
+
status: 200,
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
if (!body) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const meta = this.generateMeta(body);
|
|
51
|
+
this.$emit(body, meta);
|
|
52
|
+
},
|
|
53
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import common from "../common/base-webhook.mjs";
|
|
2
|
+
import sampleEmit from "./test-event.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
...common,
|
|
6
|
+
key: "trint-new-transcript-complete",
|
|
7
|
+
name: "New Transcript Complete (Instant)",
|
|
8
|
+
description: "Emit new event when a transcript is complete. [See the documentation](https://dev.trint.com/reference/register-webhook-endpoint)",
|
|
9
|
+
type: "source",
|
|
10
|
+
version: "0.0.1",
|
|
11
|
+
dedupe: "unique",
|
|
12
|
+
methods: {
|
|
13
|
+
...common.methods,
|
|
14
|
+
getEventTypes() {
|
|
15
|
+
return [
|
|
16
|
+
"TRANSCRIPT_COMPLETE",
|
|
17
|
+
];
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
sampleEmit,
|
|
21
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import common from "../common/base-webhook.mjs";
|
|
2
|
+
import sampleEmit from "./test-event.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
...common,
|
|
6
|
+
key: "trint-new-transcript-verified",
|
|
7
|
+
name: "New Transcript Verified (Instant)",
|
|
8
|
+
description: "Emit new event when a transcript is verified. [See the documentation](https://dev.trint.com/reference/register-webhook-endpoint)",
|
|
9
|
+
type: "source",
|
|
10
|
+
version: "0.0.1",
|
|
11
|
+
dedupe: "unique",
|
|
12
|
+
methods: {
|
|
13
|
+
...common.methods,
|
|
14
|
+
getEventTypes() {
|
|
15
|
+
return [
|
|
16
|
+
"TRANSCRIPT_VERIFIED",
|
|
17
|
+
];
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
sampleEmit,
|
|
21
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import common from "../common/base-webhook.mjs";
|
|
2
|
+
import sampleEmit from "./test-event.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
...common,
|
|
6
|
+
key: "trint-new-transcript-version",
|
|
7
|
+
name: "New Transcript Version (Instant)",
|
|
8
|
+
description: "Emit new event when a new transcript version is created. [See the documentation](https://dev.trint.com/reference/register-webhook-endpoint)",
|
|
9
|
+
type: "source",
|
|
10
|
+
version: "0.0.1",
|
|
11
|
+
methods: {
|
|
12
|
+
...common.methods,
|
|
13
|
+
getEventTypes() {
|
|
14
|
+
return [
|
|
15
|
+
"TRANSCRIPT_NEW_VERSION",
|
|
16
|
+
];
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
sampleEmit,
|
|
20
|
+
};
|
package/trint.app.mjs
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { axios } from "@pipedream/platform";
|
|
2
|
+
const DEFAULT_LIMIT = 50;
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
type: "app",
|
|
6
|
+
app: "trint",
|
|
7
|
+
propDefinitions: {
|
|
8
|
+
workspaceId: {
|
|
9
|
+
type: "string",
|
|
10
|
+
label: "Workspace ID",
|
|
11
|
+
description: "The ID of a workspace",
|
|
12
|
+
async options() {
|
|
13
|
+
const workspaces = await this.listWorkspaces();
|
|
14
|
+
return workspaces?.map(({
|
|
15
|
+
_id: value, name: label,
|
|
16
|
+
}) => ({
|
|
17
|
+
value,
|
|
18
|
+
label,
|
|
19
|
+
})) || [];
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
folderId: {
|
|
23
|
+
type: "string",
|
|
24
|
+
label: "Folder ID",
|
|
25
|
+
description: "The ID of a folder",
|
|
26
|
+
async options({ workspaceId }) {
|
|
27
|
+
const folders = await this.listFolders({
|
|
28
|
+
params: {
|
|
29
|
+
"workspace-id": workspaceId,
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
return folders?.map(({
|
|
33
|
+
_id: value, name: label,
|
|
34
|
+
}) => ({
|
|
35
|
+
value,
|
|
36
|
+
label,
|
|
37
|
+
})) || [];
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
transcriptId: {
|
|
41
|
+
type: "string",
|
|
42
|
+
label: "Transcript ID",
|
|
43
|
+
description: "The ID of a transcript",
|
|
44
|
+
async options({ page }) {
|
|
45
|
+
const transcripts = await this.listTranscripts({
|
|
46
|
+
params: {
|
|
47
|
+
limit: DEFAULT_LIMIT,
|
|
48
|
+
skip: DEFAULT_LIMIT * page,
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
return transcripts?.filter(({ fileType }) => fileType === "TRANSCRIPT")?.map(({
|
|
52
|
+
id: value, title: label,
|
|
53
|
+
}) => ({
|
|
54
|
+
value,
|
|
55
|
+
label,
|
|
56
|
+
})) || [];
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
methods: {
|
|
61
|
+
_baseUrl() {
|
|
62
|
+
return "https://api.trint.com";
|
|
63
|
+
},
|
|
64
|
+
_makeRequest({
|
|
65
|
+
$ = this, url, path, headers, ...opts
|
|
66
|
+
}) {
|
|
67
|
+
return axios($, {
|
|
68
|
+
url: url || `${this._baseUrl()}${path}`,
|
|
69
|
+
headers: {
|
|
70
|
+
...headers,
|
|
71
|
+
"api-key": `${this.$auth.api_key}`,
|
|
72
|
+
},
|
|
73
|
+
...opts,
|
|
74
|
+
});
|
|
75
|
+
},
|
|
76
|
+
registerWebhook(opts = {}) {
|
|
77
|
+
return this._makeRequest({
|
|
78
|
+
method: "PUT",
|
|
79
|
+
path: "/callbacks/transcript",
|
|
80
|
+
...opts,
|
|
81
|
+
});
|
|
82
|
+
},
|
|
83
|
+
deregisterWebhook(opts = {}) {
|
|
84
|
+
return this._makeRequest({
|
|
85
|
+
method: "DELETE",
|
|
86
|
+
path: "/callbacks/transcript",
|
|
87
|
+
...opts,
|
|
88
|
+
});
|
|
89
|
+
},
|
|
90
|
+
getTranscript({
|
|
91
|
+
format, transcriptId, ...opts
|
|
92
|
+
}) {
|
|
93
|
+
return this._makeRequest({
|
|
94
|
+
path: `/export/${format}/${transcriptId}`,
|
|
95
|
+
...opts,
|
|
96
|
+
});
|
|
97
|
+
},
|
|
98
|
+
listWorkspaces(opts = {}) {
|
|
99
|
+
return this._makeRequest({
|
|
100
|
+
path: "/workspaces",
|
|
101
|
+
...opts,
|
|
102
|
+
});
|
|
103
|
+
},
|
|
104
|
+
listFolders(opts = {}) {
|
|
105
|
+
return this._makeRequest({
|
|
106
|
+
path: "/folders",
|
|
107
|
+
...opts,
|
|
108
|
+
});
|
|
109
|
+
},
|
|
110
|
+
listTranscripts(opts = {}) {
|
|
111
|
+
return this._makeRequest({
|
|
112
|
+
path: "/transcripts",
|
|
113
|
+
...opts,
|
|
114
|
+
});
|
|
115
|
+
},
|
|
116
|
+
uploadFile(opts = {}) {
|
|
117
|
+
return this._makeRequest({
|
|
118
|
+
method: "POST",
|
|
119
|
+
url: "https://upload.trint.com/",
|
|
120
|
+
...opts,
|
|
121
|
+
});
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
};
|