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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,41 @@
{
"Send personal video messages to delight customers": "Senden Sie persönliche Video-Nachrichten, um Kunden zu begeistern",
"API Key": "API-Schlüssel",
"The API key for your Bonjoro account": "Der API-Schlüssel für dein Bonjoro-Konto",
"Authenticate with your Bonjoro account": "Authentifizieren Sie sich mit Ihrem Bonjoro-Konto",
"Create a Greet": "Greet erstellen",
"Custom API Call": "Eigener API-Aufruf",
"Create a new Greet in Bonjoro": "Erstelle einen neuen Gruß in Bonjoro",
"Make a custom API call to a specific endpoint": "Einen benutzerdefinierten API-Aufruf an einen bestimmten Endpunkt machen",
"Note": "Notiz",
"Email": "E-Mail",
"First Name": "Vorname",
"Last Name": "Nachname",
"Assignee": "Assignee",
"Campaign": "Kampagne",
"Template": "Vorlage",
"Custom Attributes": "Eigene Attribute",
"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)",
"Note to send with the greet": "Notiz mit dem Gruß senden",
"Email to send the greet to": "E-Mail senden an",
"First name of the person to greet": "Vorname der zu grüßenden Person",
"Last name of the person to greet": "Nachname der zu grüßenden Person",
"Who to assign the greet to": "Wer soll den Gruß zuweisen zu",
"The campaign to add the greet to": "Die Kampagne, um den Gruß hinzuzufügen",
"The template to use for the greet": "Die Vorlage für den Gruß",
"Enter custom attributes to send with the greet": "Geben Sie benutzerdefinierte Attribute ein, die mit dem Gruß gesendet werden sollen",
"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"
}

View File

@@ -0,0 +1,41 @@
{
"Send personal video messages to delight customers": "Enviar mensajes de vídeo personales para deleitar a los clientes",
"API Key": "Clave API",
"The API key for your Bonjoro account": "La clave API para tu cuenta Bonjoro",
"Authenticate with your Bonjoro account": "Autenticar con su cuenta Bonjoro",
"Create a Greet": "Crear un Saludo",
"Custom API Call": "Llamada API personalizada",
"Create a new Greet in Bonjoro": "Crear un nuevo Saludo en Bonjoro",
"Make a custom API call to a specific endpoint": "Hacer una llamada API personalizada a un extremo específico",
"Note": "Nota",
"Email": "E-mail",
"First Name": "Nombre",
"Last Name": "Apellido",
"Assignee": "Assignee",
"Campaign": "Campaña",
"Template": "Plantilla",
"Custom Attributes": "Atributos personalizados",
"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)",
"Note to send with the greet": "Nota para enviar con el saludo",
"Email to send the greet to": "Email para enviar el saludo a",
"First name of the person to greet": "Nombre de la persona a saludar",
"Last name of the person to greet": "Apellido de la persona a saludar",
"Who to assign the greet to": "A quién asignar el saludo",
"The campaign to add the greet to": "La campaña a la que agregar el saludo",
"The template to use for the greet": "La plantilla a usar para el saludo",
"Enter custom attributes to send with the greet": "Introduzca atributos personalizados para enviar con el saludo",
"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"
}

View File

@@ -0,0 +1,41 @@
{
"Send personal video messages to delight customers": "Envoyer des messages vidéo personnels pour ravir les clients",
"API Key": "Clé API",
"The API key for your Bonjoro account": "La clé API de votre compte Bonjoro",
"Authenticate with your Bonjoro account": "Authentification avec votre compte Bonjoro",
"Create a Greet": "Créer un salut",
"Custom API Call": "Appel API personnalisé",
"Create a new Greet in Bonjoro": "Créer un nouveau salut à Bonjoro",
"Make a custom API call to a specific endpoint": "Passez un appel API personnalisé à un point de terminaison spécifique",
"Note": "Note",
"Email": "Courriel",
"First Name": "First Name",
"Last Name": "Last Name",
"Assignee": "Assignee",
"Campaign": "Campagnes",
"Template": "Gabarit",
"Custom Attributes": "Attributs personnalisés",
"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)",
"Note to send with the greet": "Note à envoyer avec le salut",
"Email to send the greet to": "Courriel à envoyer à",
"First name of the person to greet": "Prénom de la personne à saluer",
"Last name of the person to greet": "Nom de famille de la personne à saluer",
"Who to assign the greet to": "À qui assigner le salut",
"The campaign to add the greet to": "La campagne pour ajouter le salut à",
"The template to use for the greet": "Le modèle à utiliser pour le salut",
"Enter custom attributes to send with the greet": "Entrez les attributs personnalisés à envoyer avec le salut",
"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"
}

View File

@@ -0,0 +1,41 @@
{
"Send personal video messages to delight customers": "お客様を喜ばせるために個人的なビデオメッセージを送信する",
"API Key": "API キー",
"The API key for your Bonjoro account": "Bonjoro アカウントの API キー",
"Authenticate with your Bonjoro account": "Bonjoro アカウントで認証",
"Create a Greet": "挨拶を作成",
"Custom API Call": "カスタムAPI通話",
"Create a new Greet in Bonjoro": "Bonjoroで新しい挨拶を作成する",
"Make a custom API call to a specific endpoint": "特定のエンドポイントへのカスタム API コールを実行します。",
"Note": "メモ",
"Email": "Eメールアドレス",
"First Name": "名",
"Last Name": "Last Name",
"Assignee": "Assignee",
"Campaign": "キャンペーン",
"Template": "テンプレート",
"Custom Attributes": "カスタム属性",
"Method": "方法",
"Headers": "ヘッダー",
"Query Parameters": "クエリパラメータ",
"Body": "本文",
"Response is Binary ?": "応答はバイナリですか?",
"No Error on Failure": "失敗時にエラーはありません",
"Timeout (in seconds)": "タイムアウト(秒)",
"Note to send with the greet": "挨拶を送るためのメモ",
"Email to send the greet to": "あいさつを送信するメール",
"First name of the person to greet": "挨拶する人の名",
"Last name of the person to greet": "挨拶する人の姓",
"Who to assign the greet to": "誰に挨拶するか",
"The campaign to add the greet to": "あいさつを追加するキャンペーン",
"The template to use for the greet": "あいさつに使用するテンプレート",
"Enter custom attributes to send with the greet": "挨拶で送信するカスタム属性を入力してください",
"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": "頭"
}

View File

@@ -0,0 +1,41 @@
{
"Send personal video messages to delight customers": "Stuur persoonlijke videoberichten naar blije klanten",
"API Key": "API Sleutel",
"The API key for your Bonjoro account": "De API-sleutel voor je Bonjoro account",
"Authenticate with your Bonjoro account": "Verifieer met uw Bonjoro account",
"Create a Greet": "Maak een Groet",
"Custom API Call": "Custom API Call",
"Create a new Greet in Bonjoro": "Maak een nieuwe Groet in Bonjoro",
"Make a custom API call to a specific endpoint": "Maak een aangepaste API call naar een specifiek eindpunt",
"Note": "Notitie",
"Email": "E-mail",
"First Name": "Voornaam",
"Last Name": "Achternaam",
"Assignee": "Assignee",
"Campaign": "Campagne",
"Template": "Sjabloon",
"Custom Attributes": "Aangepaste kenmerken",
"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)",
"Note to send with the greet": "Notitie om te verzenden met de groet",
"Email to send the greet to": "E-mail om de groet naar te sturen",
"First name of the person to greet": "Voornaam van de begroeter",
"Last name of the person to greet": "Achternaam van de persoon om te groeten",
"Who to assign the greet to": "Wie de groet toewijzen aan",
"The campaign to add the greet to": "De campagne om de groet toe te voegen aan",
"The template to use for the greet": "Het sjabloon dat moet worden gebruikt voor de groet",
"Enter custom attributes to send with the greet": "Voer aangepaste attributen in om met de groet te verzenden",
"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"
}

View File

@@ -0,0 +1,41 @@
{
"Send personal video messages to delight customers": "Enviar mensagens de vídeo pessoais para agradar aos clientes",
"API Key": "Chave de API",
"The API key for your Bonjoro account": "A chave API para sua conta Bonjoro",
"Authenticate with your Bonjoro account": "Autenticar com sua conta Bonjoro",
"Create a Greet": "Criar uma saudação",
"Custom API Call": "Chamada de API personalizada",
"Create a new Greet in Bonjoro": "Crie uma nova saudação em Bonjoro",
"Make a custom API call to a specific endpoint": "Faça uma chamada de API personalizada para um ponto de extremidade específico",
"Note": "Observação",
"Email": "e-mail",
"First Name": "Nome",
"Last Name": "Sobrenome",
"Assignee": "Assignee",
"Campaign": "Campanha",
"Template": "Modelo",
"Custom Attributes": "Atributos personalizados",
"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)",
"Note to send with the greet": "Nota a enviar com a saudação",
"Email to send the greet to": "E-mail para enviar a saudação",
"First name of the person to greet": "Primeiro nome da pessoa a ser cumprimentada",
"Last name of the person to greet": "Último nome da pessoa a ser cumprimentada",
"Who to assign the greet to": "Quem atribuir a saudação para",
"The campaign to add the greet to": "A campanha para adicionar a saudação",
"The template to use for the greet": "O modelo a ser usado para saudação",
"Enter custom attributes to send with the greet": "Digite os atributos personalizados para enviar com a saudação",
"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"
}

View File

@@ -0,0 +1,40 @@
{
"Bonjoro": "Bonjoro",
"Send personal video messages to delight customers": "Отправлять личные видео сообщения клиентам",
"API Key": "Ключ API",
"The API key for your Bonjoro account": "API ключ для вашего аккаунта Bonjoro",
"Authenticate with your Bonjoro account": "Аутентифицироваться с вашим аккаунтом Bonjoro",
"Create a Greet": "Создать приветствие",
"Custom API Call": "Пользовательский вызов API",
"Create a new Greet in Bonjoro": "Создать новое приветствие в Bonjoro",
"Make a custom API call to a specific endpoint": "Сделать пользовательский API вызов к определенной конечной точке",
"Note": "Примечание",
"Email": "Почта",
"First Name": "First Name",
"Last Name": "Last Name",
"Assignee": "Assignee",
"Campaign": "Кампания",
"Template": "Шаблон",
"Custom Attributes": "Пользовательские атрибуты",
"Method": "Метод",
"Headers": "Заголовки",
"Query Parameters": "Параметры запроса",
"Body": "Тело",
"No Error on Failure": "Нет ошибок при ошибке",
"Timeout (in seconds)": "Таймаут (в секундах)",
"Note to send with the greet": "Заметка для отправки с приветствием",
"Email to send the greet to": "Письмо для отправки приветствия",
"First name of the person to greet": "Имя человека, которого нужно приветствовать",
"Last name of the person to greet": "Фамилия человека для приветствия",
"Who to assign the greet to": "Кому назначить приветствие",
"The campaign to add the greet to": "Кампания для добавления приветствия",
"The template to use for the greet": "Шаблон для приветствия",
"Enter custom attributes to send with the greet": "Введите пользовательские атрибуты для отправки приветствия",
"Authorization headers are injected automatically from your connection.": "Заголовки авторизации включаются автоматически из вашего соединения.",
"GET": "ПОЛУЧИТЬ",
"POST": "ПОСТ",
"PATCH": "ПАТЧ",
"PUT": "ПОКУПИТЬ",
"DELETE": "УДАЛИТЬ",
"HEAD": "HEAD"
}

View File

@@ -0,0 +1,41 @@
{
"Send personal video messages to delight customers": "Send personal video messages to delight customers",
"API Key": "API Key",
"The API key for your Bonjoro account": "The API key for your Bonjoro account",
"Authenticate with your Bonjoro account": "Authenticate with your Bonjoro account",
"Create a Greet": "Create a Greet",
"Custom API Call": "Custom API Call",
"Create a new Greet in Bonjoro": "Create a new Greet in Bonjoro",
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
"Note": "Note",
"Email": "Email",
"First Name": "First Name",
"Last Name": "Last Name",
"Assignee": "Assignee",
"Campaign": "Campaign",
"Template": "Template",
"Custom Attributes": "Custom Attributes",
"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)",
"Note to send with the greet": "Note to send with the greet",
"Email to send the greet to": "Email to send the greet to",
"First name of the person to greet": "First name of the person to greet",
"Last name of the person to greet": "Last name of the person to greet",
"Who to assign the greet to": "Who to assign the greet to",
"The campaign to add the greet to": "The campaign to add the greet to",
"The template to use for the greet": "The template to use for the greet",
"Enter custom attributes to send with the greet": "Enter custom attributes to send with the greet",
"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"
}

View File

@@ -0,0 +1,40 @@
{
"Bonjoro": "Bonjoro",
"Send personal video messages to delight customers": "Send personal video messages to delight customers",
"API Key": "API Key",
"The API key for your Bonjoro account": "The API key for your Bonjoro account",
"Authenticate with your Bonjoro account": "Authenticate with your Bonjoro account",
"Create a Greet": "Create a Greet",
"Custom API Call": "Custom API Call",
"Create a new Greet in Bonjoro": "Create a new Greet in Bonjoro",
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
"Note": "Note",
"Email": "Email",
"First Name": "First Name",
"Last Name": "Last Name",
"Assignee": "Assignee",
"Campaign": "Campaign",
"Template": "Template",
"Custom Attributes": "Custom Attributes",
"Method": "Method",
"Headers": "Headers",
"Query Parameters": "Query Parameters",
"Body": "Body",
"No Error on Failure": "No Error on Failure",
"Timeout (in seconds)": "Timeout (in seconds)",
"Note to send with the greet": "Note to send with the greet",
"Email to send the greet to": "Email to send the greet to",
"First name of the person to greet": "First name of the person to greet",
"Last name of the person to greet": "Last name of the person to greet",
"Who to assign the greet to": "Who to assign the greet to",
"The campaign to add the greet to": "The campaign to add the greet to",
"The template to use for the greet": "The template to use for the greet",
"Enter custom attributes to send with the greet": "Enter custom attributes to send with the greet",
"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"
}

View File

@@ -0,0 +1,41 @@
{
"Send personal video messages to delight customers": "Send personal video messages to delight customers",
"API Key": "API 密钥",
"The API key for your Bonjoro account": "The API key for your Bonjoro account",
"Authenticate with your Bonjoro account": "Authenticate with your Bonjoro account",
"Create a Greet": "Create a Greet",
"Custom API Call": "自定义 API 呼叫",
"Create a new Greet in Bonjoro": "Create a new Greet in Bonjoro",
"Make a custom API call to a specific endpoint": "将一个自定义 API 调用到一个特定的终点",
"Note": "说明",
"Email": "电子邮件地址",
"First Name": "First Name",
"Last Name": "名字",
"Assignee": "Assignee",
"Campaign": "Campaign",
"Template": "模板",
"Custom Attributes": "Custom Attributes",
"Method": "方法",
"Headers": "信头",
"Query Parameters": "查询参数",
"Body": "正文内容",
"Response is Binary ?": "Response is Binary ?",
"No Error on Failure": "失败时没有错误",
"Timeout (in seconds)": "超时(秒)",
"Note to send with the greet": "Note to send with the greet",
"Email to send the greet to": "Email to send the greet to",
"First name of the person to greet": "First name of the person to greet",
"Last name of the person to greet": "Last name of the person to greet",
"Who to assign the greet to": "Who to assign the greet to",
"The campaign to add the greet to": "The campaign to add the greet to",
"The template to use for the greet": "The template to use for the greet",
"Enter custom attributes to send with the greet": "Enter custom attributes to send with the greet",
"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": "黑色"
}

View File

@@ -0,0 +1,29 @@
import { createCustomApiCallAction } from '@activepieces/pieces-common';
import { createPiece } from '@activepieces/pieces-framework';
import { PieceCategory } from '@activepieces/shared';
import { addGreetAction } from './lib/actions/add-greet';
import { bonjoroAuth } from './lib/auth';
export const bonjoro = createPiece({
displayName: 'Bonjoro',
description: 'Send personal video messages to delight customers',
auth: bonjoroAuth,
minimumSupportedRelease: '0.30.0',
logoUrl: 'https://cdn.activepieces.com/pieces/bonjoro.png',
categories: [PieceCategory.CUSTOMER_SUPPORT],
authors: ["joeworkman","kishanprmr","MoShizzle","abuaboud"],
actions: [
addGreetAction,
createCustomApiCallAction({
baseUrl: () => 'https://www.bonjoro.com/api/v2', // replace with the actual base URL
auth: bonjoroAuth,
authMapping: async (auth) => ({
Authorization: `Bearer ${auth.props.apiKey}`,
}),
}),
],
triggers: [],
});
// https://vimily.github.io/bonjoro-api-docs/
// https://www.bonjoro.com/settings/api#/

View File

@@ -0,0 +1,121 @@
import { createAction, Property } from '@activepieces/pieces-framework';
import { addGreet, addProfile } from '../api';
import { bonjoroAuth, BonjoroAuthType } from '../auth';
import {
buildCampaignDropdown,
buildTemplateDropdown,
buildUserDropdown,
} from '../props';
export const addGreetAction = createAction({
name: 'add_greet',
auth: bonjoroAuth,
displayName: 'Create a Greet',
description: 'Create a new Greet in Bonjoro',
props: {
note: Property.LongText({
displayName: 'Note',
description: 'Note to send with the greet',
required: true,
}),
email: Property.ShortText({
displayName: 'Email',
description: 'Email to send the greet to',
required: true,
}),
first: Property.ShortText({
displayName: 'First Name',
description: 'First name of the person to greet',
required: false,
}),
last: Property.ShortText({
displayName: 'Last Name',
description: 'Last name of the person to greet',
required: false,
}),
assignee: Property.Dropdown({
auth: bonjoroAuth,
displayName: 'Assignee',
description: 'Who to assign the greet to',
required: false,
refreshers: [],
options: async ({ auth }) =>
{
if (!auth) {
return {
disabled: true,
options: [],
placeholder: 'Please connect your Bonjoro account first',
};
}
return await buildUserDropdown(auth.props);
}
}),
campaign: Property.Dropdown({
auth: bonjoroAuth,
displayName: 'Campaign',
description: 'The campaign to add the greet to',
required: false,
refreshers: [],
options: async ({ auth }) =>
{
if (!auth) {
return {
disabled: true,
options: [],
placeholder: 'Please connect your Bonjoro account first',
};
}
return await buildCampaignDropdown(auth.props);
}
}),
template: Property.Dropdown({
auth: bonjoroAuth,
displayName: 'Template',
description: 'The template to use for the greet',
required: false,
refreshers: [],
options: async ({ auth }) =>
{
if (!auth) {
return {
disabled: true,
options: [],
placeholder: 'Please connect your Bonjoro account first',
};
}
return await buildTemplateDropdown(auth.props);
}
}),
custom: Property.Json({
displayName: 'Custom Attributes',
description: 'Enter custom attributes to send with the greet',
required: false,
defaultValue: {},
}),
},
async run(context) {
const user = {
email: context.propsValue.email,
first_name: context.propsValue.first,
last_name: context.propsValue.last,
};
addProfile(context.auth.props, user);
const greet = {
profiles: [context.propsValue.email],
note: context.propsValue.note,
assignee_id: context.propsValue.assignee,
campaign_id: context.propsValue.campaign,
template_id: context.propsValue.template,
custom_attributes: context.propsValue.custom,
};
if (!greet.assignee_id) delete greet.assignee_id;
if (!greet.campaign_id) delete greet.campaign_id;
if (!greet.template_id) delete greet.template_id;
if (!greet.custom_attributes) delete greet.custom_attributes;
return await addGreet(context.auth.props, greet);
},
});

View File

@@ -0,0 +1,66 @@
import {
httpClient,
HttpMethod,
HttpRequest,
} from '@activepieces/pieces-common';
import { BonjoroAuthType } from './auth';
export type KeyValuePair = {
[key: string]: string | boolean | object | undefined;
};
const bonjoroAPI = async (
api: string,
auth: BonjoroAuthType,
method: HttpMethod = HttpMethod.GET,
body: KeyValuePair = {}
) => {
const baseUrl = 'https://www.bonjoro.com/api/v2/';
const request: HttpRequest = {
body: body,
method: method,
url: `${baseUrl}${api}`,
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${auth.apiKey}`,
},
};
const response = await httpClient.sendRequest(request);
if (response.status > 201 || response.body['data'] === undefined) {
throw new Error(`Bonjoro API error: ${response.status} ${response.body}`);
}
let data = [];
data = response.body['data'];
return {
success: true,
data: data,
};
};
export async function getUsers(auth: BonjoroAuthType) {
const api = 'users';
return bonjoroAPI(api, auth);
}
export async function getCampaigns(auth: BonjoroAuthType) {
const api = 'campaigns';
return bonjoroAPI(api, auth);
}
export async function getTemplates(auth: BonjoroAuthType) {
const api = 'message-templates';
return bonjoroAPI(api, auth);
}
export async function addGreet(auth: BonjoroAuthType, data: KeyValuePair) {
const api = 'greets';
return bonjoroAPI(api, auth, HttpMethod.POST, data);
}
export async function addProfile(auth: BonjoroAuthType, data: KeyValuePair) {
const api = 'profiles';
return bonjoroAPI(api, auth, HttpMethod.POST, data);
}

View File

@@ -0,0 +1,43 @@
import { PieceAuth } from '@activepieces/pieces-framework';
import { getCampaigns } from './api';
import { z } from 'zod';
import { propsValidation } from '@activepieces/pieces-common';
export type BonjoroAuthType = { apiKey: string };
export const bonjoroAuth = PieceAuth.CustomAuth({
description: 'Authenticate with your Bonjoro account',
props: {
apiKey: PieceAuth.SecretText({
displayName: 'API Key',
description: 'The API key for your Bonjoro account',
required: true,
}),
},
validate: async ({ auth }) => {
try {
await propsValidation.validateZod(auth, {
apiKey: z.string().min(1),
});
await validateAuth(auth);
return {
valid: true,
};
} catch (e) {
return {
valid: false,
error: (e as Error)?.message,
};
}
},
required: true,
});
const validateAuth = async (auth: BonjoroAuthType) => {
const response = await getCampaigns(auth);
if (response.success !== true) {
throw new Error(
'Authentication failed. Please check your domain and API key and try again.'
);
}
};

View File

@@ -0,0 +1,55 @@
import { BonjoroAuthType } from './auth';
import { getCampaigns, getTemplates, getUsers } from './api';
type BonjoroData = { id: string; name: string; uuid: string };
export async function buildCampaignDropdown(auth: BonjoroAuthType) {
if (!auth) {
return {
options: [],
disabled: true,
placeholder: 'Please authenticate first',
};
}
const response = await getCampaigns(auth as BonjoroAuthType);
const options = (response.data as BonjoroData[]).map((campaign) => {
return { label: campaign.name, value: campaign.uuid };
});
return {
options: options,
};
}
export async function buildTemplateDropdown(auth: BonjoroAuthType) {
if (!auth) {
return {
options: [],
disabled: true,
placeholder: 'Please authenticate first',
};
}
const response = await getTemplates(auth as BonjoroAuthType);
const options = (response.data as BonjoroData[]).map((template) => {
return { label: template.name, value: template.id };
});
return {
options: options,
};
}
export async function buildUserDropdown(auth: BonjoroAuthType) {
if (!auth) {
return {
options: [],
disabled: true,
placeholder: 'Please authenticate first',
};
}
const response = await getUsers(auth as BonjoroAuthType);
const options = (response.data as BonjoroData[]).map((user) => {
return { label: user.name, value: user.id };
});
return {
options: options,
};
}

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