@pipedream/sonix 0.1.0 → 1.0.1

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 ADDED
@@ -0,0 +1,11 @@
1
+ # Overview
2
+
3
+ The Sonix API enables automated transcription of audio and video files into text, offering functions like uploading media, managing files, and retrieving transcripts. Leveraging Pipedream’s capabilities, you can integrate the Sonix API with various services to streamline media processing workflows, making transcription tasks more efficient. By automating interactions with Sonix, you can trigger actions based on the transcription status, analyze content, and connect transcribed text with other apps for further processing or analysis.
4
+
5
+ # Example Use Cases
6
+
7
+ - **Transcription Triggered from Cloud Storage Upload**: When a new audio file is uploaded to cloud storage (e.g., Google Drive), Pipedream detects the event and triggers a workflow that uploads the file to Sonix for transcription. Once the transcript is ready, it can be saved back to Google Drive or sent via email.
8
+
9
+ - **Media Management with Slack Notifications**: Use Pipedream to monitor your Sonix account for new transcripts. When a transcript is completed, send a notification with details and a download link to a designated Slack channel. This keeps the team updated on transcription progress in real-time without manual checks.
10
+
11
+ - **Content Analysis and Keyword Extraction**: After a transcript is generated, a workflow can pass the text to a natural language processing (NLP) service, like the Google Cloud Language API, to extract keywords and analyze sentiment. The results could then be sent to a Google Sheet for tracking trends over time.
@@ -1,29 +1,20 @@
1
- import { ConfigurationError } from "@pipedream/platform";
1
+ import { getFileStreamAndMetadata } from "@pipedream/platform";
2
2
  import FormData from "form-data";
3
- import fs from "fs";
4
3
  import { LANGUAGE_OPTIONS } from "../../common/constants.mjs";
5
- import { checkTmp } from "../../common/utils.mjs";
6
4
  import sonix from "../../sonix.app.mjs";
7
5
 
8
6
  export default {
9
7
  key: "sonix-upload-media",
10
8
  name: "Upload Media",
11
9
  description: "Submits new media for processing. [See the documentation](https://sonix.ai/docs/api#new_media)",
12
- version: "0.0.1",
10
+ version: "1.0.1",
13
11
  type: "action",
14
12
  props: {
15
13
  sonix,
16
14
  file: {
17
15
  type: "string",
18
- label: "File",
19
- description: "Path of the audio or video file in /tmp folder. The limit is 100MB using this parameter. For larger files, use **File URL**. `NOTE: Only one of **File** or **File URL** is required.` To upload a file to /tmp folder, please follow the [doc here](https://pipedream.com/docs/code/nodejs/working-with-files/#writing-a-file-to-tmp)",
20
- optional: true,
21
- },
22
- fileUrl: {
23
- type: "string",
24
- label: "File URL",
25
- description: "URL pointing to the audio/video file. `NOTE: Only one of **File** or **File URL** is required.`",
26
- optional: true,
16
+ label: "File Path or URL",
17
+ description: "The audio or video file to upload (max 100MB). Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/myFile.txt`)",
27
18
  },
28
19
  language: {
29
20
  type: "string",
@@ -68,20 +59,25 @@ export default {
68
59
  description: "URL for Sonix to make a POST request notifying of a change in transcript status (either failed or completed). The POST will include the media status JSON.",
69
60
  optional: true,
70
61
  },
62
+ syncDir: {
63
+ type: "dir",
64
+ accessMode: "read",
65
+ sync: true,
66
+ optional: true,
67
+ },
71
68
  },
72
69
  async run({ $ }) {
73
- if (!this.file && !this.fileUrl) {
74
- throw new ConfigurationError("You must provite whether **File** or **File URL**.");
75
- }
76
-
77
70
  const formData = new FormData();
78
71
 
79
- if (this.file) {
80
- const filePath = checkTmp(this.file);
81
- formData.append("file", fs.createReadStream(filePath));
82
- }
72
+ const {
73
+ stream, metadata,
74
+ } = await getFileStreamAndMetadata(this.file);
75
+ formData.append("file", stream, {
76
+ contentType: metadata.contentType,
77
+ knownLength: metadata.size,
78
+ filename: metadata.name,
79
+ });
83
80
 
84
- this.fileUrl && formData.append("file_url", this.fileUrl);
85
81
  this.language && formData.append("language", this.language);
86
82
  this.name && formData.append("name", this.name);
87
83
  this.transcriptText && formData.append("transcript_text", `${this.transcriptText}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/sonix",
3
- "version": "0.1.0",
3
+ "version": "1.0.1",
4
4
  "description": "Pipedream Sonix Components",
5
5
  "main": "sonix.app.mjs",
6
6
  "keywords": [
@@ -13,8 +13,7 @@
13
13
  "access": "public"
14
14
  },
15
15
  "dependencies": {
16
- "@pipedream/platform": "^1.5.1",
17
- "form-data": "^4.0.0",
18
- "fs": "^0.0.1-security"
16
+ "@pipedream/platform": "^3.1.0",
17
+ "form-data": "^4.0.0"
19
18
  }
20
19
  }