- 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>
97 lines
2.8 KiB
TypeScript
97 lines
2.8 KiB
TypeScript
import { createPiece, PieceAuth, Property } from '@activepieces/pieces-framework';
|
|
import { createCustomApiCallAction } from '@activepieces/pieces-common';
|
|
import { AppConnectionType, PieceCategory } from '@activepieces/shared';
|
|
import { textToSpeech } from './lib/actions/text-to-speech-action';
|
|
import {
|
|
createClient,
|
|
ELEVEN_RESIDENCY,
|
|
ElevenResidency,
|
|
getApiKey,
|
|
getRegionApiUrl
|
|
} from './lib/common';
|
|
|
|
const markdownDescription = `
|
|
Follow these instructions to get your API Key:
|
|
1. Visit your Elevenlabs dashboard.
|
|
2. Once there, click on your account in the bottom left corner.
|
|
3. Press Profile + API Key.
|
|
4. Copy the API Key.
|
|
`;
|
|
|
|
const customApiCallDescription = `
|
|
Check [Elevenlabs API reference](https://elevenlabs.io/docs/api-reference/introduction)
|
|
for the list of available endpoints.
|
|
`
|
|
|
|
export const elevenlabsAuth = PieceAuth.CustomAuth({
|
|
required: true,
|
|
description: markdownDescription,
|
|
props: {
|
|
region: Property.StaticDropdown<ElevenResidency>({
|
|
displayName: 'Region',
|
|
description: 'Use according URL in Custom API Call pieces',
|
|
required: true,
|
|
options: {
|
|
placeholder: 'Please select your account region...',
|
|
options: [
|
|
{ label: `default - ${ELEVEN_RESIDENCY['default'].base}`, value: 'default' },
|
|
{ label: `US - ${ELEVEN_RESIDENCY['us'].base}`, value: 'us' },
|
|
{ label: `EU - ${ELEVEN_RESIDENCY['eu'].base}`, value: 'eu' },
|
|
],
|
|
},
|
|
}),
|
|
apiKey: PieceAuth.SecretText({
|
|
displayName: 'API Key',
|
|
required: true,
|
|
}),
|
|
},
|
|
validate: async ({ auth }) => {
|
|
try {
|
|
const elevenlabs = createClient({
|
|
type: AppConnectionType.CUSTOM_AUTH,
|
|
props: auth,
|
|
});
|
|
await elevenlabs.user.get();
|
|
|
|
return {
|
|
valid: true,
|
|
};
|
|
} catch (error) {
|
|
return {
|
|
valid: false,
|
|
error: 'Invalid API Key or Region.',
|
|
};
|
|
}
|
|
},
|
|
});
|
|
|
|
export const elevenlabs = createPiece({
|
|
displayName: 'ElevenLabs',
|
|
auth: elevenlabsAuth,
|
|
minimumSupportedRelease: '0.30.0',
|
|
logoUrl: 'https://cdn.activepieces.com/pieces/elevenlabs.png',
|
|
authors: ['pfernandez98'],
|
|
categories: [PieceCategory.ARTIFICIAL_INTELLIGENCE],
|
|
description: 'AI Voice Generator & Text to Speech',
|
|
actions: [
|
|
textToSpeech,
|
|
createCustomApiCallAction({
|
|
// it would be more useful to have hint for URL
|
|
description: customApiCallDescription,
|
|
// missing propsValue to not override url when credentials are changed
|
|
// @see packages/pieces/community/common/src/lib/helpers/index.ts:65
|
|
baseUrl: (auth) => {
|
|
return getRegionApiUrl(auth?.props.region)
|
|
},
|
|
auth: elevenlabsAuth,
|
|
authMapping: async (auth) => {
|
|
return ({
|
|
// keep old plain value for bc
|
|
'xi-api-key': `${getApiKey(auth.props.apiKey)}`,
|
|
})
|
|
},
|
|
}),
|
|
],
|
|
triggers: [],
|
|
});
|