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,27 @@
{
"Calendly": "Calendly",
"Simple, modern scheduling": "Simple, modern scheduling",
"\n## Obtain your Calendly Personal Token\n1. Go to https://calendly.com/integrations/api_webhooks\n2. Click on \"Create New Token\"\n3. Copy the token and paste it in the field below\n": "\n## Obtain your Calendly Personal Token\n1. Go to https://calendly.com/integrations/api_webhooks\n2. Click on \"Create New Token\"\n3. Copy the token and paste it in the field below\n",
"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",
"Event Scheduled": "Event Scheduled",
"Event Canceled": "Event Canceled",
"Triggers when a new Calendly event is scheduled": "Triggers when a new Calendly event is scheduled",
"Triggers when a new Calendly event is canceled": "Triggers when a new Calendly event is canceled",
"Scope": "Scope",
"User": "User",
"Organization": "Organization"
}

View File

@@ -0,0 +1,28 @@
{
"Simple, modern scheduling": "Einfache, moderne Terminplanung",
"\n## Obtain your Calendly Personal Token\n1. Go to https://calendly.com/integrations/api_webhooks\n2. Click on \"Create New Token\"\n3. Copy the token and paste it in the field below\n": "\n## Erhalte deinen Calendly Persönlichen Token\n1. Gehe zu https://calendly.com/integrations/api_webhooks\n2. Klicken Sie auf \"Neues Token\"\n3. Kopieren Sie das Token und fügen Sie es in das Feld unten\n ein",
"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",
"Event Scheduled": "Ereignis geplant",
"Event Canceled": "Ereignis abgebrochen",
"Triggers when a new Calendly event is scheduled": "Wird ausgelöst, wenn ein neues Kalendly Ereignis geplant ist",
"Triggers when a new Calendly event is canceled": "Wird ausgelöst, wenn ein neues Kalendly Ereignis abgebrochen wird",
"Scope": "Bereich",
"User": "Benutzer",
"Organization": "Organisation"
}

View File

@@ -0,0 +1,28 @@
{
"Simple, modern scheduling": "Sencillamente, programación moderna",
"\n## Obtain your Calendly Personal Token\n1. Go to https://calendly.com/integrations/api_webhooks\n2. Click on \"Create New Token\"\n3. Copy the token and paste it in the field below\n": "\n## Obtén tu token personal de Calendly\n1. Ve a https://calendly.com/integrations/api_webhooks\n2. Haga clic en \"Crear nueva ficha\"\n3. Copie el token y péguelo en el campo debajo de\n",
"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",
"Event Scheduled": "Evento Programado",
"Event Canceled": "Evento cancelado",
"Triggers when a new Calendly event is scheduled": "Dispara cuando se programe un nuevo evento de Calendly",
"Triggers when a new Calendly event is canceled": "Se activa cuando un nuevo evento de Calendly es cancelado",
"Scope": "Alcance",
"User": "Usuario",
"Organization": "Organización"
}

View File

@@ -0,0 +1,28 @@
{
"Simple, modern scheduling": "Planification simple et moderne",
"\n## Obtain your Calendly Personal Token\n1. Go to https://calendly.com/integrations/api_webhooks\n2. Click on \"Create New Token\"\n3. Copy the token and paste it in the field below\n": "\n## Obtenez votre jeton personnel Calendly\n1. Allez sur https://calendly.com/integrations/api_webhooks\n2. Cliquez sur « Créer un nouveau jeton »\n3. Copiez le jeton et collez-le dans le champ ci-dessous\n",
"Custom API Call": "Appel d'API personnalisé",
"Make a custom API call to a specific endpoint": "Passez un appel d'API personnalisé à un endpoint 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": "GET",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "EFFACER",
"DELETE": "DELETE",
"HEAD": "HEAD",
"Event Scheduled": "Événement programmé",
"Event Canceled": "Événement annulé",
"Triggers when a new Calendly event is scheduled": "Déclenche quand un nouvel événement Calendly est planifié",
"Triggers when a new Calendly event is canceled": "Déclenche lorsqu'un nouvel événement Calendly est annulé",
"Scope": "Périmètre d'application",
"User": "Utilisateur",
"Organization": "Organisation"
}

View File

@@ -0,0 +1,27 @@
{
"Calendly": "Calendly",
"Simple, modern scheduling": "Simple, modern scheduling",
"\n## Obtain your Calendly Personal Token\n1. Go to https://calendly.com/integrations/api_webhooks\n2. Click on \"Create New Token\"\n3. Copy the token and paste it in the field below\n": "\n## Obtain your Calendly Personal Token\n1. Go to https://calendly.com/integrations/api_webhooks\n2. Click on \"Create New Token\"\n3. Copy the token and paste it in the field below\n",
"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",
"Event Scheduled": "Event Scheduled",
"Event Canceled": "Event Canceled",
"Triggers when a new Calendly event is scheduled": "Triggers when a new Calendly event is scheduled",
"Triggers when a new Calendly event is canceled": "Triggers when a new Calendly event is canceled",
"Scope": "Scope",
"User": "User",
"Organization": "Organization"
}

View File

@@ -0,0 +1,27 @@
{
"Calendly": "Calendly",
"Simple, modern scheduling": "Simple, modern scheduling",
"\n## Obtain your Calendly Personal Token\n1. Go to https://calendly.com/integrations/api_webhooks\n2. Click on \"Create New Token\"\n3. Copy the token and paste it in the field below\n": "\n## Obtain your Calendly Personal Token\n1. Go to https://calendly.com/integrations/api_webhooks\n2. Click on \"Create New Token\"\n3. Copy the token and paste it in the field below\n",
"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",
"Event Scheduled": "Event Scheduled",
"Event Canceled": "Event Canceled",
"Triggers when a new Calendly event is scheduled": "Triggers when a new Calendly event is scheduled",
"Triggers when a new Calendly event is canceled": "Triggers when a new Calendly event is canceled",
"Scope": "Scope",
"User": "User",
"Organization": "Organization"
}

View File

@@ -0,0 +1,28 @@
{
"Simple, modern scheduling": "シンプルでモダンなスケジューリング",
"\n## Obtain your Calendly Personal Token\n1. Go to https://calendly.com/integrations/api_webhooks\n2. Click on \"Create New Token\"\n3. Copy the token and paste it in the field below\n": "\n## Obtain your Calendly Personal Token\n1. Go to https://calendly.com/integrations/api_webhooks\n2. Click on \"Create New Token\"\n3. Copy the token and paste it in the field below\n",
"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": "頭",
"Event Scheduled": "予定されたイベント",
"Event Canceled": "イベントがキャンセルされました",
"Triggers when a new Calendly event is scheduled": "新しいカレンダーイベントがスケジュールされたときにトリガーします",
"Triggers when a new Calendly event is canceled": "新しいカレンダーイベントがキャンセルされたときにトリガーします",
"Scope": "スコープ",
"User": "ユーザー",
"Organization": "組織"
}

View File

@@ -0,0 +1,28 @@
{
"Simple, modern scheduling": "Eenvoudige, moderne planning",
"\n## Obtain your Calendly Personal Token\n1. Go to https://calendly.com/integrations/api_webhooks\n2. Click on \"Create New Token\"\n3. Copy the token and paste it in the field below\n": "\n## Verkrijg je persoonlijke token\n1. Ga naar https://kalender.com/integrations/api_webhooks\n2. Klik op \"Nieuwe Token aanmaken\"\n3. Kopieer en plak het token in het onderstaande veld\n",
"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",
"Event Scheduled": "Afspraak gepland",
"Event Canceled": "Afspraak Geannuleerd",
"Triggers when a new Calendly event is scheduled": "Triggert wanneer een nieuwe gebeurtenis is gepland",
"Triggers when a new Calendly event is canceled": "Triggert wanneer een nieuwe kalendergebeurtenis wordt geannuleerd",
"Scope": "Bereik",
"User": "Gebruiker",
"Organization": "Rekening"
}

View File

@@ -0,0 +1,28 @@
{
"Simple, modern scheduling": "Agendamento simples e moderno",
"\n## Obtain your Calendly Personal Token\n1. Go to https://calendly.com/integrations/api_webhooks\n2. Click on \"Create New Token\"\n3. Copy the token and paste it in the field below\n": "\n## Obtain your Calendly Personal Token\n1. Go to https://calendly.com/integrations/api_webhooks\n2. Click on \"Create New Token\"\n3. Copy the token and paste it in the field below\n",
"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",
"Event Scheduled": "Evento agendado",
"Event Canceled": "Evento cancelado",
"Triggers when a new Calendly event is scheduled": "Aciona quando um novo evento do Calendly é agendado",
"Triggers when a new Calendly event is canceled": "Aciona quando um novo evento do Calendly é cancelado",
"Scope": "Escopo",
"User": "Usuário",
"Organization": "Cliente"
}

View File

@@ -0,0 +1,27 @@
{
"Calendly": "Календарь",
"Simple, modern scheduling": "Простое и современное планирование",
"\n## Obtain your Calendly Personal Token\n1. Go to https://calendly.com/integrations/api_webhooks\n2. Click on \"Create New Token\"\n3. Copy the token and paste it in the field below\n": "\n## Получить свой Календарный Личный Токен\n1. Перейдите по ссылке https://calendly.com/integrations/api_webhooks\n2. Нажмите на \"Создать новый токен\"\n3. Скопируйте токен и вставьте его в поле ниже\n",
"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",
"Event Scheduled": "Событие запланировано",
"Event Canceled": "Событие отменено",
"Triggers when a new Calendly event is scheduled": "Триггеры, когда запланировано новое событие Календаря",
"Triggers when a new Calendly event is canceled": "Срабатывает при отмене нового события Календаря",
"Scope": "Сфера охвата",
"User": "Пользователь",
"Organization": "Организация"
}

View File

@@ -0,0 +1,28 @@
{
"Simple, modern scheduling": "Simple, modern scheduling",
"\n## Obtain your Calendly Personal Token\n1. Go to https://calendly.com/integrations/api_webhooks\n2. Click on \"Create New Token\"\n3. Copy the token and paste it in the field below\n": "\n## Obtain your Calendly Personal Token\n1. Go to https://calendly.com/integrations/api_webhooks\n2. Click on \"Create New Token\"\n3. Copy the token and paste it in the field below\n",
"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",
"Event Scheduled": "Event Scheduled",
"Event Canceled": "Event Canceled",
"Triggers when a new Calendly event is scheduled": "Triggers when a new Calendly event is scheduled",
"Triggers when a new Calendly event is canceled": "Triggers when a new Calendly event is canceled",
"Scope": "Scope",
"User": "User",
"Organization": "Organization"
}

View File

@@ -0,0 +1,27 @@
{
"Calendly": "Calendly",
"Simple, modern scheduling": "Simple, modern scheduling",
"\n## Obtain your Calendly Personal Token\n1. Go to https://calendly.com/integrations/api_webhooks\n2. Click on \"Create New Token\"\n3. Copy the token and paste it in the field below\n": "\n## Obtain your Calendly Personal Token\n1. Go to https://calendly.com/integrations/api_webhooks\n2. Click on \"Create New Token\"\n3. Copy the token and paste it in the field below\n",
"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",
"Event Scheduled": "Event Scheduled",
"Event Canceled": "Event Canceled",
"Triggers when a new Calendly event is scheduled": "Triggers when a new Calendly event is scheduled",
"Triggers when a new Calendly event is canceled": "Triggers when a new Calendly event is canceled",
"Scope": "Scope",
"User": "User",
"Organization": "Organization"
}

View File

@@ -0,0 +1,28 @@
{
"Simple, modern scheduling": "Simple, modern scheduling",
"\n## Obtain your Calendly Personal Token\n1. Go to https://calendly.com/integrations/api_webhooks\n2. Click on \"Create New Token\"\n3. Copy the token and paste it in the field below\n": "\n## Obtain your Calendly Personal Token\n1. Go to https://calendly.com/integrations/api_webhooks\n2. Click on \"Create New Token\"\n3. Copy the token and paste it in the field below\n",
"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": "黑色",
"Event Scheduled": "Event Scheduled",
"Event Canceled": "Event Canceled",
"Triggers when a new Calendly event is scheduled": "Triggers when a new Calendly event is scheduled",
"Triggers when a new Calendly event is canceled": "Triggers when a new Calendly event is canceled",
"Scope": "Scope",
"User": "用户",
"Organization": "Organization"
}

View File

@@ -0,0 +1,51 @@
import { createCustomApiCallAction } from '@activepieces/pieces-common';
import { PieceAuth, createPiece } from '@activepieces/pieces-framework';
import { PieceCategory } from '@activepieces/shared';
import { calendlyCommon } from './lib/common';
import { calendlyInviteeCanceled } from './lib/trigger/invitee-canceled.trigger';
import { calendlyInviteeCreated } from './lib/trigger/invitee-created.trigger';
const markdown = `
## Obtain your Calendly Personal Token
1. Go to https://calendly.com/integrations/api_webhooks
2. Click on "Create New Token"
3. Copy the token and paste it in the field below
`;
export const calendlyAuth = PieceAuth.SecretText({
displayName: 'Personal Token',
required: true,
description: markdown,
validate: async ({ auth }) => {
try {
calendlyCommon.getUser(auth);
return {
valid: true,
};
} catch (e) {
return {
valid: false,
error: 'Connection failed. Please check your token and try again.',
};
}
},
});
export const calendly = createPiece({
displayName: 'Calendly',
description: 'Simple, modern scheduling',
minimumSupportedRelease: '0.30.0',
logoUrl: 'https://cdn.activepieces.com/pieces/calendly.png',
categories: [PieceCategory.PRODUCTIVITY],
authors: ["kishanprmr","MoShizzle","AbdulTheActivePiecer","khaledmashaly","abuaboud"],
auth: calendlyAuth,
actions: [
createCustomApiCallAction({
baseUrl: () => calendlyCommon.baseUrl, // Replace with the actual base URL
auth: calendlyAuth,
authMapping: async (auth) => ({
Authorization: `Bearer ${auth.secret_text}`,
}),
}),
],
triggers: [calendlyInviteeCreated, calendlyInviteeCanceled],
});

View File

@@ -0,0 +1,48 @@
import { Property } from '@activepieces/pieces-framework';
import {
HttpRequest,
HttpMethod,
httpClient,
} from '@activepieces/pieces-common';
interface CalendlyUser {
/**User uri */
uri: string;
email: string;
name: string;
/**Organization uri */
current_organization: string;
}
export interface CalendlyWebhookInformation {
webhookId: string;
}
export const calendlyCommon = {
baseUrl: 'https://api.calendly.com',
scope: Property.StaticDropdown({
displayName: 'Scope',
required: true,
options: {
options: [
{ value: 'user', label: 'User' },
{ value: 'organization', label: 'Organization' },
],
disabled: false,
},
}),
getUser: async (personalToken: string) => {
const request: HttpRequest = {
method: HttpMethod.GET,
url: `${calendlyCommon.baseUrl}/users/me`,
headers: {
Authorization: calendlyCommon.authorizationHeader(personalToken),
},
};
const response = await httpClient.sendRequest<{ resource: CalendlyUser }>(
request
);
return response.body.resource;
},
authorizationHeader: (personalToken: string) => `Bearer ${personalToken}`,
UuidFromUri: (uri: string) => uri.split('/').pop(),
};

View File

@@ -0,0 +1,107 @@
import { createTrigger, TriggerStrategy } from '@activepieces/pieces-framework';
import {
AuthenticationType,
httpClient,
HttpMethod,
HttpRequest,
} from '@activepieces/pieces-common';
import { calendlyCommon, CalendlyWebhookInformation } from '../common';
import { calendlyAuth } from '../../';
const triggerNameInStore = 'calendly_invitee_canceled_trigger';
export const calendlyInviteeCanceled = createTrigger({
auth: calendlyAuth,
name: 'invitee_canceled',
displayName: 'Event Canceled',
description: 'Triggers when a new Calendly event is canceled',
props: {
scope: calendlyCommon.scope,
},
sampleData: {
created_at: '2023-01-29T13:57:17.000000Z',
created_by: 'https://api.calendly.com/users/AAAAAAA',
event: 'invitee.canceled',
payload: {
cancel_url: 'https://calendly.com/cancellations/AAAAAAAA',
cancellation: {
canceler_type: 'host',
canceled_by: 'Ashraf Samhouri',
reason: 'testing',
},
created_at: '2023-01-29T13:56:46.894198Z',
email: 'test@test.com',
event: 'https://api.calendly.com/scheduled_events/AAAAAAAAA',
first_name: null,
last_name: null,
name: 'abdul',
new_invitee: null,
no_show: null,
old_invitee: null,
payment: null,
questions_and_answers: [],
reconfirmation: null,
reschedule_url: 'https://calendly.com/reschedulings/AAAAAAAA',
rescheduled: false,
routing_form_submission: null,
status: 'canceled',
text_reminder_number: null,
timezone: 'Asia/Baghdad',
tracking: {
utm_campaign: null,
utm_source: null,
utm_medium: null,
utm_content: null,
utm_term: null,
salesforce_uuid: null,
},
updated_at: '2023-01-29T13:57:17.466943Z',
uri: 'https://api.calendly.com/scheduled_events/AAAAAAAAAAAaA/invitees/AAAAAAAA',
},
},
type: TriggerStrategy.WEBHOOK,
async onEnable(context) {
const calendlyUser = await calendlyCommon.getUser(context.auth.secret_text);
const request: HttpRequest = {
method: HttpMethod.POST,
url: `${calendlyCommon.baseUrl}/webhook_subscriptions`,
body: {
url: context.webhookUrl,
organization: calendlyUser.current_organization,
user: calendlyUser.uri,
scope: context.propsValue.scope,
events: ['invitee.canceled'],
},
authentication: {
token: context.auth.secret_text,
type: AuthenticationType.BEARER_TOKEN,
},
queryParams: {},
};
const { body } = await httpClient.sendRequest<{
resource: { uri: string };
}>(request);
await context.store?.put<CalendlyWebhookInformation>(triggerNameInStore, {
webhookId: calendlyCommon.UuidFromUri(body.resource.uri)!,
});
},
async onDisable(context) {
const response = await context.store?.get<CalendlyWebhookInformation>(
triggerNameInStore
);
if (response !== null && response !== undefined) {
const request: HttpRequest = {
method: HttpMethod.DELETE,
url: `${calendlyCommon.baseUrl}/webhook_subscriptions/${response.webhookId}`,
authentication: {
token: context.auth.secret_text,
type: AuthenticationType.BEARER_TOKEN,
},
};
await httpClient.sendRequest(request);
}
},
async run(context) {
return [context.payload.body];
},
});

View File

@@ -0,0 +1,96 @@
import { TriggerStrategy, createTrigger } from '@activepieces/pieces-framework';
import {
HttpRequest,
HttpMethod,
AuthenticationType,
httpClient,
} from '@activepieces/pieces-common';
import { calendlyCommon, CalendlyWebhookInformation } from '../common';
import { calendlyAuth } from '../../';
const triggerNameInStore = 'calendly_invitee_created_trigger';
export const calendlyInviteeCreated = createTrigger({
auth: calendlyAuth,
name: 'invitee_created',
displayName: 'Event Scheduled',
description: 'Triggers when a new Calendly event is scheduled',
props: {
scope: calendlyCommon.scope,
},
sampleData: {
created_at: '2023-01-29T13:50:13.000000Z',
created_by: 'https://api.calendly.com/users/AAAAAAAAAAAA',
payload: {
cancel_url: 'https://calendly.com/cancellations/AAAAAAAAAAA',
created_at: '2023-01-29T13:50:13.072950Z',
email: 'abdulyki@activepieces.com',
event: 'https://api.calendly.com/scheduled_events/AAAAAAAAAAAA',
first_name: null,
last_name: null,
name: 'abdul',
new_invitee: null,
no_show: null,
old_invitee: null,
payment: null,
questions_and_answers: [],
reconfirmation: null,
reschedule_url: 'https://calendly.com/reschedulings/AAAAAAAAAAAA',
rescheduled: false,
routing_form_submission: null,
status: 'active',
text_reminder_number: null,
timezone: 'Asia/Baghdad',
updated_at: '2023-01-29T13:50:13.072950Z',
uri: 'https://api.calendly.com/scheduled_events/AAAAAAAAAAAaA/invitees/AAAAAAAAAAAA',
},
},
type: TriggerStrategy.WEBHOOK,
async onEnable(context) {
const calendlyUser = await calendlyCommon.getUser(context.auth.secret_text);
const request: HttpRequest = {
method: HttpMethod.POST,
url: `${calendlyCommon.baseUrl}/webhook_subscriptions`,
body: {
url: context.webhookUrl,
organization: calendlyUser.current_organization,
user: calendlyUser.uri,
scope: context.propsValue['scope'],
events: ['invitee.created'],
},
authentication: {
token: context.auth.secret_text,
type: AuthenticationType.BEARER_TOKEN,
},
queryParams: {},
};
const { body } = await httpClient.sendRequest<{
resource: { uri: string };
}>(request);
await context.store?.put<CalendlyWebhookInformation>(triggerNameInStore, {
webhookId: calendlyCommon.UuidFromUri(body.resource.uri)!,
});
},
async onDisable(context) {
const response = await context.store?.get<CalendlyWebhookInformation>(
triggerNameInStore
);
console.log(response || 'nothing');
if (response !== null && response !== undefined) {
const request: HttpRequest = {
method: HttpMethod.DELETE,
url: `${calendlyCommon.baseUrl}/webhook_subscriptions/${response.webhookId}`,
authentication: {
token: context.auth.secret_text,
type: AuthenticationType.BEARER_TOKEN,
},
};
await httpClient.sendRequest(request);
} else {
throw Error('context store was null');
}
},
async run(context) {
return [context.payload.body];
},
});