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

View File

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

View File

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

View File

@@ -0,0 +1,65 @@
{
"name": "pieces-bamboohr",
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/pieces/community/bamboohr/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/bamboohr",
"tsConfig": "packages/pieces/community/bamboohr/tsconfig.lib.json",
"packageJson": "packages/pieces/community/bamboohr/package.json",
"main": "packages/pieces/community/bamboohr/src/index.ts",
"assets": [
"packages/pieces/community/bamboohr/*.md",
{
"input": "packages/pieces/community/bamboohr/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/bamboohr",
"command": "bun install --no-save --silent"
},
"dependsOn": [
"^build"
]
}
}
}

View File

@@ -0,0 +1,29 @@
{
"Company domain": "Firmendomain",
"API key": "API-Schlüssel",
"The subdomain used to access BambooHR. If you access BambooHR at https://mycompany.bamboohr.com, then the companyDomain is \"mycompany\"": "Die Subdomain für den Zugriff auf BambooHR. Wenn Sie auf BambooHR unter https://mycompany.bamboohr.com zugreifen, ist die companyDomain \"mycompany\"",
"Follow [these instructions](https://documentation.bamboohr.com/docs/getting-started#authentication) to get your API key": "Folge [diesen Anweisungen](https://documentation.bamboohr.com/docs/getting-started#authentication) um deinen API-Schlüssel zu erhalten",
"Custom API Call": "Eigener API-Aufruf",
"Make a custom API call to a specific endpoint": "Einen benutzerdefinierten API-Aufruf an einen bestimmten Endpunkt machen",
"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)",
"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..",
"GET": "ERHALTEN",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "LÖSCHEN",
"HEAD": "HEAD",
"Report Field Changed": "Berichtsfeld geändert",
"Triggers when a specific field in a BambooHR report changes for any employee.": "Wird ausgelöst, wenn sich ein bestimmtes Feld in einem BambooHR Bericht für jeden Mitarbeiter ändert.",
"Report ID": "Berichts-ID",
"Field to Monitor": "Zu überwachendes Feld",
"The ID of the BambooHR report to monitor (e.g., \"1\", \"2\", etc.)": "Die ID des zu überwachenden BambooHR-Berichts (z.B. \"1\", \"2\", usw.)",
"The name of the field to watch for changes (e.g., \"department\", \"jobTitle\", \"status\")": "Der Name des Feldes, das auf Änderungen überwacht werden soll (z.B. \"Abteilung\", \"JobTitle\", \"Status\")"
}

View File

@@ -0,0 +1,29 @@
{
"Company domain": "Dominio de empresa",
"API key": "Clave API",
"The subdomain used to access BambooHR. If you access BambooHR at https://mycompany.bamboohr.com, then the companyDomain is \"mycompany\"": "El subdominio utilizado para acceder a BambooHR. Si accede a BambooHR en https://mycompany.bamboohr.com, entonces la empresa Domain es \"mycompany\"",
"Follow [these instructions](https://documentation.bamboohr.com/docs/getting-started#authentication) to get your API key": "Sigue [estas instrucciones](https://documentation.bamboohr.com/docs/getting-started#authentication) para obtener tu clave API",
"Custom API Call": "Llamada API personalizada",
"Make a custom API call to a specific endpoint": "Hacer una llamada API personalizada a un extremo específico",
"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)",
"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.",
"GET": "RECOGER",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "BORRAR",
"HEAD": "LIMPIO",
"Report Field Changed": "Campo de reporte cambiado",
"Triggers when a specific field in a BambooHR report changes for any employee.": "Activadores cuando un campo específico de un BambooHR reporta cambios para cualquier empleado.",
"Report ID": "ID del informe",
"Field to Monitor": "Campo a Seguidor",
"The ID of the BambooHR report to monitor (e.g., \"1\", \"2\", etc.)": "El ID del informe de BambooHR a monitorear (por ejemplo, \"1\", \"2\", etc.)",
"The name of the field to watch for changes (e.g., \"department\", \"jobTitle\", \"status\")": "El nombre del campo a ver los cambios (por ejemplo, \"departamento\", \"jobTitle\", \"status\")"
}

View File

@@ -0,0 +1,29 @@
{
"Company domain": "Domaine de la société",
"API key": "Clé API",
"The subdomain used to access BambooHR. If you access BambooHR at https://mycompany.bamboohr.com, then the companyDomain is \"mycompany\"": "Le sous-domaine utilisé pour accéder à BambooHR. Si vous accédez à BambooHR à https://mycompany.bamboohr.com, alors le companyDomain est \"mycompany\"",
"Follow [these instructions](https://documentation.bamboohr.com/docs/getting-started#authentication) to get your API key": "Suivez [ces instructions](https://documentation.bamboohr.com/docs/getting-started#authentication) pour obtenir votre clé API",
"Custom API Call": "Appel API personnalisé",
"Make a custom API call to a specific endpoint": "Passez un appel API personnalisé à un point de terminaison spécifique",
"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)",
"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.",
"GET": "OBTENIR",
"POST": "POSTER",
"PATCH": "PATCH",
"PUT": "EFFACER",
"DELETE": "SUPPRIMER",
"HEAD": "TÊTE",
"Report Field Changed": "Champ de rapport modifié",
"Triggers when a specific field in a BambooHR report changes for any employee.": "Déclenche lorsqu'un champ spécifique dans un rapport BambooHR change pour tout employé.",
"Report ID": "ID du rapport",
"Field to Monitor": "Champ à surveiller",
"The ID of the BambooHR report to monitor (e.g., \"1\", \"2\", etc.)": "L'ID du rapport BambooHR à surveiller (par exemple, \"1\", \"2\", etc.)",
"The name of the field to watch for changes (e.g., \"department\", \"jobTitle\", \"status\")": "Le nom du champ à surveiller pour les modifications (ex: \"Service\", \"jobTitle\", \"statut\")"
}

View File

@@ -0,0 +1,29 @@
{
"Company domain": "会社のドメイン",
"API key": "API キー",
"The subdomain used to access BambooHR. If you access BambooHR at https://mycompany.bamboohr.com, then the companyDomain is \"mycompany\"": "BambooHRにアクセスするために使用されるサブドメイン。https://mycompany.bamboohr.comでBambooHRにアクセスする場合、companyDomain は \"mycompany\" です。",
"Follow [these instructions](https://documentation.bamboohr.com/docs/getting-started#authentication) to get your API key": "API キーを取得するには、[これらの手順](https://documentation.bamboohr.com/docs/getting-started#authentication) に従ってください",
"Custom API Call": "カスタムAPI通話",
"Make a custom API call to a specific endpoint": "特定のエンドポイントへのカスタム API コールを実行します。",
"Method": "方法",
"Headers": "ヘッダー",
"Query Parameters": "クエリパラメータ",
"Body": "本文",
"Response is Binary ?": "応答はバイナリですか?",
"No Error on Failure": "失敗時にエラーはありません",
"Timeout (in seconds)": "タイムアウト(秒)",
"Authorization headers are injected automatically from your connection.": "認証ヘッダは接続から自動的に注入されます。",
"Enable for files like PDFs, images, etc..": "PDF、画像などのファイルを有効にします。",
"GET": "取得",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "削除",
"HEAD": "頭",
"Report Field Changed": "レポート項目が変更されました",
"Triggers when a specific field in a BambooHR report changes for any employee.": "BambooHR レポートの特定のフィールドが任意の従業員に変更されたときにトリガーされます。",
"Report ID": "レポート ID",
"Field to Monitor": "モニターするフィールド",
"The ID of the BambooHR report to monitor (e.g., \"1\", \"2\", etc.)": "モニタリングするBambooHRレポートのID「1」、「2」など",
"The name of the field to watch for changes (e.g., \"department\", \"jobTitle\", \"status\")": "変更を監視するフィールドの名前 (例: \"department\", \"jobTitle\", \"status\")"
}

View File

@@ -0,0 +1,29 @@
{
"Company domain": "Domein bedrijf",
"API key": "API sleutel",
"The subdomain used to access BambooHR. If you access BambooHR at https://mycompany.bamboohr.com, then the companyDomain is \"mycompany\"": "De subdomein die wordt gebruikt om BambooHR te benaderen. Als u BambooHR opent op https://mijnbedrijf.bamboohr.com dan is het bedrijfdomein \"mijnbedrijf\"",
"Follow [these instructions](https://documentation.bamboohr.com/docs/getting-started#authentication) to get your API key": "Volg [deze instructies](https://documentation.bamboohr.com/docs/getting-started#authentication) om je API-sleutel te krijgen",
"Custom API Call": "Custom API Call",
"Make a custom API call to a specific endpoint": "Maak een aangepaste API call naar een specifiek eindpunt",
"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)",
"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..",
"GET": "KRIJG",
"POST": "POSTE",
"PATCH": "BEKIJK",
"PUT": "PUT",
"DELETE": "VERWIJDEREN",
"HEAD": "HOOFD",
"Report Field Changed": "Rapportveld gewijzigd",
"Triggers when a specific field in a BambooHR report changes for any employee.": "Triggert wanneer een specifiek veld in een BambooHR-rapport voor elke werknemer verandert.",
"Report ID": "Rapporteer ID",
"Field to Monitor": "Te monitoren veld",
"The ID of the BambooHR report to monitor (e.g., \"1\", \"2\", etc.)": "Het ID van het BambooHR-rapport om te monitoren (bijv. \"1\", \"2\", etc.)",
"The name of the field to watch for changes (e.g., \"department\", \"jobTitle\", \"status\")": "De naam van het veld om wijzigingen te bekijken (bijv. \"afdeling\", \"jobTitle\", \"status\")"
}

View File

@@ -0,0 +1,29 @@
{
"Company domain": "Domínio da empresa",
"API key": "Chave da API",
"The subdomain used to access BambooHR. If you access BambooHR at https://mycompany.bamboohr.com, then the companyDomain is \"mycompany\"": "O subdomínio usado para acessar BambooHR. Se você acessar BambooHR em https://mycompany.bamboohr.com, então o Domínio de Empresa é \"minhaempresa\"",
"Follow [these instructions](https://documentation.bamboohr.com/docs/getting-started#authentication) to get your API key": "Siga [estas instruções](https://documentation.bamboohr.com/docs/getting-started#authentication) para obter a sua chave de API",
"Custom API Call": "Chamada de API personalizada",
"Make a custom API call to a specific endpoint": "Faça uma chamada de API personalizada para um ponto de extremidade específico",
"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)",
"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..",
"GET": "OBTER",
"POST": "POSTAR",
"PATCH": "COMPRAR",
"PUT": "COLOCAR",
"DELETE": "EXCLUIR",
"HEAD": "CABEÇA",
"Report Field Changed": "Relatório Campo Alterado",
"Triggers when a specific field in a BambooHR report changes for any employee.": "Dispara quando um campo específico em um relatório de BambooHR muda para qualquer funcionário.",
"Report ID": "ID do relatório",
"Field to Monitor": "Campo para Monitorar",
"The ID of the BambooHR report to monitor (e.g., \"1\", \"2\", etc.)": "O ID do relatório BambooHR a ser monitorado (ex.: \"1\", \"2\", etc.)",
"The name of the field to watch for changes (e.g., \"department\", \"jobTitle\", \"status\")": "O nome do campo para acompanhar mudanças (por exemplo, \"departamento\", \"jobTitle\", \"status\")"
}

View File

@@ -0,0 +1,28 @@
{
"BambooHR": "Бамбур",
"Company domain": "Домен компании",
"API key": "API ключ",
"The subdomain used to access BambooHR. If you access BambooHR at https://mycompany.bamboohr.com, then the companyDomain is \"mycompany\"": "Поддомен, используемый для доступа к BambooHR. Если вы заходите на BambooHR по адресу https://mycompany.bamboohr.com, то компания является \"mycompany\"",
"Follow [these instructions](https://documentation.bamboohr.com/docs/getting-started#authentication) to get your API key": "Следуйте [этим инструкциям](https://documentation.bamboohr.com/docs/getting-started#authentication) чтобы получить ваш ключ API",
"Custom API Call": "Пользовательский вызов API",
"Make a custom API call to a specific endpoint": "Сделать пользовательский API вызов к определенной конечной точке",
"Method": "Метод",
"Headers": "Заголовки",
"Query Parameters": "Параметры запроса",
"Body": "Тело",
"No Error on Failure": "Нет ошибок при ошибке",
"Timeout (in seconds)": "Таймаут (в секундах)",
"Authorization headers are injected automatically from your connection.": "Заголовки авторизации включаются автоматически из вашего соединения.",
"GET": "ПОЛУЧИТЬ",
"POST": "ПОСТ",
"PATCH": "ПАТЧ",
"PUT": "ПОКУПИТЬ",
"DELETE": "УДАЛИТЬ",
"HEAD": "HEAD",
"Report Field Changed": "Поле отчета изменено",
"Triggers when a specific field in a BambooHR report changes for any employee.": "Вызывает, когда определенное поле в отчете BambooHR меняется для любого сотрудника.",
"Report ID": "ID отчета",
"Field to Monitor": "Поле для монитора",
"The ID of the BambooHR report to monitor (e.g., \"1\", \"2\", etc.)": "ID отчета BambooHR для мониторинга (например, \"1\", \"2\" и т. д.)",
"The name of the field to watch for changes (e.g., \"department\", \"jobTitle\", \"status\")": "Имя поля для наблюдения за изменениями (например, «департамент», «Заголовок задачи», «статус»)"
}

View File

@@ -0,0 +1,29 @@
{
"Company domain": "Company domain",
"API key": "API key",
"The subdomain used to access BambooHR. If you access BambooHR at https://mycompany.bamboohr.com, then the companyDomain is \"mycompany\"": "The subdomain used to access BambooHR. If you access BambooHR at https://mycompany.bamboohr.com, then the companyDomain is \"mycompany\"",
"Follow [these instructions](https://documentation.bamboohr.com/docs/getting-started#authentication) to get your API key": "Follow [these instructions](https://documentation.bamboohr.com/docs/getting-started#authentication) to get your API key",
"Custom API Call": "Custom API Call",
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
"Method": "Method",
"Headers": "Headers",
"Query Parameters": "Query Parameters",
"Body": "Body",
"Response is Binary ?": "Response is Binary ?",
"No Error on Failure": "No Error on Failure",
"Timeout (in seconds)": "Timeout (in seconds)",
"Authorization headers are injected automatically from your connection.": "Authorization headers are injected automatically from your connection.",
"Enable for files like PDFs, images, etc..": "Enable for files like PDFs, images, etc..",
"GET": "GET",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "DELETE",
"HEAD": "HEAD",
"Report Field Changed": "Report Field Changed",
"Triggers when a specific field in a BambooHR report changes for any employee.": "Triggers when a specific field in a BambooHR report changes for any employee.",
"Report ID": "Report ID",
"Field to Monitor": "Field to Monitor",
"The ID of the BambooHR report to monitor (e.g., \"1\", \"2\", etc.)": "The ID of the BambooHR report to monitor (e.g., \"1\", \"2\", etc.)",
"The name of the field to watch for changes (e.g., \"department\", \"jobTitle\", \"status\")": "The name of the field to watch for changes (e.g., \"department\", \"jobTitle\", \"status\")"
}

View File

@@ -0,0 +1,28 @@
{
"BambooHR": "BambooHR",
"Company domain": "Company domain",
"API key": "API key",
"The subdomain used to access BambooHR. If you access BambooHR at https://mycompany.bamboohr.com, then the companyDomain is \"mycompany\"": "The subdomain used to access BambooHR. If you access BambooHR at https://mycompany.bamboohr.com, then the companyDomain is \"mycompany\"",
"Follow [these instructions](https://documentation.bamboohr.com/docs/getting-started#authentication) to get your API key": "Follow [these instructions](https://documentation.bamboohr.com/docs/getting-started#authentication) to get your API key",
"Custom API Call": "Custom API Call",
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
"Method": "Method",
"Headers": "Headers",
"Query Parameters": "Query Parameters",
"Body": "Body",
"No Error on Failure": "No Error on Failure",
"Timeout (in seconds)": "Timeout (in seconds)",
"Authorization headers are injected automatically from your connection.": "Authorization headers are injected automatically from your connection.",
"GET": "GET",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "DELETE",
"HEAD": "HEAD",
"Report Field Changed": "Report Field Changed",
"Triggers when a specific field in a BambooHR report changes for any employee.": "Triggers when a specific field in a BambooHR report changes for any employee.",
"Report ID": "Report ID",
"Field to Monitor": "Field to Monitor",
"The ID of the BambooHR report to monitor (e.g., \"1\", \"2\", etc.)": "The ID of the BambooHR report to monitor (e.g., \"1\", \"2\", etc.)",
"The name of the field to watch for changes (e.g., \"department\", \"jobTitle\", \"status\")": "The name of the field to watch for changes (e.g., \"department\", \"jobTitle\", \"status\")"
}

View File

@@ -0,0 +1,29 @@
{
"Company domain": "Company domain",
"API key": "API key",
"The subdomain used to access BambooHR. If you access BambooHR at https://mycompany.bamboohr.com, then the companyDomain is \"mycompany\"": "The subdomain used to access BambooHR. If you access BambooHR at https://mycompany.bamboohr.com, then the companyDomain is \"mycompany\"",
"Follow [these instructions](https://documentation.bamboohr.com/docs/getting-started#authentication) to get your API key": "Follow [these instructions](https://documentation.bamboohr.com/docs/getting-started#authentication) to get your API key",
"Custom API Call": "自定义 API 呼叫",
"Make a custom API call to a specific endpoint": "将一个自定义 API 调用到一个特定的终点",
"Method": "方法",
"Headers": "信头",
"Query Parameters": "查询参数",
"Body": "正文内容",
"Response is Binary ?": "Response is Binary ?",
"No Error on Failure": "失败时没有错误",
"Timeout (in seconds)": "超时(秒)",
"Authorization headers are injected automatically from your connection.": "授权头自动从您的连接中注入。",
"Enable for files like PDFs, images, etc..": "Enable for files like PDFs, images, etc..",
"GET": "获取",
"POST": "帖子",
"PATCH": "PATCH",
"PUT": "弹出",
"DELETE": "删除",
"HEAD": "黑色",
"Report Field Changed": "Report Field Changed",
"Triggers when a specific field in a BambooHR report changes for any employee.": "Triggers when a specific field in a BambooHR report changes for any employee.",
"Report ID": "Report ID",
"Field to Monitor": "Field to Monitor",
"The ID of the BambooHR report to monitor (e.g., \"1\", \"2\", etc.)": "The ID of the BambooHR report to monitor (e.g., \"1\", \"2\", etc.)",
"The name of the field to watch for changes (e.g., \"department\", \"jobTitle\", \"status\")": "The name of the field to watch for changes (e.g., \"department\", \"jobTitle\", \"status\")"
}

View File

@@ -0,0 +1,49 @@
import {
createPiece,
PieceAuth,
Property,
} from '@activepieces/pieces-framework';
import { createCustomApiCallAction } from '@activepieces/pieces-common';
import { reportFieldChanged } from './lib/triggers/report-field-changed';
export const bambooHrAuth = PieceAuth.CustomAuth({
required: true,
description:
'Follow [these instructions](https://documentation.bamboohr.com/docs/getting-started#authentication) to get your API key',
props: {
companyDomain: Property.ShortText({
displayName: 'Company domain',
description:
'The subdomain used to access BambooHR. If you access BambooHR at https://mycompany.bamboohr.com, then the companyDomain is "mycompany"',
required: true,
}),
apiKey: PieceAuth.SecretText({
displayName: 'API key',
required: true,
}),
},
});
export const bambooHr = createPiece({
displayName: 'BambooHR',
auth: bambooHrAuth,
minimumSupportedRelease: '0.36.1',
logoUrl: 'https://cdn.activepieces.com/pieces/bamboohr.png',
authors: ['AdamSelene'],
actions: [
createCustomApiCallAction({
baseUrl: (auth) =>
`https://api.bamboohr.com/api/gateway.php/${auth?.props?.companyDomain}/v1/`,
auth: bambooHrAuth,
authMapping: async (auth) => {
const { apiKey } = auth.props;
return {
Authorization: `Basic ${Buffer.from(`${apiKey}:`).toString(
'base64'
)}`,
};
},
}),
],
triggers: [reportFieldChanged],
});

View File

@@ -0,0 +1,157 @@
import { bambooHrAuth } from '../../index';
import {
DedupeStrategy,
HttpMethod,
HttpRequest,
Polling,
httpClient,
pollingHelper,
} from '@activepieces/pieces-common';
import {
TriggerStrategy,
createTrigger,
Property,
AppConnectionValueForAuthProperty,
} from '@activepieces/pieces-framework';
import dayjs from 'dayjs';
const polling: Polling<
AppConnectionValueForAuthProperty<typeof bambooHrAuth>,
{
reportId: string;
fieldToMonitor: string;
}
> = {
strategy: DedupeStrategy.TIMEBASED,
items: async ({ auth, propsValue, store }) => {
const { companyDomain, apiKey } = auth.props;
const request: HttpRequest = {
method: HttpMethod.GET,
url: `https://api.bamboohr.com/api/gateway.php/${companyDomain}/v1/reports/${propsValue.reportId}?format=json`,
headers: {
Authorization: `Basic ${Buffer.from(`${apiKey}:`).toString('base64')}`,
Accept: 'application/json',
},
};
try {
const response = await httpClient.sendRequest<{
fields: Array<{ id: string; type: string; name: string }>;
employees: Array<Record<string, any>>;
}>(request);
const fields = response.body.fields || [];
const reportData = response.body.employees || [];
const availableFields = new Set(fields.map((f) => f.id));
if (!availableFields.has(propsValue.fieldToMonitor)) {
console.warn(
`Field "${
propsValue.fieldToMonitor
}" not found in report. Available fields: ${Array.from(
availableFields
).join(', ')}`
);
return [];
}
const lastKnownState =
(await store.get<Record<string, any>>('lastReportState')) || {};
const currentState: Record<string, any> = {};
const changes: any[] = [];
reportData.forEach((employee: Record<string, any>) => {
const employeeId = String(
employee['id'] || employee['employeeId'] || 'unknown'
);
const currentFieldValue = employee[propsValue.fieldToMonitor];
const lastFieldValue = lastKnownState[employeeId];
currentState[employeeId] = currentFieldValue;
if (
lastFieldValue !== undefined &&
lastFieldValue !== currentFieldValue
) {
changes.push({
epochMilliSeconds: dayjs().valueOf(),
data: {
employeeId,
employeeName:
employee['displayName'] ||
(employee['firstName'] && employee['lastName']
? `${employee['firstName']} ${employee['lastName']}`
: 'Unknown'),
fieldName: propsValue.fieldToMonitor,
oldValue: lastFieldValue,
newValue: currentFieldValue,
changedAt: dayjs().toISOString(),
employee: employee,
},
});
}
});
await store.put('lastReportState', currentState);
return changes;
} catch (error) {
console.error('Error fetching BambooHR report:', error);
return [];
}
},
};
export const reportFieldChanged = createTrigger({
auth: bambooHrAuth,
name: 'reportFieldChanged',
displayName: 'Report Field Changed',
description:
'Triggers when a specific field in a BambooHR report changes for any employee.',
props: {
reportId: Property.ShortText({
displayName: 'Report ID',
description:
'The ID of the BambooHR report to monitor (e.g., "1", "2", etc.)',
required: true,
}),
fieldToMonitor: Property.ShortText({
displayName: 'Field to Monitor',
description:
'The name of the field to watch for changes (e.g., "department", "jobTitle", "status")',
required: true,
}),
},
sampleData: {
employeeId: '12345',
employeeName: 'John Doe',
fieldName: 'department',
oldValue: 'Engineering',
newValue: 'Product',
changedAt: '2024-07-17T15:30:00Z',
employee: {
id: '12345',
displayName: 'John Doe',
department: 'Product',
jobTitle: 'Senior Developer',
},
},
type: TriggerStrategy.POLLING,
async test(context) {
return await pollingHelper.test(polling, context);
},
async onEnable(context) {
await pollingHelper.onEnable(polling, context);
},
async onDisable(context) {
await pollingHelper.onDisable(polling, context);
},
async run(context) {
return await pollingHelper.poll(polling, context);
},
});

View File

@@ -0,0 +1,19 @@
{
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"module": "commonjs",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"noPropertyAccessFromIndexSignature": 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"]
}