n8n-nodes-lescribeaudio 1.0.1 → 1.0.3
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 +128 -13
- package/dist/credentials/LeScribeAudioApi.credentials.d.ts +6 -35
- package/dist/credentials/LeScribeAudioApi.credentials.js +43 -36
- package/dist/nodes/LeScribeAudio/LeScribeAudio.node.d.ts +4 -161
- package/dist/nodes/LeScribeAudio/LeScribeAudio.node.js +211 -191
- package/dist/nodes/LeScribeAudio/LeScribeAudioTrigger.node.d.ts +7 -46
- package/dist/nodes/LeScribeAudio/LeScribeAudioTrigger.node.js +97 -92
- package/dist/nodes/LeScribeAudio/lescribeaudio.dark.svg +5 -0
- package/package.json +13 -4
package/README.md
CHANGED
|
@@ -8,22 +8,137 @@ Transcribe long French audio and video recordings (`.mp3`, `.m4a`, `.wav`, `.mp4
|
|
|
8
8
|
- **AI inference via Google Cloud Vertex AI (Europe region, Zero Data Retention)** — no training on user data
|
|
9
9
|
- **No intrusive meeting bot** — asynchronous file/URL submission only
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
1. **Le Scribe Audio** (`leScribeAudio`): Submit from URL or binary file, inspect status/segments/summary, export `docx`/`srt`/`vtt`/`txt`/`json`, manage webhooks.
|
|
13
|
-
2. **Le Scribe Audio Trigger** (`leScribeAudioTrigger`): Automatically registers an outbound webhook and validates `X-LeScribe-Signature` (`t=<epoch>,v1=<hmac_sha256>`) on `transcription.completed` and `transcription.failed`.
|
|
11
|
+
---
|
|
14
12
|
|
|
15
|
-
##
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
### Via n8n Community Nodes UI (Recommended)
|
|
16
|
+
|
|
17
|
+
1. In your n8n instance, go to **Settings → Community Nodes**.
|
|
18
|
+
2. Click **Install a community node**.
|
|
19
|
+
3. Enter `n8n-nodes-lescribeaudio`, acknowledge the risks, and click **Install**.
|
|
20
|
+
|
|
21
|
+
### Via npm (Self-Hosted)
|
|
19
22
|
|
|
20
|
-
## Installation in n8n
|
|
21
23
|
```bash
|
|
22
24
|
npm install n8n-nodes-lescribeaudio
|
|
23
25
|
```
|
|
24
|
-
Or install directly from **n8n Settings → Community Nodes → `n8n-nodes-lescribeaudio`**.
|
|
25
26
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
Restart n8n after installation.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Credentials
|
|
32
|
+
|
|
33
|
+
Both nodes authenticate with the **Le Scribe Audio API** credential (`leScribeAudioApi`).
|
|
34
|
+
|
|
35
|
+
### 1. Generate your Personal API Key
|
|
36
|
+
|
|
37
|
+
1. Sign in to your account on [lescribeaudio.com](https://lescribeaudio.com) (free accounts include 30 minutes of transcription with no credit card required).
|
|
38
|
+
2. Open the **API & MCP Integrations** page at [https://lescribeaudio.com/integrations-mcp](https://lescribeaudio.com/integrations-mcp) (or generate a token programmatically via `POST /api/v1/public/tokens`).
|
|
39
|
+
3. Create a new **Personal API Key** — copy the token starting with `lsa_api_...` (it is shown once).
|
|
40
|
+
|
|
41
|
+
### 2. Configure the Credential in n8n
|
|
42
|
+
|
|
43
|
+
In n8n, go to **Credentials → Add credential → Le Scribe Audio API** and fill in:
|
|
44
|
+
|
|
45
|
+
| Field | Required | Default | Description |
|
|
46
|
+
| :--- | :--- | :--- | :--- |
|
|
47
|
+
| **Personal API Key** | Yes | *(empty)* | Your Le Scribe Audio Personal API Key (`lsa_api_...`), sent automatically as `Authorization: Bearer <token>`. |
|
|
48
|
+
| **Base URL** | Yes | `https://lescribeaudio.com` | Base URL of the Le Scribe Audio API. Keep the default `https://lescribeaudio.com` for production. |
|
|
49
|
+
|
|
50
|
+
Click **Save** — n8n automatically verifies your credentials by calling `GET /api/v1/public/transcriptions?limit=1`.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Operations
|
|
55
|
+
|
|
56
|
+
This package provides **two nodes**:
|
|
57
|
+
|
|
58
|
+
### 1. Le Scribe Audio (`leScribeAudio`)
|
|
59
|
+
|
|
60
|
+
Action node (also enabled as an n8n AI Agent tool via `usableAsTool: true`).
|
|
61
|
+
|
|
62
|
+
#### Resource: `Transcription`
|
|
63
|
+
|
|
64
|
+
| Operation | API Endpoint | Description & Key Parameters |
|
|
65
|
+
| :--- | :--- | :--- |
|
|
66
|
+
| **Submit From Public URL** (`submitUrl`) | `POST /api/v1/public/transcriptions` | Submit a public HTTPS audio/video URL (`Source Media URL`, optional `Filename Override`, `Verbatim Mode`: `Clean (Edited)` or `Full Verbatim`, `Generate Executive & Chrono-Thematic Summary`, `Context Hints` up to 400 chars, optional `Per-Job Webhook Callback URL`). |
|
|
67
|
+
| **Submit Binary File** (`submitFile`) | `POST /api/v1/public/transcriptions` | Upload an incoming n8n binary file (`Binary Property Name`, default `data`) using `multipart/form-data`, with the same transcription options (`Verbatim Mode`, `Generate Summary`, `Context Hints`, `Per-Job Webhook Callback URL`). |
|
|
68
|
+
| **Get** (`get`) | `GET /api/v1/public/transcriptions/{fileId}` | Retrieve transcription status, metadata, diarized speaker segments, and generated summary for a given `File ID`. |
|
|
69
|
+
| **List** (`list`) | `GET /api/v1/public/transcriptions` | List your recent transcriptions (`Limit`, default `50`). |
|
|
70
|
+
| **Export** (`export`) | `GET /api/v1/public/transcriptions/{fileId}/export` | Export a completed transcription by `File ID` in `Word (.docx)`, `SubRip (.srt)`, `WebVTT (.vtt)`, `Plain Text (.txt)` (returned as binary `data`), or structured `JSON (.json)`. |
|
|
71
|
+
|
|
72
|
+
#### Resource: `Webhook`
|
|
73
|
+
|
|
74
|
+
| Operation | API Endpoint | Description & Key Parameters |
|
|
75
|
+
| :--- | :--- | :--- |
|
|
76
|
+
| **List** (`listWebhooks`) | `GET /api/v1/public/webhooks` | List all configured outbound webhooks on your account. |
|
|
77
|
+
| **Create** (`createWebhook`) | `POST /api/v1/public/webhooks` | Register a new outbound HTTPS endpoint (`Webhook HTTPS URL`). |
|
|
78
|
+
| **Test** (`testWebhook`) | `POST /api/v1/public/webhooks/{webhookId}/test` | Send a signed `webhook.test` event to verify your endpoint (`Webhook ID`). |
|
|
79
|
+
| **Delete** (`deleteWebhook`) | `DELETE /api/v1/public/webhooks/{webhookId}` | Remove a configured outbound webhook (`Webhook ID`). |
|
|
80
|
+
|
|
81
|
+
### 2. Le Scribe Audio Trigger (`leScribeAudioTrigger`)
|
|
82
|
+
|
|
83
|
+
Webhook trigger node that starts an n8n workflow automatically whenever a transcription finishes.
|
|
84
|
+
|
|
85
|
+
- **Events** (`events`, required, multi-select):
|
|
86
|
+
- `transcription.completed` *(default)* — fired when a transcription and optional summary are ready for export.
|
|
87
|
+
- `transcription.failed` — fired if processing fails.
|
|
88
|
+
- `webhook.test` — fired when testing a webhook.
|
|
89
|
+
- **Verify HMAC-SHA256 Signature** (`verifySignature`, boolean, default `true`):
|
|
90
|
+
- Validates the `X-LeScribe-Signature` header (`t=<unix_timestamp>,v1=<hex_hmac_sha256>`) using the secret returned on registration, with a 300-second replay-protection window.
|
|
91
|
+
- **Automatic Webhook Lifecycle**:
|
|
92
|
+
- Activating the workflow calls `POST /api/v1/public/webhooks` with n8n's webhook URL and stores the returned `webhookId` and signing `secret` in workflow static data.
|
|
93
|
+
- Deactivating the workflow automatically calls `DELETE /api/v1/public/webhooks/{webhookId}` to clean up the registration.
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Usage Example & Setting Up the Trigger
|
|
98
|
+
|
|
99
|
+
Because long recordings (1 to 10 hours) are processed asynchronously, the recommended pattern uses **two parts** — shipped ready to import in [`workflows/1-drive-audio-to-word-summary.json`](./workflows/1-drive-audio-to-word-summary.json):
|
|
100
|
+
|
|
101
|
+
### Step 1: Submit Audio Files for Transcription
|
|
102
|
+
|
|
103
|
+
1. Add a **Google Drive Trigger** (`File Created` in a watched folder) followed by a **Google Drive → Download** node (outputs binary property `data`).
|
|
104
|
+
2. Add a **Le Scribe Audio** node and select your **Le Scribe Audio API** credential:
|
|
105
|
+
- **Resource**: `Transcription`
|
|
106
|
+
- **Operation**: `Submit Binary File`
|
|
107
|
+
- **Binary Property Name**: `data`
|
|
108
|
+
- **Verbatim Mode**: `Clean (Edited)`
|
|
109
|
+
- **Generate Executive & Chrono-Thematic Summary**: `true`
|
|
110
|
+
3. When a new audio/video file arrives, the node uploads it to Le Scribe Audio and immediately returns a JSON payload containing `file_id` and `status: "queued"`.
|
|
111
|
+
|
|
112
|
+
### Step 2: Configure the Le Scribe Audio Trigger & Export the `.docx`
|
|
113
|
+
|
|
114
|
+
1. In the same workflow (or a dedicated completion workflow), add a **Le Scribe Audio Trigger** node:
|
|
115
|
+
- **Credential**: select your **Le Scribe Audio API** credential.
|
|
116
|
+
- **Events**: keep `Transcription Completed` (`transcription.completed`).
|
|
117
|
+
- **Verify HMAC-SHA256 Signature**: keep `true` (recommended).
|
|
118
|
+
2. Connect the trigger to a **Le Scribe Audio** node:
|
|
119
|
+
- **Resource**: `Transcription`
|
|
120
|
+
- **Operation**: `Export`
|
|
121
|
+
- **File ID**: `={{ $json.data.file_id }}`
|
|
122
|
+
- **Export Format**: `Word (.docx)`
|
|
123
|
+
3. Optionally connect a destination node (Google Drive Upload, Nextcloud, Email, or Slack) to deliver the exported `.docx` binary file.
|
|
124
|
+
4. **Activate the workflow** (toggle **Active** ON in n8n). Your n8n instance must be reachable over HTTPS (`WEBHOOK_URL` configured on self-hosted n8n). Upon activation, the trigger automatically registers its webhook with Le Scribe Audio and verifies every incoming event's HMAC-SHA256 signature.
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Ready-to-Import Workflow Templates (`workflows/`)
|
|
129
|
+
|
|
130
|
+
Import any JSON file below via **Workflows → Import from File** in n8n:
|
|
131
|
+
|
|
132
|
+
1. `workflows/1-drive-audio-to-word-summary.json` — Watches a Google Drive folder, uploads new recordings to Le Scribe Audio (`submitFile` with executive + chrono-thematic summary), listens with `Le Scribe Audio Trigger`, and exports the modifiable `.docx` Word file.
|
|
133
|
+
2. `workflows/2-mairie-conseil-rgaa-subtitles.json` — Submits a municipal council video URL (`submitUrl`) and exports RGAA 4.1 `.VTT` subtitles alongside the `.docx` minutes draft on completion.
|
|
134
|
+
3. `workflows/3-nextcloud-entretien-shs-iramuteq.json` — Submits qualitative research interviews in `Full Verbatim` mode and exports structured `.JSON` segments for downstream analysis.
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## Compatibility & Resources
|
|
139
|
+
|
|
140
|
+
- **Compatibility**: Tested with n8n v1.x+ (`n8nNodesApiVersion: 1`, Node.js >= 18).
|
|
141
|
+
- **API & MCP Integration Hub**: https://lescribeaudio.com/integrations-mcp
|
|
142
|
+
- **OpenAPI 3.1 Specification**: https://lescribeaudio.com/docs/openapi-public-v1.json
|
|
143
|
+
- **RGPD & Security Overview**: https://lescribeaudio.com/securite-rgpd
|
|
144
|
+
- **License**: MIT
|
|
@@ -1,39 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import type { IAuthenticateGeneric, Icon, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare class LeScribeAudioApi implements ICredentialType {
|
|
2
3
|
name: string;
|
|
3
4
|
displayName: string;
|
|
5
|
+
icon: Icon;
|
|
4
6
|
documentationUrl: string;
|
|
5
|
-
properties:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
type: string;
|
|
9
|
-
typeOptions: {
|
|
10
|
-
password: boolean;
|
|
11
|
-
};
|
|
12
|
-
default: string;
|
|
13
|
-
required: boolean;
|
|
14
|
-
description: string;
|
|
15
|
-
} | {
|
|
16
|
-
displayName: string;
|
|
17
|
-
name: string;
|
|
18
|
-
type: string;
|
|
19
|
-
default: string;
|
|
20
|
-
required: boolean;
|
|
21
|
-
description: string;
|
|
22
|
-
typeOptions?: undefined;
|
|
23
|
-
})[];
|
|
24
|
-
authenticate: {
|
|
25
|
-
type: string;
|
|
26
|
-
properties: {
|
|
27
|
-
headers: {
|
|
28
|
-
Authorization: string;
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
test: {
|
|
33
|
-
request: {
|
|
34
|
-
baseURL: string;
|
|
35
|
-
url: string;
|
|
36
|
-
method: string;
|
|
37
|
-
};
|
|
38
|
-
};
|
|
7
|
+
properties: INodeProperties[];
|
|
8
|
+
authenticate: IAuthenticateGeneric;
|
|
9
|
+
test: ICredentialTestRequest;
|
|
39
10
|
}
|
|
@@ -2,42 +2,49 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LeScribeAudioApi = void 0;
|
|
4
4
|
class LeScribeAudioApi {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
default: 'https://lescribeaudio.com',
|
|
23
|
-
required: true,
|
|
24
|
-
description: 'Le Scribe Audio API base URL (default: https://lescribeaudio.com).',
|
|
25
|
-
},
|
|
26
|
-
];
|
|
27
|
-
authenticate = {
|
|
28
|
-
type: 'generic',
|
|
29
|
-
properties: {
|
|
30
|
-
headers: {
|
|
31
|
-
Authorization: '=Bearer {{$credentials.apiKey}}',
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'leScribeAudioApi';
|
|
7
|
+
this.displayName = 'Le Scribe Audio API';
|
|
8
|
+
this.icon = {
|
|
9
|
+
light: 'file:../nodes/LeScribeAudio/lescribeaudio.svg',
|
|
10
|
+
dark: 'file:../nodes/LeScribeAudio/lescribeaudio.dark.svg',
|
|
11
|
+
};
|
|
12
|
+
this.documentationUrl = 'https://lescribeaudio.com/integrations-mcp';
|
|
13
|
+
this.properties = [
|
|
14
|
+
{
|
|
15
|
+
displayName: 'Personal API Key',
|
|
16
|
+
name: 'apiKey',
|
|
17
|
+
type: 'string',
|
|
18
|
+
typeOptions: { password: true },
|
|
19
|
+
default: '',
|
|
20
|
+
required: true,
|
|
21
|
+
description: 'Generate your Personal API Key (lsa_api_...) from https://lescribeaudio.com/integrations-mcp or POST /api/v1/public/tokens',
|
|
32
22
|
},
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
23
|
+
{
|
|
24
|
+
displayName: 'Base URL',
|
|
25
|
+
name: 'baseUrl',
|
|
26
|
+
type: 'string',
|
|
27
|
+
default: 'https://lescribeaudio.com',
|
|
28
|
+
required: true,
|
|
29
|
+
description: 'Le Scribe Audio API base URL (default: https://lescribeaudio.com)',
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
this.authenticate = {
|
|
33
|
+
type: 'generic',
|
|
34
|
+
properties: {
|
|
35
|
+
headers: {
|
|
36
|
+
Authorization: '=Bearer {{$credentials?.apiKey}}',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
this.test = {
|
|
41
|
+
request: {
|
|
42
|
+
baseURL: '={{$credentials?.baseUrl}}',
|
|
43
|
+
url: '/api/v1/public/transcriptions',
|
|
44
|
+
qs: { limit: 1 },
|
|
45
|
+
method: 'GET',
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
}
|
|
42
49
|
}
|
|
43
50
|
exports.LeScribeAudioApi = LeScribeAudioApi;
|
|
@@ -1,162 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
icon: string;
|
|
6
|
-
group: string[];
|
|
7
|
-
version: number;
|
|
8
|
-
subtitle: string;
|
|
9
|
-
description: string;
|
|
10
|
-
defaults: {
|
|
11
|
-
name: string;
|
|
12
|
-
};
|
|
13
|
-
inputs: string[];
|
|
14
|
-
outputs: string[];
|
|
15
|
-
credentials: {
|
|
16
|
-
name: string;
|
|
17
|
-
required: boolean;
|
|
18
|
-
}[];
|
|
19
|
-
properties: ({
|
|
20
|
-
displayName: string;
|
|
21
|
-
name: string;
|
|
22
|
-
type: string;
|
|
23
|
-
noDataExpression: boolean;
|
|
24
|
-
options: {
|
|
25
|
-
name: string;
|
|
26
|
-
value: string;
|
|
27
|
-
}[];
|
|
28
|
-
default: string;
|
|
29
|
-
displayOptions?: undefined;
|
|
30
|
-
required?: undefined;
|
|
31
|
-
description?: undefined;
|
|
32
|
-
} | {
|
|
33
|
-
displayName: string;
|
|
34
|
-
name: string;
|
|
35
|
-
type: string;
|
|
36
|
-
noDataExpression: boolean;
|
|
37
|
-
displayOptions: {
|
|
38
|
-
show: {
|
|
39
|
-
resource: string[];
|
|
40
|
-
operation?: undefined;
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
options: {
|
|
44
|
-
name: string;
|
|
45
|
-
value: string;
|
|
46
|
-
action: string;
|
|
47
|
-
}[];
|
|
48
|
-
default: string;
|
|
49
|
-
required?: undefined;
|
|
50
|
-
description?: undefined;
|
|
51
|
-
} | {
|
|
52
|
-
displayName: string;
|
|
53
|
-
name: string;
|
|
54
|
-
type: string;
|
|
55
|
-
default: string;
|
|
56
|
-
required: boolean;
|
|
57
|
-
displayOptions: {
|
|
58
|
-
show: {
|
|
59
|
-
resource: string[];
|
|
60
|
-
operation: string[];
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
description: string;
|
|
64
|
-
noDataExpression?: undefined;
|
|
65
|
-
options?: undefined;
|
|
66
|
-
} | {
|
|
67
|
-
displayName: string;
|
|
68
|
-
name: string;
|
|
69
|
-
type: string;
|
|
70
|
-
default: string;
|
|
71
|
-
required: boolean;
|
|
72
|
-
displayOptions: {
|
|
73
|
-
show: {
|
|
74
|
-
resource: string[];
|
|
75
|
-
operation: string[];
|
|
76
|
-
};
|
|
77
|
-
};
|
|
78
|
-
noDataExpression?: undefined;
|
|
79
|
-
options?: undefined;
|
|
80
|
-
description?: undefined;
|
|
81
|
-
} | {
|
|
82
|
-
displayName: string;
|
|
83
|
-
name: string;
|
|
84
|
-
type: string;
|
|
85
|
-
default: string;
|
|
86
|
-
displayOptions: {
|
|
87
|
-
show: {
|
|
88
|
-
resource: string[];
|
|
89
|
-
operation: string[];
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
|
-
noDataExpression?: undefined;
|
|
93
|
-
options?: undefined;
|
|
94
|
-
required?: undefined;
|
|
95
|
-
description?: undefined;
|
|
96
|
-
} | {
|
|
97
|
-
displayName: string;
|
|
98
|
-
name: string;
|
|
99
|
-
type: string;
|
|
100
|
-
options: {
|
|
101
|
-
name: string;
|
|
102
|
-
value: string;
|
|
103
|
-
}[];
|
|
104
|
-
default: string;
|
|
105
|
-
displayOptions: {
|
|
106
|
-
show: {
|
|
107
|
-
resource: string[];
|
|
108
|
-
operation: string[];
|
|
109
|
-
};
|
|
110
|
-
};
|
|
111
|
-
noDataExpression?: undefined;
|
|
112
|
-
required?: undefined;
|
|
113
|
-
description?: undefined;
|
|
114
|
-
} | {
|
|
115
|
-
displayName: string;
|
|
116
|
-
name: string;
|
|
117
|
-
type: string;
|
|
118
|
-
default: boolean;
|
|
119
|
-
displayOptions: {
|
|
120
|
-
show: {
|
|
121
|
-
resource: string[];
|
|
122
|
-
operation: string[];
|
|
123
|
-
};
|
|
124
|
-
};
|
|
125
|
-
noDataExpression?: undefined;
|
|
126
|
-
options?: undefined;
|
|
127
|
-
required?: undefined;
|
|
128
|
-
description?: undefined;
|
|
129
|
-
} | {
|
|
130
|
-
displayName: string;
|
|
131
|
-
name: string;
|
|
132
|
-
type: string;
|
|
133
|
-
default: string;
|
|
134
|
-
displayOptions: {
|
|
135
|
-
show: {
|
|
136
|
-
resource: string[];
|
|
137
|
-
operation: string[];
|
|
138
|
-
};
|
|
139
|
-
};
|
|
140
|
-
description: string;
|
|
141
|
-
noDataExpression?: undefined;
|
|
142
|
-
options?: undefined;
|
|
143
|
-
required?: undefined;
|
|
144
|
-
} | {
|
|
145
|
-
displayName: string;
|
|
146
|
-
name: string;
|
|
147
|
-
type: string;
|
|
148
|
-
default: number;
|
|
149
|
-
displayOptions: {
|
|
150
|
-
show: {
|
|
151
|
-
resource: string[];
|
|
152
|
-
operation: string[];
|
|
153
|
-
};
|
|
154
|
-
};
|
|
155
|
-
noDataExpression?: undefined;
|
|
156
|
-
options?: undefined;
|
|
157
|
-
required?: undefined;
|
|
158
|
-
description?: undefined;
|
|
159
|
-
})[];
|
|
160
|
-
};
|
|
161
|
-
execute(this: any): Promise<any[][]>;
|
|
1
|
+
import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
export declare class LeScribeAudio implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
162
5
|
}
|
|
@@ -1,187 +1,218 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LeScribeAudio = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
4
5
|
class LeScribeAudio {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
description: 'Transcribe long French audio/video files (up to 10h / 10 GB) into modifiable Word (.docx), SRT, VTT, JSON and executive/chrono-thematic summary via Le Scribe Audio Public REST API.',
|
|
13
|
-
defaults: {
|
|
14
|
-
name: 'Le Scribe Audio',
|
|
15
|
-
},
|
|
16
|
-
inputs: ['main'],
|
|
17
|
-
outputs: ['main'],
|
|
18
|
-
credentials: [
|
|
19
|
-
{
|
|
20
|
-
name: 'leScribeAudioApi',
|
|
21
|
-
required: true,
|
|
6
|
+
constructor() {
|
|
7
|
+
this.description = {
|
|
8
|
+
displayName: 'Le Scribe Audio',
|
|
9
|
+
name: 'leScribeAudio',
|
|
10
|
+
icon: {
|
|
11
|
+
light: 'file:lescribeaudio.svg',
|
|
12
|
+
dark: 'file:lescribeaudio.dark.svg',
|
|
22
13
|
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
{
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
noDataExpression: true,
|
|
30
|
-
options: [
|
|
31
|
-
{ name: 'Transcription', value: 'transcription' },
|
|
32
|
-
{ name: 'Webhook', value: 'webhook' },
|
|
33
|
-
],
|
|
34
|
-
default: 'transcription',
|
|
14
|
+
group: ['transform'],
|
|
15
|
+
version: 1,
|
|
16
|
+
subtitle: '={{$parameter["resource"] + ": " + $parameter["operation"]}}',
|
|
17
|
+
description: 'Transcribe long French audio/video files (up to 10h / 10 GB) into modifiable Word (.docx), SRT, VTT, JSON and executive/chrono-thematic summary via Le Scribe Audio Public REST API',
|
|
18
|
+
defaults: {
|
|
19
|
+
name: 'Le Scribe Audio',
|
|
35
20
|
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
{
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
21
|
+
usableAsTool: true,
|
|
22
|
+
inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
23
|
+
outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
24
|
+
credentials: [
|
|
25
|
+
{
|
|
26
|
+
name: 'leScribeAudioApi',
|
|
27
|
+
required: true,
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
properties: [
|
|
31
|
+
{
|
|
32
|
+
displayName: 'Resource',
|
|
33
|
+
name: 'resource',
|
|
34
|
+
type: 'options',
|
|
35
|
+
noDataExpression: true,
|
|
36
|
+
options: [
|
|
37
|
+
{ name: 'Transcription', value: 'transcription' },
|
|
38
|
+
{ name: 'Webhook', value: 'webhook' },
|
|
39
|
+
],
|
|
40
|
+
default: 'transcription',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
displayName: 'Operation',
|
|
44
|
+
name: 'operation',
|
|
45
|
+
type: 'options',
|
|
46
|
+
noDataExpression: true,
|
|
47
|
+
displayOptions: { show: { resource: ['transcription'] } },
|
|
48
|
+
options: [
|
|
49
|
+
{
|
|
50
|
+
name: 'Export',
|
|
51
|
+
value: 'export',
|
|
52
|
+
action: 'Export transcription file',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: 'Get',
|
|
56
|
+
value: 'get',
|
|
57
|
+
action: 'Get a transcription',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: 'List',
|
|
61
|
+
value: 'list',
|
|
62
|
+
action: 'List recent transcriptions',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: 'Submit Binary File',
|
|
66
|
+
value: 'submitFile',
|
|
67
|
+
action: 'Upload a binary audio or video file for transcription',
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: 'Submit From Public URL',
|
|
71
|
+
value: 'submitUrl',
|
|
72
|
+
action: 'Submit a public audio or video URL for transcription',
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
default: 'submitUrl',
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
displayName: 'Operation',
|
|
79
|
+
name: 'operation',
|
|
80
|
+
type: 'options',
|
|
81
|
+
noDataExpression: true,
|
|
82
|
+
displayOptions: { show: { resource: ['webhook'] } },
|
|
83
|
+
options: [
|
|
84
|
+
{ name: 'Create', value: 'createWebhook', action: 'Create an outbound webhook' },
|
|
85
|
+
{ name: 'Delete', value: 'deleteWebhook', action: 'Delete an outbound webhook' },
|
|
86
|
+
{ name: 'List', value: 'listWebhooks', action: 'List configured webhooks' },
|
|
87
|
+
{ name: 'Test', value: 'testWebhook', action: 'Send a signed test webhook event' },
|
|
88
|
+
],
|
|
89
|
+
default: 'listWebhooks',
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
displayName: 'Source Media URL',
|
|
93
|
+
name: 'sourceUrl',
|
|
94
|
+
type: 'string',
|
|
95
|
+
default: '',
|
|
96
|
+
required: true,
|
|
97
|
+
displayOptions: { show: { resource: ['transcription'], operation: ['submitUrl'] } },
|
|
98
|
+
description: 'Public HTTPS URL of the audio or video file (.mp3, .m4a, .wav, .mp4, .ds2, .dss)',
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
displayName: 'Binary Property Name',
|
|
102
|
+
name: 'binaryPropertyName',
|
|
103
|
+
type: 'string',
|
|
104
|
+
default: 'data',
|
|
105
|
+
required: true,
|
|
106
|
+
displayOptions: { show: { resource: ['transcription'], operation: ['submitFile'] } },
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
displayName: 'Filename Override',
|
|
110
|
+
name: 'filename',
|
|
111
|
+
type: 'string',
|
|
112
|
+
default: '',
|
|
113
|
+
displayOptions: { show: { resource: ['transcription'], operation: ['submitUrl'] } },
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
displayName: 'Verbatim Mode',
|
|
117
|
+
name: 'verbatimMode',
|
|
118
|
+
type: 'options',
|
|
119
|
+
options: [
|
|
120
|
+
{ name: 'Clean (Edited)', value: 'clean' },
|
|
121
|
+
{ name: 'Full Verbatim', value: 'full' },
|
|
122
|
+
],
|
|
123
|
+
default: 'clean',
|
|
124
|
+
displayOptions: { show: { resource: ['transcription'], operation: ['submitUrl', 'submitFile'] } },
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
displayName: 'Generate Executive & Chrono-Thematic Summary',
|
|
128
|
+
name: 'generateSummary',
|
|
129
|
+
type: 'boolean',
|
|
130
|
+
default: false,
|
|
131
|
+
displayOptions: { show: { resource: ['transcription'], operation: ['submitUrl', 'submitFile'] } },
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
displayName: 'Context Hints',
|
|
135
|
+
name: 'contextHints',
|
|
136
|
+
type: 'string',
|
|
137
|
+
default: '',
|
|
138
|
+
displayOptions: { show: { resource: ['transcription'], operation: ['submitUrl', 'submitFile'] } },
|
|
139
|
+
description: 'Optional context or proper nouns (max 400 chars) to guide 2-pass transcription (e.g. municipal council, acronyms)',
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
displayName: 'Per-Job Webhook Callback URL',
|
|
143
|
+
name: 'webhookUrl',
|
|
144
|
+
type: 'string',
|
|
145
|
+
default: '',
|
|
146
|
+
displayOptions: { show: { resource: ['transcription'], operation: ['submitUrl', 'submitFile'] } },
|
|
147
|
+
description: 'Optional HTTPS URL notified when this transcription completes',
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
displayName: 'File ID',
|
|
151
|
+
name: 'fileId',
|
|
152
|
+
type: 'string',
|
|
153
|
+
default: '',
|
|
154
|
+
required: true,
|
|
155
|
+
displayOptions: { show: { resource: ['transcription'], operation: ['get', 'export'] } },
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
displayName: 'Export Format',
|
|
159
|
+
name: 'exportFormat',
|
|
160
|
+
type: 'options',
|
|
161
|
+
options: [
|
|
162
|
+
{ name: 'JSON (.json)', value: 'json' },
|
|
163
|
+
{ name: 'Plain Text (.txt)', value: 'txt' },
|
|
164
|
+
{ name: 'SubRip (.srt)', value: 'srt' },
|
|
165
|
+
{ name: 'WebVTT (.vtt)', value: 'vtt' },
|
|
166
|
+
{ name: 'Word (.docx)', value: 'docx' },
|
|
167
|
+
],
|
|
168
|
+
default: 'docx',
|
|
169
|
+
displayOptions: { show: { resource: ['transcription'], operation: ['export'] } },
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
displayName: 'Limit',
|
|
173
|
+
name: 'limit',
|
|
174
|
+
type: 'number',
|
|
175
|
+
typeOptions: {
|
|
176
|
+
minValue: 1,
|
|
177
|
+
},
|
|
178
|
+
default: 50,
|
|
179
|
+
description: 'Max number of results to return',
|
|
180
|
+
displayOptions: { show: { resource: ['transcription'], operation: ['list'] } },
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
displayName: 'Webhook HTTPS URL',
|
|
184
|
+
name: 'targetWebhookUrl',
|
|
185
|
+
type: 'string',
|
|
186
|
+
default: '',
|
|
187
|
+
required: true,
|
|
188
|
+
displayOptions: { show: { resource: ['webhook'], operation: ['createWebhook'] } },
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
displayName: 'Webhook ID',
|
|
192
|
+
name: 'webhookId',
|
|
193
|
+
type: 'string',
|
|
194
|
+
default: '',
|
|
195
|
+
required: true,
|
|
196
|
+
displayOptions: { show: { resource: ['webhook'], operation: ['testWebhook', 'deleteWebhook'] } },
|
|
197
|
+
},
|
|
198
|
+
],
|
|
199
|
+
};
|
|
200
|
+
}
|
|
169
201
|
async execute() {
|
|
202
|
+
var _a, _b;
|
|
170
203
|
const items = this.getInputData();
|
|
171
204
|
const returnData = [];
|
|
172
205
|
const credentials = await this.getCredentials('leScribeAudioApi');
|
|
173
206
|
const baseUrl = String(credentials.baseUrl || 'https://lescribeaudio.com').replace(/\/+$/, '');
|
|
174
|
-
const authHeaders = { Authorization: `Bearer ${credentials.apiKey}` };
|
|
175
207
|
for (let i = 0; i < items.length; i++) {
|
|
176
208
|
const resource = this.getNodeParameter('resource', i);
|
|
177
209
|
const operation = this.getNodeParameter('operation', i);
|
|
178
210
|
if (resource === 'transcription' && operation === 'list') {
|
|
179
|
-
const limit = this.getNodeParameter('limit', i,
|
|
180
|
-
const res = await this.helpers.
|
|
211
|
+
const limit = this.getNodeParameter('limit', i, 50);
|
|
212
|
+
const res = await this.helpers.httpRequestWithAuthentication.call(this, 'leScribeAudioApi', {
|
|
181
213
|
method: 'GET',
|
|
182
214
|
url: `${baseUrl}/api/v1/public/transcriptions`,
|
|
183
215
|
qs: { limit },
|
|
184
|
-
headers: authHeaders,
|
|
185
216
|
json: true,
|
|
186
217
|
});
|
|
187
218
|
returnData.push({ json: res, pairedItem: i });
|
|
@@ -201,10 +232,9 @@ class LeScribeAudio {
|
|
|
201
232
|
body.context_hints = contextHints;
|
|
202
233
|
if (webhookUrl)
|
|
203
234
|
body.webhook_url = webhookUrl;
|
|
204
|
-
const res = await this.helpers.
|
|
235
|
+
const res = await this.helpers.httpRequestWithAuthentication.call(this, 'leScribeAudioApi', {
|
|
205
236
|
method: 'POST',
|
|
206
237
|
url: `${baseUrl}/api/v1/public/transcriptions`,
|
|
207
|
-
headers: { ...authHeaders, 'Content-Type': 'application/json' },
|
|
208
238
|
body,
|
|
209
239
|
json: true,
|
|
210
240
|
});
|
|
@@ -212,13 +242,13 @@ class LeScribeAudio {
|
|
|
212
242
|
}
|
|
213
243
|
else if (resource === 'transcription' && operation === 'submitFile') {
|
|
214
244
|
const binProp = this.getNodeParameter('binaryPropertyName', i, 'data');
|
|
215
|
-
const binMeta = items[i]
|
|
245
|
+
const binMeta = (_b = (_a = items[i]) === null || _a === void 0 ? void 0 : _a.binary) === null || _b === void 0 ? void 0 : _b[binProp];
|
|
216
246
|
if (!binMeta) {
|
|
217
|
-
throw new
|
|
247
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Missing binary property "${binProp}" on input item ${i}`, { itemIndex: i });
|
|
218
248
|
}
|
|
219
249
|
const buffer = await this.helpers.getBinaryDataBuffer(i, binProp);
|
|
220
250
|
const form = new FormData();
|
|
221
|
-
const blob = new Blob([buffer], { type: binMeta.mimeType || 'audio/mpeg' });
|
|
251
|
+
const blob = new Blob([new Uint8Array(buffer)], { type: binMeta.mimeType || 'audio/mpeg' });
|
|
222
252
|
form.append('file', blob, binMeta.fileName || 'audio.mp3');
|
|
223
253
|
form.append('verbatim_mode', String(this.getNodeParameter('verbatimMode', i, 'clean')));
|
|
224
254
|
form.append('generate_summary', String(this.getNodeParameter('generateSummary', i, false)));
|
|
@@ -228,23 +258,19 @@ class LeScribeAudio {
|
|
|
228
258
|
form.append('context_hints', contextHints);
|
|
229
259
|
if (webhookUrl)
|
|
230
260
|
form.append('webhook_url', webhookUrl);
|
|
231
|
-
const
|
|
261
|
+
const data = await this.helpers.httpRequestWithAuthentication.call(this, 'leScribeAudioApi', {
|
|
232
262
|
method: 'POST',
|
|
233
|
-
|
|
263
|
+
url: `${baseUrl}/api/v1/public/transcriptions`,
|
|
234
264
|
body: form,
|
|
265
|
+
json: true,
|
|
235
266
|
});
|
|
236
|
-
const data = await resp.json();
|
|
237
|
-
if (!resp.ok) {
|
|
238
|
-
throw new Error(`Le Scribe Audio API error (${resp.status}): ${JSON.stringify(data)}`);
|
|
239
|
-
}
|
|
240
267
|
returnData.push({ json: data, pairedItem: i });
|
|
241
268
|
}
|
|
242
269
|
else if (resource === 'transcription' && operation === 'get') {
|
|
243
270
|
const fileId = encodeURIComponent(String(this.getNodeParameter('fileId', i)));
|
|
244
|
-
const res = await this.helpers.
|
|
271
|
+
const res = await this.helpers.httpRequestWithAuthentication.call(this, 'leScribeAudioApi', {
|
|
245
272
|
method: 'GET',
|
|
246
273
|
url: `${baseUrl}/api/v1/public/transcriptions/${fileId}`,
|
|
247
|
-
headers: authHeaders,
|
|
248
274
|
json: true,
|
|
249
275
|
});
|
|
250
276
|
returnData.push({ json: res, pairedItem: i });
|
|
@@ -253,21 +279,19 @@ class LeScribeAudio {
|
|
|
253
279
|
const fileId = encodeURIComponent(String(this.getNodeParameter('fileId', i)));
|
|
254
280
|
const format = String(this.getNodeParameter('exportFormat', i, 'docx'));
|
|
255
281
|
if (format === 'json') {
|
|
256
|
-
const res = await this.helpers.
|
|
282
|
+
const res = await this.helpers.httpRequestWithAuthentication.call(this, 'leScribeAudioApi', {
|
|
257
283
|
method: 'GET',
|
|
258
284
|
url: `${baseUrl}/api/v1/public/transcriptions/${fileId}/export`,
|
|
259
285
|
qs: { format: 'json' },
|
|
260
|
-
headers: authHeaders,
|
|
261
286
|
json: true,
|
|
262
287
|
});
|
|
263
288
|
returnData.push({ json: res, pairedItem: i });
|
|
264
289
|
}
|
|
265
290
|
else {
|
|
266
|
-
const rawBuf = await this.helpers.
|
|
291
|
+
const rawBuf = await this.helpers.httpRequestWithAuthentication.call(this, 'leScribeAudioApi', {
|
|
267
292
|
method: 'GET',
|
|
268
293
|
url: `${baseUrl}/api/v1/public/transcriptions/${fileId}/export`,
|
|
269
294
|
qs: { format },
|
|
270
|
-
headers: authHeaders,
|
|
271
295
|
encoding: 'arraybuffer',
|
|
272
296
|
});
|
|
273
297
|
const mimeMap = {
|
|
@@ -281,19 +305,17 @@ class LeScribeAudio {
|
|
|
281
305
|
}
|
|
282
306
|
}
|
|
283
307
|
else if (resource === 'webhook' && operation === 'listWebhooks') {
|
|
284
|
-
const res = await this.helpers.
|
|
308
|
+
const res = await this.helpers.httpRequestWithAuthentication.call(this, 'leScribeAudioApi', {
|
|
285
309
|
method: 'GET',
|
|
286
310
|
url: `${baseUrl}/api/v1/public/webhooks`,
|
|
287
|
-
headers: authHeaders,
|
|
288
311
|
json: true,
|
|
289
312
|
});
|
|
290
313
|
returnData.push({ json: res, pairedItem: i });
|
|
291
314
|
}
|
|
292
315
|
else if (resource === 'webhook' && operation === 'createWebhook') {
|
|
293
|
-
const res = await this.helpers.
|
|
316
|
+
const res = await this.helpers.httpRequestWithAuthentication.call(this, 'leScribeAudioApi', {
|
|
294
317
|
method: 'POST',
|
|
295
318
|
url: `${baseUrl}/api/v1/public/webhooks`,
|
|
296
|
-
headers: { ...authHeaders, 'Content-Type': 'application/json' },
|
|
297
319
|
body: { url: this.getNodeParameter('targetWebhookUrl', i) },
|
|
298
320
|
json: true,
|
|
299
321
|
});
|
|
@@ -301,20 +323,18 @@ class LeScribeAudio {
|
|
|
301
323
|
}
|
|
302
324
|
else if (resource === 'webhook' && operation === 'testWebhook') {
|
|
303
325
|
const wid = encodeURIComponent(String(this.getNodeParameter('webhookId', i)));
|
|
304
|
-
const res = await this.helpers.
|
|
326
|
+
const res = await this.helpers.httpRequestWithAuthentication.call(this, 'leScribeAudioApi', {
|
|
305
327
|
method: 'POST',
|
|
306
328
|
url: `${baseUrl}/api/v1/public/webhooks/${wid}/test`,
|
|
307
|
-
headers: authHeaders,
|
|
308
329
|
json: true,
|
|
309
330
|
});
|
|
310
331
|
returnData.push({ json: res, pairedItem: i });
|
|
311
332
|
}
|
|
312
333
|
else if (resource === 'webhook' && operation === 'deleteWebhook') {
|
|
313
334
|
const wid = encodeURIComponent(String(this.getNodeParameter('webhookId', i)));
|
|
314
|
-
const res = await this.helpers.
|
|
335
|
+
const res = await this.helpers.httpRequestWithAuthentication.call(this, 'leScribeAudioApi', {
|
|
315
336
|
method: 'DELETE',
|
|
316
337
|
url: `${baseUrl}/api/v1/public/webhooks/${wid}`,
|
|
317
|
-
headers: authHeaders,
|
|
318
338
|
json: true,
|
|
319
339
|
});
|
|
320
340
|
returnData.push({ json: res, pairedItem: i });
|
|
@@ -1,55 +1,16 @@
|
|
|
1
|
+
import type { IHookFunctions, INodeType, INodeTypeDescription, IWebhookFunctions, IWebhookResponseData } from 'n8n-workflow';
|
|
1
2
|
/**
|
|
2
3
|
* Verifies the `X-LeScribe-Signature: t=<epoch>,v1=<hex>` header signed by Le Scribe Audio.
|
|
3
4
|
*/
|
|
4
5
|
export declare function verifyLeScribeSignature(signatureHeader: string, rawBody: Buffer | string, secret: string, maxSkewSeconds?: number): boolean;
|
|
5
|
-
export declare class LeScribeAudioTrigger {
|
|
6
|
-
description:
|
|
7
|
-
displayName: string;
|
|
8
|
-
name: string;
|
|
9
|
-
icon: string;
|
|
10
|
-
group: string[];
|
|
11
|
-
version: number;
|
|
12
|
-
description: string;
|
|
13
|
-
defaults: {
|
|
14
|
-
name: string;
|
|
15
|
-
};
|
|
16
|
-
inputs: any[];
|
|
17
|
-
outputs: string[];
|
|
18
|
-
credentials: {
|
|
19
|
-
name: string;
|
|
20
|
-
required: boolean;
|
|
21
|
-
}[];
|
|
22
|
-
webhooks: {
|
|
23
|
-
name: string;
|
|
24
|
-
httpMethod: string;
|
|
25
|
-
responseMode: string;
|
|
26
|
-
path: string;
|
|
27
|
-
}[];
|
|
28
|
-
properties: ({
|
|
29
|
-
displayName: string;
|
|
30
|
-
name: string;
|
|
31
|
-
type: string;
|
|
32
|
-
options: {
|
|
33
|
-
name: string;
|
|
34
|
-
value: string;
|
|
35
|
-
}[];
|
|
36
|
-
default: string[];
|
|
37
|
-
required: boolean;
|
|
38
|
-
} | {
|
|
39
|
-
displayName: string;
|
|
40
|
-
name: string;
|
|
41
|
-
type: string;
|
|
42
|
-
default: boolean;
|
|
43
|
-
options?: undefined;
|
|
44
|
-
required?: undefined;
|
|
45
|
-
})[];
|
|
46
|
-
};
|
|
6
|
+
export declare class LeScribeAudioTrigger implements INodeType {
|
|
7
|
+
description: INodeTypeDescription;
|
|
47
8
|
webhookMethods: {
|
|
48
9
|
default: {
|
|
49
|
-
checkExists(this:
|
|
50
|
-
create(this:
|
|
51
|
-
delete(this:
|
|
10
|
+
checkExists(this: IHookFunctions): Promise<boolean>;
|
|
11
|
+
create(this: IHookFunctions): Promise<boolean>;
|
|
12
|
+
delete(this: IHookFunctions): Promise<boolean>;
|
|
52
13
|
};
|
|
53
14
|
};
|
|
54
|
-
webhook(this:
|
|
15
|
+
webhook(this: IWebhookFunctions): Promise<IWebhookResponseData>;
|
|
55
16
|
}
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.LeScribeAudioTrigger = void 0;
|
|
7
7
|
exports.verifyLeScribeSignature = verifyLeScribeSignature;
|
|
8
8
|
const node_crypto_1 = __importDefault(require("node:crypto"));
|
|
9
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
9
10
|
/**
|
|
10
11
|
* Verifies the `X-LeScribe-Signature: t=<epoch>,v1=<hex>` header signed by Le Scribe Audio.
|
|
11
12
|
*/
|
|
@@ -35,102 +36,106 @@ function verifyLeScribeSignature(signatureHeader, rawBody, secret, maxSkewSecond
|
|
|
35
36
|
return node_crypto_1.default.timingSafeEqual(expectedBuf, actualBuf);
|
|
36
37
|
}
|
|
37
38
|
class LeScribeAudioTrigger {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
defaults: {
|
|
46
|
-
name: 'Le Scribe Audio Trigger',
|
|
47
|
-
},
|
|
48
|
-
inputs: [],
|
|
49
|
-
outputs: ['main'],
|
|
50
|
-
credentials: [
|
|
51
|
-
{
|
|
52
|
-
name: 'leScribeAudioApi',
|
|
53
|
-
required: true,
|
|
39
|
+
constructor() {
|
|
40
|
+
this.description = {
|
|
41
|
+
displayName: 'Le Scribe Audio Trigger',
|
|
42
|
+
name: 'leScribeAudioTrigger',
|
|
43
|
+
icon: {
|
|
44
|
+
light: 'file:lescribeaudio.svg',
|
|
45
|
+
dark: 'file:lescribeaudio.dark.svg',
|
|
54
46
|
},
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
{
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
path: 'lescribeaudio-webhook',
|
|
47
|
+
group: ['trigger'],
|
|
48
|
+
version: 1,
|
|
49
|
+
subtitle: '={{$parameter["events"].join(", ")}}',
|
|
50
|
+
description: 'Starts an n8n workflow when a Le Scribe Audio transcription finishes (transcription.completed or transcription.failed) with HMAC-SHA256 verification',
|
|
51
|
+
defaults: {
|
|
52
|
+
name: 'Le Scribe Audio Trigger',
|
|
62
53
|
},
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
const credentials = await this.getCredentials('leScribeAudioApi');
|
|
116
|
-
const baseUrl = String(credentials.baseUrl || 'https://lescribeaudio.com').replace(/\/+$/, '');
|
|
117
|
-
try {
|
|
118
|
-
await this.helpers.httpRequest({
|
|
119
|
-
method: 'DELETE',
|
|
120
|
-
url: `${baseUrl}/api/v1/public/webhooks/${encodeURIComponent(staticData.webhookId)}`,
|
|
121
|
-
headers: { Authorization: `Bearer ${credentials.apiKey}` },
|
|
54
|
+
inputs: [],
|
|
55
|
+
outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
56
|
+
credentials: [
|
|
57
|
+
{
|
|
58
|
+
name: 'leScribeAudioApi',
|
|
59
|
+
required: true,
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
webhooks: [
|
|
63
|
+
{
|
|
64
|
+
name: 'default',
|
|
65
|
+
httpMethod: 'POST',
|
|
66
|
+
responseMode: 'onReceived',
|
|
67
|
+
path: 'lescribeaudio-webhook',
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
properties: [
|
|
71
|
+
{
|
|
72
|
+
displayName: 'Events',
|
|
73
|
+
name: 'events',
|
|
74
|
+
type: 'multiOptions',
|
|
75
|
+
options: [
|
|
76
|
+
{ name: 'Transcription Completed', value: 'transcription.completed' },
|
|
77
|
+
{ name: 'Transcription Failed', value: 'transcription.failed' },
|
|
78
|
+
{ name: 'Webhook Test', value: 'webhook.test' },
|
|
79
|
+
],
|
|
80
|
+
default: ['transcription.completed'],
|
|
81
|
+
required: true,
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
displayName: 'Verify HMAC-SHA256 Signature',
|
|
85
|
+
name: 'verifySignature',
|
|
86
|
+
type: 'boolean',
|
|
87
|
+
default: true,
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
};
|
|
91
|
+
this.webhookMethods = {
|
|
92
|
+
default: {
|
|
93
|
+
async checkExists() {
|
|
94
|
+
const staticData = this.getWorkflowStaticData('node');
|
|
95
|
+
return Boolean(staticData.webhookId);
|
|
96
|
+
},
|
|
97
|
+
async create() {
|
|
98
|
+
const credentials = await this.getCredentials('leScribeAudioApi');
|
|
99
|
+
const baseUrl = String(credentials.baseUrl || 'https://lescribeaudio.com').replace(/\/+$/, '');
|
|
100
|
+
const webhookUrl = this.getNodeWebhookUrl('default');
|
|
101
|
+
const events = this.getNodeParameter('events', ['transcription.completed']);
|
|
102
|
+
const res = (await this.helpers.httpRequestWithAuthentication.call(this, 'leScribeAudioApi', {
|
|
103
|
+
method: 'POST',
|
|
104
|
+
url: `${baseUrl}/api/v1/public/webhooks`,
|
|
105
|
+
body: { url: webhookUrl, events },
|
|
122
106
|
json: true,
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
delete
|
|
130
|
-
|
|
107
|
+
}));
|
|
108
|
+
const staticData = this.getWorkflowStaticData('node');
|
|
109
|
+
staticData.webhookId = res.id;
|
|
110
|
+
staticData.webhookSecret = res.secret;
|
|
111
|
+
return true;
|
|
112
|
+
},
|
|
113
|
+
async delete() {
|
|
114
|
+
const staticData = this.getWorkflowStaticData('node');
|
|
115
|
+
if (!staticData.webhookId)
|
|
116
|
+
return true;
|
|
117
|
+
const credentials = await this.getCredentials('leScribeAudioApi');
|
|
118
|
+
const baseUrl = String(credentials.baseUrl || 'https://lescribeaudio.com').replace(/\/+$/, '');
|
|
119
|
+
try {
|
|
120
|
+
await this.helpers.httpRequestWithAuthentication.call(this, 'leScribeAudioApi', {
|
|
121
|
+
method: 'DELETE',
|
|
122
|
+
url: `${baseUrl}/api/v1/public/webhooks/${encodeURIComponent(String(staticData.webhookId))}`,
|
|
123
|
+
json: true,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
const errObj = error;
|
|
128
|
+
if ((errObj === null || errObj === void 0 ? void 0 : errObj.statusCode) !== 404 && (errObj === null || errObj === void 0 ? void 0 : errObj.httpCode) !== '404') {
|
|
129
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
delete staticData.webhookId;
|
|
133
|
+
delete staticData.webhookSecret;
|
|
134
|
+
return true;
|
|
135
|
+
},
|
|
131
136
|
},
|
|
132
|
-
}
|
|
133
|
-
}
|
|
137
|
+
};
|
|
138
|
+
}
|
|
134
139
|
async webhook() {
|
|
135
140
|
const req = this.getRequestObject();
|
|
136
141
|
const verify = this.getNodeParameter('verifySignature', true);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64">
|
|
2
|
+
<rect width="64" height="64" rx="14" fill="#2563eb"/>
|
|
3
|
+
<path d="M20 32v-8m8 16V16m8 32V20m8 18V26" stroke="#ffffff" stroke-width="4.5" stroke-linecap="round"/>
|
|
4
|
+
<circle cx="48" cy="48" r="6" fill="#34d399"/>
|
|
5
|
+
</svg>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-lescribeaudio",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Official n8n community node for Le Scribe Audio Public REST API & HMAC-SHA256 Webhooks (French 2-pass AI audio/video transcription to Word .docx, SRT, VTT, JSON & executive/chrono-thematic summary).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"n8n-community-node-package",
|
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
},
|
|
23
23
|
"repository": {
|
|
24
24
|
"type": "git",
|
|
25
|
-
"url": "git+https://github.com/
|
|
25
|
+
"url": "git+https://github.com/lescribeaudio/n8n-nodes-lescribeaudio.git"
|
|
26
26
|
},
|
|
27
27
|
"bugs": {
|
|
28
|
-
"url": "https://github.com/
|
|
28
|
+
"url": "https://github.com/lescribeaudio/n8n-nodes-lescribeaudio/issues"
|
|
29
29
|
},
|
|
30
30
|
"main": "dist/index.js",
|
|
31
31
|
"scripts": {
|
|
32
|
-
"build": "tsc",
|
|
32
|
+
"build": "tsc && cp nodes/LeScribeAudio/*.svg dist/nodes/LeScribeAudio/",
|
|
33
33
|
"test": "node --test test/node.test.mjs"
|
|
34
34
|
},
|
|
35
35
|
"files": [
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
],
|
|
41
41
|
"n8n": {
|
|
42
42
|
"n8nNodesApiVersion": 1,
|
|
43
|
+
"strict": true,
|
|
43
44
|
"credentials": [
|
|
44
45
|
"dist/credentials/LeScribeAudioApi.credentials.js"
|
|
45
46
|
],
|
|
@@ -48,6 +49,14 @@
|
|
|
48
49
|
"dist/nodes/LeScribeAudio/LeScribeAudioTrigger.node.js"
|
|
49
50
|
]
|
|
50
51
|
},
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"n8n-workflow": "*"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@types/node": "^22.0.0",
|
|
57
|
+
"n8n-workflow": "*",
|
|
58
|
+
"typescript": "^5.8.0"
|
|
59
|
+
},
|
|
51
60
|
"engines": {
|
|
52
61
|
"node": ">=18.0.0"
|
|
53
62
|
}
|