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:
poduck
2025-12-18 22:59:37 -05:00
parent 9848268d34
commit 3aa7199503
16292 changed files with 1284892 additions and 4708 deletions

View File

@@ -0,0 +1,30 @@
import { PieceAuth, Property } from '@activepieces/pieces-framework';
export const websocketCommon = {
connectionType: "websocket",
auth: PieceAuth.CustomAuth({
required: true,
props: {
proxyBaseUrl: Property.ShortText({
displayName: 'AnyHook Server URL',
description: 'The URL of your AnyHook server',
required: true,
defaultValue: 'http://10.0.0.101:3001'
}),
},
}),
apiCall: async function (
url: string,
method: string,
data: object | undefined = undefined
) {
const response = await fetch(url, {
method,
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(data),
});
return response.json();
},
};

View File

@@ -0,0 +1,31 @@
import { websocketCommon } from '../common/common';
export async function createWebsocketSubscription(
websocketUrl: string,
headers: Record<string, unknown> | undefined,
message: Record<string, unknown>,
webhookUrl: string,
proxyBaseUrl: string
) {
const subscriptionApiUrl = `${proxyBaseUrl}/subscribe`;
const data = {
connection_type: websocketCommon.connectionType,
webhook_url: webhookUrl,
args: {
endpoint_url: websocketUrl,
headers: headers ? JSON.stringify(headers) : undefined,
message,
},
};
const response = await websocketCommon.apiCall(subscriptionApiUrl, 'POST', data);
return response;
}
export async function deleteWebsocketSubscription(subscriptionId: string, proxyBaseUrl: string) {
const deleteApiUrl = `${proxyBaseUrl}/unsubscribe`;
const data = {
subscription_id: subscriptionId,
};
const response = await websocketCommon.apiCall(deleteApiUrl, 'POST', data);
return response;
}

View File

@@ -0,0 +1,66 @@
import { TriggerStrategy, createTrigger, PieceAuth, Property } from '@activepieces/pieces-framework';
import { createWebsocketSubscription, deleteWebsocketSubscription } from './helpers';
import { websocketCommon } from '../common/common';
export const websocketSubscriptionTrigger = createTrigger({
auth: websocketCommon.auth,
name: 'websocket_subscription_trigger',
displayName: 'New Websocket Subscription Event',
description: 'Triggers on a new Websocket subscription event',
type: TriggerStrategy.WEBHOOK,
props: {
websocketUrl: Property.ShortText({
displayName: 'Endpoint URL',
description: 'Websocket endpoint URL to connect to.',
required: true,
defaultValue: 'wss://testnets-stream.openseabeta.com/socket/websocket?token=xxxx',
}),
headers: Property.Object({
displayName: 'Headers',
description: 'Custom headers for the Websocket connection, such as authentication tokens.',
required: false
}),
message: Property.Json({
displayName: 'Subscription Message',
description: 'The message to send to the Websocket server to subscribe to events.',
required: true,
defaultValue: {
"topic": "collection:boredapeyachtclub",
"event": "phx_join",
"payload": {},
"ref": 0
}
}),
},
async onEnable(context) {
const subscriptionInfo = await createWebsocketSubscription(
context.propsValue.websocketUrl,
context.propsValue.headers,
context.propsValue.message,
context.webhookUrl,
context.auth.props.proxyBaseUrl
);
// Store subscription info
await context.store.put('websocket_subscription_trigger', subscriptionInfo.subscriptionId);
},
async onDisable(context) {
const subscriptionId: string = (await context.store.get('websocket_subscription_trigger')) as string;
if (subscriptionId) {
await deleteWebsocketSubscription(subscriptionId, context.auth.props.proxyBaseUrl);
await context.store.delete('websocket_subscription_trigger');
}
},
async run(context) {
return [context.payload.body];
},
async test(context) {
return [
{
event: 'Websocket event data',
details: 'Details of the event',
},
];
},
sampleData: {},
});