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-doctly
|
||||
|
||||
This library was generated with [Nx](https://nx.dev).
|
||||
|
||||
## Building
|
||||
|
||||
Run `nx build pieces-doctly` to build the library.
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "@activepieces/piece-doctly",
|
||||
"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-doctly",
|
||||
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
|
||||
"sourceRoot": "packages/pieces/community/doctly/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/doctly",
|
||||
"tsConfig": "packages/pieces/community/doctly/tsconfig.lib.json",
|
||||
"packageJson": "packages/pieces/community/doctly/package.json",
|
||||
"main": "packages/pieces/community/doctly/src/index.ts",
|
||||
"assets": [
|
||||
"packages/pieces/community/doctly/*.md",
|
||||
{
|
||||
"input": "packages/pieces/community/doctly/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/doctly",
|
||||
"command": "bun install --no-save --silent"
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nx/eslint:lint",
|
||||
"outputs": [
|
||||
"{options.outputFile}"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"You can obtain API key from [API Settings](https://doctly.ai/keys).": "You can obtain API key from [API Settings](https://doctly.ai/keys).",
|
||||
"Convert PDF to Text": "Convert PDF to Text",
|
||||
"Custom API Call": "Custom API Call",
|
||||
"Converts PDF document to text file with markdown formatting.": "Converts PDF document to text file with markdown formatting.",
|
||||
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
|
||||
"Document File": "Document File",
|
||||
"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)",
|
||||
"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..",
|
||||
"GET": "GET",
|
||||
"POST": "POST",
|
||||
"PATCH": "PATCH",
|
||||
"PUT": "PUT",
|
||||
"DELETE": "DELETE",
|
||||
"HEAD": "HEAD"
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import { createPiece } from '@activepieces/pieces-framework';
|
||||
import { doctlyAuth } from './lib/common/auth';
|
||||
import { PieceCategory } from '@activepieces/shared';
|
||||
import { convertPdfToTextAction } from './lib/actions/convert-pdf-to-text';
|
||||
import { createCustomApiCallAction } from '@activepieces/pieces-common';
|
||||
import { BASE_URL } from './lib/common/constants';
|
||||
|
||||
export const doctly = createPiece({
|
||||
displayName: 'Doctly AI',
|
||||
auth: doctlyAuth,
|
||||
minimumSupportedRelease: '0.36.1',
|
||||
logoUrl: 'https://cdn.activepieces.com/pieces/doctly.png',
|
||||
categories: [PieceCategory.ARTIFICIAL_INTELLIGENCE],
|
||||
authors: ['kishanprmr'],
|
||||
actions: [
|
||||
convertPdfToTextAction,
|
||||
createCustomApiCallAction({
|
||||
auth: doctlyAuth,
|
||||
baseUrl: () => BASE_URL,
|
||||
authMapping: async (auth) => {
|
||||
return {
|
||||
Authorization: `Bearer ${auth.secret_text}`,
|
||||
};
|
||||
},
|
||||
}),
|
||||
],
|
||||
triggers: [],
|
||||
});
|
||||
@@ -0,0 +1,70 @@
|
||||
import { createAction, Property } from '@activepieces/pieces-framework';
|
||||
import { doctlyAuth } from '../common/auth';
|
||||
import FormData from 'form-data';
|
||||
import { AuthenticationType, httpClient, HttpMethod } from '@activepieces/pieces-common';
|
||||
import { BASE_URL } from '../common/constants';
|
||||
import { CreateDocumentResponse, GetDocumentResponse } from '../common/types';
|
||||
|
||||
export const convertPdfToTextAction = createAction({
|
||||
name: 'convert-pdf-to-text',
|
||||
auth: doctlyAuth,
|
||||
displayName: 'Convert PDF to Text',
|
||||
description: 'Converts PDF document to text file with markdown formatting.',
|
||||
props: {
|
||||
file: Property.File({
|
||||
displayName: 'Document File',
|
||||
required: true,
|
||||
}),
|
||||
},
|
||||
async run(context) {
|
||||
const { file } = context.propsValue;
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append('file', file.data, { filename: file.filename });
|
||||
|
||||
const response = await httpClient.sendRequest<CreateDocumentResponse>({
|
||||
method: HttpMethod.POST,
|
||||
url: BASE_URL + '/documents/',
|
||||
authentication: {
|
||||
type: AuthenticationType.BEARER_TOKEN,
|
||||
token: context.auth.secret_text,
|
||||
},
|
||||
headers: {
|
||||
...formData.getHeaders(),
|
||||
},
|
||||
body: formData,
|
||||
});
|
||||
|
||||
const docId = response.body.id;
|
||||
let status = response.body.status;
|
||||
const timeoutAt = Date.now() + 5 * 60 * 1000;
|
||||
|
||||
while (!['COMPLETED', 'FAILED'].includes(status) && Date.now() < timeoutAt) {
|
||||
await new Promise((resolve) => setTimeout(resolve, 5000));
|
||||
|
||||
const pollResponse = await httpClient.sendRequest<GetDocumentResponse>({
|
||||
method: HttpMethod.GET,
|
||||
url: BASE_URL + `/documents/${docId}`,
|
||||
authentication: {
|
||||
type: AuthenticationType.BEARER_TOKEN,
|
||||
token: context.auth.secret_text,
|
||||
},
|
||||
});
|
||||
|
||||
status = pollResponse.body.status;
|
||||
|
||||
if (status === 'COMPLETED') {
|
||||
const mdResponse = await httpClient.sendRequest({
|
||||
method: HttpMethod.GET,
|
||||
url: pollResponse.body.output_file_url,
|
||||
});
|
||||
|
||||
const markdownText = mdResponse.body as unknown as string;
|
||||
|
||||
return { markdownText, ...pollResponse.body };
|
||||
}
|
||||
if (status === 'FAILED') throw new Error('Document processing failed.');
|
||||
}
|
||||
throw new Error('Document Parse timed out or failed.');
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,7 @@
|
||||
import { PieceAuth } from "@activepieces/pieces-framework";
|
||||
|
||||
export const doctlyAuth = PieceAuth.SecretText({
|
||||
displayName:'API Key',
|
||||
required:true,
|
||||
description:`You can obtain API key from [API Settings](https://doctly.ai/keys).`
|
||||
})
|
||||
@@ -0,0 +1 @@
|
||||
export const BASE_URL = 'https://api.doctly.ai/api/v1'
|
||||
@@ -0,0 +1,12 @@
|
||||
export type CreateDocumentResponse = {
|
||||
id:string,
|
||||
file_name:string,
|
||||
status:string
|
||||
}
|
||||
|
||||
export type GetDocumentResponse = {
|
||||
id:string,
|
||||
file_name:string,
|
||||
status:string,
|
||||
output_file_url:string
|
||||
}
|
||||
@@ -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