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,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
|
||||
}
|
||||
Reference in New Issue
Block a user