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:
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"extends": [
|
||||
"../../../../.eslintrc.base.json"
|
||||
],
|
||||
"ignorePatterns": [
|
||||
"!**/*"
|
||||
],
|
||||
"overrides": [
|
||||
{
|
||||
"files": [
|
||||
"*.ts",
|
||||
"*.tsx",
|
||||
"*.js",
|
||||
"*.jsx"
|
||||
],
|
||||
"rules": {}
|
||||
},
|
||||
{
|
||||
"files": [
|
||||
"*.ts",
|
||||
"*.tsx"
|
||||
],
|
||||
"rules": {}
|
||||
},
|
||||
{
|
||||
"files": [
|
||||
"*.js",
|
||||
"*.jsx"
|
||||
],
|
||||
"rules": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
# pieces-campaign-monitor
|
||||
|
||||
This library was generated with [Nx](https://nx.dev).
|
||||
|
||||
## Building
|
||||
|
||||
Run `nx build pieces-campaign-monitor` to build the library.
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "@activepieces/piece-campaign-monitor",
|
||||
"version": "0.0.6"
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"name": "pieces-campaign-monitor",
|
||||
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
|
||||
"sourceRoot": "packages/pieces/community/campaign-monitor/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/campaign-monitor",
|
||||
"tsConfig": "packages/pieces/community/campaign-monitor/tsconfig.lib.json",
|
||||
"packageJson": "packages/pieces/community/campaign-monitor/package.json",
|
||||
"main": "packages/pieces/community/campaign-monitor/src/index.ts",
|
||||
"assets": [
|
||||
"packages/pieces/community/campaign-monitor/*.md"
|
||||
],
|
||||
"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/campaign-monitor",
|
||||
"command": "bun install --no-save --silent"
|
||||
},
|
||||
"dependsOn": [
|
||||
"^build"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"Email marketing platform for delivering exceptional email campaigns.": "E-Mail-Marketing-Plattform für außergewöhnliche E-Mail-Kampagnen.",
|
||||
"\nTo use Campaign Monitor, you need to get an API key:\n1. Login to your account at https://www.campaignmonitor.com.\n2. Navigate to Account Settings.\n3. Click on API Keys.\n4. Create a new API key or use an existing one.\n": "\nUm den Kampagnenmonitor nutzen zu können, benötigen Sie einen API-Schlüssel:\n1. Melden Sie sich bei Ihrem Konto unter https://www.campaignmonitor.com an.\n2. Navigieren Sie zu den Kontoeinstellungen.\n3. Klicken Sie auf API-Schlüssel.\n4. Erstellen Sie einen neuen API-Schlüssel oder verwenden Sie einen vorhandenen Schlüssel.\n",
|
||||
"Add Subscriber": "Abonnent hinzufügen",
|
||||
"Update Subscriber": "Abonnent aktualisieren",
|
||||
"Unsubscribe Subscriber": "Abonnent abbestellen",
|
||||
"Find Subscriber": "Abonnent finden",
|
||||
"Adds a new subscriber to a list.": "Fügt einen neuen Abonnenten zu einer Liste hinzu.",
|
||||
"Update an existing subscriber in a list.": "Aktualisiere einen bestehenden Abonnenten in einer Liste.",
|
||||
"Remove a subscriber from a list.": "Entferne einen Abonnenten aus einer Liste.",
|
||||
"Find a subscriber by email in a specific list.": "Finden Sie einen Abonnenten per E-Mail in einer bestimmten Liste.",
|
||||
"Client Account": "Kundenkonto",
|
||||
"List ID": "Listen-ID",
|
||||
"Email Address": "E-Mail-Adresse",
|
||||
"Name": "Name",
|
||||
"Phone": "Telefon",
|
||||
"Consent to Track": "Einwilligung zum Track",
|
||||
"Consent to Send SMS": "Einwilligung zum Senden von SMS",
|
||||
"Resubscribe": "Erneut abonnieren",
|
||||
"Custom Fields": "Eigene Felder",
|
||||
"Whether the subscriber has consented to tracking.": "Ob der Abonnent der Verfolgung zugestimmt hat.",
|
||||
"Whether the subscriber has consented to send SMS.": "Ob der Abonnent zugestimmt hat, SMS zu senden.",
|
||||
"If true, the subscriber will be resubscribed if they previously unsubscribed.": "Wenn dies der Fall ist, wird der Abonnent erneut abonniert, wenn er sich zuvor abgemeldet hat.",
|
||||
"The email address of the subscriber to unsubscribe.": "Die E-Mail-Adresse des Abonnenten zum Abmelden.",
|
||||
"The email address of the subscriber to find": "Die E-Mail-Adresse des zu findenden Abonnenten",
|
||||
"Yes": "Ja",
|
||||
"No": "Nein",
|
||||
"Unchanged": "Unverändert",
|
||||
"New Subscriber Added": "Neuer Abonnent hinzugefügt",
|
||||
"Subscriber Unsubscribed": "Abonnent abgemeldet",
|
||||
"New Client": "Neuer Kunde",
|
||||
"Triggered when a new subscriber is added to a list.": "Wird ausgelöst, wenn ein neuer Abonnent zu einer Liste hinzugefügt wird.",
|
||||
"Triggered when a subscriber unsubscribes from a list": "Ausgelöst, wenn ein Abonnent sich von einer Liste abmeldet",
|
||||
"Triggered when a new client is added to Campaign Monitor.": "Wird ausgelöst, wenn ein neuer Client zum Kampagnen-Monitor hinzugefügt wird."
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"Email marketing platform for delivering exceptional email campaigns.": "Plataforma de marketing de correo electrónico para la entrega de campañas de correo electrónico excepcionales.",
|
||||
"\nTo use Campaign Monitor, you need to get an API key:\n1. Login to your account at https://www.campaignmonitor.com.\n2. Navigate to Account Settings.\n3. Click on API Keys.\n4. Create a new API key or use an existing one.\n": "\nTo use Campaign Monitor, you need to get an API key:\n1. Login to your account at https://www.campaignmonitor.com.\n2. Navigate to Account Settings.\n3. Click on API Keys.\n4. Create a new API key or use an existing one.\n",
|
||||
"Add Subscriber": "Añadir suscriptor",
|
||||
"Update Subscriber": "Actualizar suscriptor",
|
||||
"Unsubscribe Subscriber": "Darse de baja de suscriptores",
|
||||
"Find Subscriber": "Buscar suscriptores",
|
||||
"Adds a new subscriber to a list.": "Añade un nuevo suscriptor a una lista.",
|
||||
"Update an existing subscriber in a list.": "Actualizar un suscriptor existente en una lista.",
|
||||
"Remove a subscriber from a list.": "Eliminar un suscriptor de una lista.",
|
||||
"Find a subscriber by email in a specific list.": "Encontrar un suscriptor por correo electrónico en una lista específica.",
|
||||
"Client Account": "Cuenta de cliente",
|
||||
"List ID": "ID de lista",
|
||||
"Email Address": "Dirección de email",
|
||||
"Name": "Nombre",
|
||||
"Phone": "Teléfono",
|
||||
"Consent to Track": "Consentimiento a la pista",
|
||||
"Consent to Send SMS": "Consentimiento para enviar SMS",
|
||||
"Resubscribe": "Reenviar",
|
||||
"Custom Fields": "Campos personalizados",
|
||||
"Whether the subscriber has consented to tracking.": "Si el suscriptor ha consentido el seguimiento.",
|
||||
"Whether the subscriber has consented to send SMS.": "Si el suscriptor ha aceptado enviar SMS.",
|
||||
"If true, the subscriber will be resubscribed if they previously unsubscribed.": "Si es verdadero, el suscriptor será reenviado si previamente se ha dado de baja.",
|
||||
"The email address of the subscriber to unsubscribe.": "La dirección de correo electrónico del suscriptor para darse de baja.",
|
||||
"The email address of the subscriber to find": "La dirección de correo electrónico del suscriptor a encontrar",
|
||||
"Yes": "Sí",
|
||||
"No": "Nu",
|
||||
"Unchanged": "Sin cambios",
|
||||
"New Subscriber Added": "Nuevo suscriptor añadido",
|
||||
"Subscriber Unsubscribed": "Suscriptor desuscrito",
|
||||
"New Client": "Nuevo cliente",
|
||||
"Triggered when a new subscriber is added to a list.": "Se activa cuando se añade un nuevo suscriptor a una lista.",
|
||||
"Triggered when a subscriber unsubscribes from a list": "Se activó cuando un suscriptor se daba de baja de una lista",
|
||||
"Triggered when a new client is added to Campaign Monitor.": "Se ha activado cuando se añade un nuevo cliente al Monitor de Campaña."
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"Email marketing platform for delivering exceptional email campaigns.": "Plateforme de marketing électronique pour la diffusion de campagnes e-mail exceptionnelles.",
|
||||
"\nTo use Campaign Monitor, you need to get an API key:\n1. Login to your account at https://www.campaignmonitor.com.\n2. Navigate to Account Settings.\n3. Click on API Keys.\n4. Create a new API key or use an existing one.\n": "\nTo use Campaign Monitor, you need to get an API key:\n1. Login to your account at https://www.campaignmonitor.com.\n2. Navigate to Account Settings.\n3. Click on API Keys.\n4. Create a new API key or use an existing one.\n",
|
||||
"Add Subscriber": "Ajouter un abonné",
|
||||
"Update Subscriber": "Mettre à jour l'abonné",
|
||||
"Unsubscribe Subscriber": "Se désabonner de l'abonné",
|
||||
"Find Subscriber": "Trouver un abonné",
|
||||
"Adds a new subscriber to a list.": "Ajoute un nouvel abonné à une liste.",
|
||||
"Update an existing subscriber in a list.": "Mettre à jour un abonné existant dans une liste.",
|
||||
"Remove a subscriber from a list.": "Retirer un abonné d'une liste.",
|
||||
"Find a subscriber by email in a specific list.": "Trouver un abonné par email dans une liste spécifique.",
|
||||
"Client Account": "Compte client",
|
||||
"List ID": "ID de la liste",
|
||||
"Email Address": "Adresse e-mail",
|
||||
"Name": "Nom",
|
||||
"Phone": "Téléphone",
|
||||
"Consent to Track": "Consentement à suivre",
|
||||
"Consent to Send SMS": "Consentement pour envoyer des SMS",
|
||||
"Resubscribe": "Reprendre l'abonnement",
|
||||
"Custom Fields": "Champs personnalisés",
|
||||
"Whether the subscriber has consented to tracking.": "Si l'abonné a consenti au suivi.",
|
||||
"Whether the subscriber has consented to send SMS.": "Si l'abonné a consenti à envoyer des SMS.",
|
||||
"If true, the subscriber will be resubscribed if they previously unsubscribed.": "Si activé, l'abonné sera réabonné s'il s'est désabonné précédemment.",
|
||||
"The email address of the subscriber to unsubscribe.": "L'adresse email de l'abonné à désabonner.",
|
||||
"The email address of the subscriber to find": "L'adresse e-mail de l'abonné à trouver",
|
||||
"Yes": "Oui",
|
||||
"No": "Non",
|
||||
"Unchanged": "Inchangé",
|
||||
"New Subscriber Added": "Nouvel abonné ajouté",
|
||||
"Subscriber Unsubscribed": "Abonné désabonné",
|
||||
"New Client": "Nouveau client",
|
||||
"Triggered when a new subscriber is added to a list.": "Déclenché lorsqu'un nouvel abonné est ajouté à une liste.",
|
||||
"Triggered when a subscriber unsubscribes from a list": "Déclenché lorsqu'un abonné se désabonne d'une liste",
|
||||
"Triggered when a new client is added to Campaign Monitor.": "Déclenché lorsqu'un nouveau client est ajouté au moniteur de campagne."
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"Email marketing platform for delivering exceptional email campaigns.": "例外的な電子メールキャンペーンを配信するための電子メールマーケティングプラットフォーム。",
|
||||
"\nTo use Campaign Monitor, you need to get an API key:\n1. Login to your account at https://www.campaignmonitor.com.\n2. Navigate to Account Settings.\n3. Click on API Keys.\n4. Create a new API key or use an existing one.\n": "\nTo use Campaign Monitor, you need to get an API key:\n1. Login to your account at https://www.campaignmonitor.com.\n2. Navigate to Account Settings.\n3. Click on API Keys.\n4. Create a new API key or use an existing one.\n",
|
||||
"Add Subscriber": "購読者を追加",
|
||||
"Update Subscriber": "購読者を更新",
|
||||
"Unsubscribe Subscriber": "購読を解除",
|
||||
"Find Subscriber": "購読者を検索",
|
||||
"Adds a new subscriber to a list.": "新しい購読者をリストに追加します。",
|
||||
"Update an existing subscriber in a list.": "リストの既存の購読者を更新します。",
|
||||
"Remove a subscriber from a list.": "購読者をリストから削除します。",
|
||||
"Find a subscriber by email in a specific list.": "特定のリストからメールで購読者を検索します。",
|
||||
"Client Account": "クライアントアカウント",
|
||||
"List ID": "リストID",
|
||||
"Email Address": "メールアドレス",
|
||||
"Name": "Name",
|
||||
"Phone": "電話番号",
|
||||
"Consent to Track": "トラックに同意する",
|
||||
"Consent to Send SMS": "SMSの送信に同意",
|
||||
"Resubscribe": "Resubscribe",
|
||||
"Custom Fields": "カスタムフィールド",
|
||||
"Whether the subscriber has consented to tracking.": "購読者が追跡に同意したかどうか。",
|
||||
"Whether the subscriber has consented to send SMS.": "購読者がSMSを送信することに同意したかどうか。",
|
||||
"If true, the subscriber will be resubscribed if they previously unsubscribed.": "true の場合、購読者は以前に購読解除された場合に再購読されます。",
|
||||
"The email address of the subscriber to unsubscribe.": "購読を解除する購読者のメールアドレス",
|
||||
"The email address of the subscriber to find": "購読者のメールアドレスを検索",
|
||||
"Yes": "はい",
|
||||
"No": "いいえ",
|
||||
"Unchanged": "変更なし",
|
||||
"New Subscriber Added": "新しい購読者が追加されました",
|
||||
"Subscriber Unsubscribed": "購読登録解除",
|
||||
"New Client": "新規クライアント",
|
||||
"Triggered when a new subscriber is added to a list.": "新しい購読者がリストに追加されたときにトリガーされます。",
|
||||
"Triggered when a subscriber unsubscribes from a list": "購読者が一覧から購読を解除したときにトリガーされます",
|
||||
"Triggered when a new client is added to Campaign Monitor.": "新規クライアントがCampaign Monitorに追加されたときにトリガーされます。"
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"Email marketing platform for delivering exceptional email campaigns.": "Email marketing platform voor het leveren van uitzonderlijke e-mail campagnes.",
|
||||
"\nTo use Campaign Monitor, you need to get an API key:\n1. Login to your account at https://www.campaignmonitor.com.\n2. Navigate to Account Settings.\n3. Click on API Keys.\n4. Create a new API key or use an existing one.\n": "\nOm Campaign Monitor, te gebruiken, moet u een API key krijgen:\n1. Login op uw account op https://www.campaignmonitor.com.\n2. Navigeer naar Accountinstellingen.\n3. Klik op API-sleutels.\n4. Maak een nieuwe API-sleutel of gebruik een bestaande.\n",
|
||||
"Add Subscriber": "Voeg abonnee toe",
|
||||
"Update Subscriber": "Abonnee bijwerken",
|
||||
"Unsubscribe Subscriber": "Abonnee afmelden",
|
||||
"Find Subscriber": "Abonnee zoeken",
|
||||
"Adds a new subscriber to a list.": "Voegt een nieuwe abonnee toe aan een lijst.",
|
||||
"Update an existing subscriber in a list.": "Update een bestaande abonnee in een lijst.",
|
||||
"Remove a subscriber from a list.": "Verwijder een abonnee uit de lijst.",
|
||||
"Find a subscriber by email in a specific list.": "Een abonnee vinden per e-mail in een specifieke lijst.",
|
||||
"Client Account": "Klant account",
|
||||
"List ID": "Lijst ID",
|
||||
"Email Address": "Uw e-mailadres",
|
||||
"Name": "Naam",
|
||||
"Phone": "Telefoonnummer",
|
||||
"Consent to Track": "Toestemming voor track",
|
||||
"Consent to Send SMS": "Toestemming om SMS te verzenden",
|
||||
"Resubscribe": "Abonneren",
|
||||
"Custom Fields": "Aangepaste velden",
|
||||
"Whether the subscriber has consented to tracking.": "Of de abonnee toestemming heeft gegeven om te volgen.",
|
||||
"Whether the subscriber has consented to send SMS.": "Of de abonnee toestemming heeft gegeven om SMS te verzenden.",
|
||||
"If true, the subscriber will be resubscribed if they previously unsubscribed.": "Als het waar is, wordt de abonnee opnieuw geabonneerd als ze eerder uitgeschreven zijn.",
|
||||
"The email address of the subscriber to unsubscribe.": "Het e-mailadres van de afgemelde abonnee",
|
||||
"The email address of the subscriber to find": "Het e-mailadres van de abonnee om te vinden",
|
||||
"Yes": "ja",
|
||||
"No": "Neen",
|
||||
"Unchanged": "Ongewijzigd",
|
||||
"New Subscriber Added": "Nieuwe abonnee toegevoegd",
|
||||
"Subscriber Unsubscribed": "Abonnee uitgeschreven",
|
||||
"New Client": "Nieuwe klant",
|
||||
"Triggered when a new subscriber is added to a list.": "Uitgelokt wanneer een nieuwe ontvanger aan een lijst wordt toegevoegd.",
|
||||
"Triggered when a subscriber unsubscribes from a list": "Uitgelokt wanneer een abonnee zich afmeldt van een lijst",
|
||||
"Triggered when a new client is added to Campaign Monitor.": "Uitgelokt wanneer een nieuwe klant is toegevoegd aan Campaign Monitor."
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"Email marketing platform for delivering exceptional email campaigns.": "Plataforma de marketing por e-mail para a entrega de campanhas por e-mail excepcionais.",
|
||||
"\nTo use Campaign Monitor, you need to get an API key:\n1. Login to your account at https://www.campaignmonitor.com.\n2. Navigate to Account Settings.\n3. Click on API Keys.\n4. Create a new API key or use an existing one.\n": "\nTo use Campaign Monitor, you need to get an API key:\n1. Login to your account at https://www.campaignmonitor.com.\n2. Navigate to Account Settings.\n3. Click on API Keys.\n4. Create a new API key or use an existing one.\n",
|
||||
"Add Subscriber": "Adicionar Assinante",
|
||||
"Update Subscriber": "Atualizar Assinante",
|
||||
"Unsubscribe Subscriber": "Cancelar Assinatura",
|
||||
"Find Subscriber": "Encontrar Assinante",
|
||||
"Adds a new subscriber to a list.": "Adiciona um novo membro a uma lista.",
|
||||
"Update an existing subscriber in a list.": "Atualizar um assinante existente em uma lista.",
|
||||
"Remove a subscriber from a list.": "Remover um assinante de uma lista.",
|
||||
"Find a subscriber by email in a specific list.": "Encontre um assinante por e-mail em uma lista específica.",
|
||||
"Client Account": "Conta de Cliente",
|
||||
"List ID": "ID da lista",
|
||||
"Email Address": "Endereço de e-mail",
|
||||
"Name": "Nome",
|
||||
"Phone": "Smartphone",
|
||||
"Consent to Track": "Consentimento à Faixa",
|
||||
"Consent to Send SMS": "Consentimento para enviar SMS",
|
||||
"Resubscribe": "Recadastrar",
|
||||
"Custom Fields": "Campos Personalizados",
|
||||
"Whether the subscriber has consented to tracking.": "Se o assinante concordou em rastrear.",
|
||||
"Whether the subscriber has consented to send SMS.": "Se o assinante concordou em enviar SMS.",
|
||||
"If true, the subscriber will be resubscribed if they previously unsubscribed.": "Se verdadeiro, o assinante será rescrito se eles não estiverem inscritos anteriormente.",
|
||||
"The email address of the subscriber to unsubscribe.": "O endereço de e-mail do assinante para cancelar a assinatura.",
|
||||
"The email address of the subscriber to find": "O endereço de e-mail do assinante para encontrar",
|
||||
"Yes": "sim",
|
||||
"No": "Não",
|
||||
"Unchanged": "Inalterado",
|
||||
"New Subscriber Added": "Novo Assinante Adicionado",
|
||||
"Subscriber Unsubscribed": "Inscrito Inscrito",
|
||||
"New Client": "Novo Cliente",
|
||||
"Triggered when a new subscriber is added to a list.": "Acionada quando um novo assinante é adicionado a uma lista.",
|
||||
"Triggered when a subscriber unsubscribes from a list": "Acionada quando um assinante desinscrever-se de uma lista",
|
||||
"Triggered when a new client is added to Campaign Monitor.": "Acionada quando um novo cliente é adicionado ao Monitor da Campanha."
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"Campaign Monitor": "Монитор кампании",
|
||||
"Email marketing platform for delivering exceptional email campaigns.": "Почтовая маркетинговая платформа для рассылки уникальных электронных сообщений.",
|
||||
"\nTo use Campaign Monitor, you need to get an API key:\n1. Login to your account at https://www.campaignmonitor.com.\n2. Navigate to Account Settings.\n3. Click on API Keys.\n4. Create a new API key or use an existing one.\n": "\nДля использования монитора кампании вам необходимо получить API ключ:\n1. Войдите в свой аккаунт https://www.campaignmonitor.com.\n2. Перейдите в настройки аккаунта.\n3. Нажмите на API ключ.\n4. Создайте новый ключ API или используйте существующий.\n",
|
||||
"Add Subscriber": "Добавить подписчика",
|
||||
"Update Subscriber": "Обновить подписчика",
|
||||
"Unsubscribe Subscriber": "Отписать подписчика",
|
||||
"Find Subscriber": "Найти подписчика",
|
||||
"Adds a new subscriber to a list.": "Добавляет нового подписчика в список.",
|
||||
"Update an existing subscriber in a list.": "Обновить существующего подписчика в списке.",
|
||||
"Remove a subscriber from a list.": "Удалить подписчика из списка.",
|
||||
"Find a subscriber by email in a specific list.": "Найти подписчика по электронной почте в конкретном списке.",
|
||||
"Client Account": "Аккаунт клиента",
|
||||
"List ID": "ID списка",
|
||||
"Email Address": "Email Address",
|
||||
"Name": "Наименование",
|
||||
"Phone": "Телефон",
|
||||
"Consent to Track": "Согласие на отслеживание",
|
||||
"Consent to Send SMS": "Согласие на отправку SMS",
|
||||
"Resubscribe": "Повторная подписка",
|
||||
"Custom Fields": "Пользовательские поля",
|
||||
"Whether the subscriber has consented to tracking.": "Согласен ли подписчик на отслеживание.",
|
||||
"Whether the subscriber has consented to send SMS.": "Получил ли подписчик согласие на отправку SMS.",
|
||||
"If true, the subscriber will be resubscribed if they previously unsubscribed.": "Если включено, абонент будет пересдан после отказа от подписки.",
|
||||
"The email address of the subscriber to unsubscribe.": "Адрес электронной почты подписчика для отказа от подписки.",
|
||||
"The email address of the subscriber to find": "Адрес электронной почты абонента, чтобы найти",
|
||||
"Yes": "Да",
|
||||
"No": "Нет",
|
||||
"Unchanged": "Без изменений",
|
||||
"New Subscriber Added": "Добавлен новый подписчик",
|
||||
"Subscriber Unsubscribed": "Подписчик отписался",
|
||||
"New Client": "Новый клиент",
|
||||
"Triggered when a new subscriber is added to a list.": "Срабатывает при добавлении в список нового абонента.",
|
||||
"Triggered when a subscriber unsubscribes from a list": "Срабатывает при отказе от подписки подписчика из списка",
|
||||
"Triggered when a new client is added to Campaign Monitor.": "Срабатывает при добавлении нового клиента в Монитор Кампании."
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"Email marketing platform for delivering exceptional email campaigns.": "Email marketing platform for delivering exceptional email campaigns.",
|
||||
"\nTo use Campaign Monitor, you need to get an API key:\n1. Login to your account at https://www.campaignmonitor.com.\n2. Navigate to Account Settings.\n3. Click on API Keys.\n4. Create a new API key or use an existing one.\n": "\nTo use Campaign Monitor, you need to get an API key:\n1. Login to your account at https://www.campaignmonitor.com.\n2. Navigate to Account Settings.\n3. Click on API Keys.\n4. Create a new API key or use an existing one.\n",
|
||||
"Add Subscriber": "Add Subscriber",
|
||||
"Update Subscriber": "Update Subscriber",
|
||||
"Unsubscribe Subscriber": "Unsubscribe Subscriber",
|
||||
"Find Subscriber": "Find Subscriber",
|
||||
"Adds a new subscriber to a list.": "Adds a new subscriber to a list.",
|
||||
"Update an existing subscriber in a list.": "Update an existing subscriber in a list.",
|
||||
"Remove a subscriber from a list.": "Remove a subscriber from a list.",
|
||||
"Find a subscriber by email in a specific list.": "Find a subscriber by email in a specific list.",
|
||||
"Client Account": "Client Account",
|
||||
"List ID": "List ID",
|
||||
"Email Address": "Email Address",
|
||||
"Name": "Name",
|
||||
"Phone": "Phone",
|
||||
"Consent to Track": "Consent to Track",
|
||||
"Consent to Send SMS": "Consent to Send SMS",
|
||||
"Resubscribe": "Resubscribe",
|
||||
"Custom Fields": "Custom Fields",
|
||||
"Whether the subscriber has consented to tracking.": "Whether the subscriber has consented to tracking.",
|
||||
"Whether the subscriber has consented to send SMS.": "Whether the subscriber has consented to send SMS.",
|
||||
"If true, the subscriber will be resubscribed if they previously unsubscribed.": "If true, the subscriber will be resubscribed if they previously unsubscribed.",
|
||||
"The email address of the subscriber to unsubscribe.": "The email address of the subscriber to unsubscribe.",
|
||||
"The email address of the subscriber to find": "The email address of the subscriber to find",
|
||||
"Yes": "Yes",
|
||||
"No": "No",
|
||||
"Unchanged": "Unchanged",
|
||||
"New Subscriber Added": "New Subscriber Added",
|
||||
"Subscriber Unsubscribed": "Subscriber Unsubscribed",
|
||||
"New Client": "New Client",
|
||||
"Triggered when a new subscriber is added to a list.": "Triggered when a new subscriber is added to a list.",
|
||||
"Triggered when a subscriber unsubscribes from a list": "Triggered when a subscriber unsubscribes from a list",
|
||||
"Triggered when a new client is added to Campaign Monitor.": "Triggered when a new client is added to Campaign Monitor."
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"Campaign Monitor": "Campaign Monitor",
|
||||
"Email marketing platform for delivering exceptional email campaigns.": "Email marketing platform for delivering exceptional email campaigns.",
|
||||
"\nTo use Campaign Monitor, you need to get an API key:\n1. Login to your account at https://www.campaignmonitor.com.\n2. Navigate to Account Settings.\n3. Click on API Keys.\n4. Create a new API key or use an existing one.\n": "\nTo use Campaign Monitor, you need to get an API key:\n1. Login to your account at https://www.campaignmonitor.com.\n2. Navigate to Account Settings.\n3. Click on API Keys.\n4. Create a new API key or use an existing one.\n",
|
||||
"Add Subscriber": "Add Subscriber",
|
||||
"Update Subscriber": "Update Subscriber",
|
||||
"Unsubscribe Subscriber": "Unsubscribe Subscriber",
|
||||
"Find Subscriber": "Find Subscriber",
|
||||
"Adds a new subscriber to a list.": "Adds a new subscriber to a list.",
|
||||
"Update an existing subscriber in a list.": "Update an existing subscriber in a list.",
|
||||
"Remove a subscriber from a list.": "Remove a subscriber from a list.",
|
||||
"Find a subscriber by email in a specific list.": "Find a subscriber by email in a specific list.",
|
||||
"Client Account": "Client Account",
|
||||
"List ID": "List ID",
|
||||
"Email Address": "Email Address",
|
||||
"Name": "Name",
|
||||
"Phone": "Phone",
|
||||
"Consent to Track": "Consent to Track",
|
||||
"Consent to Send SMS": "Consent to Send SMS",
|
||||
"Resubscribe": "Resubscribe",
|
||||
"Custom Fields": "Custom Fields",
|
||||
"Whether the subscriber has consented to tracking.": "Whether the subscriber has consented to tracking.",
|
||||
"Whether the subscriber has consented to send SMS.": "Whether the subscriber has consented to send SMS.",
|
||||
"If true, the subscriber will be resubscribed if they previously unsubscribed.": "If true, the subscriber will be resubscribed if they previously unsubscribed.",
|
||||
"The email address of the subscriber to unsubscribe.": "The email address of the subscriber to unsubscribe.",
|
||||
"The email address of the subscriber to find": "The email address of the subscriber to find",
|
||||
"Yes": "Yes",
|
||||
"No": "No",
|
||||
"Unchanged": "Unchanged",
|
||||
"New Subscriber Added": "New Subscriber Added",
|
||||
"Subscriber Unsubscribed": "Subscriber Unsubscribed",
|
||||
"New Client": "New Client",
|
||||
"Triggered when a new subscriber is added to a list.": "Triggered when a new subscriber is added to a list.",
|
||||
"Triggered when a subscriber unsubscribes from a list": "Triggered when a subscriber unsubscribes from a list",
|
||||
"Triggered when a new client is added to Campaign Monitor.": "Triggered when a new client is added to Campaign Monitor."
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"Email marketing platform for delivering exceptional email campaigns.": "Email marketing platform for delivering exceptional email campaigns.",
|
||||
"\nTo use Campaign Monitor, you need to get an API key:\n1. Login to your account at https://www.campaignmonitor.com.\n2. Navigate to Account Settings.\n3. Click on API Keys.\n4. Create a new API key or use an existing one.\n": "\nTo use Campaign Monitor, you need to get an API key:\n1. Login to your account at https://www.campaignmonitor.com.\n2. Navigate to Account Settings.\n3. Click on API Keys.\n4. Create a new API key or use an existing one.\n",
|
||||
"Add Subscriber": "Add Subscriber",
|
||||
"Update Subscriber": "Update Subscriber",
|
||||
"Unsubscribe Subscriber": "Unsubscribe Subscriber",
|
||||
"Find Subscriber": "Find Subscriber",
|
||||
"Adds a new subscriber to a list.": "Adds a new subscriber to a list.",
|
||||
"Update an existing subscriber in a list.": "Update an existing subscriber in a list.",
|
||||
"Remove a subscriber from a list.": "Remove a subscriber from a list.",
|
||||
"Find a subscriber by email in a specific list.": "Find a subscriber by email in a specific list.",
|
||||
"Client Account": "Client Account",
|
||||
"List ID": "List ID",
|
||||
"Email Address": "Email Address",
|
||||
"Name": "名称",
|
||||
"Phone": "Phone",
|
||||
"Consent to Track": "Consent to Track",
|
||||
"Consent to Send SMS": "Consent to Send SMS",
|
||||
"Resubscribe": "Resubscribe",
|
||||
"Custom Fields": "Custom Fields",
|
||||
"Whether the subscriber has consented to tracking.": "Whether the subscriber has consented to tracking.",
|
||||
"Whether the subscriber has consented to send SMS.": "Whether the subscriber has consented to send SMS.",
|
||||
"If true, the subscriber will be resubscribed if they previously unsubscribed.": "If true, the subscriber will be resubscribed if they previously unsubscribed.",
|
||||
"The email address of the subscriber to unsubscribe.": "The email address of the subscriber to unsubscribe.",
|
||||
"The email address of the subscriber to find": "The email address of the subscriber to find",
|
||||
"Yes": "Yes",
|
||||
"No": "No",
|
||||
"Unchanged": "Unchanged",
|
||||
"New Subscriber Added": "New Subscriber Added",
|
||||
"Subscriber Unsubscribed": "Subscriber Unsubscribed",
|
||||
"New Client": "New Client",
|
||||
"Triggered when a new subscriber is added to a list.": "Triggered when a new subscriber is added to a list.",
|
||||
"Triggered when a subscriber unsubscribes from a list": "Triggered when a subscriber unsubscribes from a list",
|
||||
"Triggered when a new client is added to Campaign Monitor.": "Triggered when a new client is added to Campaign Monitor."
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
import { createPiece, PieceAuth } from '@activepieces/pieces-framework';
|
||||
import { PieceCategory } from '@activepieces/shared';
|
||||
import { addSubscriberToListAction } from './lib/actions/add-subscriber-to-list';
|
||||
import { updateSubscriberDetailsAction } from './lib/actions/update-subscriber-details';
|
||||
import { unsubscribeSubscriberAction } from './lib/actions/unsubscribe-subscriber';
|
||||
import { findSubscriberAction } from './lib/actions/find-subscriber';
|
||||
import { newSubscriberAddedTrigger } from './lib/triggers/new-subscriber-added';
|
||||
import { subscriberUnsubscribedTrigger } from './lib/triggers/subscriber-unsubscribed';
|
||||
import { newClientTrigger } from './lib/triggers/new-client';
|
||||
|
||||
const markdownDescription = `
|
||||
To use Campaign Monitor, you need to get an API key:
|
||||
1. Login to your account at https://www.campaignmonitor.com.
|
||||
2. Navigate to Account Settings.
|
||||
3. Click on API Keys.
|
||||
4. Create a new API key or use an existing one.
|
||||
`;
|
||||
|
||||
export const campaignMonitorAuth = PieceAuth.SecretText({
|
||||
displayName: 'API Key',
|
||||
description: markdownDescription,
|
||||
required: true,
|
||||
});
|
||||
|
||||
export const campaignMonitor = createPiece({
|
||||
displayName: 'Campaign Monitor',
|
||||
description: 'Email marketing platform for delivering exceptional email campaigns.',
|
||||
logoUrl: 'https://cdn.activepieces.com/pieces/campaign-monitor.png',
|
||||
authors: ['AnkitSharmaOnGithub','kishanprmr'],
|
||||
auth: campaignMonitorAuth,
|
||||
actions: [
|
||||
addSubscriberToListAction,
|
||||
updateSubscriberDetailsAction,
|
||||
unsubscribeSubscriberAction,
|
||||
findSubscriberAction
|
||||
],
|
||||
triggers: [
|
||||
newSubscriberAddedTrigger,
|
||||
subscriberUnsubscribedTrigger,
|
||||
newClientTrigger
|
||||
],
|
||||
categories: [PieceCategory.MARKETING],
|
||||
});
|
||||
@@ -0,0 +1,106 @@
|
||||
import { createAction, Property } from '@activepieces/pieces-framework';
|
||||
import { HttpMethod } from '@activepieces/pieces-common';
|
||||
import { makeRequest } from '../common/client';
|
||||
import { campaignMonitorAuth } from '../../index';
|
||||
import { clientId, customFields, listId } from '../common/props';
|
||||
import { HttpStatusCode } from 'axios';
|
||||
|
||||
export const addSubscriberToListAction = createAction({
|
||||
auth: campaignMonitorAuth,
|
||||
name: 'add_subscriber_to_list',
|
||||
displayName: 'Add Subscriber',
|
||||
description: 'Adds a new subscriber to a list.',
|
||||
props: {
|
||||
clientId: clientId,
|
||||
listId: listId,
|
||||
email: Property.ShortText({
|
||||
displayName: 'Email Address',
|
||||
required: true,
|
||||
}),
|
||||
name: Property.ShortText({
|
||||
displayName: 'Name',
|
||||
required: false,
|
||||
}),
|
||||
phone: Property.ShortText({
|
||||
displayName: 'Phone',
|
||||
required: false,
|
||||
}),
|
||||
consentToTrack: Property.StaticDropdown({
|
||||
displayName: 'Consent to Track',
|
||||
description: 'Whether the subscriber has consented to tracking.',
|
||||
required: true,
|
||||
defaultValue: 'Unchanged',
|
||||
options: {
|
||||
options: [
|
||||
{ label: 'Yes', value: 'Yes' },
|
||||
{ label: 'No', value: 'No' },
|
||||
{ label: 'Unchanged', value: 'Unchanged' },
|
||||
],
|
||||
},
|
||||
}),
|
||||
consentToSendSms: Property.StaticDropdown({
|
||||
displayName: 'Consent to Send SMS',
|
||||
required: false,
|
||||
description: 'Whether the subscriber has consented to send SMS.',
|
||||
defaultValue: 'Unchanged',
|
||||
options: {
|
||||
options: [
|
||||
{ label: 'Yes', value: 'Yes' },
|
||||
{ label: 'No', value: 'No' },
|
||||
{ label: 'Unchanged', value: 'Unchanged' },
|
||||
],
|
||||
},
|
||||
}),
|
||||
resubscribe: Property.Checkbox({
|
||||
displayName: 'Resubscribe',
|
||||
description:
|
||||
'If true, the subscriber will be resubscribed if they previously unsubscribed.',
|
||||
required: false,
|
||||
defaultValue: false,
|
||||
}),
|
||||
fields:customFields,
|
||||
},
|
||||
async run({ propsValue, auth }) {
|
||||
const {
|
||||
listId,
|
||||
email,
|
||||
name,
|
||||
phone,
|
||||
consentToSendSms,
|
||||
consentToTrack,
|
||||
resubscribe,
|
||||
fields
|
||||
} = propsValue;
|
||||
|
||||
const payload = {
|
||||
EmailAddress: email,
|
||||
Name: name || '',
|
||||
ConsentToTrack: consentToTrack,
|
||||
ConsentToSendSms: consentToSendSms,
|
||||
Resubscribe: resubscribe ?? true,
|
||||
MobileNumber: phone,
|
||||
CustomFields: Object.entries(fields).flatMap(([key, value]) =>
|
||||
Array.isArray(value)
|
||||
? value.map((v) => ({ Key: key, Value: v }))
|
||||
: [{ Key: key, Value: value }]
|
||||
),
|
||||
};
|
||||
|
||||
const response = await makeRequest(
|
||||
{ apiKey: auth.secret_text },
|
||||
HttpMethod.POST,
|
||||
`/subscribers/${listId}.json`,
|
||||
payload
|
||||
);
|
||||
|
||||
if (response.status === HttpStatusCode.Created) {
|
||||
return {
|
||||
success: true,
|
||||
};
|
||||
}
|
||||
return {
|
||||
success: false,
|
||||
error: response.body,
|
||||
};
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,48 @@
|
||||
import { createAction, Property } from '@activepieces/pieces-framework';
|
||||
import { HttpMethod } from '@activepieces/pieces-common';
|
||||
import { makeRequest, transformCustomFields } from '../common/client';
|
||||
import { campaignMonitorAuth } from '../../index';
|
||||
import { clientId, listId } from '../common/props';
|
||||
|
||||
export const findSubscriberAction = createAction({
|
||||
auth: campaignMonitorAuth,
|
||||
name: 'find_subscriber',
|
||||
displayName: 'Find Subscriber',
|
||||
description: 'Find a subscriber by email in a specific list.',
|
||||
props: {
|
||||
clientId: clientId,
|
||||
listId: listId,
|
||||
email: Property.ShortText({
|
||||
displayName: 'Email Address',
|
||||
description: 'The email address of the subscriber to find',
|
||||
required: true,
|
||||
}),
|
||||
},
|
||||
async run({ propsValue, auth }) {
|
||||
const { listId, email } = propsValue;
|
||||
|
||||
try {
|
||||
const response = await makeRequest(
|
||||
{ apiKey: auth.secret_text },
|
||||
HttpMethod.GET,
|
||||
`/subscribers/${listId}.json?email=${encodeURIComponent(
|
||||
email
|
||||
)}&includetrackingpreference=true`
|
||||
);
|
||||
|
||||
return {
|
||||
found: true,
|
||||
result: {
|
||||
...response.body,
|
||||
CustomFields:transformCustomFields(response.body['CustomFields'])
|
||||
},
|
||||
};
|
||||
} catch (error) {
|
||||
// If subscriber is not found, API returns a 404
|
||||
return {
|
||||
found: false,
|
||||
result: null,
|
||||
};
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,46 @@
|
||||
import { createAction, Property } from '@activepieces/pieces-framework';
|
||||
import { HttpMethod } from '@activepieces/pieces-common';
|
||||
import { makeRequest } from '../common/client';
|
||||
import { campaignMonitorAuth } from '../../index';
|
||||
import { clientId, listId } from '../common/props';
|
||||
import { HttpStatusCode } from 'axios';
|
||||
|
||||
export const unsubscribeSubscriberAction = createAction({
|
||||
auth: campaignMonitorAuth,
|
||||
name: 'unsubscribe_subscriber',
|
||||
displayName: 'Unsubscribe Subscriber',
|
||||
description: 'Remove a subscriber from a list.',
|
||||
props: {
|
||||
clientId: clientId,
|
||||
listId: listId,
|
||||
email: Property.ShortText({
|
||||
displayName: 'Email Address',
|
||||
description: 'The email address of the subscriber to unsubscribe.',
|
||||
required: true,
|
||||
}),
|
||||
},
|
||||
async run({ propsValue, auth }) {
|
||||
const { listId, email } = propsValue;
|
||||
|
||||
const payload = {
|
||||
EmailAddress: email,
|
||||
};
|
||||
|
||||
const response = await makeRequest(
|
||||
{ apiKey: auth.secret_text },
|
||||
HttpMethod.POST,
|
||||
`/subscribers/${listId}/unsubscribe.json`,
|
||||
payload
|
||||
);
|
||||
|
||||
if (response.status === HttpStatusCode.Ok) {
|
||||
return {
|
||||
success: true,
|
||||
};
|
||||
}
|
||||
return {
|
||||
success: false,
|
||||
error: response.body,
|
||||
};
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,105 @@
|
||||
import { createAction, Property } from '@activepieces/pieces-framework';
|
||||
import { HttpMethod } from '@activepieces/pieces-common';
|
||||
import { makeRequest } from '../common/client';
|
||||
import { campaignMonitorAuth } from '../../index';
|
||||
import { clientId, customFields, listId } from '../common/props';
|
||||
import { HttpStatusCode } from 'axios';
|
||||
|
||||
export const updateSubscriberDetailsAction = createAction({
|
||||
auth: campaignMonitorAuth,
|
||||
name: 'update_subscriber_details',
|
||||
displayName: 'Update Subscriber',
|
||||
description: 'Update an existing subscriber in a list.',
|
||||
props: {
|
||||
clientId: clientId,
|
||||
listId: listId,
|
||||
email: Property.ShortText({
|
||||
displayName: 'Email Address',
|
||||
required: true,
|
||||
}),
|
||||
name: Property.ShortText({
|
||||
displayName: 'Name',
|
||||
required: false,
|
||||
}),
|
||||
phone: Property.ShortText({
|
||||
displayName: 'Phone',
|
||||
required: false,
|
||||
}),
|
||||
consentToTrack: Property.StaticDropdown({
|
||||
displayName: 'Consent to Track',
|
||||
description: 'Whether the subscriber has consented to tracking.',
|
||||
required: false,
|
||||
defaultValue: 'Yes',
|
||||
options: {
|
||||
options: [
|
||||
{ label: 'Yes', value: 'Yes' },
|
||||
{ label: 'No', value: 'No' },
|
||||
{ label: 'Unchanged', value: 'Unchanged' },
|
||||
],
|
||||
},
|
||||
}),
|
||||
consentToSendSms: Property.StaticDropdown({
|
||||
displayName: 'Consent to Send SMS',
|
||||
required: false,
|
||||
description: 'Whether the subscriber has consented to send SMS.',
|
||||
defaultValue: 'Unchanged',
|
||||
options: {
|
||||
options: [
|
||||
{ label: 'Yes', value: 'Yes' },
|
||||
{ label: 'No', value: 'No' },
|
||||
{ label: 'Unchanged', value: 'Unchanged' },
|
||||
],
|
||||
},
|
||||
}),
|
||||
resubscribe: Property.Checkbox({
|
||||
displayName: 'Resubscribe',
|
||||
description:
|
||||
'If true, the subscriber will be resubscribed if they previously unsubscribed.',
|
||||
required: false,
|
||||
defaultValue: false,
|
||||
}),
|
||||
fields:customFields,
|
||||
},
|
||||
async run({ propsValue, auth }) {
|
||||
const {
|
||||
listId,
|
||||
email,
|
||||
name,
|
||||
consentToSendSms,
|
||||
phone,
|
||||
resubscribe,
|
||||
consentToTrack,
|
||||
fields
|
||||
} = propsValue;
|
||||
|
||||
const payload = {
|
||||
MobileNumber: phone,
|
||||
Name: name,
|
||||
ConsentToTrack: consentToTrack,
|
||||
ConsentToSendSms: consentToSendSms,
|
||||
Resubscribe: resubscribe ?? true,
|
||||
CustomFields: Object.entries(fields).flatMap(([key, value]) =>
|
||||
Array.isArray(value)
|
||||
? value.map((v) => ({ Key: key, Value: v }))
|
||||
: [{ Key: key, Value: value }]
|
||||
),
|
||||
};
|
||||
|
||||
const response = await makeRequest(
|
||||
{ apiKey: auth.secret_text },
|
||||
HttpMethod.PUT,
|
||||
`/subscribers/${listId}.json?email=${encodeURIComponent(email)}`,
|
||||
payload
|
||||
);
|
||||
|
||||
if (response.status === HttpStatusCode.Ok) {
|
||||
return {
|
||||
success: true,
|
||||
};
|
||||
}
|
||||
return {
|
||||
success: false,
|
||||
error: response.body,
|
||||
};
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,52 @@
|
||||
import {
|
||||
HttpMethod,
|
||||
httpClient,
|
||||
AuthenticationType,
|
||||
} from '@activepieces/pieces-common';
|
||||
|
||||
export const BASE_URL = 'https://api.createsend.com/api/v3.3';
|
||||
|
||||
export interface CampaignMonitorAuth {
|
||||
apiKey: string;
|
||||
}
|
||||
|
||||
export async function makeRequest(
|
||||
auth: CampaignMonitorAuth,
|
||||
method: HttpMethod,
|
||||
path: string,
|
||||
body?: unknown
|
||||
) {
|
||||
const response = await httpClient.sendRequest({
|
||||
method,
|
||||
url: `${BASE_URL}${path}`,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
authentication: {
|
||||
type: AuthenticationType.BASIC,
|
||||
username: auth.apiKey,
|
||||
password: 'x',
|
||||
},
|
||||
body,
|
||||
});
|
||||
return response;
|
||||
}
|
||||
|
||||
export function transformCustomFields(
|
||||
inputFields: Array<{ Key: string; Value: string }>
|
||||
) {
|
||||
const fields: Record<string, any> = {};
|
||||
|
||||
for (const { Key, Value } of inputFields) {
|
||||
if (fields[Key]) {
|
||||
if (Array.isArray(fields[Key])) {
|
||||
fields[Key].push(Value);
|
||||
} else {
|
||||
fields[Key] = [fields[Key], Value];
|
||||
}
|
||||
} else {
|
||||
fields[Key] = Value;
|
||||
}
|
||||
}
|
||||
return fields;
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
import { DynamicPropsValue, Property } from '@activepieces/pieces-framework';
|
||||
import { makeRequest } from './client';
|
||||
import { HttpMethod } from '@activepieces/pieces-common';
|
||||
import { campaignMonitorAuth } from '../..';
|
||||
|
||||
export const clientId = Property.Dropdown({
|
||||
displayName: 'Client Account',
|
||||
refreshers: [],
|
||||
required: true,
|
||||
auth: campaignMonitorAuth,
|
||||
options: async ({ auth }) => {
|
||||
if (!auth) {
|
||||
return {
|
||||
disabled: true,
|
||||
placeholder: 'Please connect your account.',
|
||||
options: [],
|
||||
};
|
||||
}
|
||||
|
||||
const response = await makeRequest(
|
||||
{ apiKey: auth.secret_text },
|
||||
HttpMethod.GET,
|
||||
'/clients.json'
|
||||
);
|
||||
const clients = response.body as { ClientID: string; Name: string }[];
|
||||
|
||||
return {
|
||||
disabled: false,
|
||||
options: clients.map((client) => {
|
||||
return {
|
||||
label: client.Name,
|
||||
value: client.ClientID,
|
||||
};
|
||||
}),
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
export const listId = Property.Dropdown({
|
||||
auth: campaignMonitorAuth,
|
||||
displayName: 'List ID',
|
||||
refreshers: ['clientId'],
|
||||
required: true,
|
||||
options: async ({ auth, clientId }) => {
|
||||
if (!auth || !clientId) {
|
||||
return {
|
||||
disabled: true,
|
||||
placeholder: 'Please connect your account.',
|
||||
options: [],
|
||||
};
|
||||
}
|
||||
|
||||
const response = await makeRequest(
|
||||
{ apiKey: auth.secret_text },
|
||||
HttpMethod.GET,
|
||||
`/clients/${clientId}/lists.json`
|
||||
);
|
||||
const lists = response.body as { ListID: string; Name: string }[];
|
||||
|
||||
return {
|
||||
disabled: false,
|
||||
options: lists.map((list) => {
|
||||
return {
|
||||
label: list.Name,
|
||||
value: list.ListID,
|
||||
};
|
||||
}),
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
export const customFields = Property.DynamicProperties({
|
||||
auth: campaignMonitorAuth,
|
||||
displayName: 'Custom Fields',
|
||||
refreshers: ['listId'],
|
||||
required: true,
|
||||
props: async ({ auth, listId }) => {
|
||||
if (!auth || !listId) return {};
|
||||
|
||||
const fields: DynamicPropsValue = {};
|
||||
|
||||
const response = await makeRequest(
|
||||
{
|
||||
apiKey: auth.secret_text,
|
||||
},
|
||||
HttpMethod.GET,
|
||||
`/lists/${listId}/customfields.json`
|
||||
);
|
||||
|
||||
const listFields = response.body as Array<{
|
||||
FieldName: string;
|
||||
Key: string;
|
||||
DataType: string;
|
||||
FieldOptions: string[];
|
||||
}>;
|
||||
|
||||
for (const field of listFields) {
|
||||
switch (field.DataType) {
|
||||
case 'Text':
|
||||
fields[field.Key] = Property.ShortText({
|
||||
displayName: field.FieldName,
|
||||
required: false,
|
||||
});
|
||||
break;
|
||||
case 'Number':
|
||||
fields[field.Key] = Property.Number({
|
||||
displayName: field.FieldName,
|
||||
required: false,
|
||||
});
|
||||
break;
|
||||
case 'Date':
|
||||
fields[field.Key] = Property.DateTime({
|
||||
displayName: field.FieldName,
|
||||
required: false,
|
||||
});
|
||||
break;
|
||||
case 'MultiSelectOne':
|
||||
fields[field.Key] = Property.StaticDropdown({
|
||||
displayName: field.FieldName,
|
||||
required: false,
|
||||
options: {
|
||||
disabled: false,
|
||||
options: field.FieldOptions.map((option) => ({
|
||||
label: option,
|
||||
value: option,
|
||||
})),
|
||||
},
|
||||
});
|
||||
break;
|
||||
case 'MultiSelectMany':
|
||||
fields[field.Key] = Property.StaticMultiSelectDropdown({
|
||||
displayName: field.FieldName,
|
||||
required: false,
|
||||
options: {
|
||||
disabled: false,
|
||||
options: field.FieldOptions.map((option) => ({
|
||||
label: option,
|
||||
value: option,
|
||||
})),
|
||||
},
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
return fields;
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,79 @@
|
||||
import { createTrigger, TriggerStrategy } from '@activepieces/pieces-framework';
|
||||
import { HttpMethod } from '@activepieces/pieces-common';
|
||||
import { makeRequest } from '../common/client';
|
||||
import { campaignMonitorAuth } from '../../index';
|
||||
|
||||
export const newClientTrigger = createTrigger({
|
||||
auth: campaignMonitorAuth,
|
||||
name: 'new_client',
|
||||
displayName: 'New Client',
|
||||
description: 'Triggered when a new client is added to Campaign Monitor.',
|
||||
props: {},
|
||||
type: TriggerStrategy.POLLING,
|
||||
sampleData: {
|
||||
ClientID: 'xyz',
|
||||
Name: 'New Client',
|
||||
},
|
||||
async onEnable(context) {
|
||||
// Store the list of existing clients
|
||||
const response = await makeRequest(
|
||||
{ apiKey: context.auth.secret_text },
|
||||
HttpMethod.GET,
|
||||
'/clients.json'
|
||||
);
|
||||
|
||||
const clients = response.body as Array<{ ClientID: string; Name: string }>;
|
||||
|
||||
await context.store.put('existing_clients', {
|
||||
clients: clients.map((c) => c.ClientID),
|
||||
});
|
||||
},
|
||||
async onDisable(context) {
|
||||
// No cleanup needed for polling trigger
|
||||
await context.store.delete('existing_clients');
|
||||
},
|
||||
async test(context) {
|
||||
const response = await makeRequest(
|
||||
{ apiKey: context.auth.secret_text },
|
||||
HttpMethod.GET,
|
||||
'/clients.json'
|
||||
);
|
||||
|
||||
return response.body;
|
||||
},
|
||||
async run(context) {
|
||||
// Get stored list of clients
|
||||
const storedClients = await context.store.get<{ clients: string[] }>(
|
||||
'existing_clients'
|
||||
);
|
||||
const existingClientIds = storedClients?.clients || [];
|
||||
|
||||
// Get all clients
|
||||
const response = await makeRequest(
|
||||
{ apiKey: context.auth.secret_text },
|
||||
HttpMethod.GET,
|
||||
'/clients.json'
|
||||
);
|
||||
|
||||
const allClients = response.body as Array<{
|
||||
ClientID: string;
|
||||
Name: string;
|
||||
}>;
|
||||
|
||||
// Find new clients
|
||||
const newClients = allClients.filter(
|
||||
(client) => !existingClientIds.includes(client.ClientID)
|
||||
);
|
||||
|
||||
// Update stored client list
|
||||
const updatedClientIds = Array.from(
|
||||
new Set([...existingClientIds, ...allClients.map((c) => c.ClientID)])
|
||||
);
|
||||
await context.store.put('existing_clients', {
|
||||
clients: updatedClientIds,
|
||||
});
|
||||
|
||||
// Return new clients
|
||||
return newClients;
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,93 @@
|
||||
import { createTrigger, TriggerStrategy } from '@activepieces/pieces-framework';
|
||||
import { HttpMethod } from '@activepieces/pieces-common';
|
||||
import { makeRequest, transformCustomFields } from '../common/client';
|
||||
import { isNil } from '@activepieces/shared';
|
||||
import { campaignMonitorAuth } from '../../index';
|
||||
import { clientId, listId } from '../common/props';
|
||||
|
||||
export const newSubscriberAddedTrigger = createTrigger({
|
||||
auth: campaignMonitorAuth,
|
||||
name: 'new_subscriber_added',
|
||||
displayName: 'New Subscriber Added',
|
||||
description: 'Triggered when a new subscriber is added to a list.',
|
||||
props: {
|
||||
clientId: clientId,
|
||||
listId: listId,
|
||||
},
|
||||
type: TriggerStrategy.WEBHOOK,
|
||||
sampleData: {
|
||||
EmailAddress: 'subscriber@example.com',
|
||||
Name: 'New Subscriber',
|
||||
Date: '2023-07-15T15:30:00Z',
|
||||
ListID: 'xyz',
|
||||
CustomFields: {
|
||||
website: 'https://example.com',
|
||||
},
|
||||
State: 'Active',
|
||||
ConsentToTrack: 'Yes',
|
||||
},
|
||||
async onEnable(context) {
|
||||
const { listId } = context.propsValue;
|
||||
|
||||
const response = await makeRequest(
|
||||
{ apiKey: context.auth.secret_text },
|
||||
HttpMethod.POST,
|
||||
`/lists/${listId}/webhooks.json`,
|
||||
{
|
||||
Events: ['Subscribe'],
|
||||
Url: context.webhookUrl,
|
||||
PayloadFormat: 'json',
|
||||
}
|
||||
);
|
||||
|
||||
const webhook = response.body as string;
|
||||
|
||||
await context.store.put('new_subscriber_added_webhook', webhook);
|
||||
},
|
||||
async onDisable(context) {
|
||||
const { listId } = context.propsValue;
|
||||
const storedData = await context.store.get<string>(
|
||||
'new_subscriber_added_webhook'
|
||||
);
|
||||
|
||||
|
||||
if (!isNil(storedData)) {
|
||||
await makeRequest(
|
||||
{ apiKey: context.auth.secret_text },
|
||||
HttpMethod.DELETE,
|
||||
`/lists/${listId}/webhooks/${storedData}.json`
|
||||
);
|
||||
}
|
||||
},
|
||||
async run(context) {
|
||||
const payload = context.payload.body as {
|
||||
ListID: string;
|
||||
Events: { Type: string; EmailAddress: string }[];
|
||||
};
|
||||
|
||||
if (payload.ListID !== context.propsValue.listId) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const result = [];
|
||||
|
||||
for (const event of payload.Events) {
|
||||
if (event.Type === 'Subscribe') {
|
||||
const response = await makeRequest(
|
||||
{ apiKey: context.auth.secret_text },
|
||||
HttpMethod.GET,
|
||||
`/subscribers/${context.propsValue.listId}.json?email=${encodeURIComponent(
|
||||
event.EmailAddress
|
||||
)}`,
|
||||
payload
|
||||
);
|
||||
result.push({
|
||||
...response.body,
|
||||
CustomFields: transformCustomFields(response.body['CustomFields']),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,91 @@
|
||||
import {
|
||||
createTrigger,
|
||||
Property,
|
||||
TriggerStrategy,
|
||||
} from '@activepieces/pieces-framework';
|
||||
import { HttpMethod } from '@activepieces/pieces-common';
|
||||
import { makeRequest, transformCustomFields } from '../common/client';
|
||||
import { isNil } from '@activepieces/shared';
|
||||
import { campaignMonitorAuth } from '../../index';
|
||||
import { clientId, listId } from '../common/props';
|
||||
|
||||
export const subscriberUnsubscribedTrigger = createTrigger({
|
||||
auth: campaignMonitorAuth,
|
||||
name: 'subscriber_unsubscribed',
|
||||
displayName: 'Subscriber Unsubscribed',
|
||||
description: 'Triggered when a subscriber unsubscribes from a list',
|
||||
props: {
|
||||
clientId: clientId,
|
||||
listId: listId,
|
||||
},
|
||||
type: TriggerStrategy.WEBHOOK,
|
||||
sampleData: {
|
||||
EmailAddress: 'subscriber@example.com',
|
||||
Name: 'Former Subscriber',
|
||||
Date: '2023-07-15T15:30:00Z',
|
||||
ListID: 'xyz',
|
||||
State: 'Unsubscribed',
|
||||
},
|
||||
async onEnable(context) {
|
||||
const { listId } = context.propsValue;
|
||||
|
||||
const response = await makeRequest(
|
||||
{ apiKey: context.auth.secret_text },
|
||||
HttpMethod.POST,
|
||||
`/lists/${listId}/webhooks.json`,
|
||||
{
|
||||
Events: ['Deactivate'],
|
||||
Url: context.webhookUrl,
|
||||
ListID: listId,
|
||||
PayloadFormat: 'json',
|
||||
}
|
||||
);
|
||||
const webhook = response.body as string;
|
||||
|
||||
await context.store.put('subscriber_unsubscribed_webhook', webhook);
|
||||
},
|
||||
async onDisable(context) {
|
||||
const storedData = await context.store.get<string>(
|
||||
'subscriber_unsubscribed_webhook'
|
||||
);
|
||||
|
||||
if (!isNil(storedData)) {
|
||||
await makeRequest(
|
||||
{ apiKey: context.auth.secret_text },
|
||||
HttpMethod.DELETE,
|
||||
`/lists/${listId}/webhooks/${storedData}.json`
|
||||
);
|
||||
}
|
||||
},
|
||||
async run(context) {
|
||||
const payload = context.payload.body as {
|
||||
ListID: string;
|
||||
Events: { Type: string; EmailAddress: string,State:string }[];
|
||||
};
|
||||
|
||||
if (payload.ListID !== context.propsValue.listId) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const result = [];
|
||||
|
||||
for (const event of payload.Events) {
|
||||
if (event.Type === 'Deactivate' && event.State==='Unsubscribed') {
|
||||
const response = await makeRequest(
|
||||
{ apiKey: context.auth.secret_text },
|
||||
HttpMethod.GET,
|
||||
`/subscribers/${context.propsValue.listId}.json?email=${encodeURIComponent(
|
||||
event.EmailAddress
|
||||
)}`,
|
||||
payload
|
||||
);
|
||||
result.push({
|
||||
...response.body,
|
||||
CustomFields: transformCustomFields(response.body['CustomFields']),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
},
|
||||
});
|
||||
@@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -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"]
|
||||
}
|
||||
Reference in New Issue
Block a user