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,95 @@
import { createAction, Property } from '@activepieces/pieces-framework';
import { HttpMethod } from '@activepieces/pieces-common';
import { documergeAuth } from '../common/auth';
import { DocuMergeClient } from '../common/client';
export const combineFiles = createAction({
auth: documergeAuth,
name: 'combine_files',
displayName: 'Combine Files',
description: 'Combine multiple files into a single PDF or DOCX',
props: {
output: Property.StaticDropdown({
displayName: 'Output Format',
description: 'The format of the combined file',
required: true,
options: {
options: [
{ label: 'PDF', value: 'pdf' },
{ label: 'DOCX', value: 'docx' },
],
},
}),
files: Property.Array({
displayName: 'Files',
description: 'Array of file identifiers to combine',
required: true,
}),
name: Property.ShortText({
displayName: 'Name',
description: 'Name for the combined file',
required: false,
}),
url: Property.ShortText({
displayName: 'URL',
description: 'URL of a file to include (must be a valid URL)',
required: false,
}),
contents: Property.LongText({
displayName: 'Contents',
description: 'Additional content to include',
required: false,
}),
},
async run(context) {
const { output, files, name, url, contents } = context.propsValue;
if (!files || files.length === 0) {
throw new Error('At least one file is required');
}
const client = new DocuMergeClient(context.auth.secret_text);
const body: Record<string, unknown> = {
output,
files: files.filter((f): f is string => typeof f === 'string'),
};
if (name) {
body['name'] = name;
}
if (url) {
body['url'] = url;
}
if (contents) {
body['contents'] = contents;
}
const fileData = await client.makeBinaryRequest(
HttpMethod.POST,
'/api/tools/combine',
body
);
const fileExtension = output === 'pdf' ? 'pdf' : 'docx';
const fileName = name
? `${name}.${fileExtension}`
: `combined_file_${Date.now()}.${fileExtension}`;
const fileUrl = await context.files.write({
fileName,
data: Buffer.from(fileData),
});
return {
success: true,
fileName,
fileUrl,
format: output,
size: fileData.byteLength,
};
},
});

View File

@@ -0,0 +1,75 @@
import { createAction, Property } from '@activepieces/pieces-framework';
import { HttpMethod } from '@activepieces/pieces-common';
import { documergeAuth } from '../common/auth';
import { DocuMergeClient } from '../common/client';
export const convertFileToPdf = createAction({
auth: documergeAuth,
name: 'convert_file_to_pdf',
displayName: 'Convert File to PDF',
description: 'Convert a given file to PDF',
props: {
fileName: Property.ShortText({
displayName: 'File Name',
description: 'Name of the file to convert',
required: true,
}),
fileUrl: Property.ShortText({
displayName: 'File URL',
description: 'URL of the file to convert (must be a valid URL)',
required: false,
}),
contents: Property.LongText({
displayName: 'Contents',
description: 'Additional content to include',
required: false,
}),
},
async run(context) {
const { fileName, fileUrl, contents } = context.propsValue;
if (!fileName) {
throw new Error('File name is required');
}
const client = new DocuMergeClient(context.auth.secret_text);
const body: Record<string, unknown> = {
file: {
name: fileName,
},
};
if (fileUrl) {
(body['file'] as Record<string, unknown>)['url'] = fileUrl;
}
if (contents) {
body['contents'] = contents;
}
const fileData = await client.makeBinaryRequest(
HttpMethod.POST,
'/api/tools/pdf/convert',
body
);
const pdfFileName = fileName.endsWith('.pdf')
? fileName
: `${fileName.replace(/\.[^/.]+$/, '')}.pdf`;
const fileUrlResult = await context.files.write({
fileName: pdfFileName,
data: Buffer.from(fileData),
});
return {
success: true,
fileName: pdfFileName,
fileUrl: fileUrlResult,
format: 'pdf',
size: fileData.byteLength,
};
},
});

View File

@@ -0,0 +1,40 @@
import { createAction, Property } from '@activepieces/pieces-framework';
import { HttpMethod } from '@activepieces/pieces-common';
import { documergeAuth } from '../common/auth';
import { DocuMergeClient } from '../common/client';
export const createDataRouteMerge = createAction({
auth: documergeAuth,
name: 'create_data_route_merge',
displayName: 'Create Data Route Merge',
description: 'Send data to your Data Route URL',
props: {
routeKey: Property.ShortText({
displayName: 'Route Key',
description: 'The key of the data route to merge',
required: true,
}),
fields: Property.Object({
displayName: 'Fields',
description: 'Field data to merge into the document',
required: false,
}),
},
async run(context) {
const { routeKey, fields } = context.propsValue;
if (!routeKey) {
throw new Error('Route key is required');
}
const client = new DocuMergeClient(context.auth.secret_text);
const response = await client.post<{ message: string }>(
`/api/routes/merge/${encodeURIComponent(routeKey)}`,
fields || {}
);
return response;
},
});

View File

@@ -0,0 +1,39 @@
import { createAction, Property } from '@activepieces/pieces-framework';
import { documergeAuth } from '../common/auth';
import { DocuMergeClient } from '../common/client';
export const createDocumentMerge = createAction({
auth: documergeAuth,
name: 'create_document_merge',
displayName: 'Create Document Merge',
description: 'Send data to your Merge URL',
props: {
documentKey: Property.ShortText({
displayName: 'Document Key',
description: 'The key of the document to merge',
required: true,
}),
fields: Property.Object({
displayName: 'Fields',
description: 'Field data to merge into the document',
required: false,
}),
},
async run(context) {
const { documentKey, fields } = context.propsValue;
if (!documentKey) {
throw new Error('Document key is required');
}
const client = new DocuMergeClient(context.auth.secret_text);
const response = await client.post<{ message: string }>(
`/api/documents/merge/${encodeURIComponent(documentKey)}`,
fields || {}
);
return response;
},
});

View File

@@ -0,0 +1,93 @@
import { createAction, Property } from '@activepieces/pieces-framework';
import { HttpMethod } from '@activepieces/pieces-common';
import { documergeAuth } from '../common/auth';
import { DocuMergeClient } from '../common/client';
export const splitPdf = createAction({
auth: documergeAuth,
name: 'split_pdf',
displayName: 'Split PDF',
description: 'Extract or remove specific pages from a PDF file',
props: {
fileName: Property.ShortText({
displayName: 'File Name',
description: 'Name of the PDF file',
required: true,
}),
fileUrl: Property.ShortText({
displayName: 'File URL',
description: 'URL of the PDF file (must be a valid URL)',
required: false,
}),
contents: Property.LongText({
displayName: 'Contents',
description: 'Base64 encoded file contents',
required: false,
}),
extract: Property.Array({
displayName: 'Pages to Extract',
description: 'Page numbers or ranges to extract (e.g., "1", "2-5", "1, 3-5")',
required: false,
}),
remove: Property.Array({
displayName: 'Pages to Remove',
description: 'Page numbers or ranges to remove (e.g., "1", "2-5", "1, 3-5")',
required: false,
}),
},
async run(context) {
const { fileName, fileUrl, contents, extract, remove } = context.propsValue;
if (!fileName) {
throw new Error('File name is required');
}
const client = new DocuMergeClient(context.auth.secret_text);
const body: Record<string, unknown> = {
file: {
name: fileName,
},
};
if (fileUrl) {
(body['file'] as Record<string, unknown>)['url'] = fileUrl;
}
if (contents) {
(body['file'] as Record<string, unknown>)['contents'] = contents;
}
if (extract && extract.length > 0) {
body['extract'] = extract.filter((e): e is string => typeof e === 'string');
}
if (remove && remove.length > 0) {
body['remove'] = remove.filter((r): r is string => typeof r === 'string');
}
const fileData = await client.makeBinaryRequest(
HttpMethod.POST,
'/api/tools/pdf/split',
body
);
const pdfFileName = fileName.endsWith('.pdf')
? fileName.replace('.pdf', '_split.pdf')
: `${fileName}_split.pdf`;
const fileUrlResult = await context.files.write({
fileName: pdfFileName,
data: Buffer.from(fileData),
});
return {
success: true,
fileName: pdfFileName,
fileUrl: fileUrlResult,
format: 'pdf',
size: fileData.byteLength,
};
},
});