@auxee/piece-ms-teams-transcripts 0.0.2 → 0.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/package.json +15 -4
- package/src/actions/fetch-transcript.action.d.ts +35 -0
- package/src/actions/fetch-transcript.action.js +255 -0
- package/src/actions/fetch-transcript.action.js.map +1 -0
- package/src/actions/send-message.action.d.ts +29 -0
- package/src/actions/send-message.action.js +117 -0
- package/src/actions/send-message.action.js.map +1 -0
- package/src/auth/ms-teams-app-auth.d.ts +26 -0
- package/src/auth/ms-teams-app-auth.js +55 -0
- package/src/auth/ms-teams-app-auth.js.map +1 -0
- package/src/{index.ts → index.d.ts} +15 -39
- package/src/index.js +73 -0
- package/src/index.js.map +1 -0
- package/src/triggers/meetings-webhook.trigger.d.ts +15 -0
- package/src/triggers/meetings-webhook.trigger.js +129 -0
- package/src/triggers/meetings-webhook.trigger.js.map +1 -0
- package/src/triggers/transcript-generated.trigger.d.ts +25 -0
- package/src/triggers/transcript-generated.trigger.js +162 -0
- package/src/triggers/transcript-generated.trigger.js.map +1 -0
- package/src/utils/graph-token.d.ts +66 -0
- package/src/utils/graph-token.js +155 -0
- package/src/utils/graph-token.js.map +1 -0
- package/project.json +0 -31
- package/src/actions/fetch-transcript.action.ts +0 -312
- package/src/actions/send-message.action.ts +0 -148
- package/src/auth/ms-teams-app-auth.ts +0 -65
- package/src/triggers/meetings-webhook.trigger.ts +0 -128
- package/src/triggers/transcript-generated.trigger.ts +0 -210
- package/src/utils/graph-token.ts +0 -195
- package/tsconfig.json +0 -14
- package/tsconfig.lib.json +0 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@auxee/piece-ms-teams-transcripts",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Microsoft Teams meeting transcript monitoring and retrieval using MS Graph API with client credentials",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -14,7 +14,18 @@
|
|
|
14
14
|
"@activepieces/pieces-common": "0.8.2",
|
|
15
15
|
"@activepieces/pieces-framework": "0.20.3",
|
|
16
16
|
"@activepieces/shared": "0.26.2",
|
|
17
|
-
"
|
|
17
|
+
"@sinclair/typebox": "0.34.11",
|
|
18
|
+
"axios": "1.13.1",
|
|
19
|
+
"axios-retry": "4.4.1",
|
|
20
|
+
"deepmerge-ts": "7.1.0",
|
|
21
|
+
"mime-types": "2.1.35",
|
|
22
|
+
"nanoid": "3.3.8",
|
|
23
|
+
"semver": "7.6.0",
|
|
24
|
+
"socket.io-client": "4.8.1",
|
|
25
|
+
"tslib": "^2.6.2",
|
|
26
|
+
"zod": "4.1.13"
|
|
27
|
+
},
|
|
28
|
+
"resolutions": {
|
|
29
|
+
"rollup": "npm:@rollup/wasm-node"
|
|
18
30
|
}
|
|
19
|
-
}
|
|
20
|
-
|
|
31
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetch Transcript Action
|
|
3
|
+
*
|
|
4
|
+
* Downloads and processes a Microsoft Teams meeting transcript.
|
|
5
|
+
*
|
|
6
|
+
* DESIGNED TO WORK WITH TRIGGER OUTPUT:
|
|
7
|
+
* This action consumes the output from the "Transcript Generated" trigger.
|
|
8
|
+
* The meetingId and transcriptId are passed automatically from the trigger.
|
|
9
|
+
*
|
|
10
|
+
* How it works:
|
|
11
|
+
* 1. Receives meetingId and transcriptId from trigger output
|
|
12
|
+
* 2. Fetches transcript content from Microsoft Graph API
|
|
13
|
+
* 3. Parses and cleans the transcript content
|
|
14
|
+
* 4. Returns clean text and optional structured segments
|
|
15
|
+
*
|
|
16
|
+
* API Endpoint:
|
|
17
|
+
* GET /communications/onlineMeetings/{meetingId}/transcripts/{transcriptId}/content
|
|
18
|
+
*
|
|
19
|
+
* Required Permissions (Application):
|
|
20
|
+
* - OnlineMeetingTranscript.Read.All
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* The main action definition
|
|
24
|
+
*
|
|
25
|
+
* This action is designed to consume output from the Transcript Generated trigger.
|
|
26
|
+
* The meetingId and transcriptId are passed automatically.
|
|
27
|
+
*/
|
|
28
|
+
export declare const fetchTranscriptAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").PieceAuthProperty, {
|
|
29
|
+
meetingId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
30
|
+
transcriptId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
31
|
+
meetingSubject: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
32
|
+
startDateTime: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
33
|
+
includeRawContent: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
34
|
+
includeSegments: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
35
|
+
}>;
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Fetch Transcript Action
|
|
4
|
+
*
|
|
5
|
+
* Downloads and processes a Microsoft Teams meeting transcript.
|
|
6
|
+
*
|
|
7
|
+
* DESIGNED TO WORK WITH TRIGGER OUTPUT:
|
|
8
|
+
* This action consumes the output from the "Transcript Generated" trigger.
|
|
9
|
+
* The meetingId and transcriptId are passed automatically from the trigger.
|
|
10
|
+
*
|
|
11
|
+
* How it works:
|
|
12
|
+
* 1. Receives meetingId and transcriptId from trigger output
|
|
13
|
+
* 2. Fetches transcript content from Microsoft Graph API
|
|
14
|
+
* 3. Parses and cleans the transcript content
|
|
15
|
+
* 4. Returns clean text and optional structured segments
|
|
16
|
+
*
|
|
17
|
+
* API Endpoint:
|
|
18
|
+
* GET /communications/onlineMeetings/{meetingId}/transcripts/{transcriptId}/content
|
|
19
|
+
*
|
|
20
|
+
* Required Permissions (Application):
|
|
21
|
+
* - OnlineMeetingTranscript.Read.All
|
|
22
|
+
*/
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.fetchTranscriptAction = void 0;
|
|
25
|
+
const tslib_1 = require("tslib");
|
|
26
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
27
|
+
const graph_token_1 = require("../utils/graph-token");
|
|
28
|
+
const ms_teams_app_auth_1 = require("../auth/ms-teams-app-auth");
|
|
29
|
+
/**
|
|
30
|
+
* Parses VTT (WebVTT) content into segments
|
|
31
|
+
*
|
|
32
|
+
* VTT format example:
|
|
33
|
+
* WEBVTT
|
|
34
|
+
*
|
|
35
|
+
* 00:00:00.000 --> 00:00:05.000
|
|
36
|
+
* <v John Doe>Hello everyone, welcome to the meeting.</v>
|
|
37
|
+
*
|
|
38
|
+
* 00:00:05.000 --> 00:00:10.000
|
|
39
|
+
* <v Jane Smith>Thanks John, let's get started.</v>
|
|
40
|
+
*/
|
|
41
|
+
const parseVttContent = (vttContent) => {
|
|
42
|
+
const segments = [];
|
|
43
|
+
const lines = vttContent.split('\n');
|
|
44
|
+
let currentTimestamp = '';
|
|
45
|
+
let currentSpeaker = '';
|
|
46
|
+
let currentText = '';
|
|
47
|
+
for (const line of lines) {
|
|
48
|
+
const trimmedLine = line.trim();
|
|
49
|
+
// Skip WEBVTT header and empty lines
|
|
50
|
+
if (trimmedLine === 'WEBVTT' || trimmedLine === '' || trimmedLine.startsWith('NOTE')) {
|
|
51
|
+
// If we have accumulated content, save it
|
|
52
|
+
if (currentText && currentSpeaker) {
|
|
53
|
+
segments.push({
|
|
54
|
+
speaker: currentSpeaker,
|
|
55
|
+
text: currentText.trim(),
|
|
56
|
+
timestamp: currentTimestamp,
|
|
57
|
+
});
|
|
58
|
+
currentText = '';
|
|
59
|
+
}
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
// Check if this is a timestamp line (00:00:00.000 --> 00:00:05.000)
|
|
63
|
+
if (trimmedLine.includes('-->')) {
|
|
64
|
+
currentTimestamp = trimmedLine.split('-->')[0].trim();
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
// Check if this line contains speaker info in <v Speaker Name> format
|
|
68
|
+
const speakerMatch = trimmedLine.match(/<v\s+([^>]+)>(.+?)(?:<\/v>|$)/);
|
|
69
|
+
if (speakerMatch) {
|
|
70
|
+
// Save previous segment if exists
|
|
71
|
+
if (currentText && currentSpeaker) {
|
|
72
|
+
segments.push({
|
|
73
|
+
speaker: currentSpeaker,
|
|
74
|
+
text: currentText.trim(),
|
|
75
|
+
timestamp: currentTimestamp,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
currentSpeaker = speakerMatch[1].trim();
|
|
79
|
+
currentText = speakerMatch[2].replace(/<\/v>$/, '').trim();
|
|
80
|
+
}
|
|
81
|
+
else if (currentSpeaker) {
|
|
82
|
+
// Continuation of current speaker's text
|
|
83
|
+
currentText += ' ' + trimmedLine.replace(/<\/?v[^>]*>/g, '');
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
// Text without speaker - try to extract or use "Unknown"
|
|
87
|
+
const textWithoutTags = trimmedLine.replace(/<\/?v[^>]*>/g, '').trim();
|
|
88
|
+
if (textWithoutTags) {
|
|
89
|
+
segments.push({
|
|
90
|
+
speaker: 'Unknown',
|
|
91
|
+
text: textWithoutTags,
|
|
92
|
+
timestamp: currentTimestamp,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
// Don't forget the last segment
|
|
98
|
+
if (currentText && currentSpeaker) {
|
|
99
|
+
segments.push({
|
|
100
|
+
speaker: currentSpeaker,
|
|
101
|
+
text: currentText.trim(),
|
|
102
|
+
timestamp: currentTimestamp,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
return segments;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Cleans and normalizes transcript text
|
|
109
|
+
* Removes HTML/VTT tags, normalizes whitespace, etc.
|
|
110
|
+
*/
|
|
111
|
+
const cleanTranscriptText = (rawContent) => {
|
|
112
|
+
return rawContent
|
|
113
|
+
// Remove WEBVTT header
|
|
114
|
+
.replace(/^WEBVTT\s*/i, '')
|
|
115
|
+
// Remove NOTE lines
|
|
116
|
+
.replace(/^NOTE\s.*$/gm, '')
|
|
117
|
+
// Remove timestamp lines
|
|
118
|
+
.replace(/^\d{2}:\d{2}:\d{2}\.\d{3}\s*-->\s*\d{2}:\d{2}:\d{2}\.\d{3}.*$/gm, '')
|
|
119
|
+
// Remove VTT voice tags but keep content
|
|
120
|
+
.replace(/<v\s+[^>]+>/g, '')
|
|
121
|
+
.replace(/<\/v>/g, '')
|
|
122
|
+
// Remove other HTML-like tags
|
|
123
|
+
.replace(/<[^>]+>/g, '')
|
|
124
|
+
// Normalize whitespace
|
|
125
|
+
.replace(/\s+/g, ' ')
|
|
126
|
+
// Remove leading/trailing whitespace
|
|
127
|
+
.trim();
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* Converts segments to clean plain text with speaker labels
|
|
131
|
+
*/
|
|
132
|
+
const segmentsToPlainText = (segments) => {
|
|
133
|
+
const textParts = [];
|
|
134
|
+
let lastSpeaker = '';
|
|
135
|
+
for (const segment of segments) {
|
|
136
|
+
if (segment.speaker !== lastSpeaker) {
|
|
137
|
+
textParts.push(`\n${segment.speaker}: ${segment.text}`);
|
|
138
|
+
lastSpeaker = segment.speaker;
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
textParts.push(segment.text);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return textParts.join(' ').trim();
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* The main action definition
|
|
148
|
+
*
|
|
149
|
+
* This action is designed to consume output from the Transcript Generated trigger.
|
|
150
|
+
* The meetingId and transcriptId are passed automatically.
|
|
151
|
+
*/
|
|
152
|
+
exports.fetchTranscriptAction = (0, pieces_framework_1.createAction)({
|
|
153
|
+
name: 'fetch_transcript',
|
|
154
|
+
displayName: 'Fetch Transcript',
|
|
155
|
+
description: 'Fetches the content of a Microsoft Teams meeting transcript. ' +
|
|
156
|
+
'Connect this to the Transcript Generated trigger to automatically process new transcripts.',
|
|
157
|
+
props: {
|
|
158
|
+
meetingId: pieces_framework_1.Property.ShortText({
|
|
159
|
+
displayName: 'Meeting ID',
|
|
160
|
+
description: 'The meeting ID from the Transcript Generated trigger. ' +
|
|
161
|
+
'Use: {{trigger.meetingId}}',
|
|
162
|
+
required: true,
|
|
163
|
+
}),
|
|
164
|
+
transcriptId: pieces_framework_1.Property.ShortText({
|
|
165
|
+
displayName: 'Transcript ID',
|
|
166
|
+
description: 'The transcript ID from the Transcript Generated trigger. ' +
|
|
167
|
+
'Use: {{trigger.transcriptId}}',
|
|
168
|
+
required: true,
|
|
169
|
+
}),
|
|
170
|
+
meetingSubject: pieces_framework_1.Property.ShortText({
|
|
171
|
+
displayName: 'Meeting Subject',
|
|
172
|
+
description: 'Optional: Pass the meeting subject from trigger for reference. ' +
|
|
173
|
+
'Use: {{trigger.meetingSubject}}',
|
|
174
|
+
required: false,
|
|
175
|
+
}),
|
|
176
|
+
startDateTime: pieces_framework_1.Property.ShortText({
|
|
177
|
+
displayName: 'Meeting Date',
|
|
178
|
+
description: 'Optional: Pass the meeting date from trigger for reference. ' +
|
|
179
|
+
'Use: {{trigger.startDateTime}}',
|
|
180
|
+
required: false,
|
|
181
|
+
}),
|
|
182
|
+
includeRawContent: pieces_framework_1.Property.Checkbox({
|
|
183
|
+
displayName: 'Include Raw VTT Content',
|
|
184
|
+
description: 'If enabled, includes the raw VTT content in the output.',
|
|
185
|
+
required: false,
|
|
186
|
+
defaultValue: false,
|
|
187
|
+
}),
|
|
188
|
+
includeSegments: pieces_framework_1.Property.Checkbox({
|
|
189
|
+
displayName: 'Include Parsed Segments',
|
|
190
|
+
description: 'If enabled, includes parsed segments with speaker/text/timestamp.',
|
|
191
|
+
required: false,
|
|
192
|
+
defaultValue: false,
|
|
193
|
+
}),
|
|
194
|
+
},
|
|
195
|
+
run(ctx) {
|
|
196
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
197
|
+
// Validate environment variables
|
|
198
|
+
(0, ms_teams_app_auth_1.validateMSTeamsEnv)();
|
|
199
|
+
const { meetingId, transcriptId, meetingSubject, startDateTime, includeRawContent, includeSegments } = ctx.propsValue;
|
|
200
|
+
// Fetch transcript content from Graph API using app-level endpoint
|
|
201
|
+
// GET /communications/onlineMeetings/{meetingId}/transcripts/{transcriptId}/content
|
|
202
|
+
const endpoint = `/communications/onlineMeetings/${meetingId}/transcripts/${transcriptId}/content?$format=text/vtt`;
|
|
203
|
+
const response = yield (0, graph_token_1.graphRequest)(endpoint, {
|
|
204
|
+
method: 'GET',
|
|
205
|
+
headers: {
|
|
206
|
+
Accept: 'text/vtt',
|
|
207
|
+
},
|
|
208
|
+
});
|
|
209
|
+
if (!response.ok) {
|
|
210
|
+
const errorText = yield response.text();
|
|
211
|
+
throw new Error(`Failed to fetch transcript: ${response.status} - ${errorText}`);
|
|
212
|
+
}
|
|
213
|
+
const rawContent = yield response.text();
|
|
214
|
+
const contentType = response.headers.get('content-type') || '';
|
|
215
|
+
// Parse the content
|
|
216
|
+
let content;
|
|
217
|
+
let segments;
|
|
218
|
+
if (contentType.includes('text/vtt') || rawContent.startsWith('WEBVTT')) {
|
|
219
|
+
// Parse VTT format
|
|
220
|
+
const parsedSegments = parseVttContent(rawContent);
|
|
221
|
+
content = segmentsToPlainText(parsedSegments);
|
|
222
|
+
if (includeSegments) {
|
|
223
|
+
segments = parsedSegments;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
// Fallback: treat as plain text
|
|
228
|
+
content = cleanTranscriptText(rawContent);
|
|
229
|
+
if (includeSegments) {
|
|
230
|
+
segments = [{
|
|
231
|
+
speaker: 'Unknown',
|
|
232
|
+
text: content,
|
|
233
|
+
}];
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
// Build output
|
|
237
|
+
const output = {
|
|
238
|
+
meetingId,
|
|
239
|
+
transcriptId,
|
|
240
|
+
content,
|
|
241
|
+
meetingSubject: meetingSubject || undefined,
|
|
242
|
+
meetingDate: startDateTime || undefined,
|
|
243
|
+
};
|
|
244
|
+
// Include optional fields
|
|
245
|
+
if (includeRawContent) {
|
|
246
|
+
output.rawContent = rawContent;
|
|
247
|
+
}
|
|
248
|
+
if (includeSegments && segments) {
|
|
249
|
+
output.segments = segments;
|
|
250
|
+
}
|
|
251
|
+
return output;
|
|
252
|
+
});
|
|
253
|
+
},
|
|
254
|
+
});
|
|
255
|
+
//# sourceMappingURL=fetch-transcript.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch-transcript.action.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/custom/ms-teams-transcripts/src/actions/fetch-transcript.action.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;AAEH,qEAAwE;AACxE,sDAAoD;AACpD,iEAA+D;AAwB/D;;;;;;;;;;;GAWG;AACH,MAAM,eAAe,GAAG,CAAC,UAAkB,EAAuB,EAAE;IAClE,MAAM,QAAQ,GAAwB,EAAE,CAAC;IACzC,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAErC,IAAI,gBAAgB,GAAG,EAAE,CAAC;IAC1B,IAAI,cAAc,GAAG,EAAE,CAAC;IACxB,IAAI,WAAW,GAAG,EAAE,CAAC;IAErB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAEhC,qCAAqC;QACrC,IAAI,WAAW,KAAK,QAAQ,IAAI,WAAW,KAAK,EAAE,IAAI,WAAW,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;YACrF,0CAA0C;YAC1C,IAAI,WAAW,IAAI,cAAc,EAAE,CAAC;gBAClC,QAAQ,CAAC,IAAI,CAAC;oBACZ,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ACpB,QAAQ,GAAG,cAAc,CAAC;gBAC5B,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,gCAAgC;gBAChC,OAAO,GAAG,mBAAmB,CAAC,UAAU,CAAC,CAAC;gBAE1C,IAAI,eAAe,EAAE,CAAC;oBACpB,QAAQ,GAAG,CAAC;4BACV,OAAO,EAAE,SAAS;4BAClB,IAAI,EAAE,OAAO;yBACd,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;YAED,eAAe;YACf,MAAM,MAAM,GAAqB;gBAC/B,SAAS;gBACT,YAAY;gBACZ,OAAO;gBACP,cAAc,EAAE,cAAc,IAAI,SAAS;gBAC3C,WAAW,EAAE,aAAa,IAAI,SAAS;aACxC,CAAC;YAEF,0BAA0B;YAC1B,IAAI,iBAAiB,EAAE,CAAC;gBACtB,MAAM,CAAC,UAAU,GAAG,UAAU,CAAC;YACjC,CAAC;YAED,IAAI,eAAe,IAAI,QAAQ,EAAE,CAAC;gBAChC,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;YAC7B,CAAC;YAED,OAAO,MAAM,CAAC;QAChB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Send Message Action (Stub)
|
|
3
|
+
*
|
|
4
|
+
* Sends a message to a Microsoft Teams channel or chat.
|
|
5
|
+
* This is a stub implementation that can be extended for full functionality.
|
|
6
|
+
*
|
|
7
|
+
* How it works:
|
|
8
|
+
* 1. Takes team ID, channel ID, and message content as input
|
|
9
|
+
* 2. Sends message via Microsoft Graph API
|
|
10
|
+
* 3. Returns the sent message details
|
|
11
|
+
*
|
|
12
|
+
* Required Permissions (Application):
|
|
13
|
+
* - ChannelMessage.Send - To send messages to channels
|
|
14
|
+
* - Chat.ReadWrite.All - To send messages to chats (if extended)
|
|
15
|
+
*
|
|
16
|
+
* Graph API Endpoints:
|
|
17
|
+
* - Channel: POST /teams/{teamId}/channels/{channelId}/messages
|
|
18
|
+
* - Chat: POST /chats/{chatId}/messages
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* The main action definition
|
|
22
|
+
*/
|
|
23
|
+
export declare const sendMessageAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").PieceAuthProperty, {
|
|
24
|
+
teamId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
25
|
+
channelId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
26
|
+
message: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
27
|
+
contentType: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
28
|
+
subject: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
29
|
+
}>;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Send Message Action (Stub)
|
|
4
|
+
*
|
|
5
|
+
* Sends a message to a Microsoft Teams channel or chat.
|
|
6
|
+
* This is a stub implementation that can be extended for full functionality.
|
|
7
|
+
*
|
|
8
|
+
* How it works:
|
|
9
|
+
* 1. Takes team ID, channel ID, and message content as input
|
|
10
|
+
* 2. Sends message via Microsoft Graph API
|
|
11
|
+
* 3. Returns the sent message details
|
|
12
|
+
*
|
|
13
|
+
* Required Permissions (Application):
|
|
14
|
+
* - ChannelMessage.Send - To send messages to channels
|
|
15
|
+
* - Chat.ReadWrite.All - To send messages to chats (if extended)
|
|
16
|
+
*
|
|
17
|
+
* Graph API Endpoints:
|
|
18
|
+
* - Channel: POST /teams/{teamId}/channels/{channelId}/messages
|
|
19
|
+
* - Chat: POST /chats/{chatId}/messages
|
|
20
|
+
*/
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.sendMessageAction = void 0;
|
|
23
|
+
const tslib_1 = require("tslib");
|
|
24
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
25
|
+
const graph_token_1 = require("../utils/graph-token");
|
|
26
|
+
const ms_teams_app_auth_1 = require("../auth/ms-teams-app-auth");
|
|
27
|
+
/**
|
|
28
|
+
* The main action definition
|
|
29
|
+
*/
|
|
30
|
+
exports.sendMessageAction = (0, pieces_framework_1.createAction)({
|
|
31
|
+
name: 'send_message',
|
|
32
|
+
displayName: 'Send Message',
|
|
33
|
+
description: 'Sends a message to a Microsoft Teams channel. ' +
|
|
34
|
+
'Supports plain text and HTML formatted messages.',
|
|
35
|
+
props: {
|
|
36
|
+
teamId: pieces_framework_1.Property.ShortText({
|
|
37
|
+
displayName: 'Team ID',
|
|
38
|
+
description: 'The unique identifier of the Microsoft Teams team. ' +
|
|
39
|
+
'You can find this in the Teams URL or via Graph API.',
|
|
40
|
+
required: true,
|
|
41
|
+
}),
|
|
42
|
+
channelId: pieces_framework_1.Property.ShortText({
|
|
43
|
+
displayName: 'Channel ID',
|
|
44
|
+
description: 'The unique identifier of the channel within the team. ' +
|
|
45
|
+
'You can find this in the Teams URL or via Graph API.',
|
|
46
|
+
required: true,
|
|
47
|
+
}),
|
|
48
|
+
message: pieces_framework_1.Property.LongText({
|
|
49
|
+
displayName: 'Message Content',
|
|
50
|
+
description: 'The message content to send. Supports plain text or HTML. ' +
|
|
51
|
+
'For HTML, include tags like <b>, <i>, <a>, etc.',
|
|
52
|
+
required: true,
|
|
53
|
+
}),
|
|
54
|
+
contentType: pieces_framework_1.Property.StaticDropdown({
|
|
55
|
+
displayName: 'Content Type',
|
|
56
|
+
description: 'The format of the message content.',
|
|
57
|
+
required: false,
|
|
58
|
+
defaultValue: 'text',
|
|
59
|
+
options: {
|
|
60
|
+
disabled: false,
|
|
61
|
+
options: [
|
|
62
|
+
{ label: 'Plain Text', value: 'text' },
|
|
63
|
+
{ label: 'HTML', value: 'html' },
|
|
64
|
+
],
|
|
65
|
+
},
|
|
66
|
+
}),
|
|
67
|
+
subject: pieces_framework_1.Property.ShortText({
|
|
68
|
+
displayName: 'Subject (Optional)',
|
|
69
|
+
description: 'Optional subject line for the message. ' +
|
|
70
|
+
'Shows as a bold header above the message content.',
|
|
71
|
+
required: false,
|
|
72
|
+
}),
|
|
73
|
+
},
|
|
74
|
+
run(ctx) {
|
|
75
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
// Validate environment variables
|
|
77
|
+
(0, ms_teams_app_auth_1.validateMSTeamsEnv)();
|
|
78
|
+
const { teamId, channelId, message, contentType, subject } = ctx.propsValue;
|
|
79
|
+
// Build the message payload
|
|
80
|
+
const messagePayload = {
|
|
81
|
+
body: {
|
|
82
|
+
content: message,
|
|
83
|
+
contentType: contentType === 'html' ? 'html' : 'text',
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
// Add subject if provided
|
|
87
|
+
if (subject) {
|
|
88
|
+
messagePayload.subject = subject;
|
|
89
|
+
}
|
|
90
|
+
// Send the message
|
|
91
|
+
const endpoint = `/teams/${teamId}/channels/${channelId}/messages`;
|
|
92
|
+
try {
|
|
93
|
+
const response = yield (0, graph_token_1.graphPost)(endpoint, messagePayload);
|
|
94
|
+
return {
|
|
95
|
+
success: true,
|
|
96
|
+
messageId: response.id,
|
|
97
|
+
createdAt: response.createdDateTime,
|
|
98
|
+
webUrl: response.webUrl,
|
|
99
|
+
content: response.body.content,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
104
|
+
// Provide helpful error messages
|
|
105
|
+
if (errorMessage.includes('403')) {
|
|
106
|
+
throw new Error('Permission denied. Ensure the app has ChannelMessage.Send permission ' +
|
|
107
|
+
'and is installed in the target team.');
|
|
108
|
+
}
|
|
109
|
+
if (errorMessage.includes('404')) {
|
|
110
|
+
throw new Error('Team or channel not found. Please verify the Team ID and Channel ID are correct.');
|
|
111
|
+
}
|
|
112
|
+
throw new Error(`Failed to send message: ${errorMessage}`);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
//# sourceMappingURL=send-message.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-message.action.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/custom/ms-teams-transcripts/src/actions/send-message.action.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;;;;AAEH,qEAAwE;AACxE,sDAAiD;AACjD,iEAA+D;AAe/D;;GAEG;AACU,QAAA,iBAAiB,GAAG,IAAA,+BAAY,EAAC;IAC5C,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,cAAc;IAC3B,WAAW,EACT,gDAAgD;QAChD,kDAAkD;IAEpD,KAAK,EAAE;QACL,MAAM,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACzB,WAAW,EAAE,SAAS;YACtB,WAAW,EACT,qDAAqD;gBACrD,sDAAsD;YACxD,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC5B,WAAW,EAAE,YAAY;YACzB,WAAW,EACT,wDAAwD;gBACxD,sDAAsD;YACxD,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACzB,WAAW,EAAE,iBAAiB;YAC9B,WAAW,EACT,4DAA4D;gBAC5D,iDAAiD;YACnD,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,WAAW,EAAE,2BAAQ,CAAC,cAAc,CAAC;YACnC,WAAW,EAAE,cAAc;YAC3B,WAAW,EAAE,oCAAoC;YACjD,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,MAAM;YACpB,OAAO,EAAE;gBACP,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE;oBACP,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE;oBACtC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;iBACjC;aACF;SACF,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1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AAI,KAAK,CACb,uEAAuE;wBACvE,sCAAsC,CACvC,CAAC;gBACJ,CAAC;gBAED,IAAI,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;oBACjC,MAAM,IAAI,KAAK,CACb,kFAAkF,CACnF,CAAC;gBACJ,CAAC;gBAED,MAAM,IAAI,KAAK,CAAC,2BAA2B,YAAY,EAAE,CAAC,CAAC;YAC7D,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Microsoft Teams App Authentication Module
|
|
3
|
+
*
|
|
4
|
+
* This module handles reading MS Teams credentials from environment variables.
|
|
5
|
+
* All credentials are stored as environment variables for security.
|
|
6
|
+
*
|
|
7
|
+
* Required Environment Variables:
|
|
8
|
+
* - MS_TEAMS_TENANT_ID: Your Azure AD tenant ID
|
|
9
|
+
* - MS_TEAMS_CLIENT_ID: The app registration client ID (Application ID)
|
|
10
|
+
* - MS_TEAMS_CLIENT_SECRET: The app registration client secret value
|
|
11
|
+
*/
|
|
12
|
+
export interface MSTeamsAuth {
|
|
13
|
+
tenantId: string;
|
|
14
|
+
clientId: string;
|
|
15
|
+
clientSecret: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Gets MS Teams authentication credentials from environment variables.
|
|
19
|
+
* These are fixed per deployment and not exposed to end users.
|
|
20
|
+
*/
|
|
21
|
+
export declare const getMSTeamsAuth: () => MSTeamsAuth;
|
|
22
|
+
/**
|
|
23
|
+
* Validates that all required environment variables are present.
|
|
24
|
+
* Throws descriptive error if any are missing.
|
|
25
|
+
*/
|
|
26
|
+
export declare const validateMSTeamsEnv: () => void;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Microsoft Teams App Authentication Module
|
|
4
|
+
*
|
|
5
|
+
* This module handles reading MS Teams credentials from environment variables.
|
|
6
|
+
* All credentials are stored as environment variables for security.
|
|
7
|
+
*
|
|
8
|
+
* Required Environment Variables:
|
|
9
|
+
* - MS_TEAMS_TENANT_ID: Your Azure AD tenant ID
|
|
10
|
+
* - MS_TEAMS_CLIENT_ID: The app registration client ID (Application ID)
|
|
11
|
+
* - MS_TEAMS_CLIENT_SECRET: The app registration client secret value
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.validateMSTeamsEnv = exports.getMSTeamsAuth = void 0;
|
|
15
|
+
/**
|
|
16
|
+
* Reads an environment variable, throwing an error if required and missing
|
|
17
|
+
*/
|
|
18
|
+
const readEnv = (key, required = true) => {
|
|
19
|
+
const val = process.env[key];
|
|
20
|
+
if (required && !val) {
|
|
21
|
+
throw new Error(`Missing required environment variable: ${key}. ` +
|
|
22
|
+
`Please set this in your deployment configuration.`);
|
|
23
|
+
}
|
|
24
|
+
return val || '';
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Gets MS Teams authentication credentials from environment variables.
|
|
28
|
+
* These are fixed per deployment and not exposed to end users.
|
|
29
|
+
*/
|
|
30
|
+
const getMSTeamsAuth = () => {
|
|
31
|
+
return {
|
|
32
|
+
tenantId: readEnv('MS_TEAMS_TENANT_ID'),
|
|
33
|
+
clientId: readEnv('MS_TEAMS_CLIENT_ID'),
|
|
34
|
+
clientSecret: readEnv('MS_TEAMS_CLIENT_SECRET'),
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
exports.getMSTeamsAuth = getMSTeamsAuth;
|
|
38
|
+
/**
|
|
39
|
+
* Validates that all required environment variables are present.
|
|
40
|
+
* Throws descriptive error if any are missing.
|
|
41
|
+
*/
|
|
42
|
+
const validateMSTeamsEnv = () => {
|
|
43
|
+
const required = [
|
|
44
|
+
'MS_TEAMS_TENANT_ID',
|
|
45
|
+
'MS_TEAMS_CLIENT_ID',
|
|
46
|
+
'MS_TEAMS_CLIENT_SECRET',
|
|
47
|
+
];
|
|
48
|
+
const missing = required.filter((key) => !process.env[key]);
|
|
49
|
+
if (missing.length > 0) {
|
|
50
|
+
throw new Error(`Missing required environment variables: ${missing.join(', ')}. ` +
|
|
51
|
+
`Please configure these for MS Teams integration.`);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
exports.validateMSTeamsEnv = validateMSTeamsEnv;
|
|
55
|
+
//# sourceMappingURL=ms-teams-app-auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ms-teams-app-auth.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/custom/ms-teams-transcripts/src/auth/ms-teams-app-auth.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAQH;;GAEG;AACH,MAAM,OAAO,GAAG,CAAC,GAAW,EAAE,QAAQ,GAAG,IAAI,EAAU,EAAE;IACvD,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC7B,IAAI,QAAQ,IAAI,CAAC,GAAG,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CACb,0CAA0C,GAAG,IAAI;YACjD,mDAAmD,CACpD,CAAC;IACJ,CAAC;IACD,OAAO,GAAG,IAAI,EAAE,CAAC;AACnB,CAAC,CAAC;AAEF;;;GAGG;AACI,MAAM,cAAc,GAAG,GAAgB,EAAE;IAC9C,OAAO;QACL,QAAQ,EAAE,OAAO,CAAC,oBAAoB,CAAC;QACvC,QAAQ,EAAE,OAAO,CAAC,oBAAoB,CAAC;QACvC,YAAY,EAAE,OAAO,CAAC,wBAAwB,CAAC;KAChD,CAAC;AACJ,CAAC,CAAC;AANW,QAAA,cAAc,kBAMzB;AAEF;;;GAGG;AACI,MAAM,kBAAkB,GAAG,GAAS,EAAE;IAC3C,MAAM,QAAQ,GAAG;QACf,oBAAoB;QACpB,oBAAoB;QACpB,wBAAwB;KACzB,CAAC;IAEF,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IAE5D,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CACb,2CAA2C,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;YACjE,kDAAkD,CACnD,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AAfW,QAAA,kBAAkB,sBAe7B"}
|
|
@@ -1,75 +1,51 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Microsoft Teams Transcripts Piece
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* A custom piece for monitoring and fetching Microsoft Teams meeting transcripts
|
|
5
5
|
* using Microsoft Graph API with client credentials authentication.
|
|
6
|
-
*
|
|
6
|
+
*
|
|
7
7
|
* ═══════════════════════════════════════════════════════════════════════════
|
|
8
8
|
* CONFIGURATION (Environment Variables)
|
|
9
9
|
* ═══════════════════════════════════════════════════════════════════════════
|
|
10
|
-
*
|
|
10
|
+
*
|
|
11
11
|
* This piece requires the following environment variables:
|
|
12
|
-
*
|
|
12
|
+
*
|
|
13
13
|
* MS_TEAMS_TENANT_ID - Your Azure AD tenant ID
|
|
14
|
-
* MS_TEAMS_CLIENT_ID - App registration client ID
|
|
14
|
+
* MS_TEAMS_CLIENT_ID - App registration client ID
|
|
15
15
|
* MS_TEAMS_CLIENT_SECRET - App registration client secret
|
|
16
16
|
* MS_TEAMS_USER_IDS - (Optional) Comma-separated list of user IDs to monitor
|
|
17
|
-
*
|
|
17
|
+
*
|
|
18
18
|
* These are fixed per deployment and not exposed to end users.
|
|
19
|
-
*
|
|
19
|
+
*
|
|
20
20
|
* ═══════════════════════════════════════════════════════════════════════════
|
|
21
21
|
* AZURE APP REGISTRATION REQUIREMENTS
|
|
22
22
|
* ═══════════════════════════════════════════════════════════════════════════
|
|
23
|
-
*
|
|
23
|
+
*
|
|
24
24
|
* The app registration needs these Microsoft Graph API permissions (Application):
|
|
25
25
|
* - OnlineMeetingTranscript.Read.All - To read meeting transcripts
|
|
26
26
|
* - OnlineMeetings.Read.All - To list online meetings
|
|
27
27
|
* - User.Read.All - To enumerate users for meeting discovery
|
|
28
28
|
* - ChannelMessage.Send (optional) - To send Teams messages
|
|
29
|
-
*
|
|
29
|
+
*
|
|
30
30
|
* ═══════════════════════════════════════════════════════════════════════════
|
|
31
31
|
* AVAILABLE TRIGGER
|
|
32
32
|
* ═══════════════════════════════════════════════════════════════════════════
|
|
33
|
-
*
|
|
33
|
+
*
|
|
34
34
|
* Transcript Generated
|
|
35
35
|
* - Polls for new meeting transcripts
|
|
36
36
|
* - Triggers once per new transcript
|
|
37
37
|
* - Uses transcript ID for deduplication
|
|
38
|
-
*
|
|
38
|
+
*
|
|
39
39
|
* ═══════════════════════════════════════════════════════════════════════════
|
|
40
40
|
* AVAILABLE ACTIONS
|
|
41
41
|
* ═══════════════════════════════════════════════════════════════════════════
|
|
42
|
-
*
|
|
42
|
+
*
|
|
43
43
|
* Fetch Transcript
|
|
44
44
|
* - Downloads transcript content for a specific meeting
|
|
45
45
|
* - Returns clean text and structured segments
|
|
46
|
-
*
|
|
46
|
+
*
|
|
47
47
|
* Send Message (stub)
|
|
48
48
|
* - Send a message to a Teams channel or chat
|
|
49
|
-
*
|
|
49
|
+
*
|
|
50
50
|
*/
|
|
51
|
-
|
|
52
|
-
import { PieceAuth, createPiece } from '@activepieces/pieces-framework';
|
|
53
|
-
import { PieceCategory } from '@activepieces/shared';
|
|
54
|
-
import { transcriptGeneratedTrigger } from './triggers/transcript-generated.trigger';
|
|
55
|
-
import { meetingsWebhookTrigger } from './triggers/meetings-webhook.trigger';
|
|
56
|
-
import { fetchTranscriptAction } from './actions/fetch-transcript.action';
|
|
57
|
-
import { sendMessageAction } from './actions/send-message.action';
|
|
58
|
-
|
|
59
|
-
export const msTeamsTranscripts = createPiece({
|
|
60
|
-
displayName: 'MS Teams Transcripts',
|
|
61
|
-
description:
|
|
62
|
-
'Monitor Microsoft Teams meetings for new transcripts and fetch transcript content. ' +
|
|
63
|
-
'Uses client credentials flow for application-level access.',
|
|
64
|
-
minimumSupportedRelease: '0.63.0',
|
|
65
|
-
logoUrl: 'https://cdn.activepieces.com/pieces/microsoft-teams.png',
|
|
66
|
-
categories: [PieceCategory.COMMUNICATION, PieceCategory.PRODUCTIVITY],
|
|
67
|
-
|
|
68
|
-
// No user-facing auth - credentials come from environment variables
|
|
69
|
-
auth: PieceAuth.None(),
|
|
70
|
-
|
|
71
|
-
actions: [fetchTranscriptAction, sendMessageAction],
|
|
72
|
-
triggers: [transcriptGeneratedTrigger, meetingsWebhookTrigger],
|
|
73
|
-
authors: ['auxee'],
|
|
74
|
-
});
|
|
75
|
-
|
|
51
|
+
export declare const msTeamsTranscripts: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").PieceAuthProperty>;
|