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,19 @@
{
"Extract structured data from emails, PDFs, or documents with Airparser.": "Extrahieren Sie strukturierte Daten aus E-Mails, PDFs oder Dokumenten mit Airparser.",
"You can find your API key in the Airparser dashboard under Account Settings.": "Ihren API-Schlüssel finden Sie im Airparser-Dashboard in den Kontoeinstellungen.",
"Get Data from Document": "Daten aus dem Dokument abrufen",
"Upload Document": "Dokument hochladen",
"Retrieves parsed JSON data from a specific document.": "Ruft die analysierten JSON-Daten eines bestimmten Dokuments ab.",
"Upload a document to an Airparser inbox for parsing.": "Laden Sie ein Dokument in einen Airparser-Posteingang zum Parsen hoch.",
"Inbox": "Inbox",
"Document": "Dokument",
"File": "Datei",
"File Name": "Dateiname",
"Metadata": "Metadaten",
"The document file to upload for parsing.": "Die Dokumentdatei, die zum Parsen hochgeladen werden soll.",
"Optional metadata to associate with the document.": "Optionale Metadaten, die dem Dokument zugeordnet werden sollen.",
"Document Parsed": "Dokument analysiert",
"Triggers when a new document is parsed in a specific inbox.": "Wird ausgelöst, wenn ein neues Dokument in einem bestimmten Posteingang analysiert wird.",
"Markdown": "Markdown",
"## Airparser Webhook Setup\n\t\t\tTo use this trigger, you need to manually set up a webhook in your Airparser account:\n\n\t\t\t1. Login to your Airparser account.\n\t\t\t2. Navigate to **Integrations** > **Webhooks** in the left sidebar.\n\t\t\t3. Enter the following URL in the webhooks field and select **Document Parsed** as webhook trigger:\n\t\t\t```text\n\t\t\t{{webhookUrl}}\n\t\t\t```\n\t\t\t4. Click Save to register the webhook.\n\t\t\t": "## Airparser Webhook Setup\n\t\t\tUm diesen Trigger nutzen zu können, müssen Sie manuell einen Webhook in Ihrem Airparser-Konto einrichten:\n\n\t\t\t1. Melden Sie sich mit Ihrem Airparser-Konto an.\n\t\t\t2. Navigieren Sie zu **Integrations** > **Webhooks** in der linken Seitenleiste.\n\t\t\t3. Geben Sie die folgende URL im Webhooks Feld ein und wählen Sie **Document Parsed** als Webhook Trigger aus:\n\t\t\t```text\n\t\t\t{{webhookUrl}}\n\t\t\t```\n\t\t\t4. Klicken Sie auf Speichern, um den Webhook zu registrieren.\n\t\t\t"
}

View File

@@ -0,0 +1,19 @@
{
"Extract structured data from emails, PDFs, or documents with Airparser.": "Extraer datos estructurados de correos electrónicos, PDFs o documentos con Airparser.",
"You can find your API key in the Airparser dashboard under Account Settings.": "Puede encontrar su clave API en el panel de control de Airparser en Configuración de la Cuenta.",
"Get Data from Document": "Obtener datos del documento",
"Upload Document": "Subir Documento",
"Retrieves parsed JSON data from a specific document.": "Obtiene datos JSON analizados desde un documento específico.",
"Upload a document to an Airparser inbox for parsing.": "Subir un documento a una bandeja de entrada de Airparser para analizarlo.",
"Inbox": "Entrada",
"Document": "Documento",
"File": "Archivo",
"File Name": "Nombre del archivo",
"Metadata": "Metadatos",
"The document file to upload for parsing.": "El archivo de documento a subir para analizar.",
"Optional metadata to associate with the document.": "Datos sobre datos opcionales para asociar con el documento.",
"Document Parsed": "Documento analizado",
"Triggers when a new document is parsed in a specific inbox.": "Dispara cuando un nuevo documento es analizado en una bandeja de entrada específica.",
"Markdown": "Markdown",
"## Airparser Webhook Setup\n\t\t\tTo use this trigger, you need to manually set up a webhook in your Airparser account:\n\n\t\t\t1. Login to your Airparser account.\n\t\t\t2. Navigate to **Integrations** > **Webhooks** in the left sidebar.\n\t\t\t3. Enter the following URL in the webhooks field and select **Document Parsed** as webhook trigger:\n\t\t\t```text\n\t\t\t{{webhookUrl}}\n\t\t\t```\n\t\t\t4. Click Save to register the webhook.\n\t\t\t": "## Configuración de Airparser Webhook\n\t\t\tPara utilizar este disparador, necesita configurar manualmente un webhook en su cuenta de Airparser:\n\n\t\t\t1. Inicia sesión en tu cuenta de Airparser.\n\t\t\t2. Navega a **Integraciones** > **Webhooks** en la barra lateral izquierda.\n\t\t\t3. Introduzca la siguiente URL en el campo webhooks y seleccione **Documento Analizado** como activador de webhook:\n\t\t\t```text\n\t\t\t{{webhookUrl}}\n\t\t\t```\n\t\t\t4. Haga clic en Guardar para registrar el webhook.\n\t\t\t"
}

View File

@@ -0,0 +1,19 @@
{
"Extract structured data from emails, PDFs, or documents with Airparser.": "Extraire des données structurées des courriels, des PDF ou des documents avec Airparser.",
"You can find your API key in the Airparser dashboard under Account Settings.": "Vous pouvez trouver votre clé API dans le tableau de bord Airparser sous Paramètres du compte.",
"Get Data from Document": "Récupérer les données du document",
"Upload Document": "Télécharger le document",
"Retrieves parsed JSON data from a specific document.": "Récupère les données JSON analysées à partir d'un document spécifique.",
"Upload a document to an Airparser inbox for parsing.": "Télécharger un document dans une boîte de réception Airparser pour l'analyse.",
"Inbox": "Boîte de réception",
"Document": "Document",
"File": "Ficher",
"File Name": "Nom du fichier",
"Metadata": "Métadonnées",
"The document file to upload for parsing.": "Le fichier de document à télécharger pour l'analyse.",
"Optional metadata to associate with the document.": "Métadonnées facultatives à associer au document.",
"Document Parsed": "Document analysé",
"Triggers when a new document is parsed in a specific inbox.": "Déclenche lorsqu'un nouveau document est analysé dans une boîte de réception spécifique.",
"Markdown": "Markdown",
"## Airparser Webhook Setup\n\t\t\tTo use this trigger, you need to manually set up a webhook in your Airparser account:\n\n\t\t\t1. Login to your Airparser account.\n\t\t\t2. Navigate to **Integrations** > **Webhooks** in the left sidebar.\n\t\t\t3. Enter the following URL in the webhooks field and select **Document Parsed** as webhook trigger:\n\t\t\t```text\n\t\t\t{{webhookUrl}}\n\t\t\t```\n\t\t\t4. Click Save to register the webhook.\n\t\t\t": "## Configuration du Webhook Airparser\n\t\t\tPour utiliser ce déclencheur, vous devez configurer manuellement un webhook dans votre compte Airparser :\n\n\t\t\t1. Connectez-vous à votre compte Airparser.\n\t\t\t2. Accédez à **Intégrations** > **Webhooks** dans la barre latérale gauche.\n\t\t\t3. Entrez l'URL suivante dans le champ Webhooks et sélectionnez **Document Parsed** comme déclencheur de webhook :\n\t\t\t```text\n\t\t\t{{webhookUrl}}\n\t\t\t```\n\t\t\t4. Cliquez sur Enregistrer pour enregistrer le webhook.\n\t\t\t"
}

View File

@@ -0,0 +1,19 @@
{
"Extract structured data from emails, PDFs, or documents with Airparser.": "電子メール、PDF、またはAirparserのドキュメントから構造化されたデータを抽出します。",
"You can find your API key in the Airparser dashboard under Account Settings.": "API キーは Airparser ダッシュボードの format@@0 で確認できます。",
"Get Data from Document": "ドキュメントからデータを取得する",
"Upload Document": "ドキュメントをアップロード",
"Retrieves parsed JSON data from a specific document.": "解析された JSON データを特定のドキュメントから取得します。",
"Upload a document to an Airparser inbox for parsing.": "解析のためにドキュメントを Airparser 受信トレイにアップロードします。",
"Inbox": "受信トレイ",
"Document": "ドキュメント",
"File": "ファイル",
"File Name": "ファイル名",
"Metadata": "メタデータ",
"The document file to upload for parsing.": "解析用にアップロードするドキュメントファイル。",
"Optional metadata to associate with the document.": "ドキュメントに関連付ける任意のメタデータ。",
"Document Parsed": "解析された文書",
"Triggers when a new document is parsed in a specific inbox.": "新しいドキュメントが特定の受信トレイで解析されたときにトリガーされます。",
"Markdown": "Markdown",
"## Airparser Webhook Setup\n\t\t\tTo use this trigger, you need to manually set up a webhook in your Airparser account:\n\n\t\t\t1. Login to your Airparser account.\n\t\t\t2. Navigate to **Integrations** > **Webhooks** in the left sidebar.\n\t\t\t3. Enter the following URL in the webhooks field and select **Document Parsed** as webhook trigger:\n\t\t\t```text\n\t\t\t{{webhookUrl}}\n\t\t\t```\n\t\t\t4. Click Save to register the webhook.\n\t\t\t": "## Airparser Webhook Setup\n\t\t\tTo use this trigger, you need to manually set up a webhook in your Airparser account:\n\n\t\t\t1. Login to your Airparser account.\n\t\t\t2. Navigate to **Integrations** > **Webhooks** in the left sidebar.\n\t\t\t3. Enter the following URL in the webhooks field and select **Document Parsed** as webhook trigger:\n\t\t\t```text\n\t\t\t{{webhookUrl}}\n\t\t\t```\n\t\t\t4. Click Save to register the webhook.\n\t\t\t"
}

View File

@@ -0,0 +1,19 @@
{
"Extract structured data from emails, PDFs, or documents with Airparser.": "Pak gestructureerde gegevens uit e-mails, PDF's of documenten samen met Airparser.",
"You can find your API key in the Airparser dashboard under Account Settings.": "U kunt uw API-sleutel vinden in het Airparser dashboard onder Accountinstellingen.",
"Get Data from Document": "Gegevens uit document ophalen",
"Upload Document": "Document uploaden",
"Retrieves parsed JSON data from a specific document.": "Haalt de JSON-gegevens op van een specifiek document.",
"Upload a document to an Airparser inbox for parsing.": "Upload een document naar een Airparser-postvak om te parsen.",
"Inbox": "Inkomend",
"Document": "Document",
"File": "Bestand",
"File Name": "File Name",
"Metadata": "Metagegevens",
"The document file to upload for parsing.": "Het documentbestand om te uploaden voor parsen.",
"Optional metadata to associate with the document.": "Optionele metadata om te koppelen aan het document.",
"Document Parsed": "Document verwerkt",
"Triggers when a new document is parsed in a specific inbox.": "Triggert wanneer een nieuw document wordt verwerkt in een specifieke inbox.",
"Markdown": "Markdown",
"## Airparser Webhook Setup\n\t\t\tTo use this trigger, you need to manually set up a webhook in your Airparser account:\n\n\t\t\t1. Login to your Airparser account.\n\t\t\t2. Navigate to **Integrations** > **Webhooks** in the left sidebar.\n\t\t\t3. Enter the following URL in the webhooks field and select **Document Parsed** as webhook trigger:\n\t\t\t```text\n\t\t\t{{webhookUrl}}\n\t\t\t```\n\t\t\t4. Click Save to register the webhook.\n\t\t\t": "## Airparser Webhook Setup\n\t\t\t・Om deze trigger te gebruiken, moet je handmatig een webhook instellen in je Airparser account:\n\n\t\t\tØ 1. Log in op uw Airparser-account.\n\t\t\t➜ 2. Ga naar **Integraties** > **Webhooks** in de linker zijbalk.\n\t\t\t≤ A33. Voer de volgende URL in het webhooks veld in en selecteer **Document Parsed** als webhook trigger:\n\t\t\tρ```text\n\t\t\tweb+graphie://ka-perseus-graphie.s3.amazonawsρ\n ρA,\t\t\t{{webhookUrl}}\n\t\t\t½ `````\n\t\t\t½ 4. Klik op Opslaan om de webhook te registreren.\n・\t\t\t"
}

View File

@@ -0,0 +1,19 @@
{
"Extract structured data from emails, PDFs, or documents with Airparser.": "Extraia dados estruturados de e-mails, PDFs ou documentos com Airparser.",
"You can find your API key in the Airparser dashboard under Account Settings.": "Você pode encontrar sua chave de API no painel Airparser em Configurações da Conta.",
"Get Data from Document": "Obter dados do documento",
"Upload Document": "Upload de documento",
"Retrieves parsed JSON data from a specific document.": "Recupera dados JSON analisados de um documento específico.",
"Upload a document to an Airparser inbox for parsing.": "Envie um documento para uma caixa de entrada Airparser para análise.",
"Inbox": "Recebidas",
"Document": "Documento",
"File": "Arquivo",
"File Name": "Nome do arquivo",
"Metadata": "Metadados",
"The document file to upload for parsing.": "O arquivo documento a ser enviado para análise.",
"Optional metadata to associate with the document.": "Metadados opcionais para associar com o documento.",
"Document Parsed": "Documento analisado",
"Triggers when a new document is parsed in a specific inbox.": "Dispara quando um novo documento é analisado em uma caixa de entrada específica.",
"Markdown": "Markdown",
"## Airparser Webhook Setup\n\t\t\tTo use this trigger, you need to manually set up a webhook in your Airparser account:\n\n\t\t\t1. Login to your Airparser account.\n\t\t\t2. Navigate to **Integrations** > **Webhooks** in the left sidebar.\n\t\t\t3. Enter the following URL in the webhooks field and select **Document Parsed** as webhook trigger:\n\t\t\t```text\n\t\t\t{{webhookUrl}}\n\t\t\t```\n\t\t\t4. Click Save to register the webhook.\n\t\t\t": "## Instalação do Airparser Webhook\n\t\t\t├to use this trigger você precisa configurar manualmente um webhook em sua conta Airparer:\n\n\t\t\te&rbare bis . Faça login na sua conta do Airparser.\n\t\t\t「2. Navegue para **Integrações** > **Webhooks** na barra lateral esquerda. U\n\t\t\t£3. Digite a seguinte URL no campo de webhooks e selecione **Analisado com documento** como gatilho de webhook:\n\t\t\t├format@@5format@@6 ```text\n\t\t\t├\t\t\t{{webhookUrl}}\n\t\t\t├├```\n\t\t\t├4. Clique em Salvar para registrar o webhook.\n├\t\t\t"
}

View File

@@ -0,0 +1,20 @@
{
"Airparser": "Аэропорт",
"Extract structured data from emails, PDFs, or documents with Airparser.": "Извлеките структурированные данные из электронной почты, PDF или документов с Airparser.",
"You can find your API key in the Airparser dashboard under Account Settings.": "API ключ можно найти в панели управления Airparser в настройках аккаунта.",
"Get Data from Document": "Получить данные из документа",
"Upload Document": "Загрузить документ",
"Retrieves parsed JSON data from a specific document.": "Получает обработанные JSON данные из конкретного документа.",
"Upload a document to an Airparser inbox for parsing.": "Загрузите документ в папку «Входящие» Airparser.",
"Inbox": "Входящие",
"Document": "Документ",
"File": "Файл",
"File Name": "Имя файла",
"Metadata": "Метаданные",
"The document file to upload for parsing.": "Файл документа, который необходимо загрузить для анализа.",
"Optional metadata to associate with the document.": "Необязательные метаданные для связи с документом.",
"Document Parsed": "Обновлен документ",
"Triggers when a new document is parsed in a specific inbox.": "Триггеры при разборе нового документа в определенном почтовом ящике.",
"Markdown": "Markdown",
"## Airparser Webhook Setup\n\t\t\tTo use this trigger, you need to manually set up a webhook in your Airparser account:\n\n\t\t\t1. Login to your Airparser account.\n\t\t\t2. Navigate to **Integrations** > **Webhooks** in the left sidebar.\n\t\t\t3. Enter the following URL in the webhooks field and select **Document Parsed** as webhook trigger:\n\t\t\t```text\n\t\t\t{{webhookUrl}}\n\t\t\t```\n\t\t\t4. Click Save to register the webhook.\n\t\t\t": "## Настройка Airparser Webhook\n\t\t\tДля использования этого триггера вам нужно вручную настроить вебхук в вашем аккаунте Airparser:\n\n\t\t\t1. Войдите в свой аккаунт Airparser.\n\t\t\t2. Перейдите в **Интеграции** > **Webhooks** в левой боковой панели.\n\t\t\t3. Введите следующий URL в поле webhooks и выберите **Parsed** в качестве триггера webhook:\n\t\t\t```text\n\t\t\t{{webhookUrl}}\n\t\t\t```\n\t\t\t4. Нажмите кнопку Сохранить, чтобы зарегистрировать вебхук.\n\t\t\t"
}

View File

@@ -0,0 +1,19 @@
{
"Extract structured data from emails, PDFs, or documents with Airparser.": "Extract structured data from emails, PDFs, or documents with Airparser.",
"You can find your API key in the Airparser dashboard under Account Settings.": "You can find your API key in the Airparser dashboard under Account Settings.",
"Get Data from Document": "Get Data from Document",
"Upload Document": "Upload Document",
"Retrieves parsed JSON data from a specific document.": "Retrieves parsed JSON data from a specific document.",
"Upload a document to an Airparser inbox for parsing.": "Upload a document to an Airparser inbox for parsing.",
"Inbox": "Inbox",
"Document": "Document",
"File": "File",
"File Name": "File Name",
"Metadata": "Metadata",
"The document file to upload for parsing.": "The document file to upload for parsing.",
"Optional metadata to associate with the document.": "Optional metadata to associate with the document.",
"Document Parsed": "Document Parsed",
"Triggers when a new document is parsed in a specific inbox.": "Triggers when a new document is parsed in a specific inbox.",
"Markdown": "Markdown",
"## Airparser Webhook Setup\n\t\t\tTo use this trigger, you need to manually set up a webhook in your Airparser account:\n\n\t\t\t1. Login to your Airparser account.\n\t\t\t2. Navigate to **Integrations** > **Webhooks** in the left sidebar.\n\t\t\t3. Enter the following URL in the webhooks field and select **Document Parsed** as webhook trigger:\n\t\t\t```text\n\t\t\t{{webhookUrl}}\n\t\t\t```\n\t\t\t4. Click Save to register the webhook.\n\t\t\t": "## Airparser Webhook Setup\n\t\t\tTo use this trigger, you need to manually set up a webhook in your Airparser account:\n\n\t\t\t1. Login to your Airparser account.\n\t\t\t2. Navigate to **Integrations** > **Webhooks** in the left sidebar.\n\t\t\t3. Enter the following URL in the webhooks field and select **Document Parsed** as webhook trigger:\n\t\t\t```text\n\t\t\t{{webhookUrl}}\n\t\t\t```\n\t\t\t4. Click Save to register the webhook.\n\t\t\t"
}

View File

@@ -0,0 +1,20 @@
{
"Airparser": "Airparser",
"Extract structured data from emails, PDFs, or documents with Airparser.": "Extract structured data from emails, PDFs, or documents with Airparser.",
"You can find your API key in the Airparser dashboard under Account Settings.": "You can find your API key in the Airparser dashboard under Account Settings.",
"Get Data from Document": "Get Data from Document",
"Upload Document": "Upload Document",
"Retrieves parsed JSON data from a specific document.": "Retrieves parsed JSON data from a specific document.",
"Upload a document to an Airparser inbox for parsing.": "Upload a document to an Airparser inbox for parsing.",
"Inbox": "Inbox",
"Document": "Document",
"File": "File",
"File Name": "File Name",
"Metadata": "Metadata",
"The document file to upload for parsing.": "The document file to upload for parsing.",
"Optional metadata to associate with the document.": "Optional metadata to associate with the document.",
"Document Parsed": "Document Parsed",
"Triggers when a new document is parsed in a specific inbox.": "Triggers when a new document is parsed in a specific inbox.",
"Markdown": "Markdown",
"## Airparser Webhook Setup\n\t\t\tTo use this trigger, you need to manually set up a webhook in your Airparser account:\n\n\t\t\t1. Login to your Airparser account.\n\t\t\t2. Navigate to **Integrations** > **Webhooks** in the left sidebar.\n\t\t\t3. Enter the following URL in the webhooks field and select **Document Parsed** as webhook trigger:\n\t\t\t```text\n\t\t\t{{webhookUrl}}\n\t\t\t```\n\t\t\t4. Click Save to register the webhook.\n\t\t\t": "## Airparser Webhook Setup\n\t\t\tTo use this trigger, you need to manually set up a webhook in your Airparser account:\n\n\t\t\t1. Login to your Airparser account.\n\t\t\t2. Navigate to **Integrations** > **Webhooks** in the left sidebar.\n\t\t\t3. Enter the following URL in the webhooks field and select **Document Parsed** as webhook trigger:\n\t\t\t```text\n\t\t\t{{webhookUrl}}\n\t\t\t```\n\t\t\t4. Click Save to register the webhook.\n\t\t\t"
}

View File

@@ -0,0 +1,19 @@
{
"Extract structured data from emails, PDFs, or documents with Airparser.": "Extract structured data from emails, PDFs, or documents with Airparser.",
"You can find your API key in the Airparser dashboard under Account Settings.": "You can find your API key in the Airparser dashboard under Account Settings.",
"Get Data from Document": "Get Data from Document",
"Upload Document": "Upload Document",
"Retrieves parsed JSON data from a specific document.": "Retrieves parsed JSON data from a specific document.",
"Upload a document to an Airparser inbox for parsing.": "Upload a document to an Airparser inbox for parsing.",
"Inbox": "Inbox",
"Document": "Document",
"File": "文件",
"File Name": "File Name",
"Metadata": "Metadata",
"The document file to upload for parsing.": "The document file to upload for parsing.",
"Optional metadata to associate with the document.": "Optional metadata to associate with the document.",
"Document Parsed": "Document Parsed",
"Triggers when a new document is parsed in a specific inbox.": "Triggers when a new document is parsed in a specific inbox.",
"Markdown": "Markdown",
"## Airparser Webhook Setup\n\t\t\tTo use this trigger, you need to manually set up a webhook in your Airparser account:\n\n\t\t\t1. Login to your Airparser account.\n\t\t\t2. Navigate to **Integrations** > **Webhooks** in the left sidebar.\n\t\t\t3. Enter the following URL in the webhooks field and select **Document Parsed** as webhook trigger:\n\t\t\t```text\n\t\t\t{{webhookUrl}}\n\t\t\t```\n\t\t\t4. Click Save to register the webhook.\n\t\t\t": "## Airparser Webhook Setup\n\t\t\tTo use this trigger, you need to manually set up a webhook in your Airparser account:\n\n\t\t\t1. Login to your Airparser account.\n\t\t\t2. Navigate to **Integrations** > **Webhooks** in the left sidebar.\n\t\t\t3. Enter the following URL in the webhooks field and select **Document Parsed** as webhook trigger:\n\t\t\t```text\n\t\t\t{{webhookUrl}}\n\t\t\t```\n\t\t\t4. Click Save to register the webhook.\n\t\t\t"
}

View File

@@ -0,0 +1,42 @@
import { HttpMethod } from '@activepieces/pieces-common';
import { PieceAuth, createPiece } from '@activepieces/pieces-framework';
import { PieceCategory } from '@activepieces/shared';
import { extractDataFromDocumentAction } from './lib/actions/extract-data-from-document';
import { uploadDocumentAction } from './lib/actions/upload-document-for-parsing';
import { airparserApiCall } from './lib/common';
import { documentParsedTrigger } from './lib/triggers/document-parsed';
export const airparserAuth = PieceAuth.SecretText({
displayName: 'API Key',
required: true,
description: 'You can find your API key in the Airparser dashboard under Account Settings.',
validate: async ({ auth }) => {
try {
await airparserApiCall({
apiKey: auth as string,
method: HttpMethod.GET,
resourceUri: '/inboxes',
});
return {
valid: true,
};
} catch {
return {
valid: false,
error: 'Invalid API key.',
};
}
},
});
export const airparser = createPiece({
displayName: 'Airparser',
description: 'Extract structured data from emails, PDFs, or documents with Airparser.',
auth: airparserAuth,
logoUrl: 'https://cdn.activepieces.com/pieces/airparser.png',
authors: ['krushnarout','kishanprmr'],
categories: [PieceCategory.PRODUCTIVITY],
actions: [extractDataFromDocumentAction, uploadDocumentAction],
triggers: [documentParsedTrigger],
});

View File

@@ -0,0 +1,44 @@
import { HttpMethod } from '@activepieces/pieces-common';
import { createAction } from '@activepieces/pieces-framework';
import { airparserAuth } from '../../index';
import { airparserApiCall, GetDocumentResponse } from '../common';
import { documentIdDropdown, inboxIdDropdown } from '../common/props';
export const extractDataFromDocumentAction = createAction({
auth: airparserAuth,
name: 'extract_data_from_document',
displayName: 'Get Data from Document',
description: 'Retrieves parsed JSON data from a specific document.',
props: {
inboxId: inboxIdDropdown,
documentId: documentIdDropdown,
},
async run(context) {
const { documentId } = context.propsValue;
const response = await airparserApiCall<GetDocumentResponse>({
apiKey: context.auth.secret_text,
method: HttpMethod.GET,
resourceUri: `/docs/${documentId}/extended`,
});
return {
json: response.json,
id: response._id,
inbox_id: response.inbox_id,
owner_id: response.owner_id,
name: response.name,
data_text: response.data_text,
format: response.format,
status: response.status,
created_at: response.created_at,
processed_at: response.processed_at,
secret: response.secret,
filename: response.filename,
content_type: response.content_type,
credits: response.credits,
};
},
});

View File

@@ -0,0 +1,52 @@
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { createAction, Property } from '@activepieces/pieces-framework';
import FormData from 'form-data';
import { airparserAuth } from '../../index';
import { BASE_URL } from '../common';
import { inboxIdDropdown } from '../common/props';
export const uploadDocumentAction = createAction({
auth: airparserAuth,
name: 'upload_document',
displayName: 'Upload Document',
description: 'Upload a document to an Airparser inbox for parsing.',
props: {
inboxId: inboxIdDropdown,
file: Property.File({
displayName: 'File',
description: 'The document file to upload for parsing.',
required: true,
}),
fileName: Property.ShortText({
displayName: 'File Name',
required: false,
}),
meta: Property.Object({
displayName: 'Metadata',
description: 'Optional metadata to associate with the document.',
required: false,
}),
},
async run(context) {
const { inboxId, file, meta, fileName } = context.propsValue;
const formData = new FormData();
formData.append('file', Buffer.from(file.base64, 'base64'), fileName || file.filename);
if (meta) {
formData.append('meta', JSON.stringify(meta));
}
const response = await httpClient.sendRequest({
method: HttpMethod.POST,
url: BASE_URL + `/inboxes/${inboxId}/upload`,
headers: {
...formData.getHeaders(),
'X-API-Key': context.auth.secret_text,
},
body: formData,
});
return { docId: response.body };
},
});

View File

@@ -0,0 +1,65 @@
import {
httpClient,
HttpMessageBody,
HttpMethod,
HttpRequest,
QueryParams,
} from '@activepieces/pieces-common';
export const BASE_URL = 'https://api.airparser.com';
export type AirparserApiCallParams = {
apiKey: string;
method: HttpMethod;
resourceUri: string;
query?: Record<string, string | number | string[] | undefined>;
body?: any;
};
export async function airparserApiCall<T extends HttpMessageBody>({
apiKey,
method,
resourceUri,
query,
body,
}: AirparserApiCallParams): Promise<T> {
const qs: QueryParams = {};
if (query) {
for (const [key, value] of Object.entries(query)) {
if (value !== null && value !== undefined) {
qs[key] = String(value);
}
}
}
const request: HttpRequest = {
method,
url: BASE_URL + resourceUri,
headers: {
'X-API-Key': apiKey,
},
queryParams: qs,
body,
};
const response = await httpClient.sendRequest<T>(request);
return response.body;
}
export interface GetDocumentResponse {
json: any;
_id: string;
inbox_id: string;
owner_id: string;
name: string;
data_text: string;
format: string;
status: string;
created_at: string;
processed_at: string;
secret: string;
filename: string;
content_type: string;
credits: number;
}

View File

@@ -0,0 +1,79 @@
import { HttpMethod } from '@activepieces/pieces-common';
import { Property } from '@activepieces/pieces-framework';
import { isNil } from '@activepieces/shared';
import { airparserApiCall } from './index';
import { airparserAuth } from '../..';
export const inboxIdDropdown = Property.Dropdown<string,true,typeof airparserAuth>({
auth: airparserAuth,
displayName: 'Inbox',
required: true,
refreshers: [],
options: async ({ auth }) => {
if (!auth) {
return {
disabled: true,
placeholder: 'Please connect your Airparser account.',
options: [],
};
}
const response = await airparserApiCall<{ _id: string; name: string }[]>({
apiKey: auth.secret_text,
resourceUri: '/inboxes',
method: HttpMethod.GET,
});
return {
disabled: false,
options: response.map((inbox) => ({
label: inbox.name,
value: inbox._id,
})),
};
},
});
export const documentIdDropdown = Property.Dropdown<string,true,typeof airparserAuth>({
auth: airparserAuth,
displayName: 'Document',
required: true,
refreshers: ['inboxId'],
options: async ({ auth, inboxId }) => {
if (!auth || !inboxId) {
return {
disabled: true,
placeholder: 'Select an inbox first.',
options: [],
};
}
let hasMore = true;
let page = 1;
const docs = [];
do {
const response = await airparserApiCall<{
hasPrevPage: boolean;
hasNextPage: boolean;
docs: { _id: string; name: string }[];
}>({
apiKey: auth.secret_text,
method: HttpMethod.GET,
resourceUri: `/inboxes/${inboxId}/docs`,
query: {
page,
},
});
if (!isNil(response.docs)) docs.push(...response.docs);
hasMore = response.hasNextPage;
page++;
} while (hasMore);
return {
disabled: false,
options: docs.map((doc) => ({ label: doc.name, value: doc._id })),
};
},
});

View File

@@ -0,0 +1,109 @@
import { HttpMethod } from '@activepieces/pieces-common';
import {
createTrigger,
Property,
TriggerStrategy,
} from '@activepieces/pieces-framework';
import { isNil } from '@activepieces/shared';
import { airparserAuth } from '../../index';
import { airparserApiCall, GetDocumentResponse } from '../common';
import { inboxIdDropdown } from '../common/props';
export const documentParsedTrigger = createTrigger({
auth: airparserAuth,
name: 'document_parsed',
displayName: 'Document Parsed',
description: 'Triggers when a new document is parsed in a specific inbox.',
type: TriggerStrategy.WEBHOOK,
props: {
inboxId: inboxIdDropdown,
markdown: Property.MarkDown({
value: `## Airparser Webhook Setup
To use this trigger, you need to manually set up a webhook in your Airparser account:
1. Login to your Airparser account.
2. Navigate to **Integrations** > **Webhooks** in the left sidebar.
3. Enter the following URL in the webhooks field and select **Document Parsed** as webhook trigger:
\`\`\`text
{{webhookUrl}}
\`\`\`
4. Click Save to register the webhook.
`,
}),
},
async onEnable(context) {
// No need to register webhooks programmatically as user will do it manually
},
async onDisable(context) {
// No need to unregister webhooks as user will do it manually
},
async run(context) {
const payload = context.payload.body as {
inbox_id: string;
doc_id: string;
event: string;
};
if (
payload.event === 'doc.parsed' &&
payload.inbox_id === context.propsValue.inboxId
) {
return [payload];
}
return [];
},
async test(context) {
const { inboxId } = context.propsValue;
const listDocResponse = await airparserApiCall<{
hasPrevPage: boolean;
hasNextPage: boolean;
docs: { _id: string; name: string }[];
}>({
apiKey: context.auth.secret_text,
method: HttpMethod.GET,
resourceUri: `/inboxes/${inboxId}/docs`,
query: {
statuses: 'parsed',
},
});
if (isNil(listDocResponse.docs)) return [];
const items = [];
for (const doc of listDocResponse.docs) {
const response = await airparserApiCall<GetDocumentResponse>({
apiKey: context.auth.secret_text,
method: HttpMethod.GET,
resourceUri: `/docs/${doc._id}/extended`,
});
items.push({
inbox_id: inboxId,
doc_id: doc._id,
event: 'doc.parsed',
payload: {
filename: response.filename,
parsed: response.json,
},
});
}
return items;
},
sampleData: {
inbox_id: '6846e11bb1abe002cb1ada14',
doc_id: '6846ee9db1abe002cb1b05ad',
event: 'doc.parsed',
payload: {
filename: 'sample.pdf',
parsed: {
billing_address: 'Your Company Name\nYour Address City, State Zip',
shipping_address: 'Client Name Address City, State Zip',
totalamount: '200.00',
created_at: '2025-06-09T14:24:29.099Z',
},
},
},
});