Files
smoothschedule/activepieces-fork/packages/pieces/community/prompthub/src/index.ts
poduck 3aa7199503 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>
2025-12-18 22:59:37 -05:00

61 lines
1.6 KiB
TypeScript

import {
AuthenticationType,
HttpMethod,
createCustomApiCallAction,
httpClient,
} from '@activepieces/pieces-common';
import { PieceAuth, createPiece } from '@activepieces/pieces-framework';
import { listProjects } from './lib/actions/list-projects';
import { getProjectHead } from './lib/actions/get-project-head';
import { runPrompt } from './lib/actions/run-prompt';
export const prompthubAuth = PieceAuth.SecretText({
displayName: 'API Key',
description: 'PromptHub API token',
required: true,
validate: async (auth) => {
try {
await httpClient.sendRequest({
url: 'https://app.prompthub.us/api/v1/me',
method: HttpMethod.GET,
authentication: {
type: AuthenticationType.BEARER_TOKEN,
token: auth.auth as string,
},
timeout: 10000,
});
return { valid: true };
} catch (e) {
return {
valid: false,
error: 'Invalid API key or insufficient permissions',
};
}
},
});
export const prompthub = createPiece({
displayName: 'PromptHub',
description:
'Integrate with PromptHub projects, retrieve heads, and run prompts.',
auth: prompthubAuth,
minimumSupportedRelease: '0.63.0',
logoUrl: 'https://cdn.activepieces.com/pieces/prompthub.png',
authors: ['sparkybug'],
actions: [
listProjects,
getProjectHead,
runPrompt,
createCustomApiCallAction({
auth: prompthubAuth,
baseUrl: () => 'https://app.prompthub.us/api/v1',
authMapping: async (auth) => {
return {
authorization: `Bearer ${auth.secret_text}`,
};
},
}),
],
triggers: [],
});