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,61 @@
import { createAction, Property } from '@activepieces/pieces-framework';
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { chatsistantAuth } from '../common/auth';
import { makeRequest } from '../common/client';
export const sendMessage = createAction({
auth: chatsistantAuth,
name: 'sendMessage',
displayName: 'Send Message',
description: 'Send a message to a chatbot session',
props: {
chatbot_uuid: Property.ShortText({
displayName: 'Chatbot UUID',
description: 'The UUID of the chatbot to send the message to',
required: true,
}),
query: Property.LongText({
displayName: 'Message',
description: 'The message to send to the chatbot',
required: true,
}),
session_uuid: Property.ShortText({
displayName: 'Session UUID',
description: 'The UUID of the session to send the message to',
required: false,
}),
},
async run({ auth, propsValue }) {
const { chatbot_uuid, session_uuid, query } = propsValue;
if (!session_uuid) {
const response = await makeRequest(
auth.secret_text,
HttpMethod.POST,
`/chatbot/${chatbot_uuid}/session/create`,
{}
);
const session_id = response.uuid;
const messageResponse = await makeRequest(
auth.secret_text,
HttpMethod.POST,
`/session/${session_id}/message/stream`,
{
query,
}
);
return messageResponse;
} else {
const response = await makeRequest(
auth.secret_text,
HttpMethod.POST,
`/session/${session_uuid}/message/stream`,
{
query,
}
);
return response;
}
},
});

View File

@@ -0,0 +1,38 @@
import { HttpMethod } from '@activepieces/pieces-common';
import { PieceAuth } from '@activepieces/pieces-framework';
import { makeRequest } from './client';
export const chatsistantAuth = PieceAuth.SecretText({
displayName: 'Chatsistant API Key',
description: `
To get your API Key:
1. Go to [Chatsistant platform](https://app.chatsistant.com/)
2. Sign up or log in to your account
3. Click on the "Account" menu in the navigation bar
4. Navigate to the "API Keys" section
5. Click "Generate new key"
6. Enter a description for your key and click "Generate"
7. Copy and save your API key securely
`,
required: true,
validate: async ({ auth }) => {
if (auth) {
try {
await makeRequest(auth, HttpMethod.GET, '/chatbots', {});
return {
valid: true,
};
} catch (error) {
return {
valid: false,
error: 'Invalid Api Key',
};
}
}
return {
valid: false,
error: 'Invalid Api Key',
};
},
});

View File

@@ -0,0 +1,25 @@
import { HttpMethod, httpClient } from '@activepieces/pieces-common';
export const BASE_URL = `https://app.chatsistant.com/api/v1`;
export async function makeRequest(
api_key: string,
method: HttpMethod,
path: string,
body?: unknown
) {
try {
const response = await httpClient.sendRequest({
method,
url: `${BASE_URL}${path}`,
headers: {
Authorization: `Bearer ${api_key}`,
'Content-Type': 'application/json',
},
body,
});
return response.body;
} catch (error: any) {
throw new Error(`Unexpected error: ${error.message || String(error)}`);
}
}

View File

@@ -0,0 +1,44 @@
import {
createTrigger,
TriggerStrategy,
Property,
} from '@activepieces/pieces-framework';
import { chatsistantAuth } from '../common/auth';
export const formSubmission = createTrigger({
auth: chatsistantAuth,
name: 'formSubmission',
displayName: 'form submission',
description: 'Triggered when a form is submitted',
props: {
markdown: Property.MarkDown({
value: `## Chatsistant Webhook Setup
To use this trigger, you need to manually set up a webhook in your Chatsistant account:
1. Login to your Chatsistant account.
2. Navigate to **Customizations** tab on the left navigation menu.
3. Scroll down to **Webhook** and click to expand it.
4. Select the **Form Submission** event and specify the following URL:
\`\`\`text
{{webhookUrl}}
\`\`\`
5. Click Save to register the webhook.
`,
}),
},
sampleData: {
Email: 'test@gmail.com',
name: 'Test User',
session_uuid: 'cf014deb3b3b438d935f1ee7042ff66f',
},
type: TriggerStrategy.WEBHOOK,
async onEnable(context) {
// implement webhook creation logic
},
async onDisable(context) {
// implement webhook deletion logic
},
async run(context) {
return [context.payload.body];
},
});