Files
smoothschedule/activepieces-fork/packages/pieces/community/formbricks/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

93 lines
2.4 KiB
TypeScript

import {
createCustomApiCallAction,
httpClient,
HttpMethod,
} from '@activepieces/pieces-common';
import {
createPiece,
PieceAuth,
PiecePropValueSchema,
Property,
} from '@activepieces/pieces-framework';
import { PieceCategory } from '@activepieces/shared';
import { triggers } from './lib/triggers';
const markdownPropertyDescription = `
**Enable Basic Authentication:**
1. Login to your Formbricks account
2. On the top-right, click on your account dropdown
3. Select 'Product Settings'
4. On the left, select 'API Keys'
5. Click on 'Add Production API Key'
6. On the popup form, enter the 'API Key Label' to name the Key
7. Copy the API key and paste it below.
**APP URL:**
- The API URL for Formbricks example the cloud is at https://app.formbricks.com
- **Note: make sure there is no trailing slash and no /api**
`;
export type FormBricksAuthType = {
appUrl: string;
apiKey: string;
};
export const formBricksAuth = PieceAuth.CustomAuth({
required: true,
description: markdownPropertyDescription,
props: {
appUrl: Property.ShortText({
displayName: 'APP URL',
required: true,
defaultValue: 'https://app.formbricks.com',
}),
apiKey: Property.ShortText({
displayName: 'API Key',
required: true,
}),
},
validate: async ({ auth }) => {
try {
const authValue = auth as PiecePropValueSchema<typeof formBricksAuth>;
await httpClient.sendRequest({
method: HttpMethod.GET,
url: `${authValue.appUrl}/api/v1/management/me`,
headers: {
'x-api-key': authValue.apiKey,
},
});
return {
valid: true,
};
} catch (error) {
return {
valid: false,
error: 'Please provide correct APP URL and API key.',
};
}
},
});
export const formbricks = createPiece({
displayName: 'Formbricks',
description: 'Open source Survey Platform',
auth: formBricksAuth,
minimumSupportedRelease: '0.30.0',
logoUrl: 'https://cdn.activepieces.com/pieces/formbricks.png',
categories: [PieceCategory.BUSINESS_INTELLIGENCE],
authors: ['kanarelo', 'kishanprmr', 'MoShizzle', 'abuaboud'],
actions: [
createCustomApiCallAction({
auth: formBricksAuth,
authMapping: async (auth) => {
return {
'x-api-key': (auth.props).apiKey,
};
},
baseUrl: (auth) => `${(auth?.props?.appUrl ?? '')}/api/v1`,
}),
],
triggers,
});