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,18 @@
{
"extends": ["../../../../.eslintrc.base.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}

View File

@@ -0,0 +1,7 @@
# pieces-pdfmonkey
This library was generated with [Nx](https://nx.dev).
## Building
Run `nx build pieces-pdfmonkey` to build the library.

View File

@@ -0,0 +1,10 @@
{
"name": "@activepieces/piece-pdfmonkey",
"version": "0.0.9",
"type": "commonjs",
"main": "./src/index.js",
"types": "./src/index.d.ts",
"dependencies": {
"tslib": "^2.3.0"
}
}

View File

@@ -0,0 +1,65 @@
{
"name": "pieces-pdfmonkey",
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/pieces/community/pdfmonkey/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/pdfmonkey",
"tsConfig": "packages/pieces/community/pdfmonkey/tsconfig.lib.json",
"packageJson": "packages/pieces/community/pdfmonkey/package.json",
"main": "packages/pieces/community/pdfmonkey/src/index.ts",
"assets": [
"packages/pieces/community/pdfmonkey/*.md",
{
"input": "packages/pieces/community/pdfmonkey/src/i18n",
"output": "./src/i18n",
"glob": "**/!(i18n.json)"
}
],
"buildableProjectDepsInPackageJsonType": "dependencies",
"updateBuildableProjectDepsInPackageJson": true
},
"dependsOn": [
"^build",
"prebuild"
]
},
"nx-release-publish": {
"options": {
"packageRoot": "dist/{projectRoot}"
}
},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": [
"{options.outputFile}"
]
},
"prebuild": {
"executor": "nx:run-commands",
"options": {
"cwd": "packages/pieces/community/pdfmonkey",
"command": "bun install --no-save --silent"
},
"dependsOn": [
"^build"
]
}
}
}

View File

@@ -0,0 +1,38 @@
{
"You can obtain your API key by navigating to [Account Settings](https://dashboard.pdfmonkey.io/account).": "Du kannst deinen API-Schlüssel über [Kontoeinstellungen](https://dashboard.pdfmonkey.io/account ) erhalten.",
"Generate Document": "Dokument generieren",
"Delete Document": "Dokument löschen",
"Find Document": "Dokument finden",
"Custom API Call": "Eigener API-Aufruf",
"Generates a new document using a specified template.": "Erzeugt ein neues Dokument mit einer bestimmten Vorlage.",
"Deletes a document.": "Löscht ein Dokument.",
"Finds a document by ID.": "Findet ein Dokument nach ID.",
"Make a custom API call to a specific endpoint": "Einen benutzerdefinierten API-Aufruf an einen bestimmten Endpunkt machen",
"Template ID": "Template-ID",
"Payload": "Nutzlast",
"Meta": "Meta",
"Custom File Name": "Eigener Dateiname",
"Document Status": "Dokumentstatus",
"Document ID": "Dokument-ID",
"Method": "Methode",
"Headers": "Kopfzeilen",
"Query Parameters": "Abfrageparameter",
"Body": "Körper",
"Response is Binary ?": "Antwort ist binär?",
"No Error on Failure": "Kein Fehler bei Fehler",
"Timeout (in seconds)": "Timeout (in Sekunden)",
"Data to use for the Document generation.": "Zu verwendende Daten für die Dokumentenerstellung.",
"Meta-Data to attach to the Document.": "Metadaten zum Anhängen an das Dokument.",
"Authorization headers are injected automatically from your connection.": "Autorisierungs-Header werden automatisch von Ihrer Verbindung injiziert.",
"Enable for files like PDFs, images, etc..": "Aktivieren für Dateien wie PDFs, Bilder, etc..",
"Draft": "Entwurf",
"Pending": "Ausstehend",
"GET": "ERHALTEN",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "LÖSCHEN",
"HEAD": "HEAD",
"Document Generated": "Dokument generiert",
"Triggers when a document generation completes successfully.": "Wird ausgelöst, wenn ein Dokument erfolgreich erstellt wurde."
}

View File

@@ -0,0 +1,38 @@
{
"You can obtain your API key by navigating to [Account Settings](https://dashboard.pdfmonkey.io/account).": "Puedes obtener tu clave API navegando a [Configuración de la cuenta](https://dashboard.pdfmonkey.io/account).",
"Generate Document": "Generar documento",
"Delete Document": "Eliminar Documento",
"Find Document": "Buscar documento",
"Custom API Call": "Llamada API personalizada",
"Generates a new document using a specified template.": "Genera un nuevo documento usando una plantilla especificada.",
"Deletes a document.": "Elimina un documento.",
"Finds a document by ID.": "Encuentra un documento por ID.",
"Make a custom API call to a specific endpoint": "Hacer una llamada API personalizada a un extremo específico",
"Template ID": "ID de plantilla",
"Payload": "Carga útil",
"Meta": "Meta",
"Custom File Name": "Nombre de archivo personalizado",
"Document Status": "Estado del documento",
"Document ID": "ID del documento",
"Method": "Método",
"Headers": "Encabezados",
"Query Parameters": "Parámetros de consulta",
"Body": "Cuerpo",
"Response is Binary ?": "¿Respuesta es binaria?",
"No Error on Failure": "No hay ningún error en fallo",
"Timeout (in seconds)": "Tiempo de espera (en segundos)",
"Data to use for the Document generation.": "Datos a utilizar para la generación de documentos.",
"Meta-Data to attach to the Document.": "Meta-Datos para adjuntar al documento.",
"Authorization headers are injected automatically from your connection.": "Las cabeceras de autorización se inyectan automáticamente desde tu conexión.",
"Enable for files like PDFs, images, etc..": "Activar para archivos como PDFs, imágenes, etc.",
"Draft": "Borrador",
"Pending": "Pendiente",
"GET": "RECOGER",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "BORRAR",
"HEAD": "LIMPIO",
"Document Generated": "Documento generado",
"Triggers when a document generation completes successfully.": "Se activa cuando una generación de documentos se completa con éxito."
}

View File

@@ -0,0 +1,38 @@
{
"You can obtain your API key by navigating to [Account Settings](https://dashboard.pdfmonkey.io/account).": "Vous pouvez obtenir votre clé API en accédant à [Paramètres du compte](https://dashboard.pdfmonkey.io/account).",
"Generate Document": "Générer un document",
"Delete Document": "Supprimer le document",
"Find Document": "Trouver un document",
"Custom API Call": "Appel API personnalisé",
"Generates a new document using a specified template.": "Génère un nouveau document en utilisant un modèle spécifié.",
"Deletes a document.": "Supprime un document.",
"Finds a document by ID.": "Trouve un document par ID.",
"Make a custom API call to a specific endpoint": "Passez un appel API personnalisé à un point de terminaison spécifique",
"Template ID": "ID du modèle",
"Payload": "Charge utile",
"Meta": "Meta",
"Custom File Name": "Nom du fichier personnalisé",
"Document Status": "Statut du document",
"Document ID": "ID du document",
"Method": "Méthode",
"Headers": "En-têtes",
"Query Parameters": "Paramètres de requête",
"Body": "Corps",
"Response is Binary ?": "La réponse est Binaire ?",
"No Error on Failure": "Aucune erreur en cas d'échec",
"Timeout (in seconds)": "Délai d'attente (en secondes)",
"Data to use for the Document generation.": "Données à utiliser pour la génération du document.",
"Meta-Data to attach to the Document.": "Meta-Données à joindre au Document.",
"Authorization headers are injected automatically from your connection.": "Les en-têtes d'autorisation sont injectés automatiquement à partir de votre connexion.",
"Enable for files like PDFs, images, etc..": "Activer pour les fichiers comme les PDFs, les images, etc.",
"Draft": "Brouillon",
"Pending": "En attente",
"GET": "OBTENIR",
"POST": "POSTER",
"PATCH": "PATCH",
"PUT": "EFFACER",
"DELETE": "SUPPRIMER",
"HEAD": "TÊTE",
"Document Generated": "Document généré",
"Triggers when a document generation completes successfully.": "Déclenche quand une génération de document se termine avec succès."
}

View File

@@ -0,0 +1,38 @@
{
"You can obtain your API key by navigating to [Account Settings](https://dashboard.pdfmonkey.io/account).": "[アカウント設定](https://dashboard.pdfmonkey.io/account)に移動すると、APIキーを取得できます。",
"Generate Document": "ドキュメントの生成",
"Delete Document": "ドキュメントの削除",
"Find Document": "ドキュメントを検索",
"Custom API Call": "カスタムAPI通話",
"Generates a new document using a specified template.": "指定したテンプレートを使用して新規ドキュメントを生成します。",
"Deletes a document.": "ドキュメントを削除します",
"Finds a document by ID.": "ID でドキュメントを検索します。",
"Make a custom API call to a specific endpoint": "特定のエンドポイントへのカスタム API コールを実行します。",
"Template ID": "テンプレートID",
"Payload": "積載量",
"Meta": "Meta",
"Custom File Name": "カスタムファイル名",
"Document Status": "ドキュメントの状態",
"Document ID": "ドキュメントID",
"Method": "方法",
"Headers": "ヘッダー",
"Query Parameters": "クエリパラメータ",
"Body": "本文",
"Response is Binary ?": "応答はバイナリですか?",
"No Error on Failure": "失敗時にエラーはありません",
"Timeout (in seconds)": "タイムアウト(秒)",
"Data to use for the Document generation.": "ドキュメントの生成に使用するデータ。",
"Meta-Data to attach to the Document.": "ドキュメントに添付するメタデータ。",
"Authorization headers are injected automatically from your connection.": "認証ヘッダは接続から自動的に注入されます。",
"Enable for files like PDFs, images, etc..": "PDF、画像などのファイルを有効にします。",
"Draft": "下書き",
"Pending": "処理待ち",
"GET": "取得",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "削除",
"HEAD": "頭",
"Document Generated": "生成された文書",
"Triggers when a document generation completes successfully.": "ドキュメントの生成が正常に完了したときにトリガーします。"
}

View File

@@ -0,0 +1,38 @@
{
"You can obtain your API key by navigating to [Account Settings](https://dashboard.pdfmonkey.io/account).": "U kunt uw API-sleutel verkrijgen door te navigeren naar [Accountinstellingen](https://dashboard.pdfmonkey.io/account).",
"Generate Document": "Document aanmaken",
"Delete Document": "Document verwijderen",
"Find Document": "Document zoeken",
"Custom API Call": "Custom API Call",
"Generates a new document using a specified template.": "Genereert een nieuw document met een gespecificeerd sjabloon.",
"Deletes a document.": "Verwijdert een document.",
"Finds a document by ID.": "Vindt een document via ID.",
"Make a custom API call to a specific endpoint": "Maak een aangepaste API call naar een specifiek eindpunt",
"Template ID": "Sjabloon ID",
"Payload": "Spanning",
"Meta": "Meta",
"Custom File Name": "Naam aangepast bestand",
"Document Status": "Document status",
"Document ID": "Document ID",
"Method": "Methode",
"Headers": "Kopteksten",
"Query Parameters": "Query parameters",
"Body": "Lichaam",
"Response is Binary ?": "Antwoord is binair?",
"No Error on Failure": "Geen fout bij fout",
"Timeout (in seconds)": "Time-out (in seconden)",
"Data to use for the Document generation.": "Gegevens om te gebruiken voor het genereren van Document",
"Meta-Data to attach to the Document.": "Meta-Data om het document toe te voegen.",
"Authorization headers are injected automatically from your connection.": "Autorisatie headers worden automatisch geïnjecteerd vanuit uw verbinding.",
"Enable for files like PDFs, images, etc..": "Inschakelen voor bestanden zoals PDF's, afbeeldingen etc..",
"Draft": "Concept",
"Pending": "In behandeling",
"GET": "KRIJG",
"POST": "POSTE",
"PATCH": "BEKIJK",
"PUT": "PUT",
"DELETE": "VERWIJDEREN",
"HEAD": "HOOFD",
"Document Generated": "Document gegenereerd",
"Triggers when a document generation completes successfully.": "Triggert wanneer een document generatie succesvol is voltooid."
}

View File

@@ -0,0 +1,38 @@
{
"You can obtain your API key by navigating to [Account Settings](https://dashboard.pdfmonkey.io/account).": "Você pode obter sua chave de API navegando até [Configurações da Conta](https://dashboard.pdfmonkey.io/account).",
"Generate Document": "Gerar Documento",
"Delete Document": "Excluir documento",
"Find Document": "Localizar documento",
"Custom API Call": "Chamada de API personalizada",
"Generates a new document using a specified template.": "Gera um novo documento usando um modelo especificado.",
"Deletes a document.": "Exclui um documento.",
"Finds a document by ID.": "Encontra um documento por ID.",
"Make a custom API call to a specific endpoint": "Faça uma chamada de API personalizada para um ponto de extremidade específico",
"Template ID": "ID do modelo",
"Payload": "Carga",
"Meta": "Meta",
"Custom File Name": "Nome de arquivo personalizado",
"Document Status": "Estado do documento",
"Document ID": "ID do documento",
"Method": "Método",
"Headers": "Cabeçalhos",
"Query Parameters": "Parâmetros da consulta",
"Body": "Conteúdo",
"Response is Binary ?": "A resposta é binária ?",
"No Error on Failure": "Nenhum erro no Failure",
"Timeout (in seconds)": "Tempo limite (em segundos)",
"Data to use for the Document generation.": "Dados para usar para a geração do documento.",
"Meta-Data to attach to the Document.": "Meta-dados para anexar ao documento.",
"Authorization headers are injected automatically from your connection.": "Os cabeçalhos de autorização são inseridos automaticamente a partir da sua conexão.",
"Enable for files like PDFs, images, etc..": "Habilitar para arquivos como PDFs, imagens, etc..",
"Draft": "Rascunho",
"Pending": "Pendente",
"GET": "OBTER",
"POST": "POSTAR",
"PATCH": "COMPRAR",
"PUT": "COLOCAR",
"DELETE": "EXCLUIR",
"HEAD": "CABEÇA",
"Document Generated": "Documento gerado",
"Triggers when a document generation completes successfully.": "Aciona quando uma geração de documento é concluída com sucesso."
}

View File

@@ -0,0 +1,37 @@
{
"PDFMonkey": "PDFMonkey",
"You can obtain your API key by navigating to [Account Settings](https://dashboard.pdfmonkey.io/account).": "Вы можете получить ключ API, перейдя в [Настройки аккаунта](https://dashboard.pdfmonkey.io/account).",
"Generate Document": "Создать документ",
"Delete Document": "Удалить документ",
"Find Document": "Найти документ",
"Custom API Call": "Пользовательский вызов API",
"Generates a new document using a specified template.": "Генерирует новый документ с использованием заданного шаблона.",
"Deletes a document.": "Удаление документа.",
"Finds a document by ID.": "Поиск документа по ID.",
"Make a custom API call to a specific endpoint": "Сделать пользовательский API вызов к определенной конечной точке",
"Template ID": "ID шаблона",
"Payload": "Нагрузка",
"Meta": "Meta",
"Custom File Name": "Пользовательское имя файла",
"Document Status": "Статус документа",
"Document ID": "ID документа",
"Method": "Метод",
"Headers": "Заголовки",
"Query Parameters": "Параметры запроса",
"Body": "Тело",
"No Error on Failure": "Нет ошибок при ошибке",
"Timeout (in seconds)": "Таймаут (в секундах)",
"Data to use for the Document generation.": "Данные для генерации документа.",
"Meta-Data to attach to the Document.": "Прикрепляемые к документу метаданные.",
"Authorization headers are injected automatically from your connection.": "Заголовки авторизации включаются автоматически из вашего соединения.",
"Draft": "Черновик",
"Pending": "В ожидании",
"GET": "ПОЛУЧИТЬ",
"POST": "ПОСТ",
"PATCH": "ПАТЧ",
"PUT": "ПОКУПИТЬ",
"DELETE": "УДАЛИТЬ",
"HEAD": "HEAD",
"Document Generated": "Документ создан",
"Triggers when a document generation completes successfully.": "Триггеры, когда генерация документа успешно завершена."
}

View File

@@ -0,0 +1,38 @@
{
"You can obtain your API key by navigating to [Account Settings](https://dashboard.pdfmonkey.io/account).": "You can obtain your API key by navigating to [Account Settings](https://dashboard.pdfmonkey.io/account).",
"Generate Document": "Generate Document",
"Delete Document": "Delete Document",
"Find Document": "Find Document",
"Custom API Call": "Custom API Call",
"Generates a new document using a specified template.": "Generates a new document using a specified template.",
"Deletes a document.": "Deletes a document.",
"Finds a document by ID.": "Finds a document by ID.",
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
"Template ID": "Template ID",
"Payload": "Payload",
"Meta": "Meta",
"Custom File Name": "Custom File Name",
"Document Status": "Document Status",
"Document ID": "Document ID",
"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)",
"Data to use for the Document generation.": "Data to use for the Document generation.",
"Meta-Data to attach to the Document.": "Meta-Data to attach to the Document.",
"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..",
"Draft": "Draft",
"Pending": "Pending",
"GET": "GET",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "DELETE",
"HEAD": "HEAD",
"Document Generated": "Document Generated",
"Triggers when a document generation completes successfully.": "Triggers when a document generation completes successfully."
}

View File

@@ -0,0 +1,37 @@
{
"PDFMonkey": "PDFMonkey",
"You can obtain your API key by navigating to [Account Settings](https://dashboard.pdfmonkey.io/account).": "You can obtain your API key by navigating to [Account Settings](https://dashboard.pdfmonkey.io/account).",
"Generate Document": "Generate Document",
"Delete Document": "Delete Document",
"Find Document": "Find Document",
"Custom API Call": "Custom API Call",
"Generates a new document using a specified template.": "Generates a new document using a specified template.",
"Deletes a document.": "Deletes a document.",
"Finds a document by ID.": "Finds a document by ID.",
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
"Template ID": "Template ID",
"Payload": "Payload",
"Meta": "Meta",
"Custom File Name": "Custom File Name",
"Document Status": "Document Status",
"Document ID": "Document ID",
"Method": "Method",
"Headers": "Headers",
"Query Parameters": "Query Parameters",
"Body": "Body",
"No Error on Failure": "No Error on Failure",
"Timeout (in seconds)": "Timeout (in seconds)",
"Data to use for the Document generation.": "Data to use for the Document generation.",
"Meta-Data to attach to the Document.": "Meta-Data to attach to the Document.",
"Authorization headers are injected automatically from your connection.": "Authorization headers are injected automatically from your connection.",
"Draft": "Bản nháp",
"Pending": "Đang chờ",
"GET": "GET",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "DELETE",
"HEAD": "HEAD",
"Document Generated": "Document Generated",
"Triggers when a document generation completes successfully.": "Triggers when a document generation completes successfully."
}

View File

@@ -0,0 +1,38 @@
{
"You can obtain your API key by navigating to [Account Settings](https://dashboard.pdfmonkey.io/account).": "You can obtain your API key by navigating to [Account Settings](https://dashboard.pdfmonkey.io/account).",
"Generate Document": "Generate Document",
"Delete Document": "Delete Document",
"Find Document": "Find Document",
"Custom API Call": "自定义 API 呼叫",
"Generates a new document using a specified template.": "Generates a new document using a specified template.",
"Deletes a document.": "Deletes a document.",
"Finds a document by ID.": "Finds a document by ID.",
"Make a custom API call to a specific endpoint": "将一个自定义 API 调用到一个特定的终点",
"Template ID": "Template ID",
"Payload": "Payload",
"Meta": "Meta",
"Custom File Name": "Custom File Name",
"Document Status": "Document Status",
"Document ID": "Document ID",
"Method": "方法",
"Headers": "信头",
"Query Parameters": "查询参数",
"Body": "正文内容",
"Response is Binary ?": "Response is Binary ?",
"No Error on Failure": "失败时没有错误",
"Timeout (in seconds)": "超时(秒)",
"Data to use for the Document generation.": "Data to use for the Document generation.",
"Meta-Data to attach to the Document.": "Meta-Data to attach to the Document.",
"Authorization headers are injected automatically from your connection.": "授权头自动从您的连接中注入。",
"Enable for files like PDFs, images, etc..": "Enable for files like PDFs, images, etc..",
"Draft": "草稿",
"Pending": "待處理",
"GET": "获取",
"POST": "帖子",
"PATCH": "PATCH",
"PUT": "弹出",
"DELETE": "删除",
"HEAD": "黑色",
"Document Generated": "Document Generated",
"Triggers when a document generation completes successfully.": "Triggers when a document generation completes successfully."
}

View File

@@ -0,0 +1,33 @@
import { createPiece } from '@activepieces/pieces-framework';
import { pdfmonkeyAuth } from './lib/common/auth';
import { generateDocumentAction } from './lib/actions/generate-document';
import { deleteDocumentAction } from './lib/actions/delete-document';
import { findDocumentAction } from './lib/actions/find-document';
import { PieceCategory } from '@activepieces/shared';
import { createCustomApiCallAction } from '@activepieces/pieces-common';
import { BASE_URL } from './lib/common/client';
import { documentGeneratedTrigger } from './lib/triggers/document-generated';
export const pdfmonkey = createPiece({
displayName: 'PDFMonkey',
auth: pdfmonkeyAuth,
minimumSupportedRelease: '0.36.1',
logoUrl: 'https://cdn.activepieces.com/pieces/pdfmonkey.png',
authors: ['Sanket6652'],
categories: [PieceCategory.CONTENT_AND_FILES],
actions: [
generateDocumentAction,
deleteDocumentAction,
findDocumentAction,
createCustomApiCallAction({
auth: pdfmonkeyAuth,
baseUrl: () => BASE_URL,
authMapping: async (auth) => {
return {
Authorization: `Bearer ${auth}`,
};
},
}),
],
triggers: [documentGeneratedTrigger],
});

View File

@@ -0,0 +1,31 @@
import { createAction } from '@activepieces/pieces-framework';
import { pdfmonkeyAuth } from '../common/auth';
import { makeRequest } from '../common/client';
import { HttpMethod } from '@activepieces/pieces-common';
import { documentIdDropdown } from '../common/props';
export const deleteDocumentAction = createAction({
auth: pdfmonkeyAuth,
name: 'deleteDocument',
displayName: 'Delete Document',
description: 'Deletes a document.',
props: {
document_id: documentIdDropdown,
},
async run({ auth, propsValue }) {
const { document_id } = propsValue;
if (!document_id) {
throw new Error('Document ID is required');
}
const response = await makeRequest(
auth,
HttpMethod.DELETE,
`/documents/${document_id}`,
);
return {
status: 'success',
message: 'Document deleted successfully.',
data: response,
};
},
});

View File

@@ -0,0 +1,19 @@
import { createAction } from '@activepieces/pieces-framework';
import { pdfmonkeyAuth } from '../common/auth';
import { makeRequest } from '../common/client';
import { HttpMethod } from '@activepieces/pieces-common';
import { documentIdDropdown } from '../common/props';
export const findDocumentAction = createAction({
auth: pdfmonkeyAuth,
name: 'findDocument',
displayName: 'Find Document',
description: 'Finds a document by ID.',
props: {
document_id: documentIdDropdown,
},
async run({ auth, propsValue }) {
const { document_id } = propsValue;
return await makeRequest(auth, HttpMethod.GET, `/documents/${document_id}`);
},
});

View File

@@ -0,0 +1,70 @@
import { createAction, Property } from '@activepieces/pieces-framework';
import { pdfmonkeyAuth } from '../common/auth';
import { makeRequest } from '../common/client';
import { HttpMethod } from '@activepieces/pieces-common';
import { templateIdDropdown } from '../common/props';
export const generateDocumentAction = createAction({
auth: pdfmonkeyAuth,
name: 'generateDocument',
displayName: 'Generate Document',
description: 'Generates a new document using a specified template.',
props: {
document_template_id: templateIdDropdown,
payload: Property.Json({
displayName: 'Payload',
description: 'Data to use for the Document generation.',
required: true,
}),
meta: Property.Json({
displayName: 'Meta',
description: 'Meta-Data to attach to the Document.',
required: false,
}),
fileName: Property.ShortText({
displayName: 'Custom File Name',
required: false,
}),
status: Property.StaticDropdown({
displayName: 'Document Status',
required: false,
defaultValue: 'draft',
options: {
options: [
{
label: 'Draft',
value: 'draft',
},
{
label: 'Pending',
value: 'pending',
},
],
},
}),
},
async run({ auth, propsValue }) {
const { document_template_id, payload, meta, status, fileName } = propsValue;
const metapayload = { ...meta };
if (fileName) metapayload['_filename'] = fileName;
const body = {
document: {
document_template_id,
status,
payload,
meta: metapayload,
},
};
const response = await makeRequest(
auth,
HttpMethod.POST,
'/documents',
undefined,
body,
);
return response;
},
});

View File

@@ -0,0 +1,26 @@
import { PieceAuth } from '@activepieces/pieces-framework';
import { makeRequest } from './client';
import { HttpMethod } from '@activepieces/pieces-common';
import { AppConnectionType } from '@activepieces/shared';
export const pdfmonkeyAuth = PieceAuth.SecretText({
displayName: 'API Key',
description: `You can obtain your API key by navigating to [Account Settings](https://dashboard.pdfmonkey.io/account).`,
required: true,
validate: async ({ auth }) => {
try {
await makeRequest({
type: AppConnectionType.SECRET_TEXT,
secret_text: auth,
}, HttpMethod.GET, '/documents', {});
return {
valid: true,
};
} catch {
return {
valid: false,
error: 'Invalid API Key.',
};
}
},
});

View File

@@ -0,0 +1,33 @@
import { HttpMethod, QueryParams, httpClient } from '@activepieces/pieces-common';
import { pdfmonkeyAuth } from './auth';
import { AppConnectionValueForAuthProperty } from '@activepieces/pieces-framework';
export const BASE_URL = `https://api.pdfmonkey.io/api/v1`;
export async function makeRequest<T>(
api_key: AppConnectionValueForAuthProperty<typeof pdfmonkeyAuth>,
method: HttpMethod,
path: string,
query?:QueryParams,
body?: unknown,
) {
try {
const response = await httpClient.sendRequest<T>({
method,
url: `${BASE_URL}${path}`,
headers: {
'Authorization': `Bearer ${api_key.secret_text}`,
'Content-Type': 'application/json',
},
body,
queryParams:query
});
return response.body;
} catch (error: any) {
throw new Error(`Unexpected error: ${error.message || String(error)}`);
}
}

View File

@@ -0,0 +1,103 @@
import { DropdownOption, Property } from '@activepieces/pieces-framework';
import { makeRequest } from './client';
import { HttpMethod } from '@activepieces/pieces-common';
import { pdfmonkeyAuth } from './auth';
export const templateIdDropdown = Property.Dropdown({
displayName: 'Template ID',
auth: pdfmonkeyAuth,
required: true,
refreshers: [],
options: async ({ auth }) => {
if (!auth) {
return {
disabled: true,
options: [],
placeholder: 'Please connect your account first.',
};
}
try {
let page = 1;
let hasMore = true;
const options: DropdownOption<string>[] = [];
do {
const response = await makeRequest<{
document_template_cards: Array<{ id: string; identifier: string }>;
meta: { total_pages: number; current_page: number };
}>(auth, HttpMethod.GET, '/document_template_cards',{ page: page.toString() });
const items = response.document_template_cards ?? [];
for (const template of items) {
options.push({ label: template.identifier, value: template.id });
}
page++;
hasMore = response.meta.current_page < response.meta.total_pages;
} while (hasMore);
return {
disabled: false,
options,
};
} catch (error) {
return {
disabled: true,
options: [],
placeholder: 'Error loading document templates.',
};
}
},
});
export const documentIdDropdown = Property.Dropdown({
displayName: 'Document ID',
required: true,
refreshers: [],
auth: pdfmonkeyAuth,
options: async ({ auth }) => {
if (!auth) {
return {
disabled: true,
options: [],
placeholder: 'Please connect your account first.',
};
}
try {
let page = 1;
let hasMore = true;
const options: DropdownOption<string>[] = [];
do {
const response = await makeRequest<{
document_cards: Array<{ id: string; filename: string }>;
meta: { total_pages: number; current_page: number };
}>(auth, HttpMethod.GET, '/document_cards', { page: page.toString() });
const items = response.document_cards ?? [];
for (const doc of items) {
options.push({ label: doc.filename, value: doc.id });
}
page++;
hasMore = response.meta.current_page < response.meta.total_pages;
} while (hasMore);
return {
disabled: false,
options,
};
} catch (error) {
return {
disabled: true,
options: [],
placeholder: 'Error loading documents.',
};
}
},
});

View File

@@ -0,0 +1,98 @@
import {
createTrigger,
TriggerStrategy,
PiecePropValueSchema,
AppConnectionValueForAuthProperty,
} from '@activepieces/pieces-framework';
import {
DedupeStrategy,
HttpMethod,
Polling,
pollingHelper,
QueryParams,
} from '@activepieces/pieces-common';
import dayjs from 'dayjs';
import { pdfmonkeyAuth } from '../common/auth';
import { makeRequest } from '../common/client';
const polling: Polling<AppConnectionValueForAuthProperty<typeof pdfmonkeyAuth>, Record<string, never>> = {
strategy: DedupeStrategy.TIMEBASED,
items: async ({ auth, lastFetchEpochMS }) => {
let page = 1;
let hasMore = true;
const isTest = lastFetchEpochMS === 0;
const documents = [];
do {
const qs: QueryParams = {
'page[number]': page.toString(),
'q[status]': 'success',
};
if (!isTest) qs['q[updated_since]'] = lastFetchEpochMS.toString();
const response = await makeRequest<{
document_cards: Array<{ id: string; created_at: string }>;
meta: { total_pages: number; current_page: number };
}>(auth, HttpMethod.GET, '/document_cards', qs);
const items = response.document_cards ?? [];
documents.push(...items);
if (isTest) break;
page++;
hasMore = response.meta.current_page < response.meta.total_pages;
} while (hasMore);
return documents.map((doc) => {
return {
epochMilliSeconds: dayjs(doc.created_at).valueOf(),
data: doc,
};
});
},
};
export const documentGeneratedTrigger = createTrigger({
auth: pdfmonkeyAuth,
name: 'documentGenerated',
displayName: 'Document Generated',
description: 'Triggers when a document generation completes successfully.',
props: {},
sampleData: {
id: '11475e57-0334-4ad5-8896-9462a2243957',
app_id: 'c2b67b84-4aac-49ea-bed8-69a15d7a65d3',
created_at: '2022-04-07T11:01:38.201+02:00',
document_template_id: '96611e9e-ab03-4ac3-8551-1b485210c892',
document_template_identifier: 'My Awesome Template',
download_url:
'https://pdfmonkey.s3.eu-west-1.amazonaws.com/production/backend/document/11475e57-0334-4ad5-8896-9462a2243957/my-test-document.pdf?...',
failure_cause: null,
filename: 'my-test-document.pdf',
meta: '{ "_filename":"my-test-document.pdf" }',
public_share_link:
'https://files.pdfmonkey.io/share/5CEA8C37-D130-4C19-9E11-72BE2293C82B/my-test-document.pdf',
status: 'success',
updated_at: '2022-04-03T11:12:56.023+02:00',
},
type: TriggerStrategy.POLLING,
async test(context) {
return await pollingHelper.test(polling, context);
},
async onEnable(context) {
const { store, auth, propsValue } = context;
await pollingHelper.onEnable(polling, { store, auth, propsValue });
},
async onDisable(context) {
const { store, auth, propsValue } = context;
await pollingHelper.onDisable(polling, { store, auth, propsValue });
},
async run(context) {
return await pollingHelper.poll(polling, context);
},
});

View File

@@ -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"
}
]
}

View File

@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../../../dist/out-tsc",
"declaration": true,
"types": ["node"]
},
"include": ["src/**/*.ts"]
}