Add Activepieces integration for workflow automation
- Add Activepieces fork with SmoothSchedule custom piece - Create integrations app with Activepieces service layer - Add embed token endpoint for iframe integration - Create Automations page with embedded workflow builder - Add sidebar visibility fix for embed mode - Add list inactive customers endpoint to Public API - Include SmoothSchedule triggers: event created/updated/cancelled - Include SmoothSchedule actions: create/update/cancel events, list resources/services/customers 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
import { Property, createAction } from '@activepieces/pieces-framework';
|
||||
import { deepgramAuth } from '../common/auth';
|
||||
import { BASE_URL, LANG_OPTIONS, MODEL_OPTIONS } from '../common/constants';
|
||||
import mime from 'mime-types';
|
||||
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
|
||||
|
||||
export const createSummaryAction = createAction({
|
||||
auth: deepgramAuth,
|
||||
name: 'create_summary',
|
||||
displayName: 'Create Summary',
|
||||
description: 'Produces a summary of the content from an audio file.',
|
||||
props: {
|
||||
audioFile: Property.File({
|
||||
displayName: 'Audio File',
|
||||
required: true,
|
||||
}),
|
||||
model: Property.StaticDropdown({
|
||||
displayName: 'Model',
|
||||
required: false,
|
||||
options: {
|
||||
options: MODEL_OPTIONS,
|
||||
},
|
||||
}),
|
||||
language: Property.StaticDropdown({
|
||||
displayName: 'Language',
|
||||
required: false,
|
||||
description: 'en',
|
||||
options: {
|
||||
disabled: false,
|
||||
options: LANG_OPTIONS,
|
||||
},
|
||||
}),
|
||||
fallbackToTranscript: Property.Checkbox({
|
||||
displayName: 'Fallback to Full Transcript',
|
||||
description: 'Return full transcript if summary is not available.',
|
||||
required: false,
|
||||
defaultValue: true,
|
||||
}),
|
||||
},
|
||||
async run(context) {
|
||||
const {
|
||||
audioFile,
|
||||
model = 'nova',
|
||||
fallbackToTranscript,
|
||||
language,
|
||||
} = context.propsValue;
|
||||
const mimeType = mime.lookup(audioFile.extension || '') || 'audio/wav';
|
||||
|
||||
const response = await httpClient.sendRequest({
|
||||
url: BASE_URL + '/listen',
|
||||
method: HttpMethod.POST,
|
||||
headers: {
|
||||
Authorization: `Token ${context.auth.secret_text}`,
|
||||
'Content-Type': mimeType,
|
||||
},
|
||||
body: audioFile.data,
|
||||
responseType: 'json',
|
||||
queryParams: {
|
||||
model,
|
||||
summarize: 'v2',
|
||||
language: language || 'en',
|
||||
},
|
||||
});
|
||||
|
||||
if (response.body.results.summary) {
|
||||
return response.body.results.summary;
|
||||
}
|
||||
|
||||
if (
|
||||
fallbackToTranscript &&
|
||||
response.body.results.channels?.[0]?.alternatives?.[0]?.transcript
|
||||
) {
|
||||
return response.body.results.channels[0].alternatives[0].transcript;
|
||||
}
|
||||
|
||||
throw new Error('No summary or transcript available');
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,70 @@
|
||||
import { Property, createAction } from '@activepieces/pieces-framework';
|
||||
import { deepgramAuth } from '../common/auth';
|
||||
import { BASE_URL, LANG_OPTIONS, MODEL_OPTIONS } from '../common/constants';
|
||||
import mime from 'mime-types';
|
||||
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
|
||||
|
||||
export const createTranscriptionCallbackAction = createAction({
|
||||
auth: deepgramAuth,
|
||||
name: 'create_transcription_callback',
|
||||
displayName: 'Create Transcription (Callback)',
|
||||
description: 'Creates a transcription using a callback URL.',
|
||||
props: {
|
||||
audioFile: Property.File({
|
||||
displayName: 'Audio File',
|
||||
required: true,
|
||||
}),
|
||||
model: Property.StaticDropdown({
|
||||
displayName: 'Model',
|
||||
required: false,
|
||||
options: {
|
||||
options: MODEL_OPTIONS,
|
||||
},
|
||||
}),
|
||||
language: Property.StaticDropdown({
|
||||
displayName: 'Language',
|
||||
required: false,
|
||||
description: 'en',
|
||||
options: {
|
||||
disabled: false,
|
||||
options: LANG_OPTIONS,
|
||||
},
|
||||
}),
|
||||
callbackUrl: Property.ShortText({
|
||||
displayName: 'Callback URL',
|
||||
description: 'URL to receive the transcription when ready.',
|
||||
required: true,
|
||||
}),
|
||||
},
|
||||
async run(context) {
|
||||
const {
|
||||
audioFile,
|
||||
model = 'nova',
|
||||
callbackUrl,
|
||||
language,
|
||||
} = context.propsValue;
|
||||
const mimeType = mime.lookup(audioFile.extension || '') || 'audio/wav';
|
||||
|
||||
const response = await httpClient.sendRequest({
|
||||
url: BASE_URL + '/listen',
|
||||
method: HttpMethod.POST,
|
||||
headers: {
|
||||
Authorization: `Token ${context.auth.secret_text}`,
|
||||
'Content-Type': mimeType,
|
||||
},
|
||||
body: audioFile.data,
|
||||
responseType: 'json',
|
||||
queryParams: {
|
||||
model,
|
||||
callback: callbackUrl,
|
||||
language: language || 'en',
|
||||
},
|
||||
});
|
||||
|
||||
return {
|
||||
requestId: response.body.request_id,
|
||||
callbackUrl,
|
||||
status: 'submitted',
|
||||
};
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,23 @@
|
||||
import { createAction } from '@activepieces/pieces-framework';
|
||||
import { deepgramAuth } from '../common/auth';
|
||||
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
|
||||
import { BASE_URL } from '../common/constants';
|
||||
|
||||
export const listProjectsAction = createAction({
|
||||
auth: deepgramAuth,
|
||||
name: 'list_projects',
|
||||
displayName: 'List Projects',
|
||||
description: 'Retrieves a list of all projects associated with the account.',
|
||||
props: {},
|
||||
async run(context) {
|
||||
const response = await httpClient.sendRequest({
|
||||
method: HttpMethod.GET,
|
||||
url: BASE_URL + '/projects',
|
||||
headers: {
|
||||
Authorization: `Token ${context.auth.secret_text}`,
|
||||
},
|
||||
});
|
||||
|
||||
return response.body;
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,66 @@
|
||||
import { Property, createAction } from '@activepieces/pieces-framework';
|
||||
import { deepgramAuth } from '../common/auth';
|
||||
import { BASE_URL, TEXT_TO_SPEECH_MODELS } from '../common/constants';
|
||||
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
|
||||
|
||||
export const textToSpeechAction = createAction({
|
||||
auth: deepgramAuth,
|
||||
name: 'text_to_speech',
|
||||
displayName: 'Text to Speech',
|
||||
description: 'Converts text to audio file.',
|
||||
props: {
|
||||
text: Property.LongText({
|
||||
displayName: 'Text',
|
||||
required: true,
|
||||
}),
|
||||
model: Property.StaticDropdown({
|
||||
displayName: 'Voice',
|
||||
required: true,
|
||||
options: {
|
||||
options: TEXT_TO_SPEECH_MODELS,
|
||||
},
|
||||
}),
|
||||
encoding: Property.StaticDropdown({
|
||||
displayName: 'Output Format',
|
||||
required: false,
|
||||
defaultValue: 'mp3',
|
||||
options: {
|
||||
disabled: false,
|
||||
options: [
|
||||
{ label: 'linear16', value: 'linear16' },
|
||||
{ label: 'flac', value: 'flac' },
|
||||
{ label: 'mulaw', value: 'mulaw' },
|
||||
{ label: 'alaw', value: 'alaw' },
|
||||
{ label: 'mp3', value: 'mp3' },
|
||||
{ label: 'opus', value: 'opus' },
|
||||
{ label: 'aac', value: 'aac' },
|
||||
],
|
||||
},
|
||||
}),
|
||||
},
|
||||
async run(context) {
|
||||
const { text, model, encoding } = context.propsValue;
|
||||
|
||||
const response = await httpClient.sendRequest({
|
||||
method: HttpMethod.POST,
|
||||
url: BASE_URL + '/speak',
|
||||
body: { text },
|
||||
headers: {
|
||||
Authorization: `Token ${context.auth.secret_text}`,
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
queryParams: {
|
||||
model,
|
||||
encoding: encoding || 'mp3',
|
||||
},
|
||||
responseType: 'arraybuffer',
|
||||
});
|
||||
|
||||
return {
|
||||
file: await context.files.write({
|
||||
fileName: `audio.${encoding}`,
|
||||
data: Buffer.from(response.body),
|
||||
}),
|
||||
};
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user