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

View File

@@ -0,0 +1,7 @@
# pieces-zoho-crm
This library was generated with [Nx](https://nx.dev).
## Running lint
Run `nx lint pieces-zoho-crm` to execute the lint via [ESLint](https://eslint.org/).

View File

@@ -0,0 +1,4 @@
{
"name": "@activepieces/piece-zoho-crm",
"version": "0.1.15"
}

View File

@@ -0,0 +1,51 @@
{
"name": "pieces-zoho-crm",
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/pieces/community/zoho-crm/src",
"projectType": "library",
"targets": {
"build": {
"executor": "@nx/js:tsc",
"outputs": [
"{options.outputPath}"
],
"options": {
"outputPath": "dist/packages/pieces/community/zoho-crm",
"tsConfig": "packages/pieces/community/zoho-crm/tsconfig.lib.json",
"packageJson": "packages/pieces/community/zoho-crm/package.json",
"main": "packages/pieces/community/zoho-crm/src/index.ts",
"assets": [
"packages/pieces/community/zoho-crm/*.md",
{
"input": "packages/pieces/community/zoho-crm/src/i18n",
"output": "./src/i18n",
"glob": "**/!(i18n.json)"
}
],
"buildableProjectDepsInPackageJsonType": "dependencies",
"updateBuildableProjectDepsInPackageJson": true
},
"dependsOn": [
"^build",
"prebuild"
]
},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": [
"{options.outputFile}"
]
},
"prebuild": {
"executor": "nx:run-commands",
"options": {
"cwd": "packages/pieces/community/zoho-crm",
"command": "bun install --no-save --silent"
},
"dependsOn": [
"^build"
]
}
},
"tags": []
}

View File

@@ -0,0 +1,35 @@
{
"Customer relationship management software": "Kundenbeziehungs-Management-Software",
"Location": "Standort",
"The location of your Zoho CRM account": "Der Standort Ihres Zoho CRM-Kontos",
"zoho.eu (Europe)": "zoho.eu (Europa)",
"zoho.com (United States)": "zoho.com (Vereinigte Staaten)",
"zoho.com.au (Australia)": "zoho.com.au (Australien)",
"zoho.jp (Japan)": "zoho.jp (Japan)",
"zoho.in (India)": "zoho.in (Indien)",
"zohocloud.ca (Canada)": "zohocloud.ca (Canada)",
"Authentication for Zoho CRM": "Authentifizierung für Zoho CRM",
"Read file": "Datei lesen",
"Custom API Call": "Eigener API-Aufruf",
"Download a file content from Zoho CRM. e.g.: a Backup File": "Download eines Dateiinhalts von Zoho CRM. z.B.: eine Backup-Datei",
"Make a custom API call to a specific endpoint": "Einen benutzerdefinierten API-Aufruf an einen bestimmten Endpunkt machen",
"URL": "URL",
"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)",
"The full URL to use, including the base URL": "Die vollständige URL, die verwendet werden soll, einschließlich der Basis-URL",
"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",
"New Contact": "Neuer Kontakt",
"Triggers when a new contact is created": "Wird ausgelöst, wenn ein neuer Kontakt erstellt wird"
}

View File

@@ -0,0 +1,35 @@
{
"Customer relationship management software": "Software de gestión de relaciones con clientes",
"Location": "Ubicación",
"The location of your Zoho CRM account": "La ubicación de su cuenta de Zoho CRM",
"zoho.eu (Europe)": "zoho.eu (Europa)",
"zoho.com (United States)": "zoho.com (Estados Unidos)",
"zoho.com.au (Australia)": "zoho.com.au (Tamaño)",
"zoho.jp (Japan)": "zoho.jp (Japón)",
"zoho.in (India)": "zoho.in (India)",
"zohocloud.ca (Canada)": "zohocloud.ca (Canada)",
"Authentication for Zoho CRM": "Autenticación para Zoho CRM",
"Read file": "Leer archivo",
"Custom API Call": "Llamada API personalizada",
"Download a file content from Zoho CRM. e.g.: a Backup File": "Descargar un archivo de contenido de Zoho CRM. Por ejemplo: un archivo de copia de seguridad",
"Make a custom API call to a specific endpoint": "Hacer una llamada API personalizada a un extremo específico",
"URL": "URL",
"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)",
"The full URL to use, including the base URL": "La URL completa a usar, incluyendo la URL base",
"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",
"New Contact": "Nuevo contacto",
"Triggers when a new contact is created": "Dispara cuando se crea un nuevo contacto"
}

View File

@@ -0,0 +1,35 @@
{
"Customer relationship management software": "Logiciel de gestion de la relation client",
"Location": "Localisation",
"The location of your Zoho CRM account": "La localisation de votre compte Zoho CRM",
"zoho.eu (Europe)": "zoho.eu (Europe)",
"zoho.com (United States)": "zoho.com (États-Unis)",
"zoho.com.au (Australia)": "zoho.com.au (Australie)",
"zoho.jp (Japan)": "zoho.jp (Japon)",
"zoho.in (India)": "zoho.in (Inde)",
"zohocloud.ca (Canada)": "zohocloud.ca (Canada)",
"Authentication for Zoho CRM": "Authentification pour Zoho CRM",
"Read file": "Lire le fichier",
"Custom API Call": "Appel d'API personnalisé",
"Download a file content from Zoho CRM. e.g.: a Backup File": "Télécharger un fichier depuis Zoho CRM. Par exemple : un fichier de sauvegarde",
"Make a custom API call to a specific endpoint": "Passer un appel API personnalisé à un endpoint spécifique",
"URL": "URL",
"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'expiration (en secondes)",
"The full URL to use, including the base URL": "L'URL complète à utiliser, y compris l'URL de base",
"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": "GET",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "DELETE",
"HEAD": "HEAD",
"New Contact": "Nouveau contact",
"Triggers when a new contact is created": "Déclenche lorsqu'un nouveau contact est créé"
}

View File

@@ -0,0 +1,35 @@
{
"Customer relationship management software": "顧客関係管理ソフトウェア",
"Location": "場所",
"The location of your Zoho CRM account": "Zoho CRM アカウントの場所",
"zoho.eu (Europe)": "zoho.eu (ヨーロッパ)",
"zoho.com (United States)": "zoho.com (アメリカ合衆国)",
"zoho.com.au (Australia)": "zoho.com.au (オーストラリア)",
"zoho.jp (Japan)": "zoho.jp (日本)",
"zoho.in (India)": "zoho.in (インド)",
"zohocloud.ca (Canada)": "zohocloud.ca (Canada)",
"Authentication for Zoho CRM": "Zoho CRM の認証",
"Read file": "ファイルの読み取り",
"Custom API Call": "カスタムAPI通話",
"Download a file content from Zoho CRM. e.g.: a Backup File": "Zoho CRM からファイルの内容をダウンロードします。例えば: バックアップ ファイル",
"Make a custom API call to a specific endpoint": "特定のエンドポイントへのカスタム API コールを実行します。",
"URL": "URL",
"Method": "方法",
"Headers": "ヘッダー",
"Query Parameters": "クエリパラメータ",
"Body": "本文",
"Response is Binary ?": "応答はバイナリですか?",
"No Error on Failure": "失敗時にエラーはありません",
"Timeout (in seconds)": "タイムアウト(秒)",
"The full URL to use, including the base URL": "ベースURLを含む使用する完全な URL",
"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": "頭",
"New Contact": "新しい連絡先",
"Triggers when a new contact is created": "新しい連絡先が作成されたときにトリガーします"
}

View File

@@ -0,0 +1,35 @@
{
"Customer relationship management software": "Klantenrelatie management software",
"Location": "Locatie",
"The location of your Zoho CRM account": "De locatie van uw Zoho CRM-account",
"zoho.eu (Europe)": "zoho.eu (Europa)",
"zoho.com (United States)": "zoho.com (Verenigde Staten)",
"zoho.com.au (Australia)": "zoho.com.au (Australia)",
"zoho.jp (Japan)": "zoho.jp (Japan)",
"zoho.in (India)": "zoho.in (India)",
"zohocloud.ca (Canada)": "zohocloud.ca (Canada)",
"Authentication for Zoho CRM": "Authenticatie voor Zoho CRM",
"Read file": "Bestand lezen",
"Custom API Call": "Custom API Call",
"Download a file content from Zoho CRM. e.g.: a Backup File": "Download de inhoud van een bestand van Zoho CRM. Bijv.: een back-upbestand",
"Make a custom API call to a specific endpoint": "Maak een aangepaste API call naar een specifiek eindpunt",
"URL": "URL",
"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)",
"The full URL to use, including the base URL": "De volledige URL die u wilt gebruiken, inclusief de basis-URL",
"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",
"New Contact": "Nieuw contactpersoon",
"Triggers when a new contact is created": "Triggert wanneer een nieuw contact wordt aangemaakt"
}

View File

@@ -0,0 +1,35 @@
{
"Customer relationship management software": "Software de gerenciamento de clientes",
"Location": "Local:",
"The location of your Zoho CRM account": "A localização da sua conta Zoho CRM",
"zoho.eu (Europe)": "zoho.eu (Europa)",
"zoho.com (United States)": "zoho.com (Estados Unidos)",
"zoho.com.au (Australia)": "zoho.com.au (Austrália)",
"zoho.jp (Japan)": "zoho.jp (Japão)",
"zoho.in (India)": "zoho.in (Índia)",
"zohocloud.ca (Canada)": "zohocloud.ca (Canada)",
"Authentication for Zoho CRM": "Autenticação para Zoho CRM",
"Read file": "Arquivo de leitura",
"Custom API Call": "Chamada de API personalizada",
"Download a file content from Zoho CRM. e.g.: a Backup File": "Baixar um conteúdo de arquivo do Zoho CRM. Ex.: Um arquivo de backup",
"Make a custom API call to a specific endpoint": "Faça uma chamada de API personalizada para um ponto de extremidade específico",
"URL": "URL:",
"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)",
"The full URL to use, including the base URL": "URL completa a ser usada, incluindo a URL base",
"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",
"New Contact": "Novo Contato",
"Triggers when a new contact is created": "Dispara quando um novo contato é criado"
}

View File

@@ -0,0 +1,34 @@
{
"Zoho CRM": "Zoho CRM",
"Customer relationship management software": "Программное обеспечение для управления отношениями с клиентами",
"Location": "Местоположение",
"The location of your Zoho CRM account": "Расположение вашего аккаунта Zoho CRM",
"zoho.eu (Europe)": "zoho.eu (Европа)",
"zoho.com (United States)": "zoho.com (Соединенные Штаты)",
"zoho.com.au (Australia)": "zoho.com.au (Австралия)",
"zoho.jp (Japan)": "zoho.jp (Япония)",
"zoho.in (India)": "zoho.in (Индия)",
"zohocloud.ca (Canada)": "zohocloud.ca (Canada)",
"Authentication for Zoho CRM": "Аутентификация для Zoho CRM",
"Read file": "Чтение файла",
"Custom API Call": "Пользовательский вызов API",
"Download a file content from Zoho CRM. e.g.: a Backup File": "Скачать содержимое файла из Zoho CRM. Например: файл резервной копии",
"Make a custom API call to a specific endpoint": "Сделать пользовательский API вызов к определенной конечной точке",
"URL": "URL",
"Method": "Метод",
"Headers": "Заголовки",
"Query Parameters": "Параметры запроса",
"Body": "Тело",
"No Error on Failure": "Нет ошибок при ошибке",
"Timeout (in seconds)": "Таймаут (в секундах)",
"The full URL to use, including the base URL": "Полный URL для использования, включая базовый URL",
"Authorization headers are injected automatically from your connection.": "Заголовки авторизации включаются автоматически из вашего соединения.",
"GET": "ПОЛУЧИТЬ",
"POST": "ПОСТ",
"PATCH": "ПАТЧ",
"PUT": "ПОКУПИТЬ",
"DELETE": "УДАЛИТЬ",
"HEAD": "HEAD",
"New Contact": "Новый контакт",
"Triggers when a new contact is created": "Включает при создании нового контакта"
}

View File

@@ -0,0 +1,35 @@
{
"Customer relationship management software": "Customer relationship management software",
"Location": "Location",
"The location of your Zoho CRM account": "The location of your Zoho CRM account",
"zoho.eu (Europe)": "zoho.eu (Europe)",
"zoho.com (United States)": "zoho.com (United States)",
"zoho.com.au (Australia)": "zoho.com.au (Australia)",
"zoho.jp (Japan)": "zoho.jp (Japan)",
"zoho.in (India)": "zoho.in (India)",
"zohocloud.ca (Canada)": "zohocloud.ca (Canada)",
"Authentication for Zoho CRM": "Authentication for Zoho CRM",
"Read file": "Read file",
"Custom API Call": "Custom API Call",
"Download a file content from Zoho CRM. e.g.: a Backup File": "Download a file content from Zoho CRM. e.g.: a Backup File",
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
"URL": "URL",
"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)",
"The full URL to use, including the base URL": "The full URL to use, including the base URL",
"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",
"New Contact": "New Contact",
"Triggers when a new contact is created": "Triggers when a new contact is created"
}

View File

@@ -0,0 +1,34 @@
{
"Zoho CRM": "Zoho CRM",
"Customer relationship management software": "Customer relationship management software",
"Location": "Location",
"The location of your Zoho CRM account": "The location of your Zoho CRM account",
"zoho.eu (Europe)": "zoho.eu (Europe)",
"zoho.com (United States)": "zoho.com (United States)",
"zoho.com.au (Australia)": "zoho.com.au (Australia)",
"zoho.jp (Japan)": "zoho.jp (Japan)",
"zoho.in (India)": "zoho.in (India)",
"zohocloud.ca (Canada)": "zohocloud.ca (Canada)",
"Authentication for Zoho CRM": "Authentication for Zoho CRM",
"Read file": "Read file",
"Custom API Call": "Custom API Call",
"Download a file content from Zoho CRM. e.g.: a Backup File": "Download a file content from Zoho CRM. e.g.: a Backup File",
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
"URL": "URL",
"Method": "Method",
"Headers": "Headers",
"Query Parameters": "Query Parameters",
"Body": "Body",
"No Error on Failure": "No Error on Failure",
"Timeout (in seconds)": "Timeout (in seconds)",
"The full URL to use, including the base URL": "The full URL to use, including the base URL",
"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",
"New Contact": "New Contact",
"Triggers when a new contact is created": "Triggers when a new contact is created"
}

View File

@@ -0,0 +1,35 @@
{
"Customer relationship management software": "Customer relationship management software",
"Location": "Location",
"The location of your Zoho CRM account": "The location of your Zoho CRM account",
"zoho.eu (Europe)": "zoho.eu (Europe)",
"zoho.com (United States)": "zoho.com (United States)",
"zoho.com.au (Australia)": "zoho.com.au (Australia)",
"zoho.jp (Japan)": "zoho.jp (Japan)",
"zoho.in (India)": "zoho.in (India)",
"zohocloud.ca (Canada)": "zohocloud.ca (Canada)",
"Authentication for Zoho CRM": "Authentication for Zoho CRM",
"Read file": "Read file",
"Custom API Call": "自定义 API 呼叫",
"Download a file content from Zoho CRM. e.g.: a Backup File": "Download a file content from Zoho CRM. e.g.: a Backup File",
"Make a custom API call to a specific endpoint": "将一个自定义 API 调用到一个特定的终点",
"URL": "URL",
"Method": "方法",
"Headers": "信头",
"Query Parameters": "查询参数",
"Body": "正文内容",
"Response is Binary ?": "Response is Binary ?",
"No Error on Failure": "失败时没有错误",
"Timeout (in seconds)": "超时(秒)",
"The full URL to use, including the base URL": "The full URL to use, including the base URL",
"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": "黑色",
"New Contact": "New Contact",
"Triggers when a new contact is created": "Triggers when a new contact is created"
}

View File

@@ -0,0 +1,80 @@
import { createCustomApiCallAction } from '@activepieces/pieces-common';
import {
OAuth2PropertyValue,
PieceAuth,
Property,
createPiece,
} from '@activepieces/pieces-framework';
import { PieceCategory } from '@activepieces/shared';
import { newContact } from './lib/triggers/new-contact';
import { readFile } from './lib/actions/read-file';
export const zohoCrmAuth = PieceAuth.OAuth2({
props: {
location: Property.StaticDropdown({
displayName: 'Location',
description: 'The location of your Zoho CRM account',
required: true,
options: {
options: [
{
label: 'zoho.eu (Europe)',
value: 'zoho.eu',
},
{
label: 'zoho.com (United States)',
value: 'zoho.com',
},
{
label: 'zoho.com.au (Australia)',
value: 'zoho.com.au',
},
{
label: 'zoho.jp (Japan)',
value: 'zoho.jp',
},
{
label: 'zoho.in (India)',
value: 'zoho.in',
},
{
label: 'zohocloud.ca (Canada)',
value: 'zohocloud.ca',
},
],
},
}),
},
description: 'Authentication for Zoho CRM',
scope: ['ZohoCRM.users.ALL','ZohoCRM.org.ALL', 'ZohoCRM.settings.ALL', 'ZohoCRM.modules.ALL', 'ZohoCRM.bulk.ALL', 'ZohoCRM.bulk.backup.ALL', 'ZohoFiles.files.ALL'],
authUrl: 'https://accounts.{location}/oauth/v2/auth',
tokenUrl: 'https://accounts.{location}/oauth/v2/token',
required: true,
});
export const zohoCrm = createPiece({
displayName: 'Zoho CRM',
description: 'Customer relationship management software',
logoUrl: 'https://cdn.activepieces.com/pieces/zoho-crm.png',
minimumSupportedRelease: '0.30.0',
categories: [PieceCategory.SALES_AND_CRM],
authors: ["kishanprmr","MoShizzle","khaledmashaly","abuaboud","ikus060"],
auth: zohoCrmAuth,
actions: [
readFile,
createCustomApiCallAction({
baseUrl: (auth) =>
{
const data = (auth as OAuth2PropertyValue).data;
return data && data['api_domain']? `${data['api_domain']}/crm/v3` : ''
},
auth: zohoCrmAuth,
authMapping: async (auth) => ({
Authorization: `Zoho-oauthtoken ${(auth as OAuth2PropertyValue).access_token}`,
}),
}),
],
triggers: [newContact],
});

View File

@@ -0,0 +1,45 @@
import { zohoCrmAuth } from '../../index';
import { Property, createAction } from "@activepieces/pieces-framework";
export const readFile = createAction({
auth: zohoCrmAuth,
name: 'read-file',
displayName: 'Read file',
description: 'Download a file content from Zoho CRM. e.g.: a Backup File',
props: {
url: Property.ShortText({
displayName: 'URL',
description: 'The full URL to use, including the base URL',
required: true,
defaultValue: '',
})
},
run: async ({ auth, propsValue, files }) => {
const url = propsValue['url'];
const download = await fetch(url, {
headers: {
Authorization: `Bearer ${auth.access_token}`,
},
})
.then((response) =>
response.ok ? response.blob() : Promise.reject(response)
)
.catch((error) =>
Promise.reject(
new Error(
`Error when download file:\n\tDownload file response: ${(error as Error).message ?? error
}`
)
)
);
const fileName = url.split('/').pop() ?? url;
return files.write({
fileName: fileName,
data: Buffer.from(await download.arrayBuffer()),
});
},
});

View File

@@ -0,0 +1,197 @@
import {
AuthenticationType,
DedupeStrategy,
httpClient,
HttpMethod,
Polling,
pollingHelper,
} from '@activepieces/pieces-common';
import {
AppConnectionValueForAuthProperty,
createTrigger,
OAuth2PropertyValue,
TriggerStrategy,
} from '@activepieces/pieces-framework';
import dayjs from 'dayjs';
import { zohoCrmAuth } from '../..';
export const newContact = createTrigger({
auth: zohoCrmAuth,
name: 'new_contact',
displayName: 'New Contact',
description: 'Triggers when a new contact is created',
sampleData: {
Owner: {
name: 'Activepieces Apps',
id: '560094000000343001',
email: 'apps@activepieces.com',
},
Email: 'capla-paprocki@yahoo.com',
Description: null,
$currency_symbol: '$',
Vendor_Name: null,
Mailing_Zip: '99501',
$field_states: null,
Other_Phone: null,
Mailing_State: 'AK',
$review_process: {
approve: false,
reject: false,
resubmit: false,
},
Twitter: 'lpaprocki_sample',
Other_Zip: null,
Mailing_Street: '639 Main St',
Other_State: null,
$sharing_permission: 'full_access',
Salutation: null,
Other_Country: null,
Last_Activity_Time: '2023-03-26T00:02:28+01:00',
First_Name: 'Capla',
Full_Name: 'Capla Paprocki (Sample)',
Asst_Phone: null,
Record_Image:
'd7d6bec0cbbfd9f3b84ebcd2eba41e9fa432f48560f9ed267b2e5b26eb58a07f5451e24ca9042b39f05459c41291c005b0dea6b224d375a6030f4096eb631fa3d4dcabb97393f1dc2470eb1658164f05',
Department: 'Admin',
Modified_By: {
name: 'Activepieces Apps',
id: '560094000000343001',
email: 'apps@activepieces.com',
},
$review: null,
$state: 'save',
Skype_ID: 'lpaprocki',
Unsubscribed_Mode: null,
$process_flow: false,
Assistant: null,
Phone: '555-555-5555',
Mailing_Country: 'United States',
id: '560094000000349199',
Reporting_To: null,
$approval: {
delegate: false,
approve: false,
reject: false,
resubmit: false,
},
Enrich_Status__s: null,
Other_City: null,
Created_Time: '2023-03-26T00:01:56+01:00',
$wizard_connection_path: null,
$editable: true,
Home_Phone: null,
Created_By: {
name: 'Activepieces Apps',
id: '560094000000343001',
email: 'apps@activepieces.com',
},
$zia_owner_assignment: 'owner_recommendation_unavailable',
Secondary_Email: null,
},
type: TriggerStrategy.POLLING,
props: {},
async run(context) {
return await pollingHelper.poll(polling, {
auth: context.auth,
store: context.store,
propsValue: context.propsValue,
files: context.files,
});
},
async test({ auth, propsValue, store, files }): Promise<unknown[]> {
return await pollingHelper.test(polling, {
auth,
store: store,
propsValue: propsValue,
files: files,
});
},
async onEnable({ auth, propsValue, store }): Promise<void> {
await pollingHelper.onEnable(polling, {
auth,
store: store,
propsValue: propsValue,
});
},
async onDisable({ auth, propsValue, store }): Promise<void> {
await pollingHelper.onDisable(polling, {
auth,
store: store,
propsValue: propsValue,
});
},
});
const polling: Polling<AppConnectionValueForAuthProperty<typeof zohoCrmAuth>, unknown> = {
strategy: DedupeStrategy.TIMEBASED,
items: async ({ auth }) => {
const response = await httpClient.sendRequest<{
data: { Created_Time: string }[];
}>({
url: `${auth.data.api_domain}/crm/v4/Contacts`,
method: HttpMethod.GET,
queryParams: {
perPage: '200',
sort_order: 'desc',
sort_by: 'Created_Time',
fields: [
'Owner',
'Email',
'$currency_symbol',
'$field_states',
'Other_Phone',
'Mailing_State',
'Other_State',
'$sharing_permission',
'Other_Country',
'Last_Activity_Time',
'Department',
'$state',
'Unsubscribed_Mode',
'$process_flow',
'Assistant',
'Mailing_Country',
'id',
'Reporting_To',
'$approval',
'Enrich_Status__s',
'Other_City',
'Created_Time',
'$wizard_connection_path',
'$editable',
'Home_Phone',
'Created_By',
'$zia_owner_assignment',
'Secondary_Email',
'Description',
'Vendor_Name',
'Mailing_Zip',
'$review_process',
'Twitter',
'Other_Zip',
'Mailing_Street',
'$canvas_id',
'Salutation',
'First_Name',
'Full_Name',
'Asst_Phone',
'Record_Image',
'Modified_By',
'$review',
'Skype_ID',
'Phone',
'Account_Name',
].join(','),
},
authentication: {
type: AuthenticationType.BEARER_TOKEN,
token: auth.access_token,
},
});
return response.body.data.map((record) => ({
epochMilliSeconds: dayjs(record.Created_Time).valueOf(),
data: record,
}));
},
};

View File

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

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