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,33 @@
{
"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-apify
This library was generated with [Nx](https://nx.dev).
## Building
Run `nx build pieces-apify` to build the library.

View File

@@ -0,0 +1,4 @@
{
"name": "@activepieces/piece-apify",
"version": "0.0.6"
}

View File

@@ -0,0 +1,65 @@
{
"name": "pieces-apify",
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/pieces/community/apify/src",
"projectType": "library",
"release": {
"version": {
"currentVersionResolver": "git-tag",
"preserveLocalDependencyProtocols": false,
"manifestRootsToUpdate": [
"dist/{projectRoot}"
]
}
},
"tags": [],
"targets": {
"build": {
"executor": "@nx/js:tsc",
"outputs": [
"{options.outputPath}"
],
"options": {
"outputPath": "dist/packages/pieces/community/apify",
"tsConfig": "packages/pieces/community/apify/tsconfig.lib.json",
"packageJson": "packages/pieces/community/apify/package.json",
"main": "packages/pieces/community/apify/src/index.ts",
"assets": [
"packages/pieces/community/apify/*.md",
{
"input": "packages/pieces/community/apify/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/apify",
"command": "bun install --no-save --silent"
},
"dependsOn": [
"^build"
]
}
}
}

View File

@@ -0,0 +1,22 @@
{
"Your fullstack platform for web scraping": "Ihre Komplett-Stack-Plattform für Web-Scraping",
"API Key": "API-Schlüssel",
"Find your API key on Apify in the settings, API & Integrations section.": "Finden Sie Ihren API-Schlüssel unter Apify in den Einstellungen, API & Integrations Abschnitt.",
"Enter API key authentication details": "API-Schlüssel Authentifizierungsdetails eingeben",
"Get Dataset Items": "Daten abrufen",
"Get user's Actors": "Lade Benutzeraktoren",
"Get last run details": "Letzte Rundetails abrufen",
"Start an Apify Actor": "Starte einen Apify Akteur",
"Gets the data from an Actors run.": "Ruft die Daten eines Akteurs ab.",
"Gets the list of Actors available to the user.": "Ruft die Liste der Akteure auf, die dem Benutzer zur Verfügung stehen.",
"Gets last run details for a given Actor.": "Ruft die letzten Details für einen bestimmten Akteur auf.",
"Starts an Apify Actor web scraper": "Beginnt einen Apify Akteur Web Scraper",
"The runid of the Actor (alphanumeric)": "Die Runid des Akteurs (alphanumerisch)",
"The id of the Actor (alphanumeric)": "Die id des Akteurs (alphanumerisch)",
"The id or name of the Actor (alphanumeric)": "Die Id oder Name des Akteurs (alphanumerisch)",
"JSON input": "JSON input",
"The runid of the completed Actors run [defaultDatasetId] (compulsory)": "Die Runde der abgeschlossenen Akteure läuft [defaultDatasetId] (obligatorisch)",
"The id [defaultDatasetId] of the Actor to get run information [you can also use the username then ~ then the name] (compulsory)": "Die ID [defaultDatasetId] des Akteurs um Informationen zu erhalten [Sie können auch den Benutzernamen verwenden dann ~ dann den Namen] (obligatorisch)",
"The id of the Actor to run [Use either id, or the username then ~ then the name] (compulsory)": "Die Id des Akteurs auszuführen [Benutze entweder Id oder der Benutzername dann ~ dann den Namen] (obligatorisch)",
"The JSON input to pass to the Actor [you can get the JSON from a run in your Apify account]. If left blank will use defaults. (optional)": "Die JSON-Eingabe, um an den Akteur zu übergeben [Sie können das JSON von einem Run in Ihrem Apify Account holen]. Wenn leer gelassen, werden die Standardwerte verwendet. (optional)"
}

View File

@@ -0,0 +1,22 @@
{
"Your fullstack platform for web scraping": "Tu plataforma completa para rascar web",
"API Key": "Clave API",
"Find your API key on Apify in the settings, API & Integrations section.": "Encuentre su clave API en Apify en la sección de configuraciones, API e integraciones.",
"Enter API key authentication details": "Introduzca los detalles de autenticación de la clave API",
"Get Dataset Items": "Obtener elementos de datos",
"Get user's Actors": "Obtener Actores del usuario",
"Get last run details": "Obtener los últimos detalles de ejecución",
"Start an Apify Actor": "Iniciar un Actor Apify",
"Gets the data from an Actors run.": "Obtiene los datos de una ejecución de Actores.",
"Gets the list of Actors available to the user.": "Obtiene la lista de Actores disponibles para el usuario.",
"Gets last run details for a given Actor.": "Obtiene los detalles de la última ejecución de un Actor.",
"Starts an Apify Actor web scraper": "Inicia un raspador web de Apify Actor",
"The runid of the Actor (alphanumeric)": "El runid del Actor (alfanumérico)",
"The id of the Actor (alphanumeric)": "El id del Actor (alfanumérico)",
"The id or name of the Actor (alphanumeric)": "El id o nombre del Actor (alfanumérico)",
"JSON input": "JSON input",
"The runid of the completed Actors run [defaultDatasetId] (compulsory)": "El runid de los Actores completados corre [defaultDatasetId] (sissory)",
"The id [defaultDatasetId] of the Actor to get run information [you can also use the username then ~ then the name] (compulsory)": "El id [defaultDatasetId] del Actor para obtener información de ejecución[también puedes usar el nombre de usuario entonces ~ entonces el nombre] (clasificación)",
"The id of the Actor to run [Use either id, or the username then ~ then the name] (compulsory)": "El id del Actor a ejecutar [Usar ya sea id, o el nombre de usuario entonces ~ entonces el nombre] (tidiano)",
"The JSON input to pass to the Actor [you can get the JSON from a run in your Apify account]. If left blank will use defaults. (optional)": "La entrada JSON para pasar al Actor [puedes obtener el JSON desde una ejecución en tu cuenta Apify]. Si se deja en blanco usará los valores predeterminados. (opcional)"
}

View File

@@ -0,0 +1,22 @@
{
"Your fullstack platform for web scraping": "Votre plateforme complète pour le ramassage web",
"API Key": "Clé API",
"Find your API key on Apify in the settings, API & Integrations section.": "Trouvez votre clé API sur Apify dans la section paramètres, API & Integrations.",
"Enter API key authentication details": "Entrez les détails d'authentification de la clé API",
"Get Dataset Items": "Récupérer les éléments du jeu de données",
"Get user's Actors": "Obtenir les acteurs de l'utilisateur",
"Get last run details": "Obtenir les détails de la dernière exécution",
"Start an Apify Actor": "Démarrer un acteur Apify",
"Gets the data from an Actors run.": "Récupère les données depuis une exécution d'Acteurs.",
"Gets the list of Actors available to the user.": "Renvoie la liste des Acteurs disponibles pour l'utilisateur.",
"Gets last run details for a given Actor.": "Renvoie les détails de la dernière exécution pour un acteur donné.",
"Starts an Apify Actor web scraper": "Démarre un gratteur web Apify Actor",
"The runid of the Actor (alphanumeric)": "Le runid de l'Acteur (alphanumérique)",
"The id of the Actor (alphanumeric)": "L'id de l'acteur (alphanumérique)",
"The id or name of the Actor (alphanumeric)": "L'id ou le nom de l'acteur (alphanumérique)",
"JSON input": "JSON input",
"The runid of the completed Actors run [defaultDatasetId] (compulsory)": "The runid of the completed Actors run [defaultDatasetId] (compulsory)",
"The id [defaultDatasetId] of the Actor to get run information [you can also use the username then ~ then the name] (compulsory)": "L'id [defaultDatasetId] de l'Acteur pour obtenir des informations sur l'exécution [vous pouvez également utiliser le nom d'utilisateur puis ~ puis le nom] (obligatoire)",
"The id of the Actor to run [Use either id, or the username then ~ then the name] (compulsory)": "L'identifiant de l'acteur à exécuter [Utiliser l'identifiant ou le nom d'utilisateur puis ~ puis le nom] (obligatoire)",
"The JSON input to pass to the Actor [you can get the JSON from a run in your Apify account]. If left blank will use defaults. (optional)": "L'entrée JSON à passer à l'Acteur [vous pouvez obtenir le JSON à partir d'un run dans votre compte Apify]. Si laissé vide utilisera les valeurs par défaut. (facultatif)"
}

View File

@@ -0,0 +1,22 @@
{
"Your fullstack platform for web scraping": "ウェブスクレイピング用のフルスタックプラットフォーム",
"API Key": "API キー",
"Find your API key on Apify in the settings, API & Integrations section.": "APIキーは、設定、API & 連携のセクションにあります。",
"Enter API key authentication details": "API キー認証の詳細を入力してください",
"Get Dataset Items": "データセットアイテムを取得する",
"Get user's Actors": "ユーザーのアクターを取得する",
"Get last run details": "最後の実行の詳細を取得する",
"Start an Apify Actor": "Apifyアクターを開始",
"Gets the data from an Actors run.": "アクターが実行するデータを取得します。",
"Gets the list of Actors available to the user.": "ユーザーが利用できるアクターのリストを取得します。",
"Gets last run details for a given Actor.": "特定のアクターの最後の実行の詳細を取得します。",
"Starts an Apify Actor web scraper": "ApifyアクターのWebスクレーパーを開始",
"The runid of the Actor (alphanumeric)": "俳優の<unk> (英数字)",
"The id of the Actor (alphanumeric)": "アクターのid (英数字)",
"The id or name of the Actor (alphanumeric)": "アクターのIDまたは名前 (英数字)",
"JSON input": "JSON input",
"The runid of the completed Actors run [defaultDatasetId] (compulsory)": "The runid of the completed Actors run [defaultDatasetId] (compulsory)",
"The id [defaultDatasetId] of the Actor to get run information [you can also use the username then ~ then the name] (compulsory)": "実行情報を取得するためのアクターの id [defaultDatasetId] (必須)",
"The id of the Actor to run [Use either id, or the username then ~ then the name] (compulsory)": "実行するアクターのid format@@0 (必須)",
"The JSON input to pass to the Actor [you can get the JSON from a run in your Apify account]. If left blank will use defaults. (optional)": "Actor に渡すための JSON 入力。format@@0 では、Apify アカウントの実行から JSON を取得できます。 空白の場合はデフォルトを使用します(任意)"
}

View File

@@ -0,0 +1,22 @@
{
"Your fullstack platform for web scraping": "Uw fullDailstack platform voor webscraping",
"API Key": "API Sleutel",
"Find your API key on Apify in the settings, API & Integrations section.": "Vind je API-sleutel op Apify in de sectie instellingen, API & Integraties.",
"Enter API key authentication details": "Voer authenticatiegegevens van de API-sleutel in",
"Get Dataset Items": "Dataset items ophalen",
"Get user's Actors": "Gebruiker Actors ophalen",
"Get last run details": "Krijg details van de laatste uitvoering",
"Start an Apify Actor": "Start een Apify Actor",
"Gets the data from an Actors run.": "Haalt de gegevens op van een actor.",
"Gets the list of Actors available to the user.": "Haalt de lijst van actors op die de gebruiker.",
"Gets last run details for a given Actor.": "Haalt de laatst uitgevoerde details op voor een bepaalde actor.",
"Starts an Apify Actor web scraper": "Start een Apify Actor web scraper",
"The runid of the Actor (alphanumeric)": "Het runid van de Actor (alfanumeriek)",
"The id of the Actor (alphanumeric)": "Het id van de Actor (alfanumeriek)",
"The id or name of the Actor (alphanumeric)": "Het ID of de naam van de Actor (alfanumeriek)",
"JSON input": "JSON input",
"The runid of the completed Actors run [defaultDatasetId] (compulsory)": "De runid van de voltooide Actors run [defaultDatasetId] (compulsory)",
"The id [defaultDatasetId] of the Actor to get run information [you can also use the username then ~ then the name] (compulsory)": "Het id [defaultDatasetId] van de Actor om informatie te krijgen [je kan ook de gebruikersnaam gebruiken ~ dan de naam] (compulbaar)",
"The id of the Actor to run [Use either id, or the username then ~ then the name] (compulsory)": "Het id van de Actor om [Gebruik id, of de gebruikersnaam dan ~ de naam] (verplicht.",
"The JSON input to pass to the Actor [you can get the JSON from a run in your Apify account]. If left blank will use defaults. (optional)": "De JSON invoer om door te geven aan de Actor [u kunt de JSON krijgen via een run in uw Apify account]. Indien leeg worden de standaardwaarden gebruikt. (optioneel)"
}

View File

@@ -0,0 +1,22 @@
{
"Your fullstack platform for web scraping": "Sua plataforma completa de pilha para web scraping",
"API Key": "Chave de API",
"Find your API key on Apify in the settings, API & Integrations section.": "Encontre a sua chave de API no Apify nas configurações, na seção API e integrações.",
"Enter API key authentication details": "Inserir detalhes de autenticação de chaves API",
"Get Dataset Items": "Obter Itens do Conjunto de Dados",
"Get user's Actors": "Obter Personagens do Usuário",
"Get last run details": "Obter detalhes da última execução",
"Start an Apify Actor": "Iniciar um Apify Actor",
"Gets the data from an Actors run.": "Obtém os dados de um ator executado.",
"Gets the list of Actors available to the user.": "Obtém a lista de Personagens disponíveis para o usuário.",
"Gets last run details for a given Actor.": "Obtém os detalhes da última execução para um determinado Ator",
"Starts an Apify Actor web scraper": "Inicia um Apify Actor Web scraper",
"The runid of the Actor (alphanumeric)": "O runido do ator (alfanumérico)",
"The id of the Actor (alphanumeric)": "O id do ator (alfanumérico)",
"The id or name of the Actor (alphanumeric)": "O id ou nome do ator (alfanumérico)",
"JSON input": "JSON input",
"The runid of the completed Actors run [defaultDatasetId] (compulsory)": "O runido dos personagens concluídos executa [defaultDatasetId] (obrigatório)",
"The id [defaultDatasetId] of the Actor to get run information [you can also use the username then ~ then the name] (compulsory)": "Ajuda [defaultDatasetId] do Ator para obter informações de execução [você também pode usar o nome de usuário e então o nome] (obrigatório)",
"The id of the Actor to run [Use either id, or the username then ~ then the name] (compulsory)": "Identificação do Ator para executar [Use id ou o nome de usuário então ~ então o nome] (obrigatório)",
"The JSON input to pass to the Actor [you can get the JSON from a run in your Apify account]. If left blank will use defaults. (optional)": "A entrada JSON para passar para o ator [você pode obter o JSON de uma execução em sua conta Apify]. Se deixado em branco usará os padrões. (opcional)"
}

View File

@@ -0,0 +1,23 @@
{
"Apify": "Apify",
"Your fullstack platform for web scraping": "Ваша полномасштабная стековая платформа для веб-лома",
"API Key": "Ключ API",
"Find your API key on Apify in the settings, API & Integrations section.": "Найдите ваш API ключ на Apify в разделе настройки, API и Интеграции.",
"Enter API key authentication details": "Введите данные проверки подлинности ключа API",
"Get Dataset Items": "Получить предметы набора данных",
"Get user's Actors": "Получить пользовательские акторы",
"Get last run details": "Получить данные о последнем запуске",
"Start an Apify Actor": "Начать Apify актер",
"Gets the data from an Actors run.": "Получает данные от исполнителей.",
"Gets the list of Actors available to the user.": "Получает список Actors доступных пользователю.",
"Gets last run details for a given Actor.": "Возвращает последний запуск деталей для данного актера.",
"Starts an Apify Actor web scraper": "Запускает веб-скрепер Apify Actor",
"The runid of the Actor (alphanumeric)": "Руна актера (альфанумерический)",
"The id of the Actor (alphanumeric)": "Идентификатор актера (буквенно-цифровый)",
"The id or name of the Actor (alphanumeric)": "Идентификатор или имя актера (буквенно-цифровый)",
"JSON input": "JSON input",
"The runid of the completed Actors run [defaultDatasetId] (compulsory)": "The runid of the completed Actors run [defaultDatasetId] (compulsory)",
"The id [defaultDatasetId] of the Actor to get run information [you can also use the username then ~ then the name] (compulsory)": "id [defaultDatasetId] актера для получения информации о запуске [вы также можете использовать имя пользователя, затем ~ то имя] (обязательно)",
"The id of the Actor to run [Use either id, or the username then ~ then the name] (compulsory)": "Идентификатор актора для запуска [Используйте идентификатор или имя пользователя, затем ~ то имя] (обязательно)",
"The JSON input to pass to the Actor [you can get the JSON from a run in your Apify account]. If left blank will use defaults. (optional)": "Ввод JSON, который передается Исполнительу [вы можете получить JSON с запуска в вашем аккаунте Apif]. Если оставить пустым будет использовать значения по умолчанию. (опционально)"
}

View File

@@ -0,0 +1,22 @@
{
"Your fullstack platform for web scraping": "Your fullstack platform for web scraping",
"API Key": "API Key",
"Find your API key on Apify in the settings, API & Integrations section.": "Find your API key on Apify in the settings, API & Integrations section.",
"Enter API key authentication details": "Enter API key authentication details",
"Get Dataset Items": "Get Dataset Items",
"Get user's Actors": "Get user's Actors",
"Get last run details": "Get last run details",
"Start an Apify Actor": "Start an Apify Actor",
"Gets the data from an Actors run.": "Gets the data from an Actors run.",
"Gets the list of Actors available to the user.": "Gets the list of Actors available to the user.",
"Gets last run details for a given Actor.": "Gets last run details for a given Actor.",
"Starts an Apify Actor web scraper": "Starts an Apify Actor web scraper",
"The runid of the Actor (alphanumeric)": "The runid of the Actor (alphanumeric)",
"The id of the Actor (alphanumeric)": "The id of the Actor (alphanumeric)",
"The id or name of the Actor (alphanumeric)": "The id or name of the Actor (alphanumeric)",
"JSON input": "JSON input",
"The runid of the completed Actors run [defaultDatasetId] (compulsory)": "The runid of the completed Actors run [defaultDatasetId] (compulsory)",
"The id [defaultDatasetId] of the Actor to get run information [you can also use the username then ~ then the name] (compulsory)": "The id [defaultDatasetId] of the Actor to get run information [you can also use the username then ~ then the name] (compulsory)",
"The id of the Actor to run [Use either id, or the username then ~ then the name] (compulsory)": "The id of the Actor to run [Use either id, or the username then ~ then the name] (compulsory)",
"The JSON input to pass to the Actor [you can get the JSON from a run in your Apify account]. If left blank will use defaults. (optional)": "The JSON input to pass to the Actor [you can get the JSON from a run in your Apify account]. If left blank will use defaults. (optional)"
}

View File

@@ -0,0 +1,23 @@
{
"Apify": "Apify",
"Your fullstack platform for web scraping": "Your fullstack platform for web scraping",
"API Key": "API Key",
"Find your API key on Apify in the settings, API & Integrations section.": "Find your API key on Apify in the settings, API & Integrations section.",
"Enter API key authentication details": "Enter API key authentication details",
"Get Dataset Items": "Get Dataset Items",
"Get user's Actors": "Get user's Actors",
"Get last run details": "Get last run details",
"Start an Apify Actor": "Start an Apify Actor",
"Gets the data from an Actors run.": "Gets the data from an Actors run.",
"Gets the list of Actors available to the user.": "Gets the list of Actors available to the user.",
"Gets last run details for a given Actor.": "Gets last run details for a given Actor.",
"Starts an Apify Actor web scraper": "Starts an Apify Actor web scraper",
"The runid of the Actor (alphanumeric)": "The runid of the Actor (alphanumeric)",
"The id of the Actor (alphanumeric)": "The id of the Actor (alphanumeric)",
"The id or name of the Actor (alphanumeric)": "The id or name of the Actor (alphanumeric)",
"JSON input": "JSON input",
"The runid of the completed Actors run [defaultDatasetId] (compulsory)": "The runid of the completed Actors run [defaultDatasetId] (compulsory)",
"The id [defaultDatasetId] of the Actor to get run information [you can also use the username then ~ then the name] (compulsory)": "The id [defaultDatasetId] of the Actor to get run information [you can also use the username then ~ then the name] (compulsory)",
"The id of the Actor to run [Use either id, or the username then ~ then the name] (compulsory)": "The id of the Actor to run [Use either id, or the username then ~ then the name] (compulsory)",
"The JSON input to pass to the Actor [you can get the JSON from a run in your Apify account]. If left blank will use defaults. (optional)": "The JSON input to pass to the Actor [you can get the JSON from a run in your Apify account]. If left blank will use defaults. (optional)"
}

View File

@@ -0,0 +1,22 @@
{
"Your fullstack platform for web scraping": "Your fullstack platform for web scraping",
"API Key": "API 密钥",
"Find your API key on Apify in the settings, API & Integrations section.": "Find your API key on Apify in the settings, API & Integrations section.",
"Enter API key authentication details": "Enter API key authentication details",
"Get Dataset Items": "Get Dataset Items",
"Get user's Actors": "Get user's Actors",
"Get last run details": "Get last run details",
"Start an Apify Actor": "Start an Apify Actor",
"Gets the data from an Actors run.": "Gets the data from an Actors run.",
"Gets the list of Actors available to the user.": "Gets the list of Actors available to the user.",
"Gets last run details for a given Actor.": "Gets last run details for a given Actor.",
"Starts an Apify Actor web scraper": "Starts an Apify Actor web scraper",
"The runid of the Actor (alphanumeric)": "The runid of the Actor (alphanumeric)",
"The id of the Actor (alphanumeric)": "The id of the Actor (alphanumeric)",
"The id or name of the Actor (alphanumeric)": "The id or name of the Actor (alphanumeric)",
"JSON input": "JSON input",
"The runid of the completed Actors run [defaultDatasetId] (compulsory)": "The runid of the completed Actors run [defaultDatasetId] (compulsory)",
"The id [defaultDatasetId] of the Actor to get run information [you can also use the username then ~ then the name] (compulsory)": "The id [defaultDatasetId] of the Actor to get run information [you can also use the username then ~ then the name] (compulsory)",
"The id of the Actor to run [Use either id, or the username then ~ then the name] (compulsory)": "The id of the Actor to run [Use either id, or the username then ~ then the name] (compulsory)",
"The JSON input to pass to the Actor [you can get the JSON from a run in your Apify account]. If left blank will use defaults. (optional)": "The JSON input to pass to the Actor [you can get the JSON from a run in your Apify account]. If left blank will use defaults. (optional)"
}

View File

@@ -0,0 +1,43 @@
import { createPiece, PieceAuth } from '@activepieces/pieces-framework';
import { PieceCategory } from '@activepieces/shared';
import { getDatasetItems } from './lib/actions/get-dataset-items';
import { getActors } from './lib/actions/get-actors';
import { getLastRun } from './lib/actions/get-last-run';
import { startActor } from './lib/actions/start-actor';
export const apifyAuth = PieceAuth.CustomAuth({
description: 'Enter API key authentication details',
props: {
apikey: PieceAuth.SecretText({
displayName: 'API Key',
required: true,
description:
'Find your API key on Apify in the settings, API & Integrations section.',
}),
},
// Optional Validation
validate: async ({ auth }) => {
if (auth) {
return {
valid: true,
};
}
return {
valid: false,
error: 'Invalid Api Key',
};
},
required: true,
});
export const apify = createPiece({
displayName: 'Apify',
description: 'Your fullstack platform for web scraping',
auth: apifyAuth,
minimumSupportedRelease: '0.30.0',
logoUrl: 'https://cdn.activepieces.com/pieces/apify.svg',
categories: [PieceCategory.BUSINESS_INTELLIGENCE],
authors: ['buttonsbond'],
actions: [getDatasetItems, getActors, getLastRun, startActor],
triggers: [],
});

View File

@@ -0,0 +1,29 @@
import { createAction } from '@activepieces/pieces-framework';
import { apifyAuth } from '../..';
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
export const getActors = createAction({
name: 'getActors',
auth: apifyAuth,
displayName: "Get user's Actors",
description: 'Gets the list of Actors available to the user.',
props: {},
async run(context) {
const apifyToken = context.auth.props.apikey;
const headers = {
Authorization: 'Bearer ' + apifyToken,
'Content-Type': 'application/json',
};
const url = 'https://api.apify.com/v2/acts/';
const httprequestdata = {
method: HttpMethod.GET,
url,
headers,
};
const response = await httpClient.sendRequest(httprequestdata);
return response.body;
},
});

View File

@@ -0,0 +1,39 @@
import { createAction, Property } from '@activepieces/pieces-framework';
import { apifyAuth } from '../..';
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
export const getDatasetItems = createAction({
name: 'getDatasetItems',
auth: apifyAuth,
displayName: 'Get Dataset Items',
description: 'Gets the data from an Actors run.',
props: {
runid: Property.ShortText({
displayName: 'The runid of the Actor (alphanumeric)',
description:
'The runid of the completed Actors run [defaultDatasetId] (compulsory)',
required: true,
}),
},
async run(context) {
const apifyToken = context.auth.props.apikey;
const headers = {
Authorization: 'Bearer ' + apifyToken,
'Content-Type': 'application/json',
};
const url =
'https://api.apify.com/v2/datasets/' +
context.propsValue.runid +
'/items/';
const httprequestdata = {
method: HttpMethod.GET,
url,
headers,
};
const response = await httpClient.sendRequest(httprequestdata);
return response.body;
},
});

View File

@@ -0,0 +1,42 @@
import { createAction, Property } from '@activepieces/pieces-framework';
import { apifyAuth } from '../..';
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
export const getLastRun = createAction({
name: 'getLastRun',
auth: apifyAuth,
displayName: 'Get last run details',
description: 'Gets last run details for a given Actor.',
props: {
actorid: Property.ShortText({
displayName: 'The id of the Actor (alphanumeric)',
// updated the description as can also use the actors user or ownername a tilde and the actor name in place of the id
description:
'The id [defaultDatasetId] of the Actor to get run information [you can also use the username then ~ then the name] (compulsory)',
required: true,
}),
},
async run(context) {
const apifyToken = context.auth.props.apikey;
const headers = {
Authorization: 'Bearer ' + apifyToken,
'Content-Type': 'application/json',
};
// removed ?status=SUCCEEDED as we might need to know if a particular actor failed
const url =
'https://api.apify.com/v2/acts/' +
context.propsValue.actorid +
'/runs/last';
//?status=SUCCEEDED'
const httprequestdata = {
method: HttpMethod.GET,
url,
headers,
};
const response = await httpClient.sendRequest(httprequestdata);
return response.body.data;
},
});

View File

@@ -0,0 +1,46 @@
import { createAction, Property } from '@activepieces/pieces-framework';
import { apifyAuth } from '../..';
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
export const startActor = createAction({
// https://api.apify.com/v2/acts/{actorId}/run-sync
// https://api.apify.com/v2/acts/{actorId}/runs
name: 'startActor',
auth: apifyAuth,
displayName: 'Start an Apify Actor',
description: 'Starts an Apify Actor web scraper',
props: {
actorid: Property.ShortText({
displayName: 'The id or name of the Actor (alphanumeric)',
description:
'The id of the Actor to run [Use either id, or the username then ~ then the name] (compulsory)',
required: true,
}),
jsonbody: Property.Json({
displayName: 'JSON input',
description:
'The JSON input to pass to the Actor [you can get the JSON from a run in your Apify account]. If left blank will use defaults. (optional)',
required: true,
}),
},
async run(context) {
const apifyToken = context.auth.props.apikey;
const headers = {
Authorization: 'Bearer ' + apifyToken,
'Content-Type': 'application/json',
};
const url =
'https://api.apify.com/v2/acts/' + context.propsValue.actorid + '/runs/';
const httprequestdata = {
method: HttpMethod.POST,
url,
headers,
body: JSON.stringify(context.propsValue.jsonbody),
};
const response = await httpClient.sendRequest(httprequestdata);
return response.body.data;
},
});

View File

@@ -0,0 +1,19 @@
{
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"module": "commonjs",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
}
]
}

View File

@@ -0,0 +1,11 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"outDir": "../../../../dist/out-tsc",
"declaration": true,
"types": ["node"]
},
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"],
"include": ["src/**/*.ts"]
}