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:
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"extends": [
|
||||
"../../../../.eslintrc.base.json"
|
||||
],
|
||||
"ignorePatterns": [
|
||||
"!**/*"
|
||||
],
|
||||
"overrides": [
|
||||
{
|
||||
"files": [
|
||||
"*.ts",
|
||||
"*.tsx",
|
||||
"*.js",
|
||||
"*.jsx"
|
||||
],
|
||||
"rules": {}
|
||||
},
|
||||
{
|
||||
"files": [
|
||||
"*.ts",
|
||||
"*.tsx"
|
||||
],
|
||||
"rules": {}
|
||||
},
|
||||
{
|
||||
"files": [
|
||||
"*.js",
|
||||
"*.jsx"
|
||||
],
|
||||
"rules": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
# pieces-documentpro
|
||||
|
||||
This library was generated with [Nx](https://nx.dev).
|
||||
|
||||
## Building
|
||||
|
||||
Run `nx build pieces-documentpro` to build the library.
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "@activepieces/piece-documentpro",
|
||||
"version": "0.0.1",
|
||||
"type": "commonjs",
|
||||
"main": "./src/index.js",
|
||||
"types": "./src/index.d.ts",
|
||||
"dependencies": {
|
||||
"tslib": "^2.3.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"name": "pieces-documentpro",
|
||||
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
|
||||
"sourceRoot": "packages/pieces/community/documentpro/src",
|
||||
"projectType": "library",
|
||||
"release": {
|
||||
"version": {
|
||||
"manifestRootsToUpdate": [
|
||||
"dist/{projectRoot}"
|
||||
],
|
||||
"currentVersionResolver": "git-tag",
|
||||
"fallbackCurrentVersionResolver": "disk"
|
||||
}
|
||||
},
|
||||
"tags": [],
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/js:tsc",
|
||||
"outputs": [
|
||||
"{options.outputPath}"
|
||||
],
|
||||
"options": {
|
||||
"outputPath": "dist/packages/pieces/community/documentpro",
|
||||
"tsConfig": "packages/pieces/community/documentpro/tsconfig.lib.json",
|
||||
"packageJson": "packages/pieces/community/documentpro/package.json",
|
||||
"main": "packages/pieces/community/documentpro/src/index.ts",
|
||||
"assets": [
|
||||
"packages/pieces/community/documentpro/*.md",
|
||||
{
|
||||
"input": "packages/pieces/community/documentpro/src/i18n",
|
||||
"output": "./src/i18n",
|
||||
"glob": "**/!(i18n.json)"
|
||||
}
|
||||
],
|
||||
"buildableProjectDepsInPackageJsonType": "dependencies",
|
||||
"updateBuildableProjectDepsInPackageJson": true
|
||||
},
|
||||
"dependsOn": [
|
||||
"prebuild",
|
||||
"^build"
|
||||
]
|
||||
},
|
||||
"nx-release-publish": {
|
||||
"options": {
|
||||
"packageRoot": "dist/{projectRoot}"
|
||||
}
|
||||
},
|
||||
"prebuild": {
|
||||
"dependsOn": [
|
||||
"^build"
|
||||
],
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
"cwd": "packages/pieces/community/documentpro",
|
||||
"command": "bun install --no-save --silent"
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nx/eslint:lint",
|
||||
"outputs": [
|
||||
"{options.outputFile}"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"DocumentPro is an AI-powered document processing platform that automates data extraction from various document types using advanced machine learning algorithms.": "DocumentPro is an AI-powered document processing platform that automates data extraction from various document types using advanced machine learning algorithms.",
|
||||
"\nTo get your DocumentPro API Key:\n\n1. **Login** to your DocumentPro account\n2. **Go to** https://app.documentpro.ai/workflows\n3. **Select** a workflow\n4. **Change tab** to \"Workflow\" from the top bar\n5. **Find** the \"Upload\" tab\n6. **Click** \"Upload via API\"\n7. **Click** the \"Generate API Key\" button\n8. **Copy** your API key and paste it here\n ": "\nTo get your DocumentPro API Key:\n\n1. **Login** to your DocumentPro account\n2. **Go to** https://app.documentpro.ai/workflows\n3. **Select** a workflow\n4. **Change tab** to \"Workflow\" from the top bar\n5. **Find** the \"Upload\" tab\n6. **Click** \"Upload via API\"\n7. **Click** the \"Generate API Key\" button\n8. **Copy** your API key and paste it here\n ",
|
||||
"Upload document": "Upload document",
|
||||
"Run Extract": "Run Extract",
|
||||
"Custom API Call": "Custom API Call",
|
||||
"Uploads a document to a DocumentPro parser": "Uploads a document to a DocumentPro parser",
|
||||
"Run an extract/workflow on an uploaded document": "Run an extract/workflow on an uploaded document",
|
||||
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
|
||||
"File": "File",
|
||||
"Document ID": "Document ID",
|
||||
"Template ID": "Template ID",
|
||||
"Use OCR": "Use OCR",
|
||||
"Query Model": "Query Model",
|
||||
"Detect Layout": "Detect Layout",
|
||||
"Detect Tables": "Detect Tables",
|
||||
"Page Ranges": "Page Ranges",
|
||||
"Chunk by Pages": "Chunk by Pages",
|
||||
"Rolling Window": "Rolling Window",
|
||||
"Start Regex": "Start Regex",
|
||||
"End Regex": "End Regex",
|
||||
"Split Regex": "Split Regex",
|
||||
"Use All Matches": "Use All Matches",
|
||||
"Method": "Method",
|
||||
"Headers": "Headers",
|
||||
"Query Parameters": "Query Parameters",
|
||||
"Body": "Body",
|
||||
"Response is Binary ?": "Response is Binary ?",
|
||||
"No Error on Failure": "No Error on Failure",
|
||||
"Timeout (in seconds)": "Timeout (in seconds)",
|
||||
"The document file to upload (PDF, JPEG, PNG, or TIFF, max 6MB)": "The document file to upload (PDF, JPEG, PNG, or TIFF, max 6MB)",
|
||||
"The unique identifier of the document to parse": "The unique identifier of the document to parse",
|
||||
"The unique identifier of the Workflow/template to use": "The unique identifier of the Workflow/template to use",
|
||||
"Enable OCR processing (required for gpt-3.5-turbo or OCR-related parameters)": "Enable OCR processing (required for gpt-3.5-turbo or OCR-related parameters)",
|
||||
"The AI model to use for parsing": "The AI model to use for parsing",
|
||||
"Detect document layout (requires use_ocr=true)": "Detect document layout (requires use_ocr=true)",
|
||||
"Detect tables in the document (requires use_ocr=true)": "Detect tables in the document (requires use_ocr=true)",
|
||||
"Specify which pages to parse (e.g., \"1-3,5,7-9\")": "Specify which pages to parse (e.g., \"1-3,5,7-9\")",
|
||||
"Number of pages per segment for method 1 segmentation": "Number of pages per segment for method 1 segmentation",
|
||||
"Window size for method 2 segmentation": "Window size for method 2 segmentation",
|
||||
"Regex pattern for where parsing should begin (requires use_ocr=true)": "Regex pattern for where parsing should begin (requires use_ocr=true)",
|
||||
"Regex pattern for where parsing should end (requires use_ocr=true)": "Regex pattern for where parsing should end (requires use_ocr=true)",
|
||||
"Regex pattern to split the document into sections (requires use_ocr=true)": "Regex pattern to split the document into sections (requires use_ocr=true)",
|
||||
"Use all regex matches instead of just the first (requires use_ocr=true)": "Use all regex matches instead of just the first (requires use_ocr=true)",
|
||||
"Authorization headers are injected automatically from your connection.": "Authorization headers are injected automatically from your connection.",
|
||||
"Enable for files like PDFs, images, etc..": "Enable for files like PDFs, images, etc..",
|
||||
"GPT-4o Mini": "GPT-4o Mini",
|
||||
"GPT-4o": "GPT-4o",
|
||||
"GPT-3.5 Turbo": "GPT-3.5 Turbo",
|
||||
"GET": "GET",
|
||||
"POST": "POST",
|
||||
"PATCH": "PATCH",
|
||||
"PUT": "PUT",
|
||||
"DELETE": "DELETE",
|
||||
"HEAD": "HEAD",
|
||||
"New Document": "New Document",
|
||||
"Triggers when a new document is uploaded to DocumentPro": "Triggers when a new document is uploaded to DocumentPro",
|
||||
"Markdown": "Markdown",
|
||||
"\n**In DocumentPro Dashboard:**\n - Navigate to your desired Workflow\n - Go to the \"Workflow\" tab\n - Find the \"Webhook Notification\" option in the export section\n - Set the Webhook Endpoint URL to:\n ```text\n\t\t\t{{webhookUrl}}\n\t\t\t```\n - Click Save\n\n ": "\n**In DocumentPro Dashboard:**\n - Navigate to your desired Workflow\n - Go to the \"Workflow\" tab\n - Find the \"Webhook Notification\" option in the export section\n - Set the Webhook Endpoint URL to:\n ```text\n\t\t\t{{webhookUrl}}\n\t\t\t```\n - Click Save\n\n "
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
import { createPiece } from '@activepieces/pieces-framework';
|
||||
import { documentproAuth } from './lib/common/auth';
|
||||
import { uploaddocument } from './lib/actions/upload-document';
|
||||
import { runExtract } from './lib/actions/run-extract';
|
||||
import { newDocument } from './lib/triggers/new-document';
|
||||
import { PieceCategory } from '@activepieces/shared';
|
||||
import { createCustomApiCallAction } from '@activepieces/pieces-common';
|
||||
export const documentpro = createPiece({
|
||||
displayName: 'DocumentPro',
|
||||
auth: documentproAuth,
|
||||
minimumSupportedRelease: '0.36.1',
|
||||
logoUrl: 'https://cdn.activepieces.com/pieces/documentpro.png',
|
||||
description:
|
||||
'DocumentPro is an AI-powered document processing platform that automates data extraction from various document types using advanced machine learning algorithms.',
|
||||
categories: [PieceCategory.ARTIFICIAL_INTELLIGENCE],
|
||||
authors: ['sanket-a11y'],
|
||||
actions: [
|
||||
uploaddocument,
|
||||
runExtract,
|
||||
createCustomApiCallAction({
|
||||
auth: documentproAuth,
|
||||
baseUrl: () => 'https://api.documentpro.ai/v1',
|
||||
authMapping: async (auth) => {
|
||||
return {
|
||||
'x-api-key': `${auth.secret_text}`,
|
||||
};
|
||||
},
|
||||
}),
|
||||
],
|
||||
triggers: [newDocument],
|
||||
});
|
||||
@@ -0,0 +1,152 @@
|
||||
import { createAction, Property } from '@activepieces/pieces-framework';
|
||||
import { HttpMethod, httpClient } from '@activepieces/pieces-common';
|
||||
import { documentproAuth } from '../common/auth';
|
||||
|
||||
export const runExtract = createAction({
|
||||
auth: documentproAuth,
|
||||
name: 'runExtract',
|
||||
displayName: 'Run Extract',
|
||||
description: 'Run an extract/workflow on an uploaded document',
|
||||
props: {
|
||||
document_id: Property.ShortText({
|
||||
displayName: 'Document ID',
|
||||
description: 'The unique identifier of the document to parse',
|
||||
required: true,
|
||||
}),
|
||||
template_id: Property.ShortText({
|
||||
displayName: 'Template ID',
|
||||
description: 'The unique identifier of the Workflow/template to use',
|
||||
required: true,
|
||||
}),
|
||||
use_ocr: Property.Checkbox({
|
||||
displayName: 'Use OCR',
|
||||
description:
|
||||
'Enable OCR processing (required for gpt-3.5-turbo or OCR-related parameters)',
|
||||
required: false,
|
||||
defaultValue: false,
|
||||
}),
|
||||
query_model: Property.StaticDropdown({
|
||||
displayName: 'Query Model',
|
||||
description: 'The AI model to use for parsing',
|
||||
required: false,
|
||||
defaultValue: 'gpt-4o-mini',
|
||||
options: {
|
||||
options: [
|
||||
{ label: 'GPT-4o Mini', value: 'gpt-4o-mini' },
|
||||
{ label: 'GPT-4o', value: 'gpt-4o' },
|
||||
{ label: 'GPT-3.5 Turbo', value: 'gpt-3.5-turbo' },
|
||||
],
|
||||
},
|
||||
}),
|
||||
detect_layout: Property.Checkbox({
|
||||
displayName: 'Detect Layout',
|
||||
description: 'Detect document layout (requires use_ocr=true)',
|
||||
required: false,
|
||||
defaultValue: false,
|
||||
}),
|
||||
detect_tables: Property.Checkbox({
|
||||
displayName: 'Detect Tables',
|
||||
description: 'Detect tables in the document (requires use_ocr=true)',
|
||||
required: false,
|
||||
defaultValue: false,
|
||||
}),
|
||||
page_ranges: Property.ShortText({
|
||||
displayName: 'Page Ranges',
|
||||
description: 'Specify which pages to parse (e.g., "1-3,5,7-9")',
|
||||
required: false,
|
||||
}),
|
||||
chunk_by_pages: Property.Number({
|
||||
displayName: 'Chunk by Pages',
|
||||
description: 'Number of pages per segment for method 1 segmentation',
|
||||
required: false,
|
||||
}),
|
||||
rolling_window: Property.Number({
|
||||
displayName: 'Rolling Window',
|
||||
description: 'Window size for method 2 segmentation',
|
||||
required: false,
|
||||
}),
|
||||
start_regex: Property.ShortText({
|
||||
displayName: 'Start Regex',
|
||||
description:
|
||||
'Regex pattern for where parsing should begin (requires use_ocr=true)',
|
||||
required: false,
|
||||
}),
|
||||
end_regex: Property.ShortText({
|
||||
displayName: 'End Regex',
|
||||
description:
|
||||
'Regex pattern for where parsing should end (requires use_ocr=true)',
|
||||
required: false,
|
||||
}),
|
||||
split_regex: Property.ShortText({
|
||||
displayName: 'Split Regex',
|
||||
description:
|
||||
'Regex pattern to split the document into sections (requires use_ocr=true)',
|
||||
required: false,
|
||||
}),
|
||||
use_all_matches: Property.Checkbox({
|
||||
displayName: 'Use All Matches',
|
||||
description:
|
||||
'Use all regex matches instead of just the first (requires use_ocr=true)',
|
||||
required: false,
|
||||
defaultValue: false,
|
||||
}),
|
||||
},
|
||||
async run(context) {
|
||||
const params = new URLSearchParams();
|
||||
|
||||
params.append('template_id', context.propsValue.template_id);
|
||||
|
||||
if (context.propsValue.use_ocr) {
|
||||
params.append('use_ocr', 'true');
|
||||
}
|
||||
if (context.propsValue.query_model) {
|
||||
params.append('query_model', context.propsValue.query_model);
|
||||
}
|
||||
if (context.propsValue.detect_layout) {
|
||||
params.append('detect_layout', 'true');
|
||||
}
|
||||
if (context.propsValue.detect_tables) {
|
||||
params.append('detect_tables', 'true');
|
||||
}
|
||||
if (context.propsValue.page_ranges) {
|
||||
params.append('page_ranges', context.propsValue.page_ranges);
|
||||
}
|
||||
if (context.propsValue.chunk_by_pages) {
|
||||
params.append(
|
||||
'chunk_by_pages',
|
||||
context.propsValue.chunk_by_pages.toString()
|
||||
);
|
||||
}
|
||||
if (context.propsValue.rolling_window) {
|
||||
params.append(
|
||||
'rolling_window',
|
||||
context.propsValue.rolling_window.toString()
|
||||
);
|
||||
}
|
||||
if (context.propsValue.start_regex) {
|
||||
params.append('start_regex', context.propsValue.start_regex);
|
||||
}
|
||||
if (context.propsValue.end_regex) {
|
||||
params.append('end_regex', context.propsValue.end_regex);
|
||||
}
|
||||
if (context.propsValue.split_regex) {
|
||||
params.append('split_regex', context.propsValue.split_regex);
|
||||
}
|
||||
if (context.propsValue.use_all_matches) {
|
||||
params.append('use_all_matches', 'true');
|
||||
}
|
||||
|
||||
const response = await httpClient.sendRequest({
|
||||
method: HttpMethod.GET,
|
||||
url: `https://api.documentpro.ai/v1/documents/${
|
||||
context.propsValue.document_id
|
||||
}/run_parser?${params.toString()}`,
|
||||
headers: {
|
||||
'x-api-key': context.auth.secret_text,
|
||||
Accept: 'application/json',
|
||||
},
|
||||
});
|
||||
|
||||
return response.body;
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,39 @@
|
||||
import { createAction, Property } from '@activepieces/pieces-framework';
|
||||
import { HttpMethod, httpClient } from '@activepieces/pieces-common';
|
||||
import { documentproAuth } from '../common/auth';
|
||||
|
||||
export const uploaddocument = createAction({
|
||||
auth: documentproAuth,
|
||||
name: 'uploadDocument',
|
||||
displayName: 'Upload document',
|
||||
description: 'Uploads a document to a DocumentPro parser',
|
||||
props: {
|
||||
file: Property.File({
|
||||
displayName: 'File',
|
||||
description:
|
||||
'The document file to upload (PDF, JPEG, PNG, or TIFF, max 6MB)',
|
||||
required: true,
|
||||
}),
|
||||
},
|
||||
async run(context) {
|
||||
const file = context.propsValue.file;
|
||||
|
||||
const formData = new FormData();
|
||||
const fileBuffer = Buffer.from(file.base64, 'base64');
|
||||
const mimeType = file.extension ? `application/${file.extension}` : 'application/octet-stream';
|
||||
const blob = new Blob([fileBuffer], { type: mimeType });
|
||||
formData.append('file', blob, file.filename);
|
||||
|
||||
const response = await httpClient.sendRequest({
|
||||
method: HttpMethod.POST,
|
||||
url: 'https://api.documentpro.ai/v1/documents',
|
||||
headers: {
|
||||
'x-api-key': context.auth.secret_text,
|
||||
'Content-Type': 'multipart/form-data',
|
||||
},
|
||||
body: formData,
|
||||
});
|
||||
|
||||
return response.body;
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,18 @@
|
||||
import { PieceAuth } from '@activepieces/pieces-framework';
|
||||
|
||||
export const documentproAuth = PieceAuth.SecretText({
|
||||
displayName: 'API Key',
|
||||
description: `
|
||||
To get your DocumentPro API Key:
|
||||
|
||||
1. **Login** to your DocumentPro account
|
||||
2. **Go to** https://app.documentpro.ai/workflows
|
||||
3. **Select** a workflow
|
||||
4. **Change tab** to "Workflow" from the top bar
|
||||
5. **Find** the "Upload" tab
|
||||
6. **Click** "Upload via API"
|
||||
7. **Click** the "Generate API Key" button
|
||||
8. **Copy** your API key and paste it here
|
||||
`,
|
||||
required: true,
|
||||
});
|
||||
@@ -0,0 +1,58 @@
|
||||
import {
|
||||
createTrigger,
|
||||
TriggerStrategy,
|
||||
Property,
|
||||
} from '@activepieces/pieces-framework';
|
||||
import { documentproAuth } from '../common/auth';
|
||||
|
||||
export const newDocument = createTrigger({
|
||||
auth: documentproAuth,
|
||||
name: 'newDocument',
|
||||
displayName: 'New Document',
|
||||
description: 'Triggers when a new document is uploaded to DocumentPro',
|
||||
props: {
|
||||
webhook_info: Property.MarkDown({
|
||||
value: `
|
||||
**In DocumentPro Dashboard:**
|
||||
- Navigate to your desired Workflow
|
||||
- Go to the "Workflow" tab
|
||||
- Find the "Webhook Notification" option in the export section
|
||||
- Set the Webhook Endpoint URL to:
|
||||
\`\`\`text
|
||||
{{webhookUrl}}
|
||||
\`\`\`
|
||||
- Click Save
|
||||
|
||||
`,
|
||||
}),
|
||||
},
|
||||
sampleData: {
|
||||
event: 'file_request_status_change',
|
||||
timestamp: '2024-07-25T14:30:29.565249',
|
||||
data: {
|
||||
request_id: 'a7813466-6f9a-4c33-8128-427e7a4df755',
|
||||
request_status: 'completed',
|
||||
response_body: {
|
||||
file_name: 'sample_document.pdf',
|
||||
template_id: '8e9beda9-5cba-42eb-a70a-b3e5eec9120a',
|
||||
template_title: 'Sample Parser',
|
||||
num_pages: 5,
|
||||
result_json_data: {
|
||||
field1: 'value1',
|
||||
field2: 'value2',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
type: TriggerStrategy.WEBHOOK,
|
||||
async onEnable(context) {
|
||||
// Webhook URL is automatically provided by Activepieces
|
||||
// User needs to manually configure the webhook URL in DocumentPro dashboard
|
||||
},
|
||||
async onDisable(context) {
|
||||
// User should remove webhook from DocumentPro dashboard
|
||||
},
|
||||
async run(context) {
|
||||
return [context.payload.body];
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"extends": "../../../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strict": true,
|
||||
"importHelpers": true,
|
||||
"noImplicitOverride": true,
|
||||
"noImplicitReturns": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noPropertyAccessFromIndexSignature": true
|
||||
},
|
||||
"files": [],
|
||||
"include": [],
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.lib.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../../../dist/out-tsc",
|
||||
"declaration": true,
|
||||
"types": ["node"]
|
||||
},
|
||||
"include": ["src/**/*.ts"]
|
||||
}
|
||||
Reference in New Issue
Block a user