Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

feat(pieces): add AI-agent atomics to pipedrive and mailer-lite (#15725)

Odai Ahmadc649954254a0
diff --git a/bun.lock b/bun.lock
index 77fa96a6b33..381f07e71f4 100644
--- a/bun.lock
+++ b/bun.lock
@@ -5400,7 +5400,7 @@
},
"packages/pieces/community/mailer-lite": {
"name": "@activepieces/piece-mailer-lite",
- "version": "0.8.0",
+ "version": "0.9.0",
"dependencies": {
"@activepieces/core-piece-types": "workspace:*",
"@activepieces/core-utils": "workspace:*",
@@ -6986,7 +6986,7 @@
},
"packages/pieces/community/pipedrive": {
"name": "@activepieces/piece-pipedrive",
- "version": "0.9.0",
+ "version": "0.10.0",
"dependencies": {
"@activepieces/core-piece-types": "workspace:*",
"@activepieces/core-utils": "workspace:*",
diff --git a/packages/pieces/community/mailer-lite/package.json b/packages/pieces/community/mailer-lite/package.json
index 84e90099502..7eb42e951b5 100644
--- a/packages/pieces/community/mailer-lite/package.json
+++ b/packages/pieces/community/mailer-lite/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-mailer-lite",
- "version": "0.8.0",
+ "version": "0.9.0",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"dependencies": {
diff --git a/packages/pieces/community/mailer-lite/src/i18n/translation.json b/packages/pieces/community/mailer-lite/src/i18n/translation.json
index dce3157cf14..6121cf42ce7 100644
--- a/packages/pieces/community/mailer-lite/src/i18n/translation.json
+++ b/packages/pieces/community/mailer-lite/src/i18n/translation.json
@@ -18,7 +18,6 @@
"Removes subscriber from a specific group.": "Removes subscriber from a specific group.",
"List subscribers, optionally filtered by status.": "List subscribers, optionally filtered by status.",
"Set a subscriber status to unsubscribed.": "Set a subscriber status to unsubscribed.",
- "Permanently delete a subscriber.": "Permanently delete a subscriber.",
"List all groups in the account.": "List all groups in the account.",
"Create a new group.": "Create a new group.",
"List the subscribers belonging to a group.": "List the subscribers belonging to a group.",
@@ -75,5 +74,251 @@
"Triggers when the subscriber fields have been updated.": "Triggers when the subscriber fields have been updated.",
"Triggers when a subscriber has unsubscribed from your mailing list.": "Triggers when a subscriber has unsubscribed from your mailing list.",
"Triggers when a subscriber is added to a group.": "Triggers when a subscriber is added to a group.",
- "Webhook Name": "Webhook Name"
-}
\ No newline at end of file
+ "Webhook Name": "Webhook Name",
+ "Update Subscriber": "Update Subscriber",
+ "Update fields or status of an existing subscriber.": "Update fields or status of an existing subscriber.",
+ "The subscriber ID, from find_subscriber or list_subscribers.": "The subscriber ID, from find_subscriber or list_subscribers.",
+ "Field values to set, keyed by field key (e.g. name, last_name, or a custom field key from list_fields). Fields not listed are left alone.": "Field values to set, keyed by field key (e.g. name, last_name, or a custom field key from list_fields). Fields not listed are left alone.",
+ "New subscriber status. Unsubscribed, bounced and junk subscribers cannot be reactivated through the API.": "New subscriber status. Unsubscribed, bounced and junk subscribers cannot be reactivated through the API.",
+ "Subscribed At": "Subscribed At",
+ "When the subscriber subscribed.": "When the subscriber subscribed.",
+ "Opted In At": "Opted In At",
+ "When the subscriber confirmed the opt-in.": "When the subscriber confirmed the opt-in.",
+ "Unsubscribed At": "Unsubscribed At",
+ "When the subscriber unsubscribed.": "When the subscriber unsubscribed.",
+ "IP Address": "IP Address",
+ "The IP address the subscriber signed up from.": "The IP address the subscriber signed up from.",
+ "Opt-in IP": "Opt-in IP",
+ "The IP address the subscriber confirmed the opt-in from.": "The IP address the subscriber confirmed the opt-in from.",
+ "Forget Subscriber (GDPR)": "Forget Subscriber (GDPR)",
+ "Remove a subscriber and permanently erase their data (GDPR).": "Remove a subscriber and permanently erase their data (GDPR).",
+ "Get Subscriber Activity": "Get Subscriber Activity",
+ "List the activity log of a subscriber.": "List the activity log of a subscriber.",
+ "Activity Type": "Activity Type",
+ "Only return this type of activity.": "Only return this type of activity.",
+ "Campaign send": "Campaign send",
+ "Automation email sent": "Automation email sent",
+ "Email open": "Email open",
+ "Link click": "Link click",
+ "Email bounce": "Email bounce",
+ "Spam complaint": "Spam complaint",
+ "Email forward": "Email forward",
+ "Marketing preferences change": "Marketing preferences change",
+ "Preference center": "Preference center",
+ "Items to return (1-100, default 100).": "Items to return (1-100, default 100).",
+ "Page": "Page",
+ "Page number to return, starting at 1.": "Page number to return, starting at 1.",
+ "Count Subscribers": "Count Subscribers",
+ "Get the total number of subscribers in the account.": "Get the total number of subscribers in the account.",
+ "Import Subscribers to Group": "Import Subscribers to Group",
+ "Start a bulk import of subscribers into a group.": "Start a bulk import of subscribers into a group.",
+ "The group ID, from list_groups or find_groups_by_name.": "The group ID, from list_groups or find_groups_by_name.",
+ "Subscribers": "Subscribers",
+ "JSON array of subscribers, e.g. [{\"email\": \"[email protected]\", \"fields\": {\"name\": \"Ann\"}}].": "JSON array of subscribers, e.g. [{\"email\": \"[email protected]\", \"fields\": {\"name\": \"Ann\"}}].",
+ "Get Import Status": "Get Import Status",
+ "Get the progress and report of a subscriber import.": "Get the progress and report of a subscriber import.",
+ "Import ID": "Import ID",
+ "The import ID returned by import_subscribers_to_group.": "The import ID returned by import_subscribers_to_group.",
+ "Find Groups by Name": "Find Groups by Name",
+ "Find subscriber groups whose name contains a text.": "Find subscriber groups whose name contains a text.",
+ "Name Contains": "Name Contains",
+ "Text the group name must contain.": "Text the group name must contain.",
+ "Sort": "Sort",
+ "Sort order; a minus prefix means descending.": "Sort order; a minus prefix means descending.",
+ "Name": "Name",
+ "Name (desc)": "Name (desc)",
+ "Total": "Total",
+ "Total (desc)": "Total (desc)",
+ "Open rate": "Open rate",
+ "Open rate (desc)": "Open rate (desc)",
+ "Click rate": "Click rate",
+ "Click rate (desc)": "Click rate (desc)",
+ "Created at": "Created at",
+ "Created at (desc)": "Created at (desc)",
+ "Items to return (1-1000, default 25).": "Items to return (1-1000, default 25).",
+ "Rename Group": "Rename Group",
+ "Rename a subscriber group.": "Rename a subscriber group.",
+ "The new group name (max 255 characters).": "The new group name (max 255 characters).",
+ "Delete Group": "Delete Group",
+ "Delete a subscriber group.": "Delete a subscriber group.",
+ "List Segments": "List Segments",
+ "List the segments in the account.": "List the segments in the account.",
+ "Items to return (1-250, default 50).": "Items to return (1-250, default 50).",
+ "List Segment Subscribers": "List Segment Subscribers",
+ "List the subscribers that match a segment.": "List the subscribers that match a segment.",
+ "Segment ID": "Segment ID",
+ "The segment ID, from list_segments.": "The segment ID, from list_segments.",
+ "Only return subscribers with this status. MailerLite defaults to active.": "Only return subscribers with this status. MailerLite defaults to active.",
+ "Items to return (1-1000, default 50).": "Items to return (1-1000, default 50).",
+ "Cursor": "Cursor",
+ "The meta.next_cursor value from the previous page. Leave empty for the first page.": "The meta.next_cursor value from the previous page. Leave empty for the first page.",
+ "Rename Segment": "Rename Segment",
+ "Rename a segment.": "Rename a segment.",
+ "The new segment name (max 255 characters).": "The new segment name (max 255 characters).",
+ "Delete Segment": "Delete Segment",
+ "Delete a segment.": "Delete a segment.",
+ "List Fields": "List Fields",
+ "List the subscriber fields in the account.": "List the subscriber fields in the account.",
+ "Keyword": "Keyword",
+ "Only return fields whose name contains this text.": "Only return fields whose name contains this text.",
+ "Type": "Type",
+ "Only return fields of this type.": "Only return fields of this type.",
+ "Text": "Text",
+ "Number": "Number",
+ "Date": "Date",
+ "Create Field": "Create Field",
+ "Create a custom subscriber field.": "Create a custom subscriber field.",
+ "The field name.": "The field name.",
+ "The field type. It cannot be changed later.": "The field type. It cannot be changed later.",
+ "Rename Field": "Rename Field",
+ "Rename a custom field.": "Rename a custom field.",
+ "Field ID": "Field ID",
+ "The custom field ID, from list_fields.": "The custom field ID, from list_fields.",
+ "The new field name.": "The new field name.",
+ "Delete Field": "Delete Field",
+ "Delete a custom field.": "Delete a custom field.",
+ "List Automations": "List Automations",
+ "List the automations in the account.": "List the automations in the account.",
+ "Enabled": "Enabled",
+ "Only return enabled or disabled automations.": "Only return enabled or disabled automations.",
+ "Disabled": "Disabled",
+ "Only return automations whose name contains this text.": "Only return automations whose name contains this text.",
+ "Only return automations that use this group, from list_groups.": "Only return automations that use this group, from list_groups.",
+ "Items to return (1-100, default 10).": "Items to return (1-100, default 10).",
+ "Get Automation": "Get Automation",
+ "Get an automation by ID.": "Get an automation by ID.",
+ "Automation ID": "Automation ID",
+ "The automation ID, from list_automations.": "The automation ID, from list_automations.",
+ "Get Automation Activity": "Get Automation Activity",
+ "List subscriber activity in an automation.": "List subscriber activity in an automation.",
+ "Which activity to return.": "Which activity to return.",
+ "Completed": "Completed",
+ "Canceled": "Canceled",
+ "Failed": "Failed",
+ "Date From": "Date From",
+ "Finished on or after this date (YYYY-MM-DD).": "Finished on or after this date (YYYY-MM-DD).",
+ "Date To": "Date To",
+ "Finished on or before this date (YYYY-MM-DD).": "Finished on or before this date (YYYY-MM-DD).",
+ "Scheduled From": "Scheduled From",
+ "Active runs scheduled on or after this date (YYYY-MM-DD).": "Active runs scheduled on or after this date (YYYY-MM-DD).",
+ "Scheduled To": "Scheduled To",
+ "Active runs scheduled on or before this date (YYYY-MM-DD).": "Active runs scheduled on or before this date (YYYY-MM-DD).",
+ "Subscriber Email": "Subscriber Email",
+ "Only return activity for subscribers whose email matches this text.": "Only return activity for subscribers whose email matches this text.",
+ "Create Automation Draft": "Create Automation Draft",
+ "Create an empty, disabled automation draft.": "Create an empty, disabled automation draft.",
+ "The automation name.": "The automation name.",
+ "Delete Automation": "Delete Automation",
+ "Delete an automation.": "Delete an automation.",
+ "List Campaigns": "List Campaigns",
+ "List campaigns, optionally filtered by status and type.": "List campaigns, optionally filtered by status and type.",
+ "Only return campaigns with this status. MailerLite defaults to ready.": "Only return campaigns with this status. MailerLite defaults to ready.",
+ "Draft": "Draft",
+ "Ready": "Ready",
+ "Sent": "Sent",
+ "Only return campaigns of this type.": "Only return campaigns of this type.",
+ "Regular": "Regular",
+ "A/B split": "A/B split",
+ "Resend": "Resend",
+ "RSS": "RSS",
+ "Items to return (1-100, default 25).": "Items to return (1-100, default 25).",
+ "Get Campaign": "Get Campaign",
+ "Get a campaign by ID.": "Get a campaign by ID.",
+ "Campaign ID": "Campaign ID",
+ "The campaign ID, from list_campaigns.": "The campaign ID, from list_campaigns.",
+ "Create Campaign Draft": "Create Campaign Draft",
+ "Create a regular email campaign as a draft. It is never sent.": "Create a regular email campaign as a draft. It is never sent.",
+ "Campaign Name": "Campaign Name",
+ "Internal campaign name.": "Internal campaign name.",
+ "Subject": "Subject",
+ "Email subject line.": "Email subject line.",
+ "From Name": "From Name",
+ "Sender name shown to recipients.": "Sender name shown to recipients.",
+ "From Email": "From Email",
+ "Sender email. Must be a verified sender on the MailerLite account.": "Sender email. Must be a verified sender on the MailerLite account.",
+ "Reply-To Email": "Reply-To Email",
+ "Reply-to email address.": "Reply-to email address.",
+ "Groups to send to, from list_groups.": "Groups to send to, from list_groups.",
+ "Segment IDs": "Segment IDs",
+ "Segments to send to, from list_segments.": "Segments to send to, from list_segments.",
+ "Language ID": "Language ID",
+ "Campaign language ID, from list_campaign_languages.": "Campaign language ID, from list_campaign_languages.",
+ "HTML Content": "HTML Content",
+ "Email HTML. Advanced plan only; omit on other plans.": "Email HTML. Advanced plan only; omit on other plans.",
+ "Update Campaign Draft": "Update Campaign Draft",
+ "Update a draft campaign, keeping the values you do not change.": "Update a draft campaign, keeping the values you do not change.",
+ "The draft campaign ID, from list_campaigns.": "The draft campaign ID, from list_campaigns.",
+ "New internal campaign name.": "New internal campaign name.",
+ "New email subject line.": "New email subject line.",
+ "New sender name.": "New sender name.",
+ "New sender email. Must be a verified sender on the MailerLite account.": "New sender email. Must be a verified sender on the MailerLite account.",
+ "New reply-to email address.": "New reply-to email address.",
+ "Replaces the audience with these groups, from list_groups. Not with Segment IDs.": "Replaces the audience with these groups, from list_groups. Not with Segment IDs.",
+ "Replaces the audience with these segments, from list_segments. Not with Group IDs.": "Replaces the audience with these segments, from list_segments. Not with Group IDs.",
+ "Delete Campaign": "Delete Campaign",
+ "Delete a campaign.": "Delete a campaign.",
+ "List Campaign Languages": "List Campaign Languages",
+ "List the languages available for campaigns.": "List the languages available for campaigns.",
+ "List Forms": "List Forms",
+ "List signup forms of one type.": "List signup forms of one type.",
+ "Form Type": "Form Type",
+ "The type of forms to list.": "The type of forms to list.",
+ "Popup": "Popup",
+ "Embedded": "Embedded",
+ "Promotion": "Promotion",
+ "Only return forms whose name contains this text.": "Only return forms whose name contains this text.",
+ "Get Form": "Get Form",
+ "Get a form by ID.": "Get a form by ID.",
+ "Form ID": "Form ID",
+ "The form ID, from list_forms.": "The form ID, from list_forms.",
+ "List Form Subscribers": "List Form Subscribers",
+ "List the subscribers who signed up through a form.": "List the subscribers who signed up through a form.",
+ "List Webhooks": "List Webhooks",
+ "List the webhooks in the account.": "List the webhooks in the account.",
+ "Get Webhook": "Get Webhook",
+ "Get a webhook by ID.": "Get a webhook by ID.",
+ "Webhook ID": "Webhook ID",
+ "The webhook ID, from list_webhooks.": "The webhook ID, from list_webhooks.",
+ "Create Webhook": "Create Webhook",
+ "Create a webhook that posts MailerLite events to a URL.": "Create a webhook that posts MailerLite events to a URL.",
+ "URL": "URL",
+ "The HTTPS URL MailerLite will POST events to.": "The HTTPS URL MailerLite will POST events to.",
+ "Events": "Events",
+ "The events that trigger the webhook.": "The events that trigger the webhook.",
+ "A name for the webhook.": "A name for the webhook.",
+ "Whether the webhook is active. MailerLite defaults to enabled.": "Whether the webhook is active. MailerLite defaults to enabled.",
+ "Batchable": "Batchable",
+ "Whether events are delivered in batches.": "Whether events are delivered in batches.",
+ "Update Webhook": "Update Webhook",
+ "Update a webhook, changing only the values you supply.": "Update a webhook, changing only the values you supply.",
+ "New webhook name.": "New webhook name.",
+ "New HTTPS URL MailerLite will POST events to.": "New HTTPS URL MailerLite will POST events to.",
+ "Replaces the events that trigger the webhook.": "Replaces the events that trigger the webhook.",
+ "Whether the webhook is active.": "Whether the webhook is active.",
+ "Delete Webhook": "Delete Webhook",
+ "Delete a webhook.": "Delete a webhook.",
+ "List Timezones": "List Timezones",
+ "List the timezones MailerLite supports.": "List the timezones MailerLite supports.",
+ "Subscribers to return (1-1000, default 25).": "Subscribers to return (1-1000, default 25).",
+ "Group": "Group",
+ "Delete a subscriber. MailerLite keeps their data in case they re-subscribe.": "Delete a subscriber. MailerLite keeps their data in case they re-subscribe.",
+ "Yes": "Yes",
+ "No": "No",
+ "subscriber.created": "subscriber.created",
+ "subscriber.updated": "subscriber.updated",
+ "subscriber.unsubscribed": "subscriber.unsubscribed",
+ "subscriber.added_to_group": "subscriber.added_to_group",
+ "subscriber.removed_from_group": "subscriber.removed_from_group",
+ "subscriber.bounced": "subscriber.bounced",
+ "subscriber.automation_triggered": "subscriber.automation_triggered",
+ "subscriber.automation_completed": "subscriber.automation_completed",
+ "subscriber.spam_reported": "subscriber.spam_reported",
+ "subscriber.deleted": "subscriber.deleted",
+ "subscriber.active": "subscriber.active",
+ "campaign.sent": "campaign.sent",
+ "campaign.click": "campaign.click",
+ "campaign.open": "campaign.open",
+ "List groups in the account, one page at a time.": "List groups in the account, one page at a time.",
+ "Groups to return per page (1-1000, default 100).": "Groups to return per page (1-1000, default 100).",
+ "Page number to return, starting at 1. Use `meta.last_page` from a previous response to know when to stop.": "Page number to return, starting at 1. Use `meta.last_page` from a previous response to know when to stop."
+}
diff --git a/packages/pieces/community/mailer-lite/src/index.ts b/packages/pieces/community/mailer-lite/src/index.ts
index fe44639cc02..f416ac6054e 100644
--- a/packages/pieces/community/mailer-lite/src/index.ts
+++ b/packages/pieces/community/mailer-lite/src/index.ts
@@ -12,6 +12,43 @@ import { listGroupSubscribersAction } from './lib/actions/list-group-subscribers
import { listGroupsAction } from './lib/actions/list-groups';
import { listSubscribersAction } from './lib/actions/list-subscribers';
import { unsubscribeSubscriberAction } from './lib/actions/unsubscribe-subscriber';
+import { updateSubscriberAction } from './lib/actions/update-subscriber';
+import { forgetSubscriberAction } from './lib/actions/forget-subscriber';
+import { getSubscriberActivityAction } from './lib/actions/get-subscriber-activity';
+import { countSubscribersAction } from './lib/actions/count-subscribers';
+import { importSubscribersToGroupAction } from './lib/actions/import-subscribers-to-group';
+import { getImportStatusAction } from './lib/actions/get-import-status';
+import { findGroupsByNameAction } from './lib/actions/find-groups-by-name';
+import { renameGroupAction } from './lib/actions/rename-group';
+import { deleteGroupAction } from './lib/actions/delete-group';
+import { listSegmentsAction } from './lib/actions/list-segments';
+import { listSegmentSubscribersAction } from './lib/actions/list-segment-subscribers';
+import { renameSegmentAction } from './lib/actions/rename-segment';
+import { deleteSegmentAction } from './lib/actions/delete-segment';
+import { listFieldsAction } from './lib/actions/list-fields';
+import { createFieldAction } from './lib/actions/create-field';
+import { renameFieldAction } from './lib/actions/rename-field';
+import { deleteFieldAction } from './lib/actions/delete-field';
+import { listAutomationsAction } from './lib/actions/list-automations';
+import { getAutomationAction } from './lib/actions/get-automation';
+import { getAutomationActivityAction } from './lib/actions/get-automation-activity';
+import { createAutomationAction } from './lib/actions/create-automation';
+import { deleteAutomationAction } from './lib/actions/delete-automation';
+import { listCampaignsAction } from './lib/actions/list-campaigns';
+import { getCampaignAction } from './lib/actions/get-campaign';
+import { createCampaignDraftAction } from './lib/actions/create-campaign-draft';
+import { updateCampaignDraftAction } from './lib/actions/update-campaign-draft';
+import { deleteCampaignAction } from './lib/actions/delete-campaign';
+import { listCampaignLanguagesAction } from './lib/actions/list-campaign-languages';
+import { listFormsAction } from './lib/actions/list-forms';
+import { getFormAction } from './lib/actions/get-form';
+import { listFormSubscribersAction } from './lib/actions/list-form-subscribers';
+import { listWebhooksAction } from './lib/actions/list-webhooks';
+import { getWebhookAction } from './lib/actions/get-webhook';
+import { createWebhookAction } from './lib/actions/create-webhook';
+import { updateWebhookAction } from './lib/actions/update-webhook';
+import { deleteWebhookAction } from './lib/actions/delete-webhook';
+import { listTimezonesAction } from './lib/actions/list-timezones';
import { mailerLiteAuth } from './lib/auth';
export { mailerLiteAuth };
@@ -20,7 +57,7 @@ export const mailerLite = createPiece({
displayName: 'MailerLite',
description: 'Email marketing software',
- minimumSupportedRelease: '0.30.0',
+ minimumSupportedRelease: '0.88.2',
logoUrl: 'https://cdn.activepieces.com/pieces/mailer-lite.png',
categories: [PieceCategory.MARKETING],
authors: ["Willianwg","kanarelo","kishanprmr","khaledmashaly","abuaboud"],
@@ -36,6 +73,43 @@ export const mailerLite = createPiece({
listGroupsAction,
createGroupAction,
listGroupSubscribersAction,
+ updateSubscriberAction,
+ forgetSubscriberAction,
+ getSubscriberActivityAction,
+ countSubscribersAction,
+ importSubscribersToGroupAction,
+ getImportStatusAction,
+ findGroupsByNameAction,
+ renameGroupAction,
+ deleteGroupAction,
+ listSegmentsAction,
+ listSegmentSubscribersAction,
+ renameSegmentAction,
+ deleteSegmentAction,
+ listFieldsAction,
+ createFieldAction,
+ renameFieldAction,
+ deleteFieldAction,
+ listAutomationsAction,
+ getAutomationAction,
+ getAutomationActivityAction,
+ createAutomationAction,
+ deleteAutomationAction,
+ listCampaignsAction,
+ getCampaignAction,
+ createCampaignDraftAction,
+ updateCampaignDraftAction,
+ deleteCampaignAction,
+ listCampaignLanguagesAction,
+ listFormsAction,
+ getFormAction,
+ listFormSubscribersAction,
+ listWebhooksAction,
+ getWebhookAction,
+ createWebhookAction,
+ updateWebhookAction,
+ deleteWebhookAction,
+ listTimezonesAction,
createCustomApiCallAction({
baseUrl: () => 'https://connect.mailerlite.com/',
auth: mailerLiteAuth,
diff --git a/packages/pieces/community/mailer-lite/src/lib/actions/count-subscribers.ts b/packages/pieces/community/mailer-lite/src/lib/actions/count-subscribers.ts
new file mode 100644
index 00000000000..c631117062d
--- /dev/null
+++ b/packages/pieces/community/mailer-lite/src/lib/actions/count-subscribers.ts
@@ -0,0 +1,39 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction } from '@activepieces/pieces-framework';
+import { mailerLiteAuth } from '../auth';
+import { mailerLiteApi } from '../common/client';
+import { countSubscribersOutputSchema } from '../output-schemas';
+
+export const countSubscribersAction = createAction({
+ auth: mailerLiteAuth,
+ name: 'count_subscribers',
+ classification: 'READ',
+ displayName: 'Count Subscribers',
+ description: 'Get the total number of subscribers in the account.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Get the total number of subscribers in the MailerLite account without listing them. Read-only and idempotent.',
+ idempotent: true,
+ },
+ outputSchema: countSubscribersOutputSchema,
+ props: {},
+ async run(context) {
+ const body = await mailerLiteApi.request<unknown>({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.GET,
+ path: '/subscribers',
+ queryParams: { limit: 0 },
+ });
+ if (!mailerLiteApi.isRecord(body)) {
+ throw new Error('MailerLite returned an unexpected response for the subscriber count.');
+ }
+ const meta = body['meta'];
+ const rawTotal = body['total'] ?? (mailerLiteApi.isRecord(meta) ? meta['total'] : undefined);
+ const total = Number(rawTotal);
+ if (rawTotal === undefined || rawTotal === null || !Number.isFinite(total)) {
+ throw new Error('MailerLite did not return a subscriber total.');
+ }
+ return { total };
+ },
+});
diff --git a/packages/pieces/community/mailer-lite/src/lib/actions/create-automation.ts b/packages/pieces/community/mailer-lite/src/lib/actions/create-automation.ts
new file mode 100644
index 00000000000..d0b8090ee71
--- /dev/null
+++ b/packages/pieces/community/mailer-lite/src/lib/actions/create-automation.ts
@@ -0,0 +1,40 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { Property, createAction } from '@activepieces/pieces-framework';
+import { mailerLiteAuth } from '../auth';
+import { mailerLiteApi } from '../common/client';
+import { createAutomationOutputSchema } from '../output-schemas';
+
+export const createAutomationAction = createAction({
+ auth: mailerLiteAuth,
+ name: 'create_automation',
+ classification: 'WRITE',
+ displayName: 'Create Automation Draft',
+ description: 'Create an empty, disabled automation draft.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Create an empty MailerLite automation draft with only a name. It is disabled and has no trigger or steps; those are configured in the MailerLite dashboard. Nothing is sent. Not idempotent: each call creates another draft.',
+ idempotent: false,
+ },
+ outputSchema: createAutomationOutputSchema,
+ props: {
+ name: Property.ShortText({
+ displayName: 'Name',
+ description: 'The automation name.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const name = context.propsValue.name.trim();
+ if (!name) {
+ throw new Error('Name is required.');
+ }
+ const body = await mailerLiteApi.request<unknown>({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.POST,
+ path: '/automations',
+ body: { name },
+ });
+ return mailerLiteApi.unwrapData(body);
+ },
+});
diff --git a/packages/pieces/community/mailer-lite/src/lib/actions/create-campaign-draft.ts b/packages/pieces/community/mailer-lite/src/lib/actions/create-campaign-draft.ts
new file mode 100644
index 00000000000..90cadb834ce
--- /dev/null
+++ b/packages/pieces/community/mailer-lite/src/lib/actions/create-campaign-draft.ts
@@ -0,0 +1,103 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { Property, createAction } from '@activepieces/pieces-framework';
+import { mailerLiteAuth } from '../auth';
+import { mailerLiteApi } from '../common/client';
+import { campaignWriteOutputSchema } from '../output-schemas';
+
+function toIdList(value: unknown): string[] {
+ if (!Array.isArray(value)) {
+ return [];
+ }
+ return value.map((item) => String(item).trim()).filter((item) => item.length > 0);
+}
+
+export const createCampaignDraftAction = createAction({
+ auth: mailerLiteAuth,
+ name: 'create_campaign_draft',
+ classification: 'WRITE',
+ displayName: 'Create Campaign Draft',
+ description: 'Create a regular email campaign as a draft. It is never sent.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Create a regular MailerLite email campaign as a draft only; it is never sent or scheduled, sending is done in the MailerLite dashboard. from must be a verified sender email on the account. Target it with group_ids (from list_groups) and/or segment_ids (from list_segments); with neither, the draft has no audience yet. language_id comes from list_campaign_languages. content (HTML) works on the Advanced plan only; omit it on other plans. Not idempotent: each call creates another draft.',
+ idempotent: false,
+ },
+ outputSchema: campaignWriteOutputSchema,
+ props: {
+ name: Property.ShortText({
+ displayName: 'Campaign Name',
+ description: 'Internal campaign name.',
+ required: true,
+ }),
+ subject: Property.ShortText({
+ displayName: 'Subject',
+ description: 'Email subject line.',
+ required: true,
+ }),
+ from_name: Property.ShortText({
+ displayName: 'From Name',
+ description: 'Sender name shown to recipients.',
+ required: true,
+ }),
+ from: Property.ShortText({
+ displayName: 'From Email',
+ description: 'Sender email. Must be a verified sender on the MailerLite account.',
+ required: true,
+ }),
+ reply_to: Property.ShortText({
+ displayName: 'Reply-To Email',
+ description: 'Reply-to email address.',
+ required: false,
+ }),
+ group_ids: Property.Array({
+ displayName: 'Group IDs',
+ description: 'Groups to send to, from list_groups.',
+ required: false,
+ }),
+ segment_ids: Property.Array({
+ displayName: 'Segment IDs',
+ description: 'Segments to send to, from list_segments.',
+ required: false,
+ }),
+ language_id: Property.ShortText({
+ displayName: 'Language ID',
+ description: 'Campaign language ID, from list_campaign_languages.',
+ required: false,
+ }),
+ content: Property.LongText({
+ displayName: 'HTML Content',
+ description: 'Email HTML. Advanced plan only; omit on other plans.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const { name, subject, from_name, from, reply_to, language_id, content } = context.propsValue;
+ const email: Record<string, string> = { subject, from_name, from };
+ if (reply_to) {
+ email['reply_to'] = reply_to;
+ }
+ if (content) {
+ email['content'] = content;
+ }
+ const body: Record<string, unknown> = { name, type: 'regular', emails: [email] };
+ const groups = toIdList(context.propsValue.group_ids);
+ const segments = toIdList(context.propsValue.segment_ids);
+ if (groups.length > 0) {
+ body['groups'] = groups;
+ }
+ if (segments.length > 0) {
+ body['segments'] = segments;
+ }
+ if (language_id) {
+ body['language_id'] = language_id;
+ }
+ const response = await mailerLiteApi.request<unknown>({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.POST,
+ path: '/campaigns',
+ body,
+ });
+ return mailerLiteApi.unwrapData(response);
+ },
+});
diff --git a/packages/pieces/community/mailer-lite/src/lib/actions/create-field.ts b/packages/pieces/community/mailer-lite/src/lib/actions/create-field.ts
new file mode 100644
index 00000000000..68b3677401d
--- /dev/null
+++ b/packages/pieces/community/mailer-lite/src/lib/actions/create-field.ts
@@ -0,0 +1,52 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { Property, createAction } from '@activepieces/pieces-framework';
+import { mailerLiteAuth } from '../auth';
+import { mailerLiteApi } from '../common/client';
+import { fieldOutputSchema } from '../output-schemas';
+
+export const createFieldAction = createAction({
+ auth: mailerLiteAuth,
+ name: 'create_field',
+ classification: 'WRITE',
+ displayName: 'Create Field',
+ description: 'Create a custom subscriber field.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Create a MailerLite custom subscriber field with a name and type (text, number or date). The type cannot be changed later. Returns the field with its key, which is what goes into a subscriber\'s fields object. Check list_fields first: not idempotent, and a duplicate name returns a validation error.',
+ idempotent: false,
+ },
+ outputSchema: fieldOutputSchema,
+ props: {
+ name: Property.ShortText({
+ displayName: 'Name',
+ description: 'The field name.',
+ required: true,
+ }),
+ type: Property.StaticDropdown({
+ displayName: 'Type',
+ description: 'The field type. It cannot be changed later.',
+ required: true,
+ options: {
+ options: [
+ { label: 'Text', value: 'text' },
+ { label: 'Number', value: 'number' },
+ { label: 'Date', value: 'date' },
+ ],
+ },
+ }),
+ },
+ async run(context) {
+ const name = context.propsValue.name.trim();
+ if (!name) {
+ throw new Error('Name is required.');
+ }
+ const body = await mailerLiteApi.request<unknown>({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.POST,
+ path: '/fields',
+ body: { name, type: context.propsValue.type },
+ });
+ return mailerLiteApi.unwrapData(body);
+ },
+});
diff --git a/packages/pieces/community/mailer-lite/src/lib/actions/create-webhook.ts b/packages/pieces/community/mailer-lite/src/lib/actions/create-webhook.ts
new file mode 100644
index 00000000000..106d4fac1be
--- /dev/null
+++ b/packages/pieces/community/mailer-lite/src/lib/actions/create-webhook.ts
@@ -0,0 +1,76 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { Property, createAction } from '@activepieces/pieces-framework';
+import { mailerLiteAuth } from '../auth';
+import { mailerLiteApi } from '../common/client';
+import { webhookOutputSchema } from '../output-schemas';
+
+export const createWebhookAction = createAction({
+ auth: mailerLiteAuth,
+ name: 'create_webhook',
+ classification: 'WRITE',
+ displayName: 'Create Webhook',
+ description: 'Create a webhook that posts MailerLite events to a URL.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Create a MailerLite webhook that POSTs the chosen events (for example subscriber.created) to a URL. The signing secret is never returned. Optionally set enabled and batchable. Not idempotent: each call creates another webhook, so check list_webhooks first.',
+ idempotent: false,
+ },
+ outputSchema: webhookOutputSchema,
+ props: {
+ url: Property.ShortText({
+ displayName: 'URL',
+ description: 'The HTTPS URL MailerLite will POST events to.',
+ required: true,
+ }),
+ events: Property.StaticMultiSelectDropdown({
+ displayName: 'Events',
+ description: 'The events that trigger the webhook.',
+ required: true,
+ options: { options: mailerLiteApi.webhookEventOptions() },
+ }),
+ name: Property.ShortText({
+ displayName: 'Name',
+ description: 'A name for the webhook.',
+ required: false,
+ }),
+ enabled: Property.StaticDropdown({
+ displayName: 'Enabled',
+ description: 'Whether the webhook is active. MailerLite defaults to enabled.',
+ required: false,
+ options: { options: mailerLiteApi.booleanOptions() },
+ }),
+ batchable: Property.StaticDropdown({
+ displayName: 'Batchable',
+ description: 'Whether events are delivered in batches.',
+ required: false,
+ options: { options: mailerLiteApi.booleanOptions() },
+ }),
+ },
+ async run(context) {
+ const { url, events, name, enabled, batchable } = context.propsValue;
+ if (!url.trim()) {
+ throw new Error('URL is required.');
+ }
+ if (!events || events.length === 0) {
+ throw new Error('Select at least one event.');
+ }
+ const body: Record<string, unknown> = { url: url.trim(), events };
+ if (name) {
+ body['name'] = name;
+ }
+ if (enabled === 'true' || enabled === 'false') {
+ body['enabled'] = enabled === 'true';
+ }
+ if (batchable === 'true' || batchable === 'false') {
+ body['batchable'] = batchable === 'true';
+ }
+ const response = await mailerLiteApi.request<unknown>({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.POST,
+ path: '/webhooks',
+ body,
+ });
+ return mailerLiteApi.withoutSecret(mailerLiteApi.unwrapData(response));
+ },
+});
diff --git a/packages/pieces/community/mailer-lite/src/lib/actions/delete-automation.ts b/packages/pieces/community/mailer-lite/src/lib/actions/delete-automation.ts
new file mode 100644
index 00000000000..8f9a07380e2
--- /dev/null
+++ b/packages/pieces/community/mailer-lite/src/lib/actions/delete-automation.ts
@@ -0,0 +1,37 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { Property, createAction } from '@activepieces/pieces-framework';
+import { mailerLiteAuth } from '../auth';
+import { mailerLiteApi } from '../common/client';
+import { deleteAutomationOutputSchema } from '../output-schemas';
+
+export const deleteAutomationAction = createAction({
+ auth: mailerLiteAuth,
+ name: 'delete_automation',
+ classification: 'DESTRUCTIVE',
+ displayName: 'Delete Automation',
+ description: 'Delete an automation.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Permanently delete a MailerLite automation by ID, including its steps; subscribers currently in it stop receiving its emails. Cannot be undone. Get the ID from list_automations. Not idempotent: a repeat call returns a 404 error.',
+ idempotent: false,
+ },
+ outputSchema: deleteAutomationOutputSchema,
+ props: {
+ automation_id: Property.ShortText({
+ displayName: 'Automation ID',
+ description: 'The automation ID, from list_automations.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const id = mailerLiteApi.requireId({ value: context.propsValue.automation_id, label: 'Automation ID' });
+ await mailerLiteApi.request<unknown>({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.DELETE,
+ path: `/automations/${id}`,
+ resource: `automation ${id}`,
+ });
+ return { deleted: true, automation_id: context.propsValue.automation_id.trim() };
+ },
+});
diff --git a/packages/pieces/community/mailer-lite/src/lib/actions/delete-campaign.ts b/packages/pieces/community/mailer-lite/src/lib/actions/delete-campaign.ts
new file mode 100644
index 00000000000..a0a3b7e39e7
--- /dev/null
+++ b/packages/pieces/community/mailer-lite/src/lib/actions/delete-campaign.ts
@@ -0,0 +1,37 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { Property, createAction } from '@activepieces/pieces-framework';
+import { mailerLiteAuth } from '../auth';
+import { mailerLiteApi } from '../common/client';
+import { deleteCampaignOutputSchema } from '../output-schemas';
+
+export const deleteCampaignAction = createAction({
+ auth: mailerLiteAuth,
+ name: 'delete_campaign',
+ classification: 'DESTRUCTIVE',
+ displayName: 'Delete Campaign',
+ description: 'Delete a campaign.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Permanently delete a MailerLite campaign by ID, including its content and, for sent campaigns, its reports. Cannot be undone. Get the ID from list_campaigns. Not idempotent: a repeat call returns a 404 error.',
+ idempotent: false,
+ },
+ outputSchema: deleteCampaignOutputSchema,
+ props: {
+ campaign_id: Property.ShortText({
+ displayName: 'Campaign ID',
+ description: 'The campaign ID, from list_campaigns.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const id = mailerLiteApi.requireId({ value: context.propsValue.campaign_id, label: 'Campaign ID' });
+ await mailerLiteApi.request<unknown>({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.DELETE,
+ path: `/campaigns/${id}`,
+ resource: `campaign ${id}`,
+ });
+ return { deleted: true, campaign_id: context.propsValue.campaign_id.trim() };
+ },
+});
diff --git a/packages/pieces/community/mailer-lite/src/lib/actions/delete-field.ts b/packages/pieces/community/mailer-lite/src/lib/actions/delete-field.ts
new file mode 100644
index 00000000000..6098f4dfe54
--- /dev/null
+++ b/packages/pieces/community/mailer-lite/src/lib/actions/delete-field.ts
@@ -0,0 +1,37 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { Property, createAction } from '@activepieces/pieces-framework';
+import { mailerLiteAuth } from '../auth';
+import { mailerLiteApi } from '../common/client';
+import { deleteFieldOutputSchema } from '../output-schemas';
+
+export const deleteFieldAction = createAction({
+ auth: mailerLiteAuth,
+ name: 'delete_field',
+ classification: 'DESTRUCTIVE',
+ displayName: 'Delete Field',
+ description: 'Delete a custom field.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Permanently delete a MailerLite custom field by ID. This also removes that field\'s value from every subscriber. Cannot be undone. Get the ID from list_fields. Not idempotent: a repeat call returns a 404 error.',
+ idempotent: false,
+ },
+ outputSchema: deleteFieldOutputSchema,
+ props: {
+ field_id: Property.ShortText({
+ displayName: 'Field ID',
+ description: 'The custom field ID, from list_fields.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const id = mailerLiteApi.requireId({ value: context.propsValue.field_id, label: 'Field ID' });
+ await mailerLiteApi.request<unknown>({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.DELETE,
+ path: `/fields/${id}`,
+ resource: `field ${id}`,
+ });
+ return { deleted: true, field_id: context.propsValue.field_id.trim() };
+ },
+});
diff --git a/packages/pieces/community/mailer-lite/src/lib/actions/delete-group.ts b/packages/pieces/community/mailer-lite/src/lib/actions/delete-group.ts
new file mode 100644
index 00000000000..966f1fca7f4
--- /dev/null
+++ b/packages/pieces/community/mailer-lite/src/lib/actions/delete-group.ts
@@ -0,0 +1,37 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { Property, createAction } from '@activepieces/pieces-framework';
+import { mailerLiteAuth } from '../auth';
+import { mailerLiteApi } from '../common/client';
+import { deleteGroupOutputSchema } from '../output-schemas';
+
+export const deleteGroupAction = createAction({
+ auth: mailerLiteAuth,
+ name: 'delete_group',
+ classification: 'DESTRUCTIVE',
+ displayName: 'Delete Group',
+ description: 'Delete a subscriber group.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Permanently delete a MailerLite group by ID. The group membership is removed but the subscribers themselves are kept. Cannot be undone. Get the ID from list_groups or find_groups_by_name. Not idempotent: deleting an already-deleted group returns a 404 error.',
+ idempotent: false,
+ },
+ outputSchema: deleteGroupOutputSchema,
+ props: {
+ group_id: Property.ShortText({
+ displayName: 'Group ID',
+ description: 'The group ID, from list_groups or find_groups_by_name.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const id = mailerLiteApi.requireId({ value: context.propsValue.group_id, label: 'Group ID' });
+ await mailerLiteApi.request<unknown>({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.DELETE,
+ path: `/groups/${id}`,
+ resource: `group ${id}`,
+ });
+ return { deleted: true, group_id: context.propsValue.group_id.trim() };
+ },
+});
diff --git a/packages/pieces/community/mailer-lite/src/lib/actions/delete-segment.ts b/packages/pieces/community/mailer-lite/src/lib/actions/delete-segment.ts
new file mode 100644
index 00000000000..3370838f5d2
--- /dev/null
+++ b/packages/pieces/community/mailer-lite/src/lib/actions/delete-segment.ts
@@ -0,0 +1,37 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { Property, createAction } from '@activepieces/pieces-framework';
+import { mailerLiteAuth } from '../auth';
+import { mailerLiteApi } from '../common/client';
+import { deleteSegmentOutputSchema } from '../output-schemas';
+
+export const deleteSegmentAction = createAction({
+ auth: mailerLiteAuth,
+ name: 'delete_segment',
+ classification: 'DESTRUCTIVE',
+ displayName: 'Delete Segment',
+ description: 'Delete a segment.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Permanently delete a MailerLite segment by ID. Only the segment definition is removed; the subscribers it matched are kept. Cannot be undone, and segments cannot be recreated through the API. Get the ID from list_segments. Not idempotent: a repeat call returns a 404 error.',
+ idempotent: false,
+ },
+ outputSchema: deleteSegmentOutputSchema,
+ props: {
+ segment_id: Property.ShortText({
+ displayName: 'Segment ID',
+ description: 'The segment ID, from list_segments.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const id = mailerLiteApi.requireId({ value: context.propsValue.segment_id, label: 'Segment ID' });
+ await mailerLiteApi.request<unknown>({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.DELETE,
+ path: `/segments/${id}`,
+ resource: `segment ${id}`,
+ });
+ return { deleted: true, segment_id: context.propsValue.segment_id.trim() };
+ },
+});
diff --git a/packages/pieces/community/mailer-lite/src/lib/actions/delete-subscriber.ts b/packages/pieces/community/mailer-lite/src/lib/actions/delete-subscriber.ts
index f61f689f63c..a176b435a58 100644
--- a/packages/pieces/community/mailer-lite/src/lib/actions/delete-subscriber.ts
+++ b/packages/pieces/community/mailer-lite/src/lib/actions/delete-subscriber.ts
@@ -2,19 +2,20 @@ import MailerLite from '@mailerlite/mailerlite-nodejs';
import { createAction } from '@activepieces/pieces-framework';
import { mailerLiteAuth } from '../auth';
import { mailerLiteCommon } from '../common';
+import { mailerLiteApi } from '../common/client';
import { deleteSubscriberOutputSchema } from '../output-schemas';
export const deleteSubscriberAction = createAction({
auth: mailerLiteAuth,
name: 'delete_subscriber',
- classification: 'WRITE',
+ classification: 'DESTRUCTIVE',
displayName: 'Delete Subscriber',
- description: 'Permanently delete a subscriber.',
+ description: 'Delete a subscriber. MailerLite keeps their data in case they re-subscribe.',
audience: 'both',
aiMetadata: {
description:
- 'Permanently delete a MailerLite subscriber by ID, removing the record and its history. This cannot be undone; prefer Unsubscribe Subscriber for ordinary opt-outs. Returns no content. Idempotent in effect: deleting an already-deleted subscriber leaves the account in the same state.',
- idempotent: true,
+ 'Delete a MailerLite subscriber by ID. MailerLite keeps their data in case they re-subscribe; use forget_subscriber to permanently erase it (GDPR), or unsubscribe_subscriber for an ordinary opt-out. Not idempotent: a repeat call on a deleted subscriber returns a 404 error.',
+ idempotent: false,
},
outputSchema: deleteSubscriberOutputSchema,
props: {
@@ -22,7 +23,9 @@ export const deleteSubscriberAction = createAction({
},
async run(context) {
const client = new MailerLite({ api_key: context.auth.secret_text });
- await client.subscribers.delete(context.propsValue.subscriberId!);
+ await client.subscribers.delete(context.propsValue.subscriberId!).catch((error: unknown) => {
+ throw mailerLiteApi.readableSdkError({ error, resource: `subscriber ${context.propsValue.subscriberId}` });
+ });
return { deleted: true, subscriberId: context.propsValue.subscriberId };
},
});
diff --git a/packages/pieces/community/mailer-lite/src/lib/actions/delete-webhook.ts b/packages/pieces/community/mailer-lite/src/lib/actions/delete-webhook.ts
new file mode 100644
index 00000000000..3dc682c8526
--- /dev/null
+++ b/packages/pieces/community/mailer-lite/src/lib/actions/delete-webhook.ts
@@ -0,0 +1,37 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { Property, createAction } from '@activepieces/pieces-framework';
+import { mailerLiteAuth } from '../auth';
+import { mailerLiteApi } from '../common/client';
+import { deleteWebhookOutputSchema } from '../output-schemas';
+
+export const deleteWebhookAction = createAction({
+ auth: mailerLiteAuth,
+ name: 'delete_webhook',
+ classification: 'DESTRUCTIVE',
+ displayName: 'Delete Webhook',
+ description: 'Delete a webhook.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Permanently delete a MailerLite webhook by ID. Warning: webhooks created by Activepieces MailerLite triggers are listed too, and deleting one silently breaks that flow. Get the ID from list_webhooks. Not idempotent: a repeat call returns a 404 error.',
+ idempotent: false,
+ },
+ outputSchema: deleteWebhookOutputSchema,
+ props: {
+ webhook_id: Property.ShortText({
+ displayName: 'Webhook ID',
+ description: 'The webhook ID, from list_webhooks.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const id = mailerLiteApi.requireId({ value: context.propsValue.webhook_id, label: 'Webhook ID' });
+ await mailerLiteApi.request<unknown>({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.DELETE,
+ path: `/webhooks/${id}`,
+ resource: `webhook ${id}`,
+ });
+ return { deleted: true, webhook_id: context.propsValue.webhook_id.trim() };
+ },
+});
diff --git a/packages/pieces/community/mailer-lite/src/lib/actions/find-groups-by-name.ts b/packages/pieces/community/mailer-lite/src/lib/actions/find-groups-by-name.ts
new file mode 100644
index 00000000000..4496b6078a1
--- /dev/null
+++ b/packages/pieces/community/mailer-lite/src/lib/actions/find-groups-by-name.ts
@@ -0,0 +1,71 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { Property, createAction } from '@activepieces/pieces-framework';
+import { mailerLiteAuth } from '../auth';
+import { mailerLiteApi } from '../common/client';
+import { findGroupsByNameOutputSchema } from '../output-schemas';
+
+export const findGroupsByNameAction = createAction({
+ auth: mailerLiteAuth,
+ name: 'find_groups_by_name',
+ classification: 'SEARCH',
+ displayName: 'Find Groups by Name',
+ description: 'Find subscriber groups whose name contains a text.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Search MailerLite groups by name (partial, case-insensitive match) and return the matching groups with their IDs and subscriber counts. Use it to resolve a group name to the group ID other actions need. Page-paginated: use meta.last_page and pass page to get more. Read-only.',
+ idempotent: true,
+ },
+ outputSchema: findGroupsByNameOutputSchema,
+ props: {
+ name: Property.ShortText({
+ displayName: 'Name Contains',
+ description: 'Text the group name must contain.',
+ required: true,
+ }),
+ sort: Property.StaticDropdown({
+ displayName: 'Sort',
+ description: 'Sort order; a minus prefix means descending.',
+ required: false,
+ options: {
+ options: [
+ { label: 'Name', value: 'name' },
+ { label: 'Name (desc)', value: '-name' },
+ { label: 'Total', value: 'total' },
+ { label: 'Total (desc)', value: '-total' },
+ { label: 'Open rate', value: 'open_rate' },
+ { label: 'Open rate (desc)', value: '-open_rate' },
+ { label: 'Click rate', value: 'click_rate' },
+ { label: 'Click rate (desc)', value: '-click_rate' },
+ { label: 'Created at', value: 'created_at' },
+ { label: 'Created at (desc)', value: '-created_at' },
+ ],
+ },
+ }),
+ limit: Property.Number({
+ displayName: 'Limit',
+ description: 'Items to return (1-1000, default 25).',
+ required: false,
+ defaultValue: 25,
+ }),
+ page: Property.Number({
+ displayName: 'Page',
+ description: 'Page number to return, starting at 1.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const body = await mailerLiteApi.request<unknown>({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.GET,
+ path: '/groups',
+ queryParams: {
+ 'filter[name]': context.propsValue.name,
+ 'sort': context.propsValue.sort,
+ limit: mailerLiteApi.resolveLimit({ value: context.propsValue.limit, fallback: 25, max: 1000 }),
+ page: mailerLiteApi.resolvePage(context.propsValue.page),
+ },
+ });
+ return body;
+ },
+});
diff --git a/packages/pieces/community/mailer-lite/src/lib/actions/forget-subscriber.ts b/packages/pieces/community/mailer-lite/src/lib/actions/forget-subscriber.ts
new file mode 100644
index 00000000000..58feba3322e
--- /dev/null
+++ b/packages/pieces/community/mailer-lite/src/lib/actions/forget-subscriber.ts
@@ -0,0 +1,37 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { Property, createAction } from '@activepieces/pieces-framework';
+import { mailerLiteAuth } from '../auth';
+import { mailerLiteApi } from '../common/client';
+import { forgetSubscriberOutputSchema } from '../output-schemas';
+
+export const forgetSubscriberAction = createAction({
+ auth: mailerLiteAuth,
+ name: 'forget_subscriber',
+ classification: 'DESTRUCTIVE',
+ displayName: 'Forget Subscriber (GDPR)',
+ description: 'Remove a subscriber and permanently erase their data (GDPR).',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Remove a MailerLite subscriber and permanently erase all of their data within 30 days (GDPR right to be forgotten). This cannot be undone. Lighter options: delete_subscriber removes the subscriber but keeps their data in case they re-subscribe, and unsubscribe_subscriber only opts them out. Get the ID from find_subscriber. Returns the subscriber with forget_at set. Not idempotent: a repeat call on a forgotten subscriber returns an error.',
+ idempotent: false,
+ },
+ outputSchema: forgetSubscriberOutputSchema,
+ props: {
+ subscriber_id: Property.ShortText({
+ displayName: 'Subscriber ID',
+ description: 'The subscriber ID, from find_subscriber or list_subscribers.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const id = mailerLiteApi.requireId({ value: context.propsValue.subscriber_id, label: 'Subscriber ID' });
+ const body = await mailerLiteApi.request<unknown>({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.POST,
+ path: `/subscribers/${id}/forget`,
+ resource: `subscriber ${id}`,
+ });
+ return mailerLiteApi.unwrapData(body);
+ },
+});
diff --git a/packages/pieces/community/mailer-lite/src/lib/actions/get-automation-activity.ts b/packages/pieces/community/mailer-lite/src/lib/actions/get-automation-activity.ts
new file mode 100644
index 00000000000..744fb9b9be2
--- /dev/null
+++ b/packages/pieces/community/mailer-lite/src/lib/actions/get-automation-activity.ts
@@ -0,0 +1,96 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { Property, createAction } from '@activepieces/pieces-framework';
+import { mailerLiteAuth } from '../auth';
+import { mailerLiteApi } from '../common/client';
+import { automationActivityOutputSchema } from '../output-schemas';
+
+export const getAutomationActivityAction = createAction({
+ auth: mailerLiteAuth,
+ name: 'get_automation_activity',
+ classification: 'SEARCH',
+ displayName: 'Get Automation Activity',
+ description: 'List subscriber activity in an automation.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'List the subscribers who went through a MailerLite automation, given the automation ID from list_automations. status is required: completed, active, canceled or failed. Date filters use YYYY-MM-DD: date_from/date_to apply to finished runs, scheduled_from/scheduled_to to active runs. Page-paginated. Read-only.',
+ idempotent: true,
+ },
+ outputSchema: automationActivityOutputSchema,
+ props: {
+ automation_id: Property.ShortText({
+ displayName: 'Automation ID',
+ description: 'The automation ID, from list_automations.',
+ required: true,
+ }),
+ status: Property.StaticDropdown({
+ displayName: 'Status',
+ description: 'Which activity to return.',
+ required: true,
+ options: {
+ options: [
+ { label: 'Completed', value: 'completed' },
+ { label: 'Active', value: 'active' },
+ { label: 'Canceled', value: 'canceled' },
+ { label: 'Failed', value: 'failed' },
+ ],
+ },
+ }),
+ date_from: Property.ShortText({
+ displayName: 'Date From',
+ description: 'Finished on or after this date (YYYY-MM-DD).',
+ required: false,
+ }),
+ date_to: Property.ShortText({
+ displayName: 'Date To',
+ description: 'Finished on or before this date (YYYY-MM-DD).',
+ required: false,
+ }),
+ scheduled_from: Property.ShortText({
+ displayName: 'Scheduled From',
+ description: 'Active runs scheduled on or after this date (YYYY-MM-DD).',
+ required: false,
+ }),
+ scheduled_to: Property.ShortText({
+ displayName: 'Scheduled To',
+ description: 'Active runs scheduled on or before this date (YYYY-MM-DD).',
+ required: false,
+ }),
+ search: Property.ShortText({
+ displayName: 'Subscriber Email',
+ description: 'Only return activity for subscribers whose email matches this text.',
+ required: false,
+ }),
+ limit: Property.Number({
+ displayName: 'Limit',
+ description: 'Items to return (1-100, default 10).',
+ required: false,
+ defaultValue: 10,
+ }),
+ page: Property.Number({
+ displayName: 'Page',
+ description: 'Page number to return, starting at 1.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const id = mailerLiteApi.requireId({ value: context.propsValue.automation_id, label: 'Automation ID' });
+ const body = await mailerLiteApi.request<unknown>({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.GET,
+ path: `/automations/${id}/activity`,
+ resource: `automation ${id}`,
+ queryParams: {
+ 'filter[status]': context.propsValue.status,
+ 'filter[date_from]': context.propsValue.date_from,
+ 'filter[date_to]': context.propsValue.date_to,
+ 'filter[scheduled_from]': context.propsValue.scheduled_from,
+ 'filter[scheduled_to]': context.propsValue.scheduled_to,
+ 'filter[search]': context.propsValue.search,
+ limit: mailerLiteApi.resolveLimit({ value: context.propsValue.limit, fallback: 10, max: 100 }),
+ page: mailerLiteApi.resolvePage(context.propsValue.page),
+ },
+ });
+ return body;
+ },
+});
diff --git a/packages/pieces/community/mailer-lite/src/lib/actions/get-automation.ts b/packages/pieces/community/mailer-lite/src/lib/actions/get-automation.ts
new file mode 100644
index 00000000000..f3879187ded
--- /dev/null
+++ b/packages/pieces/community/mailer-lite/src/lib/actions/get-automation.ts
@@ -0,0 +1,37 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { Property, createAction } from '@activepieces/pieces-framework';
+import { mailerLiteAuth } from '../auth';
+import { mailerLiteApi } from '../common/client';
+import { automationOutputSchema } from '../output-schemas';
+
+export const getAutomationAction = createAction({
+ auth: mailerLiteAuth,
+ name: 'get_automation',
+ classification: 'READ',
+ displayName: 'Get Automation',
+ description: 'Get an automation by ID.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Get one MailerLite automation by ID, including its enabled state, trigger configuration, steps and stats. Get the ID from list_automations. Read-only; returns a 404 error if the ID does not exist.',
+ idempotent: true,
+ },
+ outputSchema: automationOutputSchema,
+ props: {
+ automation_id: Property.ShortText({
+ displayName: 'Automation ID',
+ description: 'The automation ID, from list_automations.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const id = mailerLiteApi.requireId({ value: context.propsValue.automation_id, label: 'Automation ID' });
+ const body = await mailerLiteApi.request<unknown>({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.GET,
+ path: `/automations/${id}`,
+ resource: `automation ${id}`,
+ });
+ return mailerLiteApi.unwrapData(body);
+ },
+});
diff --git a/packages/pieces/community/mailer-lite/src/lib/actions/get-campaign.ts b/packages/pieces/community/mailer-lite/src/lib/actions/get-campaign.ts
new file mode 100644
index 00000000000..88482dae630
--- /dev/null
+++ b/packages/pieces/community/mailer-lite/src/lib/actions/get-campaign.ts
@@ -0,0 +1,37 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { Property, createAction } from '@activepieces/pieces-framework';
+import { mailerLiteAuth } from '../auth';
+import { mailerLiteApi } from '../common/client';
+import { campaignOutputSchema } from '../output-schemas';
+
+export const getCampaignAction = createAction({
+ auth: mailerLiteAuth,
+ name: 'get_campaign',
+ classification: 'READ',
+ displayName: 'Get Campaign',
+ description: 'Get a campaign by ID.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Get one MailerLite campaign by ID, including status (draft, ready, sent), audience, emails and stats. Get the ID from list_campaigns. Read-only; returns a 404 error if the ID does not exist.',
+ idempotent: true,
+ },
+ outputSchema: campaignOutputSchema,
+ props: {
+ campaign_id: Property.ShortText({
+ displayName: 'Campaign ID',
+ description: 'The campaign ID, from list_campaigns.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const id = mailerLiteApi.requireId({ value: context.propsValue.campaign_id, label: 'Campaign ID' });
+ const body = await mailerLiteApi.request<unknown>({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.GET,
+ path: `/campaigns/${id}`,
+ resource: `campaign ${id}`,
+ });
+ return mailerLiteApi.unwrapData(body);
+ },
+});
diff --git a/packages/pieces/community/mailer-lite/src/lib/actions/get-form.ts b/packages/pieces/community/mailer-lite/src/lib/actions/get-form.ts
new file mode 100644
index 00000000000..88f89fa44fb
--- /dev/null
+++ b/packages/pieces/community/mailer-lite/src/lib/actions/get-form.ts
@@ -0,0 +1,37 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { Property, createAction } from '@activepieces/pieces-framework';
+import { mailerLiteAuth } from '../auth';
+import { mailerLiteApi } from '../common/client';
+import { formOutputSchema } from '../output-schemas';
+
+export const getFormAction = createAction({
+ auth: mailerLiteAuth,
+ name: 'get_form',
+ classification: 'READ',
+ displayName: 'Get Form',
+ description: 'Get a form by ID.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Get one MailerLite signup form (popup, embedded or promotion) by ID, including conversions and settings. Get the ID from list_forms. Read-only; returns a 404 error if the ID does not exist.',
+ idempotent: true,
+ },
+ outputSchema: formOutputSchema,
+ props: {
+ form_id: Property.ShortText({
+ displayName: 'Form ID',
+ description: 'The form ID, from list_forms.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const id = mailerLiteApi.requireId({ value: context.propsValue.form_id, label: 'Form ID' });
+ const body = await mailerLiteApi.request<unknown>({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.GET,
+ path: `/forms/${id}`,
+ resource: `form ${id}`,
+ });
+ return mailerLiteApi.unwrapData(body);
+ },
+});
diff --git a/packages/pieces/community/mailer-lite/src/lib/actions/get-import-status.ts b/packages/pieces/community/mailer-lite/src/lib/actions/get-import-status.ts
new file mode 100644
index 00000000000..90c0a522894
--- /dev/null
+++ b/packages/pieces/community/mailer-lite/src/lib/actions/get-import-status.ts
@@ -0,0 +1,37 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { Property, createAction } from '@activepieces/pieces-framework';
+import { mailerLiteAuth } from '../auth';
+import { mailerLiteApi } from '../common/client';
+import { importStatusOutputSchema } from '../output-schemas';
+
+export const getImportStatusAction = createAction({
+ auth: mailerLiteAuth,
+ name: 'get_import_status',
+ classification: 'READ',
+ displayName: 'Get Import Status',
+ description: 'Get the progress and report of a subscriber import.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Check the progress of a subscriber import started by import_subscribers_to_group, given its import_id. Makes one read and does not wait: if done is false, call it again later. When done, the report counts imported, updated and errored rows. Read-only and idempotent.',
+ idempotent: true,
+ },
+ outputSchema: importStatusOutputSchema,
+ props: {
+ import_id: Property.ShortText({
+ displayName: 'Import ID',
+ description: 'The import ID returned by import_subscribers_to_group.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const id = mailerLiteApi.requireId({ value: context.propsValue.import_id, label: 'Import ID' });
+ const body = await mailerLiteApi.request<unknown>({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.GET,
+ path: `/subscribers/import/${id}`,
+ resource: `import ${id}`,
+ });
+ return mailerLiteApi.unwrapData(body);
+ },
+});
diff --git a/packages/pieces/community/mailer-lite/src/lib/actions/get-subscriber-activity.ts b/packages/pieces/community/mailer-lite/src/lib/actions/get-subscriber-activity.ts
new file mode 100644
index 00000000000..79db2cbe6cc
--- /dev/null
+++ b/packages/pieces/community/mailer-lite/src/lib/actions/get-subscriber-activity.ts
@@ -0,0 +1,72 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { Property, createAction } from '@activepieces/pieces-framework';
+import { mailerLiteAuth } from '../auth';
+import { mailerLiteApi } from '../common/client';
+import { subscriberActivityOutputSchema } from '../output-schemas';
+
+export const getSubscriberActivityAction = createAction({
+ auth: mailerLiteAuth,
+ name: 'get_subscriber_activity',
+ classification: 'SEARCH',
+ displayName: 'Get Subscriber Activity',
+ description: 'List the activity log of a subscriber.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'List the activity log of a MailerLite subscriber (campaign sends, opens, clicks, bounces, unsubscribes and more), given the subscriber ID from find_subscriber. Optionally filter by one log type. Page-paginated. Read-only.',
+ idempotent: true,
+ },
+ outputSchema: subscriberActivityOutputSchema,
+ props: {
+ subscriber_id: Property.ShortText({
+ displayName: 'Subscriber ID',
+ description: 'The subscriber ID, from find_subscriber or list_subscribers.',
+ required: true,
+ }),
+ log_name: Property.StaticDropdown({
+ displayName: 'Activity Type',
+ description: 'Only return this type of activity.',
+ required: false,
+ options: {
+ options: [
+ { label: 'Campaign send', value: 'campaign_send' },
+ { label: 'Automation email sent', value: 'automation_email_sent' },
+ { label: 'Email open', value: 'email_open' },
+ { label: 'Link click', value: 'link_click' },
+ { label: 'Email bounce', value: 'email_bounce' },
+ { label: 'Spam complaint', value: 'spam_complaint' },
+ { label: 'Unsubscribed', value: 'unsubscribed' },
+ { label: 'Email forward', value: 'email_forward' },
+ { label: 'Marketing preferences change', value: 'marketing_preferences_change' },
+ { label: 'Preference center', value: 'preference_center' },
+ ],
+ },
+ }),
+ limit: Property.Number({
+ displayName: 'Limit',
+ description: 'Items to return (1-100, default 100).',
+ required: false,
+ defaultValue: 100,
+ }),
+ page: Property.Number({
+ displayName: 'Page',
+ description: 'Page number to return, starting at 1.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const id = mailerLiteApi.requireId({ value: context.propsValue.subscriber_id, label: 'Subscriber ID' });
+ const body = await mailerLiteApi.request<unknown>({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.GET,
+ path: `/subscribers/${id}/activity-log`,
+ resource: `subscriber ${id}`,
+ queryParams: {
+ 'filter[log_name]': context.propsValue.log_name,
+ limit: mailerLiteApi.resolveLimit({ value: context.propsValue.limit, fallback: 100, max: 100 }),
+ page: mailerLiteApi.resolvePage(context.propsValue.page),
+ },
+ });
+ return body;
+ },
+});
diff --git a/packages/pieces/community/mailer-lite/src/lib/actions/get-webhook.ts b/packages/pieces/community/mailer-lite/src/lib/actions/get-webhook.ts
new file mode 100644
index 00000000000..969d2935aad
--- /dev/null
+++ b/packages/pieces/community/mailer-lite/src/lib/actions/get-webhook.ts
@@ -0,0 +1,37 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { Property, createAction } from '@activepieces/pieces-framework';
+import { mailerLiteAuth } from '../auth';
+import { mailerLiteApi } from '../common/client';
+import { webhookOutputSchema } from '../output-schemas';
+
+export const getWebhookAction = createAction({
+ auth: mailerLiteAuth,
+ name: 'get_webhook',
+ classification: 'READ',
+ displayName: 'Get Webhook',
+ description: 'Get a webhook by ID.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Get one MailerLite webhook by ID: name, URL, subscribed events, enabled and batchable flags. The signing secret is never returned. Get the ID from list_webhooks. Read-only; returns a 404 error if the ID does not exist.',
+ idempotent: true,
+ },
+ outputSchema: webhookOutputSchema,
+ props: {
+ webhook_id: Property.ShortText({
+ displayName: 'Webhook ID',
+ description: 'The webhook ID, from list_webhooks.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const id = mailerLiteApi.requireId({ value: context.propsValue.webhook_id, label: 'Webhook ID' });
+ const body = await mailerLiteApi.request<unknown>({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.GET,
+ path: `/webhooks/${id}`,
+ resource: `webhook ${id}`,
+ });
+ return mailerLiteApi.withoutSecret(mailerLiteApi.unwrapData(body));
+ },
+});
diff --git a/packages/pieces/community/mailer-lite/src/lib/actions/import-subscribers-to-group.ts b/packages/pieces/community/mailer-lite/src/lib/actions/import-subscribers-to-group.ts
new file mode 100644
index 00000000000..ad562fac6ca
--- /dev/null
+++ b/packages/pieces/community/mailer-lite/src/lib/actions/import-subscribers-to-group.ts
@@ -0,0 +1,56 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { Property, createAction } from '@activepieces/pieces-framework';
+import { mailerLiteAuth } from '../auth';
+import { mailerLiteApi } from '../common/client';
+import { importSubscribersOutputSchema } from '../output-schemas';
+
+export const importSubscribersToGroupAction = createAction({
+ auth: mailerLiteAuth,
+ name: 'import_subscribers_to_group',
+ classification: 'WRITE',
+ displayName: 'Import Subscribers to Group',
+ description: 'Start a bulk import of subscribers into a group.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Start a bulk import of subscribers into a MailerLite group. subscribers is a JSON array of objects, each with an email and an optional fields object. Existing subscribers are updated and added to the group. The import runs in the background and this action does not wait: it returns an import_id to pass to get_import_status to check progress. Limited to 5 imports per minute. Not idempotent: each call starts a new import.',
+ idempotent: false,
+ },
+ outputSchema: importSubscribersOutputSchema,
+ props: {
+ group_id: Property.ShortText({
+ displayName: 'Group ID',
+ description: 'The group ID, from list_groups or find_groups_by_name.',
+ required: true,
+ }),
+ subscribers: Property.Json({
+ displayName: 'Subscribers',
+ description: 'JSON array of subscribers, e.g. [{"email": "[email protected]", "fields": {"name": "Ann"}}].',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const id = mailerLiteApi.requireId({ value: context.propsValue.group_id, label: 'Group ID' });
+ const input: unknown = context.propsValue.subscribers;
+ if (!Array.isArray(input) || input.length === 0) {
+ throw new Error('Subscribers must be a non-empty JSON array.');
+ }
+ const subscribers = input.map((row: unknown, index: number) => {
+ if (!mailerLiteApi.isRecord(row) || typeof row['email'] !== 'string' || !row['email'].trim()) {
+ throw new Error(`Subscriber at position ${index + 1} must have an email.`);
+ }
+ const fields = row['fields'];
+ return mailerLiteApi.isRecord(fields) ? { email: row['email'].trim(), fields } : { email: row['email'].trim() };
+ });
+ const body = await mailerLiteApi.request<unknown>({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.POST,
+ path: `/groups/${id}/import-subscribers`,
+ resource: `group ${id}`,
+ body: { subscribers },
+ });
+ const url = mailerLiteApi.isRecord(body) && typeof body['import_progress_url'] === 'string' ? body['import_progress_url'] : '';
+ const importId = url.split('/').filter((segment) => segment.length > 0).pop() ?? '';
+ return { import_id: importId, import_progress_url: url };
+ },
+});
diff --git a/packages/pieces/community/mailer-lite/src/lib/actions/list-automations.ts b/packages/pieces/community/mailer-lite/src/lib/actions/list-automations.ts
new file mode 100644
index 00000000000..0e477d77dd1
--- /dev/null
+++ b/packages/pieces/community/mailer-lite/src/lib/actions/list-automations.ts
@@ -0,0 +1,69 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { Property, createAction } from '@activepieces/pieces-framework';
+import { mailerLiteAuth } from '../auth';
+import { mailerLiteApi } from '../common/client';
+import { listAutomationsOutputSchema } from '../output-schemas';
+
+export const listAutomationsAction = createAction({
+ auth: mailerLiteAuth,
+ name: 'list_automations',
+ classification: 'SEARCH',
+ displayName: 'List Automations',
+ description: 'List the automations in the account.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'List MailerLite automations with their IDs, enabled state and stats. Optionally filter by enabled state, name, or a group ID from list_groups. Page-paginated. Read-only.',
+ idempotent: true,
+ },
+ outputSchema: listAutomationsOutputSchema,
+ props: {
+ enabled: Property.StaticDropdown({
+ displayName: 'Enabled',
+ description: 'Only return enabled or disabled automations.',
+ required: false,
+ options: {
+ options: [
+ { label: 'Enabled', value: 'true' },
+ { label: 'Disabled', value: 'false' },
+ ],
+ },
+ }),
+ name: Property.ShortText({
+ displayName: 'Name Contains',
+ description: 'Only return automations whose name contains this text.',
+ required: false,
+ }),
+ group_id: Property.ShortText({
+ displayName: 'Group ID',
+ description: 'Only return automations that use this group, from list_groups.',
+ required: false,
+ }),
+ limit: Property.Number({
+ displayName: 'Limit',
+ description: 'Items to return (1-100, default 10).',
+ required: false,
+ defaultValue: 10,
+ }),
+ page: Property.Number({
+ displayName: 'Page',
+ description: 'Page number to return, starting at 1.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const body = await mailerLiteApi.request<unknown>({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.GET,
+ path: '/automations',
+ queryParams: {
+ 'filter[enabled]': context.propsValue.enabled,
+ 'filter[name]': context.propsValue.name,
+ 'filter[group]': context.propsValue.group_id,
+ limit: mailerLiteApi.resolveLimit({ value: context.propsValue.limit, fallback: 10, max: 100 }),
+ page: mailerLiteApi.resolvePage(context.propsValue.page),
+ },
+ });
+ return body;
+ },
+});
diff --git a/packages/pieces/community/mailer-lite/src/lib/actions/list-campaign-languages.ts b/packages/pieces/community/mailer-lite/src/lib/actions/list-campaign-languages.ts
new file mode 100644
index 00000000000..42d6c7d64c9
--- /dev/null
+++ b/packages/pieces/community/mailer-lite/src/lib/actions/list-campaign-languages.ts
@@ -0,0 +1,29 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction } from '@activepieces/pieces-framework';
+import { mailerLiteAuth } from '../auth';
+import { mailerLiteApi } from '../common/client';
+import { listCampaignLanguagesOutputSchema } from '../output-schemas';
+
+export const listCampaignLanguagesAction = createAction({
+ auth: mailerLiteAuth,
+ name: 'list_campaign_languages',
+ classification: 'READ',
+ displayName: 'List Campaign Languages',
+ description: 'List the languages available for campaigns.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'List the languages MailerLite supports for campaigns, with their IDs. Pass an ID as language_id to create_campaign_draft or update_campaign_draft. Read-only.',
+ idempotent: true,
+ },
+ outputSchema: listCampaignLanguagesOutputSchema,
+ props: {},
+ async run(context) {
+ const body = await mailerLiteApi.request<unknown>({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.GET,
+ path: '/campaigns/languages',
+ });
+ return body;
+ },
+});
diff --git a/packages/pieces/community/mailer-lite/src/lib/actions/list-campaigns.ts b/packages/pieces/community/mailer-lite/src/lib/actions/list-campaigns.ts
new file mode 100644
index 00000000000..2fad65d04be
--- /dev/null
+++ b/packages/pieces/community/mailer-lite/src/lib/actions/list-campaigns.ts
@@ -0,0 +1,72 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { Property, createAction } from '@activepieces/pieces-framework';
+import { mailerLiteAuth } from '../auth';
+import { mailerLiteApi } from '../common/client';
+import { listCampaignsOutputSchema } from '../output-schemas';
+
+export const listCampaignsAction = createAction({
+ auth: mailerLiteAuth,
+ name: 'list_campaigns',
+ classification: 'SEARCH',
+ displayName: 'List Campaigns',
+ description: 'List campaigns, optionally filtered by status and type.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'List MailerLite campaigns with their IDs, status and stats. MailerLite returns only ready (scheduled) campaigns unless status is set, so set status to draft or sent to see those. Page-paginated. Read-only.',
+ idempotent: true,
+ },
+ outputSchema: listCampaignsOutputSchema,
+ props: {
+ status: Property.StaticDropdown({
+ displayName: 'Status',
+ description: 'Only return campaigns with this status. MailerLite defaults to ready.',
+ required: false,
+ options: {
+ options: [
+ { label: 'Draft', value: 'draft' },
+ { label: 'Ready', value: 'ready' },
+ { label: 'Sent', value: 'sent' },
+ ],
+ },
+ }),
+ type: Property.StaticDropdown({
+ displayName: 'Type',
+ description: 'Only return campaigns of this type.',
+ required: false,
+ options: {
+ options: [
+ { label: 'Regular', value: 'regular' },
+ { label: 'A/B split', value: 'ab' },
+ { label: 'Resend', value: 'resend' },
+ { label: 'RSS', value: 'rss' },
+ ],
+ },
+ }),
+ limit: Property.Number({
+ displayName: 'Limit',
+ description: 'Items to return (1-100, default 25).',
+ required: false,
+ defaultValue: 25,
+ }),
+ page: Property.Number({
+ displayName: 'Page',
+ description: 'Page number to return, starting at 1.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const body = await mailerLiteApi.request<unknown>({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.GET,
+ path: '/campaigns',
+ queryParams: {
+ 'filter[status]': context.propsValue.status,
+ 'filter[type]': context.propsValue.type,
+ limit: mailerLiteApi.resolveLimit({ value: context.propsValue.limit, fallback: 25, max: 100 }),
+ page: mailerLiteApi.resolvePage(context.propsValue.page),
+ },
+ });
+ return body;
+ },
+});
diff --git a/packages/pieces/community/mailer-lite/src/lib/actions/list-fields.ts b/packages/pieces/community/mailer-lite/src/lib/actions/list-fields.ts
new file mode 100644
index 00000000000..679cb780807
--- /dev/null
+++ b/packages/pieces/community/mailer-lite/src/lib/actions/list-fields.ts
@@ -0,0 +1,64 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { Property, createAction } from '@activepieces/pieces-framework';
+import { mailerLiteAuth } from '../auth';
+import { mailerLiteApi } from '../common/client';
+import { listFieldsOutputSchema } from '../output-schemas';
+
+export const listFieldsAction = createAction({
+ auth: mailerLiteAuth,
+ name: 'list_fields',
+ classification: 'SEARCH',
+ displayName: 'List Fields',
+ description: 'List the subscriber fields in the account.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'List MailerLite subscriber fields (default and custom) with their IDs, keys and types. The key is what goes into a subscriber\'s fields object. Optionally filter by keyword or type. Page-paginated. Read-only.',
+ idempotent: true,
+ },
+ outputSchema: listFieldsOutputSchema,
+ props: {
+ keyword: Property.ShortText({
+ displayName: 'Keyword',
+ description: 'Only return fields whose name contains this text.',
+ required: false,
+ }),
+ type: Property.StaticDropdown({
+ displayName: 'Type',
+ description: 'Only return fields of this type.',
+ required: false,
+ options: {
+ options: [
+ { label: 'Text', value: 'text' },
+ { label: 'Number', value: 'number' },
+ { label: 'Date', value: 'date' },
+ ],
+ },
+ }),
+ limit: Property.Number({
+ displayName: 'Limit',
+ description: 'Items to return (1-100, default 100).',
+ required: false,
+ defaultValue: 100,
+ }),
+ page: Property.Number({
+ displayName: 'Page',
+ description: 'Page number to return, starting at 1.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const body = await mailerLiteApi.request<unknown>({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.GET,
+ path: '/fields',
+ queryParams: {
+ 'filter[keyword]': context.propsValue.keyword,
+ 'filter[type]': context.propsValue.type,
+ limit: mailerLiteApi.resolveLimit({ value: context.propsValue.limit, fallback: 100, max: 100 }),
+ page: mailerLiteApi.resolvePage(context.propsValue.page),
+ },
+ });
+ return body;
+ },
+});
diff --git a/packages/pieces/community/mailer-lite/src/lib/actions/list-form-subscribers.ts b/packages/pieces/community/mailer-lite/src/lib/actions/list-form-subscribers.ts
new file mode 100644
index 00000000000..0a96ea2a8a5
--- /dev/null
+++ b/packages/pieces/community/mailer-lite/src/lib/actions/list-form-subscribers.ts
@@ -0,0 +1,67 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { Property, createAction } from '@activepieces/pieces-framework';
+import { mailerLiteAuth } from '../auth';
+import { mailerLiteApi } from '../common/client';
+import { listFormSubscribersOutputSchema } from '../output-schemas';
+
+export const listFormSubscribersAction = createAction({
+ auth: mailerLiteAuth,
+ name: 'list_form_subscribers',
+ classification: 'SEARCH',
+ displayName: 'List Form Subscribers',
+ description: 'List the subscribers who signed up through a form.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'List the subscribers who signed up through a MailerLite form, given the form ID from list_forms. By default MailerLite returns active subscribers only; set status to list others. Cursor-paginated: pass meta.next_cursor back as cursor to get the next page. Read-only.',
+ idempotent: true,
+ },
+ outputSchema: listFormSubscribersOutputSchema,
+ props: {
+ form_id: Property.ShortText({
+ displayName: 'Form ID',
+ description: 'The form ID, from list_forms.',
+ required: true,
+ }),
+ status: Property.StaticDropdown({
+ displayName: 'Status',
+ description: 'Only return subscribers with this status. MailerLite defaults to active.',
+ required: false,
+ options: {
+ options: [
+ { label: 'Active', value: 'active' },
+ { label: 'Unsubscribed', value: 'unsubscribed' },
+ { label: 'Unconfirmed', value: 'unconfirmed' },
+ { label: 'Bounced', value: 'bounced' },
+ { label: 'Junk', value: 'junk' },
+ ],
+ },
+ }),
+ limit: Property.Number({
+ displayName: 'Limit',
+ description: 'Items to return (1-1000, default 25).',
+ required: false,
+ defaultValue: 25,
+ }),
+ cursor: Property.ShortText({
+ displayName: 'Cursor',
+ description: 'The meta.next_cursor value from the previous page. Leave empty for the first page.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const id = mailerLiteApi.requireId({ value: context.propsValue.form_id, label: 'Form ID' });
+ const body = await mailerLiteApi.request<unknown>({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.GET,
+ path: `/forms/${id}/subscribers`,
+ resource: `form ${id}`,
+ queryParams: {
+ 'filter[status]': context.propsValue.status,
+ limit: mailerLiteApi.resolveLimit({ value: context.propsValue.limit, fallback: 25, max: 1000 }),
+ cursor: context.propsValue.cursor,
+ },
+ });
+ return body;
+ },
+});
diff --git a/packages/pieces/community/mailer-lite/src/lib/actions/list-forms.ts b/packages/pieces/community/mailer-lite/src/lib/actions/list-forms.ts
new file mode 100644
index 00000000000..e7851713ff5
--- /dev/null
+++ b/packages/pieces/community/mailer-lite/src/lib/actions/list-forms.ts
@@ -0,0 +1,65 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { Property, createAction } from '@activepieces/pieces-framework';
+import { mailerLiteAuth } from '../auth';
+import { mailerLiteApi } from '../common/client';
+import { listFormsOutputSchema } from '../output-schemas';
+
+export const listFormsAction = createAction({
+ auth: mailerLiteAuth,
+ name: 'list_forms',
+ classification: 'SEARCH',
+ displayName: 'List Forms',
+ description: 'List signup forms of one type.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'List MailerLite signup forms of one type (popup, embedded or promotion) with their IDs and conversion stats. Forms cannot be created through the API. Page-paginated. Read-only.',
+ idempotent: true,
+ },
+ outputSchema: listFormsOutputSchema,
+ props: {
+ type: Property.StaticDropdown({
+ displayName: 'Form Type',
+ description: 'The type of forms to list.',
+ required: true,
+ options: {
+ options: [
+ { label: 'Popup', value: 'popup' },
+ { label: 'Embedded', value: 'embedded' },
+ { label: 'Promotion', value: 'promotion' },
+ ],
+ },
+ }),
+ name: Property.ShortText({
+ displayName: 'Name Contains',
+ description: 'Only return forms whose name contains this text.',
+ required: false,
+ }),
+ limit: Property.Number({
+ displayName: 'Limit',
+ description: 'Items to return (1-100, default 25).',
+ required: false,
+ defaultValue: 25,
+ }),
+ page: Property.Number({
+ displayName: 'Page',
+ description: 'Page number to return, starting at 1.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const id = mailerLiteApi.requireId({ value: context.propsValue.type, label: 'Form Type' });
+ const body = await mailerLiteApi.request<unknown>({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.GET,
+ path: `/forms/${id}`,
+ resource: `forms ${id}`,
+ queryParams: {
+ 'filter[name]': context.propsValue.name,
+ limit: mailerLiteApi.resolveLimit({ value: context.propsValue.limit, fallback: 25, max: 100 }),
+ page: mailerLiteApi.resolvePage(context.propsValue.page),
+ },
+ });
+ return body;
+ },
+});
diff --git a/packages/pieces/community/mailer-lite/src/lib/actions/list-group-subscribers.ts b/packages/pieces/community/mailer-lite/src/lib/actions/list-group-subscribers.ts
index 1d109476060..12a1fb068f6 100644
--- a/packages/pieces/community/mailer-lite/src/lib/actions/list-group-subscribers.ts
+++ b/packages/pieces/community/mailer-lite/src/lib/actions/list-group-subscribers.ts
@@ -1,7 +1,8 @@
-import MailerLite from '@mailerlite/mailerlite-nodejs';
+import { HttpMethod } from '@activepieces/pieces-common';
import { Property, createAction } from '@activepieces/pieces-framework';
import { mailerLiteAuth } from '../auth';
import { mailerLiteCommon } from '../common';
+import { mailerLiteApi } from '../common/client';
import { listGroupSubscribersOutputSchema } from '../output-schemas';
export const listGroupSubscribersAction = createAction({
@@ -13,29 +14,50 @@ export const listGroupSubscribersAction = createAction({
audience: 'both',
aiMetadata: {
description:
- 'List the subscribers that belong to a specific MailerLite group, given the group ID. Use this to enumerate the members of a segment before messaging or reporting on them. Read-only and idempotent.',
+ 'List the subscribers that belong to a specific MailerLite group, given the group ID. By default MailerLite returns active subscribers only; set status to list unsubscribed, unconfirmed, bounced or junk members instead. Cursor-paginated: pass meta.next_cursor back as cursor to get the next page. Read-only and idempotent.',
idempotent: true,
},
outputSchema: listGroupSubscribersOutputSchema,
props: {
subscriberGroupId: mailerLiteCommon.subscriberGroupId(true),
+ status: Property.StaticDropdown({
+ displayName: 'Status',
+ description: 'Only return subscribers with this status. MailerLite defaults to active.',
+ required: false,
+ options: {
+ options: [
+ { label: 'Active', value: 'active' },
+ { label: 'Unsubscribed', value: 'unsubscribed' },
+ { label: 'Unconfirmed', value: 'unconfirmed' },
+ { label: 'Bounced', value: 'bounced' },
+ { label: 'Junk', value: 'junk' },
+ ],
+ },
+ }),
limit: Property.Number({
displayName: 'Limit',
description: 'Subscribers to return (1-1000, default 25).',
required: false,
defaultValue: 25,
}),
+ cursor: Property.ShortText({
+ displayName: 'Cursor',
+ description: 'The meta.next_cursor value from the previous page. Leave empty for the first page.',
+ required: false,
+ }),
},
async run(context) {
- const resolvedLimit = Math.trunc(Number(context.propsValue.limit ?? 25));
- if (!Number.isFinite(resolvedLimit) || resolvedLimit < 1 || resolvedLimit > 1000) {
- throw new Error('Limit must be between 1 and 1000.');
- }
- const client = new MailerLite({ api_key: context.auth.secret_text });
- const response = await client.groups.getSubscribers(context.propsValue.subscriberGroupId!, {
- limit: resolvedLimit,
- page: 1,
+ const id = mailerLiteApi.requireId({ value: context.propsValue.subscriberGroupId, label: 'Group' });
+ return mailerLiteApi.request<unknown>({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.GET,
+ path: `/groups/${id}/subscribers`,
+ resource: `group ${id}`,
+ queryParams: {
+ limit: mailerLiteApi.resolveLimit({ value: context.propsValue.limit, fallback: 25, max: 1000 }),
+ cursor: context.propsValue.cursor,
+ 'filter[status]': context.propsValue.status,
+ },
});
- return response.data;
},
});
diff --git a/packages/pieces/community/mailer-lite/src/lib/actions/list-segment-subscribers.ts b/packages/pieces/community/mailer-lite/src/lib/actions/list-segment-subscribers.ts
new file mode 100644
index 00000000000..e92e15f2829
--- /dev/null
+++ b/packages/pieces/community/mailer-lite/src/lib/actions/list-segment-subscribers.ts
@@ -0,0 +1,67 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { Property, createAction } from '@activepieces/pieces-framework';
+import { mailerLiteAuth } from '../auth';
+import { mailerLiteApi } from '../common/client';
+import { listSegmentSubscribersOutputSchema } from '../output-schemas';
+
+export const listSegmentSubscribersAction = createAction({
+ auth: mailerLiteAuth,
+ name: 'list_segment_subscribers',
+ classification: 'SEARCH',
+ displayName: 'List Segment Subscribers',
+ description: 'List the subscribers that match a segment.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'List the subscribers that match a MailerLite segment, given the segment ID from list_segments. By default MailerLite returns active subscribers only; set status to list unsubscribed, unconfirmed, bounced or junk ones instead. Cursor-paginated: pass meta.next_cursor back as cursor to get the next page. Read-only.',
+ idempotent: true,
+ },
+ outputSchema: listSegmentSubscribersOutputSchema,
+ props: {
+ segment_id: Property.ShortText({
+ displayName: 'Segment ID',
+ description: 'The segment ID, from list_segments.',
+ required: true,
+ }),
+ status: Property.StaticDropdown({
+ displayName: 'Status',
+ description: 'Only return subscribers with this status. MailerLite defaults to active.',
+ required: false,
+ options: {
+ options: [
+ { label: 'Active', value: 'active' },
+ { label: 'Unsubscribed', value: 'unsubscribed' },
+ { label: 'Unconfirmed', value: 'unconfirmed' },
+ { label: 'Bounced', value: 'bounced' },
+ { label: 'Junk', value: 'junk' },
+ ],
+ },
+ }),
+ limit: Property.Number({
+ displayName: 'Limit',
+ description: 'Items to return (1-1000, default 50).',
+ required: false,
+ defaultValue: 50,
+ }),
+ cursor: Property.ShortText({
+ displayName: 'Cursor',
+ description: 'The meta.next_cursor value from the previous page. Leave empty for the first page.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const id = mailerLiteApi.requireId({ value: context.propsValue.segment_id, label: 'Segment ID' });
+ const body = await mailerLiteApi.request<unknown>({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.GET,
+ path: `/segments/${id}/subscribers`,
+ resource: `segment ${id}`,
+ queryParams: {
+ 'filter[status]': context.propsValue.status,
+ limit: mailerLiteApi.resolveLimit({ value: context.propsValue.limit, fallback: 50, max: 1000 }),
+ cursor: context.propsValue.cursor,
+ },
+ });
+ return body;
+ },
+});
diff --git a/packages/pieces/community/mailer-lite/src/lib/actions/list-segments.ts b/packages/pieces/community/mailer-lite/src/lib/actions/list-segments.ts
new file mode 100644
index 00000000000..9e0d12f656e
--- /dev/null
+++ b/packages/pieces/community/mailer-lite/src/lib/actions/list-segments.ts
@@ -0,0 +1,45 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { Property, createAction } from '@activepieces/pieces-framework';
+import { mailerLiteAuth } from '../auth';
+import { mailerLiteApi } from '../common/client';
+import { listSegmentsOutputSchema } from '../output-schemas';
+
+export const listSegmentsAction = createAction({
+ auth: mailerLiteAuth,
+ name: 'list_segments',
+ classification: 'SEARCH',
+ displayName: 'List Segments',
+ description: 'List the segments in the account.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'List MailerLite segments (saved subscriber filters created in the dashboard) with their IDs and subscriber totals. Segments cannot be created through the API. Page-paginated: pass page for more. Read-only.',
+ idempotent: true,
+ },
+ outputSchema: listSegmentsOutputSchema,
+ props: {
+ limit: Property.Number({
+ displayName: 'Limit',
+ description: 'Items to return (1-250, default 50).',
+ required: false,
+ defaultValue: 50,
+ }),
+ page: Property.Number({
+ displayName: 'Page',
+ description: 'Page number to return, starting at 1.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const body = await mailerLiteApi.request<unknown>({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.GET,
+ path: '/segments',
+ queryParams: {
+ limit: mailerLiteApi.resolveLimit({ value: context.propsValue.limit, fallback: 50, max: 250 }),
+ page: mailerLiteApi.resolvePage(context.propsValue.page),
+ },
+ });
+ return body;
+ },
+});
diff --git a/packages/pieces/community/mailer-lite/src/lib/actions/list-subscribers.ts b/packages/pieces/community/mailer-lite/src/lib/actions/list-subscribers.ts
index bca1644db97..70d657e9315 100644
--- a/packages/pieces/community/mailer-lite/src/lib/actions/list-subscribers.ts
+++ b/packages/pieces/community/mailer-lite/src/lib/actions/list-subscribers.ts
@@ -12,7 +12,7 @@ export const listSubscribersAction = createAction({
audience: 'both',
aiMetadata: {
description:
- 'List MailerLite subscribers, optionally filtered by status (active, unsubscribed, unconfirmed, bounced, junk). Use this to enumerate contacts for reporting or bulk processing. Returns a page of subscriber records with cursor pagination. Read-only and idempotent.',
+ 'List MailerLite subscribers, optionally filtered by status (active, unsubscribed, unconfirmed, bounced, junk). Use this to enumerate contacts for reporting or bulk processing. Returns a page of subscriber records with cursor pagination: pass meta.next_cursor back as cursor to get the next page. Read-only and idempotent.',
idempotent: true,
},
outputSchema: listSubscribersOutputSchema,
@@ -37,10 +37,15 @@ export const listSubscribersAction = createAction({
required: false,
defaultValue: 25,
}),
+ cursor: Property.ShortText({
+ displayName: 'Cursor',
+ description: 'The meta.next_cursor value from the previous page. Leave empty for the first page.',
+ required: false,
+ }),
},
async run(context) {
const client = new MailerLite({ api_key: context.auth.secret_text });
- const { status, limit } = context.propsValue;
+ const { status, limit, cursor } = context.propsValue;
const resolvedLimit = Math.trunc(Number(limit ?? 25));
if (!Number.isFinite(resolvedLimit) || resolvedLimit < 1 || resolvedLimit > 1000) {
throw new Error('Limit must be between 1 and 1000.');
@@ -53,8 +58,8 @@ export const listSubscribersAction = createAction({
status === 'junk';
const response = await client.subscribers.get(
isKnownStatus
- ? { limit: resolvedLimit, filter: { status } }
- : { limit: resolvedLimit },
+ ? { limit: resolvedLimit, cursor: cursor || undefined, filter: { status } }
+ : { limit: resolvedLimit, cursor: cursor || undefined },
);
return response.data;
},
diff --git a/packages/pieces/community/mailer-lite/src/lib/actions/list-timezones.ts b/packages/pieces/community/mailer-lite/src/lib/actions/list-timezones.ts
new file mode 100644
index 00000000000..436abbc894f
--- /dev/null
+++ b/packages/pieces/community/mailer-lite/src/lib/actions/list-timezones.ts
@@ -0,0 +1,29 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction } from '@activepieces/pieces-framework';
+import { mailerLiteAuth } from '../auth';
+import { mailerLiteApi } from '../common/client';
+import { listTimezonesOutputSchema } from '../output-schemas';
+
+export const listTimezonesAction = createAction({
+ auth: mailerLiteAuth,
+ name: 'list_timezones',
+ classification: 'READ',
+ displayName: 'List Timezones',
+ description: 'List the timezones MailerLite supports.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'List the timezones MailerLite supports, with their IDs, names and UTC offsets. Read-only.',
+ idempotent: true,
+ },
+ outputSchema: listTimezonesOutputSchema,
+ props: {},
+ async run(context) {
+ const body = await mailerLiteApi.request<unknown>({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.GET,
+ path: '/timezones',
+ });
+ return body;
+ },
+});
diff --git a/packages/pieces/community/mailer-lite/src/lib/actions/list-webhooks.ts b/packages/pieces/community/mailer-lite/src/lib/actions/list-webhooks.ts
new file mode 100644
index 00000000000..160d3f10638
--- /dev/null
+++ b/packages/pieces/community/mailer-lite/src/lib/actions/list-webhooks.ts
@@ -0,0 +1,30 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction } from '@activepieces/pieces-framework';
+import { mailerLiteAuth } from '../auth';
+import { mailerLiteApi } from '../common/client';
+import { listWebhooksOutputSchema } from '../output-schemas';
+
+export const listWebhooksAction = createAction({
+ auth: mailerLiteAuth,
+ name: 'list_webhooks',
+ classification: 'SEARCH',
+ displayName: 'List Webhooks',
+ description: 'List the webhooks in the account.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'List the MailerLite webhooks in the account with their IDs, URLs, events and enabled state. Signing secrets are never returned. Webhooks created by Activepieces MailerLite triggers appear here too. Read-only.',
+ idempotent: true,
+ },
+ outputSchema: listWebhooksOutputSchema,
+ props: {},
+ async run(context) {
+ const body = await mailerLiteApi.request<unknown>({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.GET,
+ path: '/webhooks',
+ });
+ const items = mailerLiteApi.isRecord(body) && Array.isArray(body['data']) ? body['data'] : [];
+ return { ...(mailerLiteApi.isRecord(body) ? body : {}), data: items.map((item) => mailerLiteApi.withoutSecret(item)) };
+ },
+});
diff --git a/packages/pieces/community/mailer-lite/src/lib/actions/remove-subscriber-from-group.ts b/packages/pieces/community/mailer-lite/src/lib/actions/remove-subscriber-from-group.ts
index fc53ebada60..5686e36c3bd 100644
--- a/packages/pieces/community/mailer-lite/src/lib/actions/remove-subscriber-from-group.ts
+++ b/packages/pieces/community/mailer-lite/src/lib/actions/remove-subscriber-from-group.ts
@@ -12,7 +12,7 @@ export const removeSubscriberFromGroupAction = createAction({
audience: 'both',
aiMetadata: {
description:
- 'Unassign a MailerLite subscriber from a group, given the subscriber ID and group ID. Use this to remove a contact from a specific list/group without deleting the subscriber. Idempotent — re-running for a subscriber not in the group leaves membership unchanged.',
+ 'Unassign a MailerLite subscriber from a group, given the subscriber ID and group ID. Use this to remove a contact from a specific list/group without deleting the subscriber. Idempotent: removing a subscriber who is no longer in the group succeeds and leaves membership unchanged.',
idempotent: true,
},
props: {
diff --git a/packages/pieces/community/mailer-lite/src/lib/actions/rename-field.ts b/packages/pieces/community/mailer-lite/src/lib/actions/rename-field.ts
new file mode 100644
index 00000000000..e8e5decf851
--- /dev/null
+++ b/packages/pieces/community/mailer-lite/src/lib/actions/rename-field.ts
@@ -0,0 +1,47 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { Property, createAction } from '@activepieces/pieces-framework';
+import { mailerLiteAuth } from '../auth';
+import { mailerLiteApi } from '../common/client';
+import { fieldOutputSchema } from '../output-schemas';
+
+export const renameFieldAction = createAction({
+ auth: mailerLiteAuth,
+ name: 'rename_field',
+ classification: 'WRITE',
+ displayName: 'Rename Field',
+ description: 'Rename a custom field.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Rename a MailerLite custom field by ID. The field type cannot be changed and subscriber values are kept. Get the ID from list_fields. Idempotent.',
+ idempotent: true,
+ },
+ outputSchema: fieldOutputSchema,
+ props: {
+ field_id: Property.ShortText({
+ displayName: 'Field ID',
+ description: 'The custom field ID, from list_fields.',
+ required: true,
+ }),
+ name: Property.ShortText({
+ displayName: 'Name',
+ description: 'The new field name.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const id = mailerLiteApi.requireId({ value: context.propsValue.field_id, label: 'Field ID' });
+ const name = context.propsValue.name.trim();
+ if (!name) {
+ throw new Error('Name is required.');
+ }
+ const body = await mailerLiteApi.request<unknown>({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.PUT,
+ path: `/fields/${id}`,
+ resource: `field ${id}`,
+ body: { name },
+ });
+ return mailerLiteApi.unwrapData(body);
+ },
+});
diff --git a/packages/pieces/community/mailer-lite/src/lib/actions/rename-group.ts b/packages/pieces/community/mailer-lite/src/lib/actions/rename-group.ts
new file mode 100644
index 00000000000..38affdc06e9
--- /dev/null
+++ b/packages/pieces/community/mailer-lite/src/lib/actions/rename-group.ts
@@ -0,0 +1,47 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { Property, createAction } from '@activepieces/pieces-framework';
+import { mailerLiteAuth } from '../auth';
+import { mailerLiteApi } from '../common/client';
+import { groupOutputSchema } from '../output-schemas';
+
+export const renameGroupAction = createAction({
+ auth: mailerLiteAuth,
+ name: 'rename_group',
+ classification: 'WRITE',
+ displayName: 'Rename Group',
+ description: 'Rename a subscriber group.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Rename a MailerLite group by ID. Only the name changes; members are untouched. Get the ID from list_groups or find_groups_by_name. Idempotent: the same name twice leaves the same state.',
+ idempotent: true,
+ },
+ outputSchema: groupOutputSchema,
+ props: {
+ group_id: Property.ShortText({
+ displayName: 'Group ID',
+ description: 'The group ID, from list_groups or find_groups_by_name.',
+ required: true,
+ }),
+ name: Property.ShortText({
+ displayName: 'Name',
+ description: 'The new group name (max 255 characters).',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const id = mailerLiteApi.requireId({ value: context.propsValue.group_id, label: 'Group ID' });
+ const name = context.propsValue.name.trim();
+ if (!name) {
+ throw new Error('Name is required.');
+ }
+ const body = await mailerLiteApi.request<unknown>({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.PUT,
+ path: `/groups/${id}`,
+ resource: `group ${id}`,
+ body: { name },
+ });
+ return mailerLiteApi.unwrapData(body);
+ },
+});
diff --git a/packages/pieces/community/mailer-lite/src/lib/actions/rename-segment.ts b/packages/pieces/community/mailer-lite/src/lib/actions/rename-segment.ts
new file mode 100644
index 00000000000..88a3ca512ca
--- /dev/null
+++ b/packages/pieces/community/mailer-lite/src/lib/actions/rename-segment.ts
@@ -0,0 +1,47 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { Property, createAction } from '@activepieces/pieces-framework';
+import { mailerLiteAuth } from '../auth';
+import { mailerLiteApi } from '../common/client';
+import { segmentOutputSchema } from '../output-schemas';
+
+export const renameSegmentAction = createAction({
+ auth: mailerLiteAuth,
+ name: 'rename_segment',
+ classification: 'WRITE',
+ displayName: 'Rename Segment',
+ description: 'Rename a segment.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Rename a MailerLite segment by ID. Only the name changes; the segment rules are untouched. Get the ID from list_segments. Idempotent.',
+ idempotent: true,
+ },
+ outputSchema: segmentOutputSchema,
+ props: {
+ segment_id: Property.ShortText({
+ displayName: 'Segment ID',
+ description: 'The segment ID, from list_segments.',
+ required: true,
+ }),
+ name: Property.ShortText({
+ displayName: 'Name',
+ description: 'The new segment name (max 255 characters).',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const id = mailerLiteApi.requireId({ value: context.propsValue.segment_id, label: 'Segment ID' });
+ const name = context.propsValue.name.trim();
+ if (!name) {
+ throw new Error('Name is required.');
+ }
+ const body = await mailerLiteApi.request<unknown>({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.PUT,
+ path: `/segments/${id}`,
+ resource: `segment ${id}`,
+ body: { name },
+ });
+ return mailerLiteApi.unwrapData(body);
+ },
+});
diff --git a/packages/pieces/community/mailer-lite/src/lib/actions/unsubscribe-subscriber.ts b/packages/pieces/community/mailer-lite/src/lib/actions/unsubscribe-subscriber.ts
index 7f4e6f4a70a..1dd7d0128b1 100644
--- a/packages/pieces/community/mailer-lite/src/lib/actions/unsubscribe-subscriber.ts
+++ b/packages/pieces/community/mailer-lite/src/lib/actions/unsubscribe-subscriber.ts
@@ -6,7 +6,7 @@ import { unsubscribeSubscriberOutputSchema } from '../output-schemas';
export const unsubscribeSubscriberAction = createAction({
auth: mailerLiteAuth,
name: 'unsubscribe_subscriber',
- classification: 'WRITE',
+ classification: 'DESTRUCTIVE',
displayName: 'Unsubscribe Subscriber',
description: 'Set a subscriber status to unsubscribed.',
audience: 'both',
diff --git a/packages/pieces/community/mailer-lite/src/lib/actions/update-campaign-draft.ts b/packages/pieces/community/mailer-lite/src/lib/actions/update-campaign-draft.ts
new file mode 100644
index 00000000000..e0f414c4b0e
--- /dev/null
+++ b/packages/pieces/community/mailer-lite/src/lib/actions/update-campaign-draft.ts
@@ -0,0 +1,215 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { Property, createAction } from '@activepieces/pieces-framework';
+import { mailerLiteAuth } from '../auth';
+import { mailerLiteApi } from '../common/client';
+import { campaignWriteOutputSchema } from '../output-schemas';
+
+function idsOf(value: unknown): string[] {
+ if (!Array.isArray(value)) {
+ return [];
+ }
+ return value
+ .map((item) => (mailerLiteApi.isRecord(item) ? item['id'] : item))
+ .filter((item) => typeof item === 'string' && item !== '')
+ .map(String);
+}
+
+function inclusionOf(rule: unknown): { kind: 'groups' | 'segments'; ids: string[] } | null {
+ if (!mailerLiteApi.isRecord(rule) || rule['operator'] !== 'in_any' || !Array.isArray(rule['args'])) {
+ return null;
+ }
+ const [target, values] = rule['args'];
+ if ((target !== 'groups' && target !== 'segments') || !Array.isArray(values)) {
+ return null;
+ }
+ return { kind: target, ids: values.map(String) };
+}
+
+function currentTargeting(current: Record<string, unknown>): Targeting {
+ const filter = current['filter'];
+ if (!Array.isArray(filter) || filter.length === 0) {
+ return { groups: idsOf(current['groups']), segments: idsOf(current['segments']), representable: true };
+ }
+ const rules = filter.flatMap((clause: unknown) => (Array.isArray(clause) ? clause : [clause]));
+ const inclusions = rules.map(inclusionOf);
+ const idsFor = (kind: 'groups' | 'segments'): string[] =>
+ Array.from(new Set(inclusions.flatMap((inclusion) => (inclusion?.kind === kind ? inclusion.ids : []))));
+ return {
+ groups: idsFor('groups'),
+ segments: idsFor('segments'),
+ representable: inclusions.every((inclusion) => inclusion !== null),
+ };
+}
+
+function toIdList(value: unknown): string[] | undefined {
+ if (!Array.isArray(value)) {
+ return undefined;
+ }
+ const ids = value.map((item) => String(item).trim()).filter((item) => item.length > 0);
+ return ids.length > 0 ? ids : undefined;
+}
+
+function textOf(value: unknown): string | undefined {
+ return typeof value === 'string' && value.length > 0 ? value : undefined;
+}
+
+export const updateCampaignDraftAction = createAction({
+ auth: mailerLiteAuth,
+ name: 'update_campaign_draft',
+ classification: 'WRITE',
+ displayName: 'Update Campaign Draft',
+ description: 'Update a draft campaign, keeping the values you do not change.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Update a MailerLite campaign that is still a draft, changing only the values you supply; everything else (name, subject, sender, groups, segments, language) is kept. Fails if the campaign is not a draft. It never sends or schedules. Get the ID from list_campaigns with status draft. Pass group_ids or segment_ids (not both) to replace the audience. Fails without changing anything if the campaign excludes groups or segments, or targets both groups and segments and you pass neither, because the MailerLite API cannot save those rules back. content (HTML) works on the Advanced plan only. At least one value is required. Idempotent.',
+ idempotent: true,
+ },
+ outputSchema: campaignWriteOutputSchema,
+ props: {
+ campaign_id: Property.ShortText({
+ displayName: 'Campaign ID',
+ description: 'The draft campaign ID, from list_campaigns.',
+ required: true,
+ }),
+ name: Property.ShortText({
+ displayName: 'Campaign Name',
+ description: 'New internal campaign name.',
+ required: false,
+ }),
+ subject: Property.ShortText({
+ displayName: 'Subject',
+ description: 'New email subject line.',
+ required: false,
+ }),
+ from_name: Property.ShortText({
+ displayName: 'From Name',
+ description: 'New sender name.',
+ required: false,
+ }),
+ from: Property.ShortText({
+ displayName: 'From Email',
+ description: 'New sender email. Must be a verified sender on the MailerLite account.',
+ required: false,
+ }),
+ reply_to: Property.ShortText({
+ displayName: 'Reply-To Email',
+ description: 'New reply-to email address.',
+ required: false,
+ }),
+ group_ids: Property.Array({
+ displayName: 'Group IDs',
+ description: 'Replaces the audience with these groups, from list_groups. Not with Segment IDs.',
+ required: false,
+ }),
+ segment_ids: Property.Array({
+ displayName: 'Segment IDs',
+ description: 'Replaces the audience with these segments, from list_segments. Not with Group IDs.',
+ required: false,
+ }),
+ language_id: Property.ShortText({
+ displayName: 'Language ID',
+ description: 'Campaign language ID, from list_campaign_languages.',
+ required: false,
+ }),
+ content: Property.LongText({
+ displayName: 'HTML Content',
+ description: 'Email HTML. Advanced plan only; omit on other plans.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const id = mailerLiteApi.requireId({ value: context.propsValue.campaign_id, label: 'Campaign ID' });
+ const props = context.propsValue;
+ const groupPatch = toIdList(props.group_ids);
+ const segmentPatch = toIdList(props.segment_ids);
+ const hasPatch =
+ [props.name, props.subject, props.from_name, props.from, props.reply_to, props.language_id, props.content].some(
+ (value) => typeof value === 'string' && value.length > 0,
+ ) ||
+ groupPatch !== undefined ||
+ segmentPatch !== undefined;
+ if (!hasPatch) {
+ throw new Error('Provide at least one value to update.');
+ }
+ if (groupPatch !== undefined && segmentPatch !== undefined) {
+ throw new Error('Provide Group IDs or Segment IDs, not both: MailerLite only sends to the segments when both are set.');
+ }
+ const current = mailerLiteApi.unwrapData(
+ await mailerLiteApi.request<unknown>({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.GET,
+ path: `/campaigns/${id}`,
+ resource: `campaign ${id}`,
+ }),
+ );
+ if (current['status'] !== 'draft') {
+ throw new Error(`Campaign ${id} is not a draft (status: ${String(current['status'])}); only drafts can be updated.`);
+ }
+ const targeting = currentTargeting(current);
+ if (!targeting.representable) {
+ throw new Error(
+ `Campaign ${id} uses audience rules the MailerLite API cannot save back, such as excluded groups or segments. Update it in MailerLite instead so those rules are not lost.`,
+ );
+ }
+ const emails = current['emails'];
+ const firstEmail = Array.isArray(emails) && mailerLiteApi.isRecord(emails[0]) ? emails[0] : {};
+ const email: Record<string, string> = {};
+ const subject = props.subject || textOf(firstEmail['subject']);
+ const fromName = props.from_name || textOf(firstEmail['from_name']);
+ const from = props.from || textOf(firstEmail['from']);
+ const replyTo = props.reply_to || textOf(firstEmail['reply_to']);
+ if (subject) {
+ email['subject'] = subject;
+ }
+ if (fromName) {
+ email['from_name'] = fromName;
+ }
+ if (from) {
+ email['from'] = from;
+ }
+ if (replyTo) {
+ email['reply_to'] = replyTo;
+ }
+ const content = props.content || textOf(firstEmail['content']);
+ if (content) {
+ email['content'] = content;
+ }
+ const body: Record<string, unknown> = {
+ name: props.name || textOf(current['name']),
+ emails: [email],
+ };
+ if (groupPatch !== undefined) {
+ body['groups'] = groupPatch;
+ } else if (segmentPatch !== undefined) {
+ body['segments'] = segmentPatch;
+ } else if (targeting.segments.length > 0) {
+ if (targeting.groups.length > 0) {
+ throw new Error(
+ `Campaign ${id} targets both groups and segments, which the MailerLite API cannot save back together. Pass Group IDs or Segment IDs to choose the audience.`,
+ );
+ }
+ body['segments'] = targeting.segments;
+ } else if (targeting.groups.length > 0) {
+ body['groups'] = targeting.groups;
+ }
+ const languageId = props.language_id || current['language_id'];
+ if (languageId !== undefined && languageId !== null && languageId !== '') {
+ body['language_id'] = String(languageId);
+ }
+ const response = await mailerLiteApi.request<unknown>({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.PUT,
+ path: `/campaigns/${id}`,
+ resource: `campaign ${id}`,
+ body,
+ });
+ return mailerLiteApi.unwrapData(response);
+ },
+});
+
+type Targeting = {
+ groups: string[];
+ segments: string[];
+ representable: boolean;
+};
diff --git a/packages/pieces/community/mailer-lite/src/lib/actions/update-subscriber.ts b/packages/pieces/community/mailer-lite/src/lib/actions/update-subscriber.ts
new file mode 100644
index 00000000000..91643bb23da
--- /dev/null
+++ b/packages/pieces/community/mailer-lite/src/lib/actions/update-subscriber.ts
@@ -0,0 +1,108 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { Property, createAction } from '@activepieces/pieces-framework';
+import dayjs from 'dayjs';
+import { mailerLiteAuth } from '../auth';
+import { mailerLiteApi } from '../common/client';
+import { updateSubscriberOutputSchema } from '../output-schemas';
+
+function formatDate(value: string | undefined): string | undefined {
+ if (value === undefined || value === null || value === '') {
+ return undefined;
+ }
+ const parsed = dayjs(value);
+ if (!parsed.isValid()) {
+ throw new Error(`Invalid date: ${value}`);
+ }
+ return parsed.format('YYYY-MM-DD HH:mm:ss');
+}
+
+export const updateSubscriberAction = createAction({
+ auth: mailerLiteAuth,
+ name: 'update_subscriber',
+ classification: 'WRITE',
+ displayName: 'Update Subscriber',
+ description: 'Update fields or status of an existing subscriber.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Update an existing MailerLite subscriber by ID, sending only the values you supply: custom or default field values (fields object keyed by field key from list_fields), status, dates and IPs. Group membership is never changed here; use add_subscriber_to_group or remove_subscriber_from_group. The API cannot reactivate unsubscribed, bounced or junk subscribers. Get the ID from find_subscriber. At least one value is required. Idempotent.',
+ idempotent: true,
+ },
+ outputSchema: updateSubscriberOutputSchema,
+ props: {
+ subscriber_id: Property.ShortText({
+ displayName: 'Subscriber ID',
+ description: 'The subscriber ID, from find_subscriber or list_subscribers.',
+ required: true,
+ }),
+ fields: Property.Object({
+ displayName: 'Fields',
+ description: 'Field values to set, keyed by field key (e.g. name, last_name, or a custom field key from list_fields). Fields not listed are left alone.',
+ required: false,
+ }),
+ status: Property.StaticDropdown({
+ displayName: 'Status',
+ description: 'New subscriber status. Unsubscribed, bounced and junk subscribers cannot be reactivated through the API.',
+ required: false,
+ options: {
+ options: [
+ { label: 'Active', value: 'active' },
+ { label: 'Unsubscribed', value: 'unsubscribed' },
+ { label: 'Unconfirmed', value: 'unconfirmed' },
+ { label: 'Bounced', value: 'bounced' },
+ { label: 'Junk', value: 'junk' },
+ ],
+ },
+ }),
+ subscribed_at: Property.DateTime({
+ displayName: 'Subscribed At',
+ description: 'When the subscriber subscribed.',
+ required: false,
+ }),
+ opted_in_at: Property.DateTime({
+ displayName: 'Opted In At',
+ description: 'When the subscriber confirmed the opt-in.',
+ required: false,
+ }),
+ unsubscribed_at: Property.DateTime({
+ displayName: 'Unsubscribed At',
+ description: 'When the subscriber unsubscribed.',
+ required: false,
+ }),
+ ip_address: Property.ShortText({
+ displayName: 'IP Address',
+ description: 'The IP address the subscriber signed up from.',
+ required: false,
+ }),
+ optin_ip: Property.ShortText({
+ displayName: 'Opt-in IP',
+ description: 'The IP address the subscriber confirmed the opt-in from.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const id = mailerLiteApi.requireId({ value: context.propsValue.subscriber_id, label: 'Subscriber ID' });
+ const { fields, status, ip_address, optin_ip } = context.propsValue;
+ const candidate: Record<string, unknown> = {
+ fields: fields && Object.keys(fields).length > 0 ? fields : undefined,
+ status: status || undefined,
+ subscribed_at: formatDate(context.propsValue.subscribed_at),
+ opted_in_at: formatDate(context.propsValue.opted_in_at),
+ unsubscribed_at: formatDate(context.propsValue.unsubscribed_at),
+ ip_address: ip_address || undefined,
+ optin_ip: optin_ip || undefined,
+ };
+ const body = Object.fromEntries(Object.entries(candidate).filter(([, value]) => value !== undefined));
+ if (Object.keys(body).length === 0) {
+ throw new Error('Provide at least one value to update.');
+ }
+ const response = await mailerLiteApi.request<unknown>({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.PUT,
+ path: `/subscribers/${id}`,
+ resource: `subscriber ${id}`,
+ body,
+ });
+ return mailerLiteApi.unwrapData(response);
+ },
+});
diff --git a/packages/pieces/community/mailer-lite/src/lib/actions/update-webhook.ts b/packages/pieces/community/mailer-lite/src/lib/actions/update-webhook.ts
new file mode 100644
index 00000000000..28b6e84a623
--- /dev/null
+++ b/packages/pieces/community/mailer-lite/src/lib/actions/update-webhook.ts
@@ -0,0 +1,86 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { Property, createAction } from '@activepieces/pieces-framework';
+import { mailerLiteAuth } from '../auth';
+import { mailerLiteApi } from '../common/client';
+import { webhookOutputSchema } from '../output-schemas';
+
+export const updateWebhookAction = createAction({
+ auth: mailerLiteAuth,
+ name: 'update_webhook',
+ classification: 'WRITE',
+ displayName: 'Update Webhook',
+ description: 'Update a webhook, changing only the values you supply.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Update a MailerLite webhook by ID, sending only the values you supply (name, URL, events, enabled, batchable); the rest are kept. A supplied events list replaces the current one. The signing secret is never returned. Get the ID from list_webhooks. Webhooks created by Activepieces MailerLite triggers are listed too; changing one can break that flow. At least one value is required. Idempotent.',
+ idempotent: true,
+ },
+ outputSchema: webhookOutputSchema,
+ props: {
+ webhook_id: Property.ShortText({
+ displayName: 'Webhook ID',
+ description: 'The webhook ID, from list_webhooks.',
+ required: true,
+ }),
+ name: Property.ShortText({
+ displayName: 'Name',
+ description: 'New webhook name.',
+ required: false,
+ }),
+ url: Property.ShortText({
+ displayName: 'URL',
+ description: 'New HTTPS URL MailerLite will POST events to.',
+ required: false,
+ }),
+ events: Property.StaticMultiSelectDropdown({
+ displayName: 'Events',
+ description: 'Replaces the events that trigger the webhook.',
+ required: false,
+ options: { options: mailerLiteApi.webhookEventOptions() },
+ }),
+ enabled: Property.StaticDropdown({
+ displayName: 'Enabled',
+ description: 'Whether the webhook is active.',
+ required: false,
+ options: { options: mailerLiteApi.booleanOptions() },
+ }),
+ batchable: Property.StaticDropdown({
+ displayName: 'Batchable',
+ description: 'Whether events are delivered in batches.',
+ required: false,
+ options: { options: mailerLiteApi.booleanOptions() },
+ }),
+ },
+ async run(context) {
+ const id = mailerLiteApi.requireId({ value: context.propsValue.webhook_id, label: 'Webhook ID' });
+ const { name, url, events, enabled, batchable } = context.propsValue;
+ const body: Record<string, unknown> = {};
+ if (name) {
+ body['name'] = name;
+ }
+ if (url && url.trim()) {
+ body['url'] = url.trim();
+ }
+ if (events && events.length > 0) {
+ body['events'] = events;
+ }
+ if (enabled === 'true' || enabled === 'false') {
+ body['enabled'] = enabled === 'true';
+ }
+ if (batchable === 'true' || batchable === 'false') {
+ body['batchable'] = batchable === 'true';
+ }
+ if (Object.keys(body).length === 0) {
+ throw new Error('Provide at least one value to update.');
+ }
+ const response = await mailerLiteApi.request<unknown>({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.PUT,
+ path: `/webhooks/${id}`,
+ resource: `webhook ${id}`,
+ body,
+ });
+ return mailerLiteApi.withoutSecret(mailerLiteApi.unwrapData(response));
+ },
+});
diff --git a/packages/pieces/community/mailer-lite/src/lib/common/client.ts b/packages/pieces/community/mailer-lite/src/lib/common/client.ts
new file mode 100644
index 00000000000..09dc9e0105b
--- /dev/null
+++ b/packages/pieces/community/mailer-lite/src/lib/common/client.ts
@@ -0,0 +1,190 @@
+import {
+ AuthenticationType,
+ HttpError,
+ HttpMethod,
+ QueryParams,
+ httpClient,
+} from '@activepieces/pieces-common';
+
+const BASE_URL = 'https://connect.mailerlite.com/api';
+
+function isRecord(value: unknown): value is Record<string, unknown> {
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
+}
+
+function describeFieldErrors(errors: unknown): string {
+ if (!isRecord(errors)) {
+ return '';
+ }
+ return Object.entries(errors)
+ .map(([field, messages]) => {
+ const text = Array.isArray(messages) ? messages.map(String).join(', ') : String(messages);
+ return `${field}: ${text}`;
+ })
+ .join('; ');
+}
+
+function toReadableError({ error, resource }: { error: HttpError; resource: string }): Error {
+ const status = error.response.status;
+ const body = error.response.body;
+ const vendorMessage = isRecord(body) && typeof body['message'] === 'string' ? body['message'] : '';
+ switch (status) {
+ case 401:
+ return new Error('MailerLite rejected the API token (invalid or revoked). Reconnect with a valid token.');
+ case 404:
+ return new Error(`MailerLite could not find ${resource}. Check the ID.`);
+ case 410:
+ return new Error(`MailerLite reports ${resource} was already deleted.`);
+ case 422: {
+ const fieldErrors = isRecord(body) ? describeFieldErrors(body['errors']) : '';
+ return new Error(
+ `MailerLite validation failed: ${vendorMessage}${fieldErrors ? ` (${fieldErrors})` : ''}`,
+ );
+ }
+ case 429:
+ return new Error(
+ 'MailerLite rate limit reached (120 requests/minute, 5/minute for imports). Wait and retry.',
+ );
+ case 400:
+ return new Error(`MailerLite rejected the request: ${vendorMessage}`);
+ default:
+ return new Error(`MailerLite request failed with status ${status}: ${vendorMessage || JSON.stringify(body)}`);
+ }
+}
+
+async function request<T>({
+ apiKey,
+ method,
+ path,
+ resource,
+ queryParams,
+ body,
+}: RequestParams): Promise<T> {
+ const query: QueryParams = {};
+ Object.entries(queryParams ?? {}).forEach(([key, value]) => {
+ if (value !== undefined && value !== null && value !== '') {
+ query[key] = String(value);
+ }
+ });
+ try {
+ const response = await httpClient.sendRequest<T>({
+ method,
+ url: `${BASE_URL}${path}`,
+ authentication: { type: AuthenticationType.BEARER_TOKEN, token: apiKey },
+ headers: { Accept: 'application/json' },
+ queryParams: query,
+ body,
+ });
+ return response.body;
+ } catch (error) {
+ if (error instanceof HttpError) {
+ throw toReadableError({ error, resource: resource ?? `the resource at ${path}` });
+ }
+ throw error;
+ }
+}
+
+function readableSdkError({ error, resource }: { error: unknown; resource: string }): unknown {
+ if (!isRecord(error) || !isRecord(error['response']) || typeof error['response']['status'] !== 'number') {
+ return error;
+ }
+ const status = error['response']['status'];
+ if (status === 404) {
+ return new Error(`MailerLite could not find ${resource}; it may not exist or was already deleted.`);
+ }
+ return toReadableError({
+ error: new HttpError(undefined, { status, responseBody: error['response']['data'] }),
+ resource,
+ });
+}
+
+function unwrapData(body: unknown): Record<string, unknown> {
+ if (isRecord(body) && isRecord(body['data'])) {
+ return body['data'];
+ }
+ return isRecord(body) ? body : {};
+}
+
+function withoutSecret(item: unknown): unknown {
+ if (!isRecord(item)) {
+ return item;
+ }
+ return Object.fromEntries(Object.entries(item).filter(([key]) => key !== 'secret'));
+}
+
+function resolveLimit({ value, fallback, max }: { value: number | undefined; fallback: number; max: number }): number {
+ const resolved = Math.trunc(Number(value ?? fallback));
+ if (!Number.isFinite(resolved) || resolved < 1 || resolved > max) {
+ throw new Error(`Limit must be between 1 and ${max}.`);
+ }
+ return resolved;
+}
+
+function resolvePage(value: number | undefined): number | undefined {
+ if (value === undefined || value === null) {
+ return undefined;
+ }
+ const resolved = Math.trunc(Number(value));
+ if (!Number.isFinite(resolved) || resolved < 1) {
+ throw new Error('Page must be 1 or greater.');
+ }
+ return resolved;
+}
+
+function requireId({ value, label }: { value: string | undefined; label: string }): string {
+ const trimmed = (value ?? '').trim();
+ if (!trimmed) {
+ throw new Error(`${label} is required.`);
+ }
+ return encodeURIComponent(trimmed);
+}
+
+const WEBHOOK_EVENTS = [
+ 'subscriber.created',
+ 'subscriber.updated',
+ 'subscriber.unsubscribed',
+ 'subscriber.added_to_group',
+ 'subscriber.removed_from_group',
+ 'subscriber.bounced',
+ 'subscriber.automation_triggered',
+ 'subscriber.automation_completed',
+ 'subscriber.spam_reported',
+ 'subscriber.deleted',
+ 'subscriber.active',
+ 'campaign.sent',
+ 'campaign.click',
+ 'campaign.open',
+];
+
+function webhookEventOptions(): { label: string; value: string }[] {
+ return WEBHOOK_EVENTS.map((event) => ({ label: event, value: event }));
+}
+
+function booleanOptions(): { label: string; value: string }[] {
+ return [
+ { label: 'Yes', value: 'true' },
+ { label: 'No', value: 'false' },
+ ];
+}
+
+type RequestParams = {
+ apiKey: string;
+ method: HttpMethod;
+ path: string;
+ resource?: string;
+ queryParams?: Record<string, string | number | boolean | undefined | null>;
+ body?: unknown;
+};
+
+export const mailerLiteApi = {
+ request,
+ unwrapData,
+ readableSdkError,
+ withoutSecret,
+ isRecord,
+ resolveLimit,
+ resolvePage,
+ requireId,
+ webhookEventOptions,
+ booleanOptions,
+};
diff --git a/packages/pieces/community/mailer-lite/src/lib/output-schemas.ts b/packages/pieces/community/mailer-lite/src/lib/output-schemas.ts
index 6bd7e09f6ea..1a47a34d749 100644
--- a/packages/pieces/community/mailer-lite/src/lib/output-schemas.ts
+++ b/packages/pieces/community/mailer-lite/src/lib/output-schemas.ts
@@ -102,7 +102,7 @@ const single = (fields: Fields): OutputSchema => ({
fields: [{ key: 'data', label: 'Data', children: fields }],
});
-const cursorList = (label: string, fields: Fields): OutputSchema => ({
+const cursorList = ({ label, fields }: { label: string; fields: Fields }): OutputSchema => ({
fields: [
{ key: 'data', label, listItems: fields, labelKey: 'id' },
{ key: 'links', label: 'Links', children: linksFields },
@@ -110,7 +110,7 @@ const cursorList = (label: string, fields: Fields): OutputSchema => ({
],
});
-const pageList = (label: string, fields: Fields): OutputSchema => ({
+const pageList = ({ label, fields }: { label: string; fields: Fields }): OutputSchema => ({
fields: [
{ key: 'data', label, listItems: fields, labelKey: 'name' },
{ key: 'links', label: 'Links', children: linksFields },
@@ -118,15 +118,427 @@ const pageList = (label: string, fields: Fields): OutputSchema => ({
],
});
+const humanize = (key: string): string =>
+ key
+ .split('_')
+ .map((part) => (part.length > 0 ? part[0].toUpperCase() + part.slice(1) : part))
+ .join(' ');
+
+const named = (keys: string[]): Fields => keys.map((key) => ({ key, label: humanize(key) }));
+
+const rates = (keys: string[]): Fields => keys.map((key) => ({ key, label: humanize(key), children: rateFields }));
+
+const segmentFields: Fields = [
+ { key: 'id', label: 'Segment ID' },
+ { key: 'name', label: 'Name' },
+ { key: 'total', label: 'Total Subscribers', format: 'number' },
+ { key: 'automations_using_segment_count', label: 'Automations Using Segment', format: 'number' },
+ { key: 'open_rate', label: 'Open Rate', children: rateFields },
+ { key: 'click_rate', label: 'Click Rate', children: rateFields },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+];
+
+const fieldFields: Fields = [
+ { key: 'id', label: 'Field ID' },
+ { key: 'name', label: 'Name' },
+ { key: 'key', label: 'Key' },
+ { key: 'type', label: 'Type' },
+ { key: 'is_default', label: 'Default Field', format: 'boolean' },
+];
+
+const listedFieldFields: Fields = [
+ ...fieldFields,
+ { key: 'used_in_automations', label: 'Used In Automations', format: 'boolean' },
+];
+
+const automationStatsFields: Fields = [
+ ...named([
+ 'completed_subscribers_count',
+ 'subscribers_in_queue_count',
+ 'sent',
+ 'opens_count',
+ 'unique_opens_count',
+ 'clicks_count',
+ 'unique_clicks_count',
+ 'unsubscribes_count',
+ 'spam_count',
+ 'hard_bounces_count',
+ 'soft_bounces_count',
+ 'social_interactions_count',
+ ]),
+ ...rates([
+ 'bounce_rate',
+ 'click_to_open_rate',
+ 'open_rate',
+ 'click_rate',
+ 'unsubscribe_rate',
+ 'spam_rate',
+ 'hard_bounce_rate',
+ 'soft_bounce_rate',
+ 'forward_rate',
+ 'social_interaction_rate',
+ ]),
+];
+
+const automationFields: Fields = [
+ { key: 'id', label: 'Automation ID' },
+ { key: 'name', label: 'Name' },
+ { key: 'enabled', label: 'Enabled', format: 'boolean' },
+ { key: 'trigger_data', label: 'Trigger Data', children: named(['track_ecommerce', 'broken_workflow', 'complete_workflow']) },
+ { key: 'steps', label: 'Steps' },
+ { key: 'triggers', label: 'Triggers' },
+ { key: 'complete', label: 'Complete', format: 'boolean' },
+ { key: 'broken', label: 'Broken', format: 'boolean' },
+ { key: 'warnings', label: 'Warnings' },
+ { key: 'emails_count', label: 'Emails Count', format: 'number' },
+ { key: 'first_email_screenshot_url', label: 'First Email Screenshot URL', format: 'url' },
+ { key: 'stats', label: 'Stats', children: automationStatsFields },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'has_banned_content', label: 'Has Banned Content', format: 'boolean' },
+ { key: 'building_in_progress', label: 'Building In Progress', format: 'boolean' },
+ { key: 'automation_template_id', label: 'Template ID' },
+ { key: 'automation_template_name', label: 'Template Name' },
+ { key: 'classic_sync_in_progress', label: 'Classic Sync In Progress', format: 'boolean' },
+ { key: 'classic_sync_activate_after', label: 'Classic Sync Activate After' },
+];
+
+const automationDetailFields: Fields = [
+ ...automationFields.filter((field) => field.key !== 'first_email_screenshot_url'),
+ { key: 'heylite_inactive_count', label: 'Heylite Inactive Count', format: 'number' },
+ { key: 'heylite_recommendation_id', label: 'Heylite Recommendation ID' },
+];
+
+const createdAutomationFields: Fields = automationFields.filter(
+ (field) => field.key !== 'first_email_screenshot_url' && field.key !== 'triggers',
+);
+
+const languageFields: Fields = [
+ { key: 'id', label: 'Language ID' },
+ { key: 'shortcode', label: 'Shortcode' },
+ { key: 'iso639', label: 'ISO 639' },
+ { key: 'name', label: 'Name' },
+ { key: 'direction', label: 'Direction' },
+];
+
+const campaignEmailStatsFields: Fields = [
+ ...named([
+ 'sent',
+ 'opens_count',
+ 'clicks_count',
+ 'unsubscribes_count',
+ 'spam_count',
+ 'hard_bounces_count',
+ 'soft_bounces_count',
+ 'deliveries_count',
+ 'forwards_count',
+ 'social_interactions_count',
+ ]),
+ ...rates([
+ 'open_rate',
+ 'click_rate',
+ 'unsubscribe_rate',
+ 'spam_rate',
+ 'hard_bounce_rate',
+ 'soft_bounce_rate',
+ 'delivery_rate',
+ 'forward_rate',
+ 'social_interaction_rate',
+ 'click_to_open_rate',
+ ]),
+];
+
+const campaignEmailFields: Fields = [
+ ...named([
+ 'id',
+ 'account_id',
+ 'emailable_id',
+ 'emailable_type',
+ 'type',
+ 'from',
+ 'from_name',
+ 'reply_to',
+ 'name',
+ 'subject',
+ 'content',
+ 'plain_text',
+ 'screenshot_url',
+ 'uses_new_builder',
+ 'uses_landscape_screenshot',
+ 'generate_screenshot_timestamp',
+ 'is_building_content',
+ 'preview_url',
+ 'report_preview_url',
+ 'created_at',
+ 'updated_at',
+ 'is_designed',
+ 'language_id',
+ 'is_winner',
+ 'send_after',
+ 'track_opens',
+ 'uses_survey',
+ 'uses_quiz',
+ 'preheader',
+ ]),
+ { key: 'language', label: 'Language', children: languageFields },
+ { key: 'stats', label: 'Stats', children: campaignEmailStatsFields },
+];
+
+const filterGroupFields: Fields = [
+ ...groupFields.map((field) => (field.children ? { key: field.key, label: field.label } : field)),
+ ...named(['account_id', 'updated_at', 'deleted_at', 'serial_no']),
+];
+
+const campaignWriteFields: Fields = [
+ ...named([
+ 'id',
+ 'account_id',
+ 'name',
+ 'type',
+ 'status',
+ 'missing_data',
+ 'filter',
+ 'filter_for_humans',
+ 'delivery_schedule',
+ 'language_id',
+ 'created_at',
+ 'updated_at',
+ 'scheduled_for',
+ 'queued_at',
+ 'started_at',
+ 'finished_at',
+ 'stopped_at',
+ 'default_email_id',
+ 'used_in_automations',
+ 'type_for_humans',
+ 'is_stopped',
+ 'has_winner',
+ 'winner_version_for_human',
+ 'winner_sending_time_for_humans',
+ 'winner_selected_manually_at',
+ 'uses_ecommerce',
+ 'ecommerce_stats',
+ 'uses_survey',
+ 'is_smart_sending_index_option_finished',
+ 'is_applied_for_smart_sending_index_option',
+ 'warnings',
+ 'recipients_count',
+ 'next_step',
+ 'is_currently_sending_out',
+ 'can_be_copied',
+ 'has_basic_filter',
+ 'is_eligible_for_sending',
+ 'subscriber_import_limit_exceeded',
+ 'needs_repair',
+ ]),
+ { key: 'settings', label: 'Settings', children: named(['track_opens', 'use_google_analytics', 'ecommerce_tracking']) },
+ { key: 'language', label: 'Language', children: languageFields },
+ { key: 'can', label: 'Permissions', children: named(['update', 'delete', 'send', 'copy', 'resend']) },
+ { key: 'emails', label: 'Emails', listItems: campaignEmailFields, labelKey: 'subject' },
+ {
+ key: 'basic_filter_for_humans',
+ label: 'Audience',
+ children: [
+ { key: 'all_active_subscribers', label: 'All Active Subscribers' },
+ { key: 'included_groups', label: 'Included Groups', listItems: filterGroupFields, labelKey: 'name' },
+ { key: 'excluded_groups', label: 'Excluded Groups' },
+ { key: 'included_segments', label: 'Included Segments' },
+ { key: 'excluded_segments', label: 'Excluded Segments' },
+ ],
+ },
+];
+
+const campaignFields: Fields = [
+ ...campaignWriteFields.map((field) =>
+ field.key === 'emails'
+ ? { ...field, listItems: [...campaignEmailFields, { key: 'click_map', label: 'Click Map' }] }
+ : field,
+ ),
+ { key: 'can_be_scheduled', label: 'Can Be Scheduled', format: 'boolean' },
+ { key: 'cannot_be_scheduled_reason', label: 'Cannot Be Scheduled Reason' },
+];
+
+const formFields: Fields = [
+ { key: 'id', label: 'Form ID' },
+ { key: 'type', label: 'Type' },
+ { key: 'slug', label: 'Slug' },
+ { key: 'name', label: 'Name' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'conversions_count', label: 'Conversions', format: 'number' },
+ { key: 'conversion_rate', label: 'Conversion Rate', children: rateFields },
+ { key: 'opens_count', label: 'Opens Count', format: 'number' },
+ { key: 'settings', label: 'Settings' },
+ { key: 'last_registration_at', label: 'Last Registration At', format: 'datetime' },
+ { key: 'active', label: 'Active', format: 'boolean' },
+ { key: 'is_broken', label: 'Broken', format: 'boolean' },
+ { key: 'has_content', label: 'Has Content', format: 'boolean' },
+ { key: 'used_in_automations', label: 'Used In Automations', format: 'boolean' },
+ { key: 'warnings', label: 'Warnings' },
+ { key: 'double_optin', label: 'Double Opt-in', format: 'boolean' },
+ { key: 'screenshot_url', label: 'Screenshot URL', format: 'url' },
+ { key: 'share_url', label: 'Share URL', format: 'url' },
+ { key: 'groups', label: 'Groups', listItems: groupFields, labelKey: 'name' },
+ { key: 'can', label: 'Permissions', children: named(['update']) },
+ { key: 'conversion_rate_including_children', label: 'Conversion Rate Including Children', children: rateFields },
+ ...named([
+ 'account_id',
+ 'original_name',
+ 'parent_id',
+ 'children',
+ 'has_missing_groups',
+ 'split_test_enabled',
+ 'split_test_finished',
+ 'has_split_tests',
+ 'split_percentage',
+ 'warning_messages',
+ 'uses_new_builder',
+ 'uses_survey',
+ 'can_choose_template',
+ 'is_split_test_winner',
+ 'analytics_reset_at',
+ 'conversions_count_including_children',
+ 'opens_count_including_children',
+ ]),
+];
+
+const formDetailFields: Fields = formFields.map((field) =>
+ field.key === 'settings' ? { ...field, children: named(['double_optin', 'groot_id', 'automated_content_check_performed']) } : field,
+);
+
+const listedFormFields: Fields = formFields.map((field) =>
+ field.key === 'settings' ? { ...field, children: named([
+ 'double_optin',
+ 'form_type',
+ 'groot_id',
+ 'automated_content_check_performed',
+ 'is_first_form_with_content',
+ 'needs_content_refresh',
+ ]) } : field,
+);
+
+const webhookFields: Fields = [
+ { key: 'id', label: 'Webhook ID' },
+ { key: 'name', label: 'Name' },
+ { key: 'url', label: 'URL', format: 'url' },
+ { key: 'events', label: 'Events' },
+ { key: 'enabled', label: 'Enabled', format: 'boolean' },
+ { key: 'batchable', label: 'Batchable', format: 'boolean' },
+ { key: 'is_blocked', label: 'Blocked', format: 'boolean' },
+ { key: 'last_fired_at', label: 'Last Fired At', format: 'datetime' },
+ { key: 'response_code', label: 'Last Response Code' },
+ { key: 'version', label: 'Version' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+];
+
+const subscriberActivityFields: Fields = [
+ { key: 'id', label: 'Activity ID' },
+ { key: 'log_name', label: 'Activity Type' },
+ { key: 'subject_id', label: 'Subject ID' },
+ { key: 'subject_type', label: 'Subject Type' },
+ { key: 'properties', label: 'Properties', children: [
+ { key: 'group_id', label: 'Group ID' },
+ { key: 'group_name', label: 'Group Name' },
+ ] },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+];
+
+const automationActivityFields: Fields = [
+ { key: 'id', label: 'Activity ID' },
+ { key: 'status', label: 'Status' },
+ { key: 'subscriber', label: 'Subscriber' },
+ { key: 'date', label: 'Date', format: 'datetime' },
+ { key: 'scheduled_for', label: 'Scheduled For', format: 'datetime' },
+ { key: 'reason', label: 'Reason' },
+ { key: 'reason_description', label: 'Reason Description' },
+];
+
+const importFields: Fields = [
+ ...named([
+ 'id',
+ 'account_id',
+ 'total',
+ 'processed',
+ 'imported',
+ 'updated',
+ 'errored',
+ 'percent',
+ 'done',
+ 'invalid',
+ 'invalid_count',
+ 'mistyped',
+ 'mistyped_count',
+ 'changed',
+ 'changed_count',
+ 'unchanged',
+ 'unchanged_count',
+ 'unsubscribed',
+ 'unsubscribed_count',
+ 'role_based',
+ 'role_based_count',
+ 'suspicious_format',
+ 'suspicious_format_count',
+ 'duplicate',
+ 'duplicate_count',
+ 'subscriber_limit',
+ 'subscriber_limit_count',
+ 'banned_import_emails_count',
+ 'updated_at',
+ 'undone_at',
+ 'is_stopped_due_to_free_account_limit_exceeded',
+ 'stopped_at',
+ 'undo_started_at',
+ 'finished_at',
+ ]),
+];
+
+const timezoneFields: Fields = [
+ { key: 'id', label: 'Timezone ID' },
+ { key: 'name', label: 'Name' },
+ { key: 'name_for_humans', label: 'Display Name' },
+ { key: 'offset_name', label: 'Offset Name' },
+ { key: 'offset', label: 'Offset', format: 'number' },
+];
+
+const subscriberWithGroupListFields: Fields = [
+ ...subscriberFields,
+ { key: 'location', label: 'Location' },
+ { key: 'groups', label: 'Groups', listItems: groupFields, labelKey: 'name' },
+];
+
+const forgottenSubscriberFields: Fields = [
+ ...webhookSubscriberFields,
+ { key: 'groups', label: 'Group IDs' },
+];
+
+const plainList = ({ label, fields, labelKey = 'name' }: { label: string; fields: Fields; labelKey?: string }): OutputSchema => ({
+ fields: [{ key: 'data', label, listItems: fields, labelKey }],
+});
+
+const withAggregations = ({ schema, keys }: { schema: OutputSchema; keys: string[] }): OutputSchema => ({
+ fields: schema.fields.map((field) =>
+ field.key === 'meta'
+ ? { ...field, children: [...(field.children ?? []), { key: 'aggregations', label: 'Aggregations', children: named(keys) }] }
+ : field,
+ ),
+});
+
+const deleted = ({ idKey, idLabel }: { idKey: string; idLabel: string }): OutputSchema => ({
+ fields: [
+ { key: 'deleted', label: 'Deleted', format: 'boolean' },
+ { key: idKey, label: idLabel },
+ ],
+});
+
export const findSubscriberOutputSchema: OutputSchema = single(subscriberWithGroupsFields);
export const addOrUpdateSubscriberOutputSchema: OutputSchema = single(subscriberWithGroupsFields);
export const unsubscribeSubscriberOutputSchema: OutputSchema = single(unsubscribedSubscriberFields);
-export const listSubscribersOutputSchema: OutputSchema = cursorList('Subscribers', subscriberFields);
+export const listSubscribersOutputSchema: OutputSchema = cursorList({ label: 'Subscribers', fields: subscriberFields });
export const addSubscriberToGroupOutputSchema: OutputSchema = single(groupFields);
export const createGroupOutputSchema: OutputSchema = single(groupFields);
-export const listGroupsOutputSchema: OutputSchema = pageList('Groups', groupFields);
-export const listGroupSubscribersOutputSchema: OutputSchema = cursorList('Subscribers', subscriberFields);
+export const listGroupsOutputSchema: OutputSchema = pageList({ label: 'Groups', fields: groupFields });
+export const listGroupSubscribersOutputSchema: OutputSchema = cursorList({ label: 'Subscribers', fields: subscriberFields });
export const deleteSubscriberOutputSchema: OutputSchema = {
fields: [
@@ -154,3 +566,44 @@ export const subscriberAddedToGroupTriggerOutputSchema: OutputSchema = {
...webhookEnvelopeFields,
],
};
+
+export const updateSubscriberOutputSchema: OutputSchema = { fields: subscriberWithGroupListFields };
+export const forgetSubscriberOutputSchema: OutputSchema = { fields: forgottenSubscriberFields };
+export const subscriberActivityOutputSchema: OutputSchema = plainList({ label: 'Activity', fields: subscriberActivityFields, labelKey: 'log_name' });
+export const countSubscribersOutputSchema: OutputSchema = {
+ fields: [{ key: 'total', label: 'Total Subscribers', format: 'number' }],
+};
+export const importSubscribersOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'import_id', label: 'Import ID' },
+ { key: 'import_progress_url', label: 'Import Progress URL', format: 'url' },
+ ],
+};
+export const importStatusOutputSchema: OutputSchema = { fields: importFields };
+export const findGroupsByNameOutputSchema: OutputSchema = pageList({ label: 'Groups', fields: groupFields });
+export const groupOutputSchema: OutputSchema = { fields: groupFields };
+export const deleteGroupOutputSchema: OutputSchema = deleted({ idKey: 'group_id', idLabel: 'Group ID' });
+export const listSegmentsOutputSchema: OutputSchema = pageList({ label: 'Segments', fields: segmentFields });
+export const listSegmentSubscribersOutputSchema: OutputSchema = cursorList({ label: 'Subscribers', fields: [...subscriberFields, { key: 'groups', label: 'Groups' }] });
+export const segmentOutputSchema: OutputSchema = { fields: segmentFields.filter((field) => field.key !== 'automations_using_segment_count') };
+export const deleteSegmentOutputSchema: OutputSchema = deleted({ idKey: 'segment_id', idLabel: 'Segment ID' });
+export const listFieldsOutputSchema: OutputSchema = pageList({ label: 'Fields', fields: listedFieldFields });
+export const fieldOutputSchema: OutputSchema = { fields: fieldFields };
+export const deleteFieldOutputSchema: OutputSchema = deleted({ idKey: 'field_id', idLabel: 'Field ID' });
+export const listAutomationsOutputSchema: OutputSchema = withAggregations({ schema: pageList({ label: 'Automations', fields: automationFields }), keys: ['workflows', 'drafts', 'unsync', 'all'] });
+export const automationOutputSchema: OutputSchema = { fields: automationDetailFields };
+export const automationActivityOutputSchema: OutputSchema = pageList({ label: 'Activity', fields: automationActivityFields });
+export const deleteAutomationOutputSchema: OutputSchema = deleted({ idKey: 'automation_id', idLabel: 'Automation ID' });
+export const listCampaignsOutputSchema: OutputSchema = withAggregations({ schema: pageList({ label: 'Campaigns', fields: campaignFields }), keys: ['all', 'draft', 'ready', 'sent'] });
+export const campaignOutputSchema: OutputSchema = { fields: campaignFields };
+export const campaignWriteOutputSchema: OutputSchema = { fields: campaignWriteFields };
+export const createAutomationOutputSchema: OutputSchema = { fields: createdAutomationFields };
+export const deleteCampaignOutputSchema: OutputSchema = deleted({ idKey: 'campaign_id', idLabel: 'Campaign ID' });
+export const listCampaignLanguagesOutputSchema: OutputSchema = plainList({ label: 'Languages', fields: languageFields });
+export const listFormsOutputSchema: OutputSchema = withAggregations({ schema: pageList({ label: 'Forms', fields: listedFormFields }), keys: ['popup', 'embedded', 'promotion'] });
+export const formOutputSchema: OutputSchema = { fields: formDetailFields };
+export const listFormSubscribersOutputSchema: OutputSchema = cursorList({ label: 'Subscribers', fields: subscriberFields });
+export const listWebhooksOutputSchema: OutputSchema = pageList({ label: 'Webhooks', fields: webhookFields });
+export const webhookOutputSchema: OutputSchema = { fields: webhookFields };
+export const deleteWebhookOutputSchema: OutputSchema = deleted({ idKey: 'webhook_id', idLabel: 'Webhook ID' });
+export const listTimezonesOutputSchema: OutputSchema = plainList({ label: 'Timezones', fields: timezoneFields });
diff --git a/packages/pieces/community/pipedrive/package.json b/packages/pieces/community/pipedrive/package.json
index 95b35e2c27a..deb995e0262 100644
--- a/packages/pieces/community/pipedrive/package.json
+++ b/packages/pieces/community/pipedrive/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-pipedrive",
- "version": "0.9.0",
+ "version": "0.10.0",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"scripts": {
diff --git a/packages/pieces/community/pipedrive/src/i18n/translation.json b/packages/pieces/community/pipedrive/src/i18n/translation.json
index 560fa8faa21..a2415e3e653 100644
--- a/packages/pieces/community/pipedrive/src/i18n/translation.json
+++ b/packages/pieces/community/pipedrive/src/i18n/translation.json
@@ -225,5 +225,179 @@
"Field to watch for Changes On": "Field to watch for Changes On",
"Stage in Pipeline": "Stage in Pipeline",
"Deal Status": "Deal Status",
- "All(Not Deleted)": "All(Not Deleted)"
-}
\ No newline at end of file
+ "All(Not Deleted)": "All(Not Deleted)",
+ "Get Deal": "Get Deal",
+ "Retrieves a deal by its ID.": "Retrieves a deal by its ID.",
+ "The numeric deal ID (from Search Deals, List Deals or a deal trigger).": "The numeric deal ID (from Search Deals, List Deals or a deal trigger).",
+ "List Deals": "List Deals",
+ "Lists one page of deals, optionally filtered.": "Lists one page of deals, optionally filtered.",
+ "Owner ID": "Owner ID",
+ "Only deals owned by this user ID (from List Users).": "Only deals owned by this user ID (from List Users).",
+ "Only deals linked to this person ID (from Search Persons).": "Only deals linked to this person ID (from Search Persons).",
+ "Only deals linked to this organization ID (from Search Organizations).": "Only deals linked to this organization ID (from Search Organizations).",
+ "Pipeline ID": "Pipeline ID",
+ "Only deals in this pipeline ID (from List Pipelines).": "Only deals in this pipeline ID (from List Pipelines).",
+ "Stage ID": "Stage ID",
+ "Only deals in this stage ID (from List Stages).": "Only deals in this stage ID (from List Stages).",
+ "Only deals with this status. Leave empty for open, won and lost deals.": "Only deals with this status. Leave empty for open, won and lost deals.",
+ "Updated Since": "Updated Since",
+ "Only deals updated at or after this time.": "Only deals updated at or after this time.",
+ "Updated Until": "Updated Until",
+ "Only deals updated before this time.": "Only deals updated before this time.",
+ "Sort By": "Sort By",
+ "Field to sort by. Defaults to ID.": "Field to sort by. Defaults to ID.",
+ "Update Time": "Update Time",
+ "Add Time": "Add Time",
+ "Sort Direction": "Sort Direction",
+ "Sort order. Defaults to ascending.": "Sort order. Defaults to ascending.",
+ "Ascending": "Ascending",
+ "Descending": "Descending",
+ "Limit": "Limit",
+ "Maximum number of items to return in this page (1-500). Defaults to 50.": "Maximum number of items to return in this page (1-500). Defaults to 50.",
+ "Cursor": "Cursor",
+ "The next_cursor value from the previous call, to fetch the next page. Leave empty for the first page.": "The next_cursor value from the previous call, to fetch the next page. Leave empty for the first page.",
+ "Search Deals": "Search Deals",
+ "Searches deals by title, notes or custom field text.": "Searches deals by title, notes or custom field text.",
+ "Text to search for. At least 2 characters, or 1 when Exact Match is Yes.": "Text to search for. At least 2 characters, or 1 when Exact Match is Yes.",
+ "Search In": "Search In",
+ "Fields to search. Leave empty to search all of them.": "Fields to search. Leave empty to search all of them.",
+ "Notes": "Notes",
+ "Yes returns only exact matches of the full term. Leave empty for partial matching.": "Yes returns only exact matches of the full term. Leave empty for partial matching.",
+ "Yes": "Yes",
+ "No": "No",
+ "Only deals with this status. Leave empty for any status.": "Only deals with this status. Leave empty for any status.",
+ "Delete Deal": "Delete Deal",
+ "Deletes a deal.": "Deletes a deal.",
+ "The numeric ID of the deal to delete (from Search Deals or List Deals).": "The numeric ID of the deal to delete (from Search Deals or List Deals).",
+ "List Deal Products": "List Deal Products",
+ "Lists the products attached to a deal.": "Lists the products attached to a deal.",
+ "The numeric deal ID (from Search Deals or List Deals).": "The numeric deal ID (from Search Deals or List Deals).",
+ "Order Number": "Order Number",
+ "Remove Product From Deal": "Remove Product From Deal",
+ "Removes a product line from a deal.": "Removes a product line from a deal.",
+ "The numeric ID of the deal the product is attached to.": "The numeric ID of the deal the product is attached to.",
+ "Deal Product ID": "Deal Product ID",
+ "The id of the row returned by List Deal Products (the attachment ID). This is not the product_id.": "The id of the row returned by List Deal Products (the attachment ID). This is not the product_id.",
+ "Get Person": "Get Person",
+ "Retrieves a person by their ID.": "Retrieves a person by their ID.",
+ "The numeric person ID (from Search Persons, List Persons or a person trigger).": "The numeric person ID (from Search Persons, List Persons or a person trigger).",
+ "List Persons": "List Persons",
+ "Lists one page of persons, optionally filtered.": "Lists one page of persons, optionally filtered.",
+ "Only persons owned by this user ID (from List Users).": "Only persons owned by this user ID (from List Users).",
+ "Only persons linked to this organization ID (from Search Organizations).": "Only persons linked to this organization ID (from Search Organizations).",
+ "Only persons linked to this deal ID (from Search Deals).": "Only persons linked to this deal ID (from Search Deals).",
+ "Only persons updated at or after this time.": "Only persons updated at or after this time.",
+ "Only persons updated before this time.": "Only persons updated before this time.",
+ "Search Persons": "Search Persons",
+ "Searches persons by name, email, phone, notes or custom field text.": "Searches persons by name, email, phone, notes or custom field text.",
+ "Delete Person": "Delete Person",
+ "Deletes a person.": "Deletes a person.",
+ "The numeric ID of the person to delete (from Search Persons or List Persons).": "The numeric ID of the person to delete (from Search Persons or List Persons).",
+ "Get Organization": "Get Organization",
+ "Retrieves an organization by its ID.": "Retrieves an organization by its ID.",
+ "The numeric organization ID (from Search Organizations, List Organizations or an organization trigger).": "The numeric organization ID (from Search Organizations, List Organizations or an organization trigger).",
+ "List Organizations": "List Organizations",
+ "Lists one page of organizations, optionally filtered.": "Lists one page of organizations, optionally filtered.",
+ "Only organizations owned by this user ID (from List Users).": "Only organizations owned by this user ID (from List Users).",
+ "Only organizations updated at or after this time.": "Only organizations updated at or after this time.",
+ "Only organizations updated before this time.": "Only organizations updated before this time.",
+ "Search Organizations": "Search Organizations",
+ "Searches organizations by name, address, notes or custom field text.": "Searches organizations by name, address, notes or custom field text.",
+ "Delete Organization": "Delete Organization",
+ "Deletes an organization.": "Deletes an organization.",
+ "The numeric ID of the organization to delete (from Search Organizations or List Organizations).": "The numeric ID of the organization to delete (from Search Organizations or List Organizations).",
+ "Get Activity": "Get Activity",
+ "Retrieves an activity by its ID.": "Retrieves an activity by its ID.",
+ "The numeric activity ID (from List Activities or an activity trigger).": "The numeric activity ID (from List Activities or an activity trigger).",
+ "List Activities": "List Activities",
+ "Lists one page of activities, optionally filtered.": "Lists one page of activities, optionally filtered.",
+ "Only activities linked to this deal ID (from Search Deals).": "Only activities linked to this deal ID (from Search Deals).",
+ "Only activities linked to this lead ID, a UUID (from Find Lead).": "Only activities linked to this lead ID, a UUID (from Find Lead).",
+ "Only activities linked to this person ID (from Search Persons).": "Only activities linked to this person ID (from Search Persons).",
+ "Only activities linked to this organization ID (from Search Organizations).": "Only activities linked to this organization ID (from Search Organizations).",
+ "Only activities owned by this user ID (from List Users).": "Only activities owned by this user ID (from List Users).",
+ "Yes for completed activities only, No for pending only. Leave empty for both.": "Yes for completed activities only, No for pending only. Leave empty for both.",
+ "Only activities updated at or after this time.": "Only activities updated at or after this time.",
+ "Only activities updated before this time.": "Only activities updated before this time.",
+ "Delete Activity": "Delete Activity",
+ "Deletes an activity.": "Deletes an activity.",
+ "The numeric ID of the activity to delete (from List Activities).": "The numeric ID of the activity to delete (from List Activities).",
+ "Get Lead": "Get Lead",
+ "Retrieves a lead by its ID.": "Retrieves a lead by its ID.",
+ "The lead UUID (from Find Lead or a lead trigger).": "The lead UUID (from Find Lead or a lead trigger).",
+ "Delete Lead": "Delete Lead",
+ "Deletes a lead.": "Deletes a lead.",
+ "The UUID of the lead to delete (from Find Lead).": "The UUID of the lead to delete (from Find Lead).",
+ "Convert Lead to Deal": "Convert Lead to Deal",
+ "Starts converting a lead into a deal.": "Starts converting a lead into a deal.",
+ "The UUID of the lead to convert (from Find Lead).": "The UUID of the lead to convert (from Find Lead).",
+ "Stage for the new deal (from List Stages); its pipeline is used. Set this or Pipeline ID, not both.": "Stage for the new deal (from List Stages); its pipeline is used. Set this or Pipeline ID, not both.",
+ "Pipeline for the new deal (from List Pipelines). Set this or Stage ID, not both.": "Pipeline for the new deal (from List Pipelines). Set this or Stage ID, not both.",
+ "Get Lead Conversion Status": "Get Lead Conversion Status",
+ "Checks the status of a lead-to-deal conversion.": "Checks the status of a lead-to-deal conversion.",
+ "The UUID of the lead that is being converted.": "The UUID of the lead that is being converted.",
+ "Conversion ID": "Conversion ID",
+ "The conversion_id returned by Convert Lead to Deal.": "The conversion_id returned by Convert Lead to Deal.",
+ "Update Note": "Update Note",
+ "Updates an existing note.": "Updates an existing note.",
+ "The numeric ID of the note to update (from Find Notes or Create Note).": "The numeric ID of the note to update (from Find Notes or Create Note).",
+ "New note content. HTML is allowed. Leave empty to keep the current content.": "New note content. HTML is allowed. Leave empty to keep the current content.",
+ "Attach the note to this deal ID (from Search Deals).": "Attach the note to this deal ID (from Search Deals).",
+ "Attach the note to this lead UUID (from Find Lead).": "Attach the note to this lead UUID (from Find Lead).",
+ "Attach the note to this person ID (from Search Persons).": "Attach the note to this person ID (from Search Persons).",
+ "Attach the note to this organization ID (from Search Organizations).": "Attach the note to this organization ID (from Search Organizations).",
+ "Author User ID": "Author User ID",
+ "Make this user ID the note author (from List Users).": "Make this user ID the note author (from List Users).",
+ "Pinned to Deal": "Pinned to Deal",
+ "Yes to pin, No to unpin. Leave empty to keep the current setting.": "Yes to pin, No to unpin. Leave empty to keep the current setting.",
+ "Pinned to Lead": "Pinned to Lead",
+ "Pinned to Person": "Pinned to Person",
+ "Pinned to Organization": "Pinned to Organization",
+ "Delete Note": "Delete Note",
+ "Deletes a note.": "Deletes a note.",
+ "The numeric ID of the note to delete (from Find Notes).": "The numeric ID of the note to delete (from Find Notes).",
+ "Delete Product": "Delete Product",
+ "Deletes a product from the catalog.": "Deletes a product from the catalog.",
+ "The numeric ID of the product to delete (from Find Product or Find Products).": "The numeric ID of the product to delete (from Find Product or Find Products).",
+ "List Pipelines": "List Pipelines",
+ "Lists the sales pipelines.": "Lists the sales pipelines.",
+ "List Stages": "List Stages",
+ "Lists pipeline stages.": "Lists pipeline stages.",
+ "Only stages of this pipeline ID (from List Pipelines). Leave empty for all pipelines.": "Only stages of this pipeline ID (from List Pipelines). Leave empty for all pipelines.",
+ "List Activity Types": "List Activity Types",
+ "Lists the activity types of the company.": "Lists the activity types of the company.",
+ "List Users": "List Users",
+ "Lists the users of the company.": "Lists the users of the company.",
+ "Get Current User": "Get Current User",
+ "Retrieves the connected Pipedrive user.": "Retrieves the connected Pipedrive user.",
+ "Merge Deals": "Merge Deals",
+ "Merge Persons": "Merge Persons",
+ "Merge Organizations": "Merge Organizations",
+ "Merges one deal into another, removing the first.": "Merges one deal into another, removing the first.",
+ "Merges one person into another, removing the first.": "Merges one person into another, removing the first.",
+ "Merges one organization into another, removing the first.": "Merges one organization into another, removing the first.",
+ "Start": "Start",
+ "Activity Type ID": "Activity Type ID",
+ "Target": "Target",
+ "Start Date": "Start Date",
+ "Active": "Active",
+ "Outcome": "Outcome",
+ "User ID": "User ID",
+ "Deal ID To Merge Away (this deal is removed)": "Deal ID To Merge Away (this deal is removed)",
+ "Surviving Deal ID (this deal is kept)": "Surviving Deal ID (this deal is kept)",
+ "Person ID To Merge Away (this person is removed)": "Person ID To Merge Away (this person is removed)",
+ "Surviving Person ID (this person is kept)": "Surviving Person ID (this person is kept)",
+ "Organization ID To Merge Away (this organization is removed)": "Organization ID To Merge Away (this organization is removed)",
+ "Surviving Organization ID (this organization is kept)": "Surviving Organization ID (this organization is kept)",
+ "Zero-based offset of the first item to return. Pass the next_start value from the previous call to fetch the next page. Leave empty for the first page.": "Zero-based offset of the first item to return. Pass the next_start value from the previous call to fetch the next page. Leave empty for the first page.",
+ "Maximum number of items to return in this page (1-50). Defaults to 50.": "Maximum number of items to return in this page (1-50). Defaults to 50.",
+ "The numeric ID of the deal that will be CONSUMED and no longer exist after the merge.": "The numeric ID of the deal that will be CONSUMED and no longer exist after the merge.",
+ "The numeric ID of the deal that SURVIVES the merge and receives the other deal's data.": "The numeric ID of the deal that SURVIVES the merge and receives the other deal's data.",
+ "The numeric ID of the person that will be CONSUMED and no longer exist after the merge.": "The numeric ID of the person that will be CONSUMED and no longer exist after the merge.",
+ "The numeric ID of the person that SURVIVES the merge and will NOT be overwritten.": "The numeric ID of the person that SURVIVES the merge and will NOT be overwritten.",
+ "The numeric ID of the organization that will be CONSUMED and no longer exist after the merge.": "The numeric ID of the organization that will be CONSUMED and no longer exist after the merge.",
+ "The numeric ID of the organization that SURVIVES the merge and will NOT be overwritten.": "The numeric ID of the organization that SURVIVES the merge and will NOT be overwritten.",
+ "Company": "Company",
+ "Sum": "Sum",
+ "Connected": "Connected"
+}
diff --git a/packages/pieces/community/pipedrive/src/index.ts b/packages/pieces/community/pipedrive/src/index.ts
index f8e042764bd..4b4e8de6c31 100644
--- a/packages/pieces/community/pipedrive/src/index.ts
+++ b/packages/pieces/community/pipedrive/src/index.ts
@@ -1,5 +1,5 @@
import { createCustomApiCallAction } from '@activepieces/pieces-common';
-import { OAuth2PropertyValue, PieceAuth, createPiece } from '@activepieces/pieces-framework';
+import { OAuth2PropertyValue, createPiece } from '@activepieces/pieces-framework';
import { PieceCategory } from '@activepieces/pieces-framework';
import { newActivity } from './lib/trigger/new-activity';
import { newDeal } from './lib/trigger/new-deal';
@@ -44,13 +44,45 @@ import { findDealAction } from './lib/actions/find-deal';
import { findActivityAction } from './lib/actions/find-activity';
import { updateProductAction } from './lib/actions/update-product';
import { findLeadAction } from './lib/actions/find-leads';
+import { getDealAction } from './lib/actions/get-deal';
+import { listDealsAction } from './lib/actions/list-deals';
+import { searchDealsAction } from './lib/actions/search-deals';
+import { deleteDealAction } from './lib/actions/delete-deal';
+import { listDealProductsAction } from './lib/actions/list-deal-products';
+import { removeProductFromDealAction } from './lib/actions/remove-product-from-deal';
+import { getPersonAction } from './lib/actions/get-person';
+import { listPersonsAction } from './lib/actions/list-persons';
+import { searchPersonsAction } from './lib/actions/search-persons';
+import { deletePersonAction } from './lib/actions/delete-person';
+import { getOrganizationAction } from './lib/actions/get-organization';
+import { listOrganizationsAction } from './lib/actions/list-organizations';
+import { searchOrganizationsAction } from './lib/actions/search-organizations';
+import { deleteOrganizationAction } from './lib/actions/delete-organization';
+import { getActivityAction } from './lib/actions/get-activity';
+import { listActivitiesAction } from './lib/actions/list-activities';
+import { deleteActivityAction } from './lib/actions/delete-activity';
+import { getLeadAction } from './lib/actions/get-lead';
+import { deleteLeadAction } from './lib/actions/delete-lead';
+import { convertLeadToDealAction } from './lib/actions/convert-lead-to-deal';
+import { getLeadConversionStatusAction } from './lib/actions/get-lead-conversion-status';
+import { updateNoteAction } from './lib/actions/update-note';
+import { deleteNoteAction } from './lib/actions/delete-note';
+import { deleteProductAction } from './lib/actions/delete-product';
+import { listPipelinesAction } from './lib/actions/list-pipelines';
+import { listStagesAction } from './lib/actions/list-stages';
+import { listActivityTypesAction } from './lib/actions/list-activity-types';
+import { listUsersAction } from './lib/actions/list-users';
+import { getCurrentUserAction } from './lib/actions/get-current-user';
+import { mergeDealsAction } from './lib/actions/merge-deals';
+import { mergePersonsAction } from './lib/actions/merge-persons';
+import { mergeOrganizationsAction } from './lib/actions/merge-organizations';
import { pipedriveAuth } from './lib/auth';
export const pipedrive = createPiece({
displayName: 'Pipedrive',
description: 'Sales CRM and pipeline management software',
- minimumSupportedRelease: '0.30.0',
+ minimumSupportedRelease: '0.88.2',
logoUrl: 'https://cdn.activepieces.com/pieces/pipedrive.png',
categories: [PieceCategory.SALES_AND_CRM],
auth: pipedriveAuth,
@@ -84,8 +116,45 @@ export const pipedrive = createPiece({
findActivityAction,
findUserAction,
findLeadAction,
+ getDealAction,
+ listDealsAction,
+ searchDealsAction,
+ deleteDealAction,
+ listDealProductsAction,
+ removeProductFromDealAction,
+ getPersonAction,
+ listPersonsAction,
+ searchPersonsAction,
+ deletePersonAction,
+ getOrganizationAction,
+ listOrganizationsAction,
+ searchOrganizationsAction,
+ deleteOrganizationAction,
+ getActivityAction,
+ listActivitiesAction,
+ deleteActivityAction,
+ getLeadAction,
+ deleteLeadAction,
+ convertLeadToDealAction,
+ getLeadConversionStatusAction,
+ updateNoteAction,
+ deleteNoteAction,
+ deleteProductAction,
+ listPipelinesAction,
+ listStagesAction,
+ listActivityTypesAction,
+ listUsersAction,
+ getCurrentUserAction,
+ mergeDealsAction,
+ mergePersonsAction,
+ mergeOrganizationsAction,
createCustomApiCallAction({
- baseUrl: () => 'https://api.pipedrive.com/api/v2',
+ baseUrl: (auth) => {
+ const apiDomain = auth?.data?.['api_domain'];
+ return typeof apiDomain === 'string' && apiDomain.length > 0
+ ? `${apiDomain}/api/v2`
+ : 'https://api.pipedrive.com/api/v2';
+ },
auth: pipedriveAuth,
authMapping: async (auth) => ({
Authorization: `Bearer ${(auth as OAuth2PropertyValue).access_token}`,
diff --git a/packages/pieces/community/pipedrive/src/lib/actions/convert-lead-to-deal.ts b/packages/pieces/community/pipedrive/src/lib/actions/convert-lead-to-deal.ts
new file mode 100644
index 00000000000..b6d1b743326
--- /dev/null
+++ b/packages/pieces/community/pipedrive/src/lib/actions/convert-lead-to-deal.ts
@@ -0,0 +1,62 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, isNil, Property } from '@activepieces/pieces-framework';
+import { pipedriveAuth } from '../auth';
+import { PipedriveEnvelope, pipedriveAtomic } from '../common/atomic-helpers';
+import { convertLeadToDealActionOutputSchema } from '../output-schemas';
+
+export const convertLeadToDealAction = createAction({
+ auth: pipedriveAuth,
+ name: 'convert-lead-to-deal',
+ outputSchema: convertLeadToDealActionOutputSchema,
+ classification: 'WRITE',
+ displayName: 'Convert Lead to Deal',
+ description: 'Starts converting a lead into a deal.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Starts an asynchronous conversion of a lead into a deal and returns a conversion_id, not the deal. The new deal_id comes from Get Lead Conversion Status (call it with the lead ID and conversion_id until status is completed). On success Pipedrive deletes the lead. Set Stage ID or Pipeline ID, not both (Pipedrive ignores the pipeline when a stage is given); leave both empty to let Pipedrive pick the placement. Not safe to retry: poll the status instead of calling this again.',
+ idempotent: false,
+ },
+ props: {
+ leadId: Property.ShortText({
+ displayName: 'Lead ID',
+ description: 'The UUID of the lead to convert (from Find Lead).',
+ required: true,
+ }),
+ stageId: Property.Number({
+ displayName: 'Stage ID',
+ description:
+ 'Stage for the new deal (from List Stages); its pipeline is used. Set this or Pipeline ID, not both.',
+ required: false,
+ }),
+ pipelineId: Property.Number({
+ displayName: 'Pipeline ID',
+ description:
+ 'Pipeline for the new deal (from List Pipelines). Set this or Stage ID, not both.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const { stageId, pipelineId } = context.propsValue;
+ if (!isNil(stageId) && !isNil(pipelineId)) {
+ throw new Error(
+ 'Set either Stage ID or Pipeline ID, not both: Pipedrive ignores Pipeline ID when Stage ID is given.',
+ );
+ }
+ const leadId = context.propsValue.leadId.trim();
+ const response = await pipedriveAtomic.call<PipedriveEnvelope<{ conversion_id: string }>>({
+ auth: context.auth,
+ method: HttpMethod.POST,
+ resourceUri: `/v2/leads/${encodeURIComponent(leadId)}/convert/deal`,
+ resourceLabel: `Lead ${leadId}`,
+ body: {
+ stage_id: stageId,
+ pipeline_id: pipelineId,
+ },
+ });
+ return {
+ conversion_id: response.data.conversion_id,
+ lead_id: leadId,
+ };
+ },
+});
diff --git a/packages/pieces/community/pipedrive/src/lib/actions/delete-activity.ts b/packages/pieces/community/pipedrive/src/lib/actions/delete-activity.ts
new file mode 100644
index 00000000000..283ef763f52
--- /dev/null
+++ b/packages/pieces/community/pipedrive/src/lib/actions/delete-activity.ts
@@ -0,0 +1,36 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { pipedriveAuth } from '../auth';
+import { PipedriveEnvelope, pipedriveAtomic } from '../common/atomic-helpers';
+import { deleteRecordActionOutputSchema } from '../output-schemas';
+
+export const deleteActivityAction = createAction({
+ auth: pipedriveAuth,
+ name: 'delete-activity',
+ outputSchema: deleteRecordActionOutputSchema,
+ classification: 'DESTRUCTIVE',
+ displayName: 'Delete Activity',
+ description: 'Deletes an activity.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Deletes one activity by numeric ID. The activity is soft-deleted; Pipedrive purges it after 30 days and it cannot be restored via this piece. To mark an activity complete instead, use Update Activity. Not safe to retry blindly.',
+ idempotent: false,
+ },
+ props: {
+ activityId: Property.Number({
+ displayName: 'Activity ID',
+ description: 'The numeric ID of the activity to delete (from List Activities).',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const { activityId } = context.propsValue;
+ return pipedriveAtomic.call<PipedriveEnvelope<{ id: number }>>({
+ auth: context.auth,
+ method: HttpMethod.DELETE,
+ resourceUri: `/v2/activities/${activityId}`,
+ resourceLabel: `Activity ${activityId}`,
+ });
+ },
+});
diff --git a/packages/pieces/community/pipedrive/src/lib/actions/delete-deal.ts b/packages/pieces/community/pipedrive/src/lib/actions/delete-deal.ts
new file mode 100644
index 00000000000..7e31af481ea
--- /dev/null
+++ b/packages/pieces/community/pipedrive/src/lib/actions/delete-deal.ts
@@ -0,0 +1,36 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { pipedriveAuth } from '../auth';
+import { PipedriveEnvelope, pipedriveAtomic } from '../common/atomic-helpers';
+import { deleteRecordActionOutputSchema } from '../output-schemas';
+
+export const deleteDealAction = createAction({
+ auth: pipedriveAuth,
+ name: 'delete-deal',
+ outputSchema: deleteRecordActionOutputSchema,
+ classification: 'DESTRUCTIVE',
+ displayName: 'Delete Deal',
+ description: 'Deletes a deal.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Deletes one deal by its numeric ID. The deal is soft-deleted; Pipedrive purges it after 30 days and it cannot be restored via this piece. To close a deal as won or lost instead, use Update Deal. Not safe to retry blindly.',
+ idempotent: false,
+ },
+ props: {
+ dealId: Property.Number({
+ displayName: 'Deal ID',
+ description: 'The numeric ID of the deal to delete (from Search Deals or List Deals).',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const { dealId } = context.propsValue;
+ return pipedriveAtomic.call<PipedriveEnvelope<{ id: number }>>({
+ auth: context.auth,
+ method: HttpMethod.DELETE,
+ resourceUri: `/v2/deals/${dealId}`,
+ resourceLabel: `Deal ${dealId}`,
+ });
+ },
+});
diff --git a/packages/pieces/community/pipedrive/src/lib/actions/delete-lead.ts b/packages/pieces/community/pipedrive/src/lib/actions/delete-lead.ts
new file mode 100644
index 00000000000..1d930d13103
--- /dev/null
+++ b/packages/pieces/community/pipedrive/src/lib/actions/delete-lead.ts
@@ -0,0 +1,36 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { pipedriveAuth } from '../auth';
+import { PipedriveEnvelope, pipedriveAtomic } from '../common/atomic-helpers';
+import { deleteRecordWithAdditionalDataActionOutputSchema } from '../output-schemas';
+
+export const deleteLeadAction = createAction({
+ auth: pipedriveAuth,
+ name: 'delete-lead',
+ outputSchema: deleteRecordWithAdditionalDataActionOutputSchema,
+ classification: 'DESTRUCTIVE',
+ displayName: 'Delete Lead',
+ description: 'Deletes a lead.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Deletes one lead by its UUID; it cannot be restored via this piece. To turn a lead into a deal instead, use Convert Lead to Deal; to archive it, use Update Lead. Safe to retry: a repeat call on an already deleted record also succeeds.',
+ idempotent: true,
+ },
+ props: {
+ leadId: Property.ShortText({
+ displayName: 'Lead ID',
+ description: 'The UUID of the lead to delete (from Find Lead).',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const leadId = encodeURIComponent(context.propsValue.leadId.trim());
+ return pipedriveAtomic.call<PipedriveEnvelope<{ id: string }>>({
+ auth: context.auth,
+ method: HttpMethod.DELETE,
+ resourceUri: `/v1/leads/${leadId}`,
+ resourceLabel: `Lead ${context.propsValue.leadId}`,
+ });
+ },
+});
diff --git a/packages/pieces/community/pipedrive/src/lib/actions/delete-note.ts b/packages/pieces/community/pipedrive/src/lib/actions/delete-note.ts
new file mode 100644
index 00000000000..61572bf3b72
--- /dev/null
+++ b/packages/pieces/community/pipedrive/src/lib/actions/delete-note.ts
@@ -0,0 +1,36 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { pipedriveAuth } from '../auth';
+import { PipedriveEnvelope, pipedriveAtomic } from '../common/atomic-helpers';
+import { deleteNoteActionOutputSchema } from '../output-schemas';
+
+export const deleteNoteAction = createAction({
+ auth: pipedriveAuth,
+ name: 'delete-note',
+ outputSchema: deleteNoteActionOutputSchema,
+ classification: 'DESTRUCTIVE',
+ displayName: 'Delete Note',
+ description: 'Deletes a note.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Deletes one note by numeric ID; it cannot be restored via this piece. To change a note\'s text or pins instead, use Update Note. Not safe to retry blindly.',
+ idempotent: false,
+ },
+ props: {
+ noteId: Property.Number({
+ displayName: 'Note ID',
+ description: 'The numeric ID of the note to delete (from Find Notes).',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const { noteId } = context.propsValue;
+ return pipedriveAtomic.call<PipedriveEnvelope<boolean>>({
+ auth: context.auth,
+ method: HttpMethod.DELETE,
+ resourceUri: `/v1/notes/${noteId}`,
+ resourceLabel: `Note ${noteId}`,
+ });
+ },
+});
diff --git a/packages/pieces/community/pipedrive/src/lib/actions/delete-organization.ts b/packages/pieces/community/pipedrive/src/lib/actions/delete-organization.ts
new file mode 100644
index 00000000000..7fcf500bc1a
--- /dev/null
+++ b/packages/pieces/community/pipedrive/src/lib/actions/delete-organization.ts
@@ -0,0 +1,37 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { pipedriveAuth } from '../auth';
+import { PipedriveEnvelope, pipedriveAtomic } from '../common/atomic-helpers';
+import { deleteRecordActionOutputSchema } from '../output-schemas';
+
+export const deleteOrganizationAction = createAction({
+ auth: pipedriveAuth,
+ name: 'delete-organization',
+ outputSchema: deleteRecordActionOutputSchema,
+ classification: 'DESTRUCTIVE',
+ displayName: 'Delete Organization',
+ description: 'Deletes an organization.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Deletes one organization by numeric ID. The organization is soft-deleted; Pipedrive purges it after 30 days and it cannot be restored via this piece. Not safe to retry blindly.',
+ idempotent: false,
+ },
+ props: {
+ organizationId: Property.Number({
+ displayName: 'Organization ID',
+ description:
+ 'The numeric ID of the organization to delete (from Search Organizations or List Organizations).',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const { organizationId } = context.propsValue;
+ return pipedriveAtomic.call<PipedriveEnvelope<{ id: number }>>({
+ auth: context.auth,
+ method: HttpMethod.DELETE,
+ resourceUri: `/v2/organizations/${organizationId}`,
+ resourceLabel: `Organization ${organizationId}`,
+ });
+ },
+});
diff --git a/packages/pieces/community/pipedrive/src/lib/actions/delete-person.ts b/packages/pieces/community/pipedrive/src/lib/actions/delete-person.ts
new file mode 100644
index 00000000000..cacc4376488
--- /dev/null
+++ b/packages/pieces/community/pipedrive/src/lib/actions/delete-person.ts
@@ -0,0 +1,36 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { pipedriveAuth } from '../auth';
+import { PipedriveEnvelope, pipedriveAtomic } from '../common/atomic-helpers';
+import { deleteRecordActionOutputSchema } from '../output-schemas';
+
+export const deletePersonAction = createAction({
+ auth: pipedriveAuth,
+ name: 'delete-person',
+ outputSchema: deleteRecordActionOutputSchema,
+ classification: 'DESTRUCTIVE',
+ displayName: 'Delete Person',
+ description: 'Deletes a person.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Deletes one person (contact) by numeric ID. The person is soft-deleted; Pipedrive purges it after 30 days and it cannot be restored via this piece. Not safe to retry blindly.',
+ idempotent: false,
+ },
+ props: {
+ personId: Property.Number({
+ displayName: 'Person ID',
+ description: 'The numeric ID of the person to delete (from Search Persons or List Persons).',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const { personId } = context.propsValue;
+ return pipedriveAtomic.call<PipedriveEnvelope<{ id: number }>>({
+ auth: context.auth,
+ method: HttpMethod.DELETE,
+ resourceUri: `/v2/persons/${personId}`,
+ resourceLabel: `Person ${personId}`,
+ });
+ },
+});
diff --git a/packages/pieces/community/pipedrive/src/lib/actions/delete-product.ts b/packages/pieces/community/pipedrive/src/lib/actions/delete-product.ts
new file mode 100644
index 00000000000..7458fe247c2
--- /dev/null
+++ b/packages/pieces/community/pipedrive/src/lib/actions/delete-product.ts
@@ -0,0 +1,36 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { pipedriveAuth } from '../auth';
+import { PipedriveEnvelope, pipedriveAtomic } from '../common/atomic-helpers';
+import { deleteRecordWithAdditionalDataActionOutputSchema } from '../output-schemas';
+
+export const deleteProductAction = createAction({
+ auth: pipedriveAuth,
+ name: 'delete-product',
+ outputSchema: deleteRecordWithAdditionalDataActionOutputSchema,
+ classification: 'DESTRUCTIVE',
+ displayName: 'Delete Product',
+ description: 'Deletes a product from the catalog.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Deletes one product from the product catalog by numeric ID. The product is soft-deleted; Pipedrive purges it after 30 days and it cannot be restored via this piece. To detach a product from a single deal instead, use Remove Product From Deal. Safe to retry: a repeat call on an already deleted record also succeeds.',
+ idempotent: true,
+ },
+ props: {
+ productId: Property.Number({
+ displayName: 'Product ID',
+ description: 'The numeric ID of the product to delete (from Find Product or Find Products).',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const { productId } = context.propsValue;
+ return pipedriveAtomic.call<PipedriveEnvelope<{ id: number }>>({
+ auth: context.auth,
+ method: HttpMethod.DELETE,
+ resourceUri: `/v2/products/${productId}`,
+ resourceLabel: `Product ${productId}`,
+ });
+ },
+});
diff --git a/packages/pieces/community/pipedrive/src/lib/actions/find-deal.ts b/packages/pieces/community/pipedrive/src/lib/actions/find-deal.ts
index a4900506018..e9059f9c487 100644
--- a/packages/pieces/community/pipedrive/src/lib/actions/find-deal.ts
+++ b/packages/pieces/community/pipedrive/src/lib/actions/find-deal.ts
@@ -19,7 +19,7 @@ export const findDealAction = createAction({
classification: 'SEARCH',
displayName: 'Find Deal',
description: 'Finds a deal by any field.',
- audience: 'both',
+ audience: 'human',
aiMetadata: {
description:
'Finds a single deal by matching a chosen field to a value (exact match), returning the most recently updated match. Use to locate a deal before reading or updating it; pick the field via Search Field and supply its value. To list deals tied to a specific person, use Find Deals Associated With Person instead. Read-only and idempotent (a temporary search filter is created and removed internally).',
diff --git a/packages/pieces/community/pipedrive/src/lib/actions/find-deals-associated-with-person.ts b/packages/pieces/community/pipedrive/src/lib/actions/find-deals-associated-with-person.ts
index 31bcdf8e31c..99ccca721ac 100644
--- a/packages/pieces/community/pipedrive/src/lib/actions/find-deals-associated-with-person.ts
+++ b/packages/pieces/community/pipedrive/src/lib/actions/find-deals-associated-with-person.ts
@@ -19,7 +19,7 @@ export const findDealsAssociatedWithPersonAction = createAction({
classification: 'SEARCH',
displayName: 'Find Deals Associated With Person',
description: 'Finds multiple deals related to a specific person.',
- audience: 'both',
+ audience: 'human',
aiMetadata: {
description:
'Lists all deals linked to a given person, identified by their numeric person ID, sorted by most recently updated. Use when you already have a person and need their associated deals; to look up a deal by a field value instead, use Find Deal. Read-only and idempotent.',
diff --git a/packages/pieces/community/pipedrive/src/lib/actions/find-organization.ts b/packages/pieces/community/pipedrive/src/lib/actions/find-organization.ts
index 75c6d74b7bc..df095ea4ddf 100644
--- a/packages/pieces/community/pipedrive/src/lib/actions/find-organization.ts
+++ b/packages/pieces/community/pipedrive/src/lib/actions/find-organization.ts
@@ -19,7 +19,7 @@ export const findOrganizationAction = createAction({
classification: 'SEARCH',
displayName: 'Find Organization',
description: 'Finds an organization.',
- audience: 'both',
+ audience: 'human',
aiMetadata: {
description:
'Finds a single organization by matching a chosen field to a value (exact match), returning the most recently updated match. Use to locate an organization before reading or updating it; pick the field via Search Field and supply its value. Read-only and idempotent (a temporary search filter is created and removed internally).',
diff --git a/packages/pieces/community/pipedrive/src/lib/actions/find-person.ts b/packages/pieces/community/pipedrive/src/lib/actions/find-person.ts
index a6236b97a7f..67dc42e0fbb 100644
--- a/packages/pieces/community/pipedrive/src/lib/actions/find-person.ts
+++ b/packages/pieces/community/pipedrive/src/lib/actions/find-person.ts
@@ -19,7 +19,7 @@ export const findPersonAction = createAction({
classification: 'SEARCH',
displayName: 'Find Person',
description: 'Finds a person.',
- audience: 'both',
+ audience: 'human',
aiMetadata: { description: 'Look up a single person by an exact value in a chosen field (e.g. email, phone, name, or a custom field). Pick this when you need to resolve a person record to its ID or details before acting on it. Effectively read-only (it creates and removes a temporary search filter) and returns the most recently updated match.', idempotent: true },
props: {
searchField: searchFieldProp('person'),
diff --git a/packages/pieces/community/pipedrive/src/lib/actions/get-activity.ts b/packages/pieces/community/pipedrive/src/lib/actions/get-activity.ts
new file mode 100644
index 00000000000..40d3cbf6f30
--- /dev/null
+++ b/packages/pieces/community/pipedrive/src/lib/actions/get-activity.ts
@@ -0,0 +1,37 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { pipedriveAuth } from '../auth';
+import { PipedriveEnvelope, pipedriveAtomic } from '../common/atomic-helpers';
+import { getActivityActionOutputSchema } from '../output-schemas';
+
+export const getActivityAction = createAction({
+ auth: pipedriveAuth,
+ name: 'get-activity',
+ outputSchema: getActivityActionOutputSchema,
+ classification: 'READ',
+ displayName: 'Get Activity',
+ description: 'Retrieves an activity by its ID.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Reads one activity (call, meeting, task, etc.) by numeric ID, including its attendees and linked deal, lead, person and organization. Use when you already hold the activity ID; to browse activities of a deal or person use List Activities, and for an exact single-field match use Find Activity. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ props: {
+ activityId: Property.Number({
+ displayName: 'Activity ID',
+ description: 'The numeric activity ID (from List Activities or an activity trigger).',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const { activityId } = context.propsValue;
+ return pipedriveAtomic.call<PipedriveEnvelope<Record<string, unknown>>>({
+ auth: context.auth,
+ method: HttpMethod.GET,
+ resourceUri: `/v2/activities/${activityId}`,
+ resourceLabel: `Activity ${activityId}`,
+ query: { include_fields: 'attendees' },
+ });
+ },
+});
diff --git a/packages/pieces/community/pipedrive/src/lib/actions/get-current-user.ts b/packages/pieces/community/pipedrive/src/lib/actions/get-current-user.ts
new file mode 100644
index 00000000000..ebe9f7d0aec
--- /dev/null
+++ b/packages/pieces/community/pipedrive/src/lib/actions/get-current-user.ts
@@ -0,0 +1,29 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction } from '@activepieces/pieces-framework';
+import { pipedriveAuth } from '../auth';
+import { PipedriveEnvelope, pipedriveAtomic } from '../common/atomic-helpers';
+import { getCurrentUserActionOutputSchema } from '../output-schemas';
+
+export const getCurrentUserAction = createAction({
+ auth: pipedriveAuth,
+ name: 'get-current-user',
+ outputSchema: getCurrentUserActionOutputSchema,
+ classification: 'READ',
+ displayName: 'Get Current User',
+ description: 'Retrieves the connected Pipedrive user.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns the user this connection acts as, with user ID, email, timezone, default currency and company details. Use it for "me" or "my deals" requests to get your own Owner ID; use List Users for teammates. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ props: {},
+ async run(context) {
+ return pipedriveAtomic.call<PipedriveEnvelope<Record<string, unknown>>>({
+ auth: context.auth,
+ method: HttpMethod.GET,
+ resourceUri: '/v1/users/me',
+ resourceLabel: 'the connected user',
+ });
+ },
+});
diff --git a/packages/pieces/community/pipedrive/src/lib/actions/get-deal.ts b/packages/pieces/community/pipedrive/src/lib/actions/get-deal.ts
new file mode 100644
index 00000000000..5217959cdd8
--- /dev/null
+++ b/packages/pieces/community/pipedrive/src/lib/actions/get-deal.ts
@@ -0,0 +1,47 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { pipedriveAuth } from '../auth';
+import { pipedriveTransformCustomFields } from '../common';
+import { PipedriveEnvelope, pipedriveAtomic } from '../common/atomic-helpers';
+import { DEAL_OPTIONAL_FIELDS } from '../common/constants';
+import { getDealActionOutputSchema } from '../output-schemas';
+
+export const getDealAction = createAction({
+ auth: pipedriveAuth,
+ name: 'get-deal',
+ outputSchema: getDealActionOutputSchema,
+ classification: 'READ',
+ displayName: 'Get Deal',
+ description: 'Retrieves a deal by its ID.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Reads one deal by its numeric ID, including activity/product counters and custom fields by their names. Use when you already hold the deal ID; to locate a deal by text use Search Deals, and for an exact single-field match use Find Deal. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ props: {
+ dealId: Property.Number({
+ displayName: 'Deal ID',
+ description: 'The numeric deal ID (from Search Deals, List Deals or a deal trigger).',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const { dealId } = context.propsValue;
+ const response = await pipedriveAtomic.call<PipedriveEnvelope<Record<string, unknown>>>({
+ auth: context.auth,
+ method: HttpMethod.GET,
+ resourceUri: `/v2/deals/${dealId}`,
+ resourceLabel: `Deal ${dealId}`,
+ query: { include_fields: DEAL_OPTIONAL_FIELDS.join(',') },
+ });
+ const customFields = await pipedriveAtomic.fetchCustomFieldDefinitions({
+ auth: context.auth,
+ resourceUri: '/v1/dealFields',
+ });
+ return {
+ success: response.success,
+ data: pipedriveTransformCustomFields(customFields, response.data),
+ };
+ },
+});
diff --git a/packages/pieces/community/pipedrive/src/lib/actions/get-lead-conversion-status.ts b/packages/pieces/community/pipedrive/src/lib/actions/get-lead-conversion-status.ts
new file mode 100644
index 00000000000..ac154ea837f
--- /dev/null
+++ b/packages/pieces/community/pipedrive/src/lib/actions/get-lead-conversion-status.ts
@@ -0,0 +1,49 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { pipedriveAuth } from '../auth';
+import { PipedriveEnvelope, pipedriveAtomic } from '../common/atomic-helpers';
+import { getLeadConversionStatusActionOutputSchema } from '../output-schemas';
+
+export const getLeadConversionStatusAction = createAction({
+ auth: pipedriveAuth,
+ name: 'get-lead-conversion-status',
+ outputSchema: getLeadConversionStatusActionOutputSchema,
+ classification: 'READ',
+ displayName: 'Get Lead Conversion Status',
+ description: 'Checks the status of a lead-to-deal conversion.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Reads the current status of a conversion started by Convert Lead to Deal: not_started, running, completed, failed or rejected. When completed, deal_id holds the new deal (read it with Get Deal). Makes one check per call; call again after a short wait while running. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ props: {
+ leadId: Property.ShortText({
+ displayName: 'Lead ID',
+ description: 'The UUID of the lead that is being converted.',
+ required: true,
+ }),
+ conversionId: Property.ShortText({
+ displayName: 'Conversion ID',
+ description: 'The conversion_id returned by Convert Lead to Deal.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const leadId = encodeURIComponent(context.propsValue.leadId.trim());
+ const conversionId = encodeURIComponent(context.propsValue.conversionId.trim());
+ return pipedriveAtomic.call<
+ PipedriveEnvelope<{
+ conversion_id: string;
+ status: string;
+ deal_id?: number;
+ lead_id?: string;
+ }>
+ >({
+ auth: context.auth,
+ method: HttpMethod.GET,
+ resourceUri: `/v2/leads/${leadId}/convert/status/${conversionId}`,
+ resourceLabel: `Conversion ${context.propsValue.conversionId} of lead ${context.propsValue.leadId}`,
+ });
+ },
+});
diff --git a/packages/pieces/community/pipedrive/src/lib/actions/get-lead.ts b/packages/pieces/community/pipedrive/src/lib/actions/get-lead.ts
new file mode 100644
index 00000000000..4c3f7e4efe7
--- /dev/null
+++ b/packages/pieces/community/pipedrive/src/lib/actions/get-lead.ts
@@ -0,0 +1,36 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { pipedriveAuth } from '../auth';
+import { PipedriveEnvelope, pipedriveAtomic } from '../common/atomic-helpers';
+import { getLeadActionOutputSchema } from '../output-schemas';
+
+export const getLeadAction = createAction({
+ auth: pipedriveAuth,
+ name: 'get-lead',
+ outputSchema: getLeadActionOutputSchema,
+ classification: 'READ',
+ displayName: 'Get Lead',
+ description: 'Retrieves a lead by its ID.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Reads one lead by its UUID, including title, value, owner, linked person/organization and labels. Use when you already hold the lead ID; to locate a lead by text use Find Lead. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ props: {
+ leadId: Property.ShortText({
+ displayName: 'Lead ID',
+ description: 'The lead UUID (from Find Lead or a lead trigger).',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const leadId = encodeURIComponent(context.propsValue.leadId.trim());
+ return pipedriveAtomic.call<PipedriveEnvelope<Record<string, unknown>>>({
+ auth: context.auth,
+ method: HttpMethod.GET,
+ resourceUri: `/v1/leads/${leadId}`,
+ resourceLabel: `Lead ${context.propsValue.leadId}`,
+ });
+ },
+});
diff --git a/packages/pieces/community/pipedrive/src/lib/actions/get-organization.ts b/packages/pieces/community/pipedrive/src/lib/actions/get-organization.ts
new file mode 100644
index 00000000000..25d61f7a084
--- /dev/null
+++ b/packages/pieces/community/pipedrive/src/lib/actions/get-organization.ts
@@ -0,0 +1,48 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { pipedriveAuth } from '../auth';
+import { pipedriveTransformCustomFields } from '../common';
+import { PipedriveEnvelope, pipedriveAtomic } from '../common/atomic-helpers';
+import { ORGANIZATION_OPTIONAL_FIELDS } from '../common/constants';
+import { getOrganizationActionOutputSchema } from '../output-schemas';
+
+export const getOrganizationAction = createAction({
+ auth: pipedriveAuth,
+ name: 'get-organization',
+ outputSchema: getOrganizationActionOutputSchema,
+ classification: 'READ',
+ displayName: 'Get Organization',
+ description: 'Retrieves an organization by its ID.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Reads one organization by numeric ID, including people/deal/activity counters and custom fields by their names. Use when you already hold the organization ID; to locate one by name use Search Organizations, and for an exact single-field match use Find Organization. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ props: {
+ organizationId: Property.Number({
+ displayName: 'Organization ID',
+ description:
+ 'The numeric organization ID (from Search Organizations, List Organizations or an organization trigger).',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const { organizationId } = context.propsValue;
+ const response = await pipedriveAtomic.call<PipedriveEnvelope<Record<string, unknown>>>({
+ auth: context.auth,
+ method: HttpMethod.GET,
+ resourceUri: `/v2/organizations/${organizationId}`,
+ resourceLabel: `Organization ${organizationId}`,
+ query: { include_fields: ORGANIZATION_OPTIONAL_FIELDS.join(',') },
+ });
+ const customFields = await pipedriveAtomic.fetchCustomFieldDefinitions({
+ auth: context.auth,
+ resourceUri: '/v1/organizationFields',
+ });
+ return {
+ success: response.success,
+ data: pipedriveTransformCustomFields(customFields, response.data),
+ };
+ },
+});
diff --git a/packages/pieces/community/pipedrive/src/lib/actions/get-person.ts b/packages/pieces/community/pipedrive/src/lib/actions/get-person.ts
new file mode 100644
index 00000000000..3a20f7a2450
--- /dev/null
+++ b/packages/pieces/community/pipedrive/src/lib/actions/get-person.ts
@@ -0,0 +1,47 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { pipedriveAuth } from '../auth';
+import { pipedriveTransformCustomFields } from '../common';
+import { PipedriveEnvelope, pipedriveAtomic } from '../common/atomic-helpers';
+import { PERSON_OPTIONAL_FIELDS } from '../common/constants';
+import { getPersonActionOutputSchema } from '../output-schemas';
+
+export const getPersonAction = createAction({
+ auth: pipedriveAuth,
+ name: 'get-person',
+ outputSchema: getPersonActionOutputSchema,
+ classification: 'READ',
+ displayName: 'Get Person',
+ description: 'Retrieves a person by their ID.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Reads one person (contact) by numeric ID, including emails, phones, deal/activity counters and custom fields by their names. Use when you already hold the person ID; to locate a person by name, email or phone use Search Persons, and for an exact single-field match use Find Person. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ props: {
+ personId: Property.Number({
+ displayName: 'Person ID',
+ description: 'The numeric person ID (from Search Persons, List Persons or a person trigger).',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const { personId } = context.propsValue;
+ const response = await pipedriveAtomic.call<PipedriveEnvelope<Record<string, unknown>>>({
+ auth: context.auth,
+ method: HttpMethod.GET,
+ resourceUri: `/v2/persons/${personId}`,
+ resourceLabel: `Person ${personId}`,
+ query: { include_fields: PERSON_OPTIONAL_FIELDS.join(',') },
+ });
+ const customFields = await pipedriveAtomic.fetchCustomFieldDefinitions({
+ auth: context.auth,
+ resourceUri: '/v1/personFields',
+ });
+ return {
+ success: response.success,
+ data: pipedriveTransformCustomFields(customFields, response.data),
+ };
+ },
+});
diff --git a/packages/pieces/community/pipedrive/src/lib/actions/list-activities.ts b/packages/pieces/community/pipedrive/src/lib/actions/list-activities.ts
new file mode 100644
index 00000000000..efaf3cc207d
--- /dev/null
+++ b/packages/pieces/community/pipedrive/src/lib/actions/list-activities.ts
@@ -0,0 +1,109 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { pipedriveAuth } from '../auth';
+import { V2ListResponse, pipedriveAtomic } from '../common/atomic-helpers';
+import { listActivitiesActionOutputSchema } from '../output-schemas';
+
+export const listActivitiesAction = createAction({
+ auth: pipedriveAuth,
+ name: 'list-activities',
+ outputSchema: listActivitiesActionOutputSchema,
+ classification: 'SEARCH',
+ displayName: 'List Activities',
+ description: 'Lists one page of activities, optionally filtered.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns one bounded page of activities filtered by deal, lead, person, organization, owner, done state or update time; pass next_cursor back as Cursor for the next page. Use this to see what is scheduled or done for a record; Find Activity instead does an exact match on one chosen field. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ props: {
+ dealId: Property.Number({
+ displayName: 'Deal ID',
+ description: 'Only activities linked to this deal ID (from Search Deals).',
+ required: false,
+ }),
+ leadId: Property.ShortText({
+ displayName: 'Lead ID',
+ description: 'Only activities linked to this lead ID, a UUID (from Find Lead).',
+ required: false,
+ }),
+ personId: Property.Number({
+ displayName: 'Person ID',
+ description: 'Only activities linked to this person ID (from Search Persons).',
+ required: false,
+ }),
+ organizationId: Property.Number({
+ displayName: 'Organization ID',
+ description: 'Only activities linked to this organization ID (from Search Organizations).',
+ required: false,
+ }),
+ ownerId: Property.Number({
+ displayName: 'Owner ID',
+ description: 'Only activities owned by this user ID (from List Users).',
+ required: false,
+ }),
+ done: Property.StaticDropdown<boolean>({
+ displayName: 'Done',
+ description: 'Yes for completed activities only, No for pending only. Leave empty for both.',
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'Yes', value: true },
+ { label: 'No', value: false },
+ ],
+ },
+ }),
+ updatedSince: Property.DateTime({
+ displayName: 'Updated Since',
+ description: 'Only activities updated at or after this time.',
+ required: false,
+ }),
+ updatedUntil: Property.DateTime({
+ displayName: 'Updated Until',
+ description: 'Only activities updated before this time.',
+ required: false,
+ }),
+ sortBy: Property.StaticDropdown<string>({
+ displayName: 'Sort By',
+ description: 'Field to sort by. Defaults to ID.',
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'ID', value: 'id' },
+ { label: 'Update Time', value: 'update_time' },
+ { label: 'Add Time', value: 'add_time' },
+ { label: 'Due Date', value: 'due_date' },
+ ],
+ },
+ }),
+ sortDirection: pipedriveAtomic.sortDirectionProp(),
+ ...pipedriveAtomic.paginationProps(),
+ },
+ async run(context) {
+ const props = context.propsValue;
+ const response = await pipedriveAtomic.call<V2ListResponse<Record<string, unknown>>>({
+ auth: context.auth,
+ method: HttpMethod.GET,
+ resourceUri: '/v2/activities',
+ resourceLabel: 'activities',
+ query: {
+ deal_id: props.dealId,
+ lead_id: pipedriveAtomic.emptyToUndefined(props.leadId),
+ person_id: props.personId,
+ org_id: props.organizationId,
+ owner_id: props.ownerId,
+ done: props.done,
+ updated_since: pipedriveAtomic.toRfc3339({ value: props.updatedSince, label: 'Updated Since' }),
+ updated_until: pipedriveAtomic.toRfc3339({ value: props.updatedUntil, label: 'Updated Until' }),
+ sort_by: props.sortBy,
+ sort_direction: props.sortDirection,
+ limit: pipedriveAtomic.clampLimit(props.limit),
+ cursor: pipedriveAtomic.emptyToUndefined(props.cursor),
+ },
+ });
+ return pipedriveAtomic.toPage(response);
+ },
+});
diff --git a/packages/pieces/community/pipedrive/src/lib/actions/list-activity-types.ts b/packages/pieces/community/pipedrive/src/lib/actions/list-activity-types.ts
new file mode 100644
index 00000000000..4528e0c4572
--- /dev/null
+++ b/packages/pieces/community/pipedrive/src/lib/actions/list-activity-types.ts
@@ -0,0 +1,31 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction } from '@activepieces/pieces-framework';
+import { pipedriveAuth } from '../auth';
+import { PipedriveEnvelope, pipedriveAtomic } from '../common/atomic-helpers';
+import { listActivityTypesActionOutputSchema } from '../output-schemas';
+
+export const listActivityTypesAction = createAction({
+ auth: pipedriveAuth,
+ name: 'list-activity-types',
+ outputSchema: listActivityTypesActionOutputSchema,
+ classification: 'SEARCH',
+ displayName: 'List Activity Types',
+ description: 'Lists the activity types of the company.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Lists every activity type (call, meeting, task, custom types) with its name and key_string. The key_string is the type value that Create Activity and Update Activity expect. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ props: {},
+ async run(context) {
+ const response = await pipedriveAtomic.call<PipedriveEnvelope<Record<string, unknown>[] | null>>({
+ auth: context.auth,
+ method: HttpMethod.GET,
+ resourceUri: '/v1/activityTypes',
+ resourceLabel: 'activity types',
+ });
+ const data = response.data ?? [];
+ return { found: data.length > 0, data };
+ },
+});
diff --git a/packages/pieces/community/pipedrive/src/lib/actions/list-deal-products.ts b/packages/pieces/community/pipedrive/src/lib/actions/list-deal-products.ts
new file mode 100644
index 00000000000..f048eb7fd9c
--- /dev/null
+++ b/packages/pieces/community/pipedrive/src/lib/actions/list-deal-products.ts
@@ -0,0 +1,59 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { pipedriveAuth } from '../auth';
+import { V2ListResponse, pipedriveAtomic } from '../common/atomic-helpers';
+import { listDealProductsActionOutputSchema } from '../output-schemas';
+
+export const listDealProductsAction = createAction({
+ auth: pipedriveAuth,
+ name: 'list-deal-products',
+ outputSchema: listDealProductsActionOutputSchema,
+ classification: 'SEARCH',
+ displayName: 'List Deal Products',
+ description: 'Lists the products attached to a deal.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns one page of the product lines attached to a deal, with price, quantity and discount; pass next_cursor back as Cursor for the next page. Each row\'s id is the attachment ID that Remove Product From Deal needs, which differs from its product_id. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ props: {
+ dealId: Property.Number({
+ displayName: 'Deal ID',
+ description: 'The numeric deal ID (from Search Deals or List Deals).',
+ required: true,
+ }),
+ sortBy: Property.StaticDropdown<string>({
+ displayName: 'Sort By',
+ description: 'Field to sort by. Defaults to ID.',
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'ID', value: 'id' },
+ { label: 'Add Time', value: 'add_time' },
+ { label: 'Update Time', value: 'update_time' },
+ { label: 'Order Number', value: 'order_nr' },
+ ],
+ },
+ }),
+ sortDirection: pipedriveAtomic.sortDirectionProp(),
+ ...pipedriveAtomic.paginationProps(),
+ },
+ async run(context) {
+ const props = context.propsValue;
+ const response = await pipedriveAtomic.call<V2ListResponse<Record<string, unknown>>>({
+ auth: context.auth,
+ method: HttpMethod.GET,
+ resourceUri: `/v2/deals/${props.dealId}/products`,
+ resourceLabel: `Deal ${props.dealId}`,
+ query: {
+ sort_by: props.sortBy,
+ sort_direction: props.sortDirection,
+ limit: pipedriveAtomic.clampLimit(props.limit),
+ cursor: pipedriveAtomic.emptyToUndefined(props.cursor),
+ },
+ });
+ return pipedriveAtomic.toPage(response);
+ },
+});
diff --git a/packages/pieces/community/pipedrive/src/lib/actions/list-deals.ts b/packages/pieces/community/pipedrive/src/lib/actions/list-deals.ts
new file mode 100644
index 00000000000..19356054dc4
--- /dev/null
+++ b/packages/pieces/community/pipedrive/src/lib/actions/list-deals.ts
@@ -0,0 +1,110 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { pipedriveAuth } from '../auth';
+import { V2ListResponse, pipedriveAtomic } from '../common/atomic-helpers';
+import { listDealsActionOutputSchema } from '../output-schemas';
+
+export const listDealsAction = createAction({
+ auth: pipedriveAuth,
+ name: 'list-deals',
+ outputSchema: listDealsActionOutputSchema,
+ classification: 'SEARCH',
+ displayName: 'List Deals',
+ description: 'Lists one page of deals, optionally filtered.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns one bounded page of deals filtered by owner, person, organization, pipeline, stage, status or update time; pass next_cursor back as Cursor for the next page. Prefer this over Find Deals Associated With Person, which fetches every deal of one person; use Search Deals to match by title text. Custom fields are keyed by field hash here; use Get Deal for named custom fields. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ props: {
+ ownerId: Property.Number({
+ displayName: 'Owner ID',
+ description: 'Only deals owned by this user ID (from List Users).',
+ required: false,
+ }),
+ personId: Property.Number({
+ displayName: 'Person ID',
+ description: 'Only deals linked to this person ID (from Search Persons).',
+ required: false,
+ }),
+ organizationId: Property.Number({
+ displayName: 'Organization ID',
+ description: 'Only deals linked to this organization ID (from Search Organizations).',
+ required: false,
+ }),
+ pipelineId: Property.Number({
+ displayName: 'Pipeline ID',
+ description: 'Only deals in this pipeline ID (from List Pipelines).',
+ required: false,
+ }),
+ stageId: Property.Number({
+ displayName: 'Stage ID',
+ description: 'Only deals in this stage ID (from List Stages).',
+ required: false,
+ }),
+ status: Property.StaticDropdown<string>({
+ displayName: 'Status',
+ description: 'Only deals with this status. Leave empty for open, won and lost deals.',
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'Open', value: 'open' },
+ { label: 'Won', value: 'won' },
+ { label: 'Lost', value: 'lost' },
+ { label: 'Deleted', value: 'deleted' },
+ ],
+ },
+ }),
+ updatedSince: Property.DateTime({
+ displayName: 'Updated Since',
+ description: 'Only deals updated at or after this time.',
+ required: false,
+ }),
+ updatedUntil: Property.DateTime({
+ displayName: 'Updated Until',
+ description: 'Only deals updated before this time.',
+ required: false,
+ }),
+ sortBy: Property.StaticDropdown<string>({
+ displayName: 'Sort By',
+ description: 'Field to sort by. Defaults to ID.',
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'ID', value: 'id' },
+ { label: 'Update Time', value: 'update_time' },
+ { label: 'Add Time', value: 'add_time' },
+ ],
+ },
+ }),
+ sortDirection: pipedriveAtomic.sortDirectionProp(),
+ ...pipedriveAtomic.paginationProps(),
+ },
+ async run(context) {
+ const props = context.propsValue;
+ const response = await pipedriveAtomic.call<V2ListResponse<Record<string, unknown>>>({
+ auth: context.auth,
+ method: HttpMethod.GET,
+ resourceUri: '/v2/deals',
+ resourceLabel: 'deals',
+ query: {
+ owner_id: props.ownerId,
+ person_id: props.personId,
+ org_id: props.organizationId,
+ pipeline_id: props.pipelineId,
+ stage_id: props.stageId,
+ status: props.status,
+ updated_since: pipedriveAtomic.toRfc3339({ value: props.updatedSince, label: 'Updated Since' }),
+ updated_until: pipedriveAtomic.toRfc3339({ value: props.updatedUntil, label: 'Updated Until' }),
+ sort_by: props.sortBy,
+ sort_direction: props.sortDirection,
+ limit: pipedriveAtomic.clampLimit(props.limit),
+ cursor: pipedriveAtomic.emptyToUndefined(props.cursor),
+ },
+ });
+ return pipedriveAtomic.toPage(response);
+ },
+});
diff --git a/packages/pieces/community/pipedrive/src/lib/actions/list-organizations.ts b/packages/pieces/community/pipedrive/src/lib/actions/list-organizations.ts
new file mode 100644
index 00000000000..cdc578391f7
--- /dev/null
+++ b/packages/pieces/community/pipedrive/src/lib/actions/list-organizations.ts
@@ -0,0 +1,71 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { pipedriveAuth } from '../auth';
+import { V2ListResponse, pipedriveAtomic } from '../common/atomic-helpers';
+import { listOrganizationsActionOutputSchema } from '../output-schemas';
+
+export const listOrganizationsAction = createAction({
+ auth: pipedriveAuth,
+ name: 'list-organizations',
+ outputSchema: listOrganizationsActionOutputSchema,
+ classification: 'SEARCH',
+ displayName: 'List Organizations',
+ description: 'Lists one page of organizations, optionally filtered.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns one bounded page of organizations filtered by owner or update time; pass next_cursor back as Cursor for the next page. Use Search Organizations to find one by name or address. Custom fields are keyed by field hash here; use Get Organization for named custom fields. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ props: {
+ ownerId: Property.Number({
+ displayName: 'Owner ID',
+ description: 'Only organizations owned by this user ID (from List Users).',
+ required: false,
+ }),
+ updatedSince: Property.DateTime({
+ displayName: 'Updated Since',
+ description: 'Only organizations updated at or after this time.',
+ required: false,
+ }),
+ updatedUntil: Property.DateTime({
+ displayName: 'Updated Until',
+ description: 'Only organizations updated before this time.',
+ required: false,
+ }),
+ sortBy: Property.StaticDropdown<string>({
+ displayName: 'Sort By',
+ description: 'Field to sort by. Defaults to ID.',
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'ID', value: 'id' },
+ { label: 'Update Time', value: 'update_time' },
+ { label: 'Add Time', value: 'add_time' },
+ ],
+ },
+ }),
+ sortDirection: pipedriveAtomic.sortDirectionProp(),
+ ...pipedriveAtomic.paginationProps(),
+ },
+ async run(context) {
+ const props = context.propsValue;
+ const response = await pipedriveAtomic.call<V2ListResponse<Record<string, unknown>>>({
+ auth: context.auth,
+ method: HttpMethod.GET,
+ resourceUri: '/v2/organizations',
+ resourceLabel: 'organizations',
+ query: {
+ owner_id: props.ownerId,
+ updated_since: pipedriveAtomic.toRfc3339({ value: props.updatedSince, label: 'Updated Since' }),
+ updated_until: pipedriveAtomic.toRfc3339({ value: props.updatedUntil, label: 'Updated Until' }),
+ sort_by: props.sortBy,
+ sort_direction: props.sortDirection,
+ limit: pipedriveAtomic.clampLimit(props.limit),
+ cursor: pipedriveAtomic.emptyToUndefined(props.cursor),
+ },
+ });
+ return pipedriveAtomic.toPage(response);
+ },
+});
diff --git a/packages/pieces/community/pipedrive/src/lib/actions/list-persons.ts b/packages/pieces/community/pipedrive/src/lib/actions/list-persons.ts
new file mode 100644
index 00000000000..65b51a6bfc7
--- /dev/null
+++ b/packages/pieces/community/pipedrive/src/lib/actions/list-persons.ts
@@ -0,0 +1,83 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { pipedriveAuth } from '../auth';
+import { V2ListResponse, pipedriveAtomic } from '../common/atomic-helpers';
+import { listPersonsActionOutputSchema } from '../output-schemas';
+
+export const listPersonsAction = createAction({
+ auth: pipedriveAuth,
+ name: 'list-persons',
+ outputSchema: listPersonsActionOutputSchema,
+ classification: 'SEARCH',
+ displayName: 'List Persons',
+ description: 'Lists one page of persons, optionally filtered.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns one bounded page of persons (contacts) filtered by owner, organization, deal or update time; pass next_cursor back as Cursor for the next page. Use Search Persons to find someone by name, email or phone. Custom fields are keyed by field hash here; use Get Person for named custom fields. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ props: {
+ ownerId: Property.Number({
+ displayName: 'Owner ID',
+ description: 'Only persons owned by this user ID (from List Users).',
+ required: false,
+ }),
+ organizationId: Property.Number({
+ displayName: 'Organization ID',
+ description: 'Only persons linked to this organization ID (from Search Organizations).',
+ required: false,
+ }),
+ dealId: Property.Number({
+ displayName: 'Deal ID',
+ description: 'Only persons linked to this deal ID (from Search Deals).',
+ required: false,
+ }),
+ updatedSince: Property.DateTime({
+ displayName: 'Updated Since',
+ description: 'Only persons updated at or after this time.',
+ required: false,
+ }),
+ updatedUntil: Property.DateTime({
+ displayName: 'Updated Until',
+ description: 'Only persons updated before this time.',
+ required: false,
+ }),
+ sortBy: Property.StaticDropdown<string>({
+ displayName: 'Sort By',
+ description: 'Field to sort by. Defaults to ID.',
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'ID', value: 'id' },
+ { label: 'Update Time', value: 'update_time' },
+ { label: 'Add Time', value: 'add_time' },
+ ],
+ },
+ }),
+ sortDirection: pipedriveAtomic.sortDirectionProp(),
+ ...pipedriveAtomic.paginationProps(),
+ },
+ async run(context) {
+ const props = context.propsValue;
+ const response = await pipedriveAtomic.call<V2ListResponse<Record<string, unknown>>>({
+ auth: context.auth,
+ method: HttpMethod.GET,
+ resourceUri: '/v2/persons',
+ resourceLabel: 'persons',
+ query: {
+ owner_id: props.ownerId,
+ org_id: props.organizationId,
+ deal_id: props.dealId,
+ updated_since: pipedriveAtomic.toRfc3339({ value: props.updatedSince, label: 'Updated Since' }),
+ updated_until: pipedriveAtomic.toRfc3339({ value: props.updatedUntil, label: 'Updated Until' }),
+ sort_by: props.sortBy,
+ sort_direction: props.sortDirection,
+ limit: pipedriveAtomic.clampLimit(props.limit),
+ cursor: pipedriveAtomic.emptyToUndefined(props.cursor),
+ },
+ });
+ return pipedriveAtomic.toPage(response);
+ },
+});
diff --git a/packages/pieces/community/pipedrive/src/lib/actions/list-pipelines.ts b/packages/pieces/community/pipedrive/src/lib/actions/list-pipelines.ts
new file mode 100644
index 00000000000..64b04c5f2b2
--- /dev/null
+++ b/packages/pieces/community/pipedrive/src/lib/actions/list-pipelines.ts
@@ -0,0 +1,53 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { pipedriveAuth } from '../auth';
+import { V2ListResponse, pipedriveAtomic } from '../common/atomic-helpers';
+import { listPipelinesActionOutputSchema } from '../output-schemas';
+
+export const listPipelinesAction = createAction({
+ auth: pipedriveAuth,
+ name: 'list-pipelines',
+ outputSchema: listPipelinesActionOutputSchema,
+ classification: 'SEARCH',
+ displayName: 'List Pipelines',
+ description: 'Lists the sales pipelines.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Lists the sales pipelines with their IDs and names, one page at a time. Use it to turn a pipeline name into the Pipeline ID that deal filters, Create Deal and Convert Lead to Deal expect; use List Stages for the stages inside a pipeline. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ props: {
+ sortBy: Property.StaticDropdown<string>({
+ displayName: 'Sort By',
+ description: 'Field to sort by. Defaults to ID.',
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'ID', value: 'id' },
+ { label: 'Update Time', value: 'update_time' },
+ { label: 'Add Time', value: 'add_time' },
+ ],
+ },
+ }),
+ sortDirection: pipedriveAtomic.sortDirectionProp(),
+ ...pipedriveAtomic.paginationProps(),
+ },
+ async run(context) {
+ const props = context.propsValue;
+ const response = await pipedriveAtomic.call<V2ListResponse<Record<string, unknown>>>({
+ auth: context.auth,
+ method: HttpMethod.GET,
+ resourceUri: '/v2/pipelines',
+ resourceLabel: 'pipelines',
+ query: {
+ sort_by: props.sortBy,
+ sort_direction: props.sortDirection,
+ limit: pipedriveAtomic.clampLimit(props.limit),
+ cursor: pipedriveAtomic.emptyToUndefined(props.cursor),
+ },
+ });
+ return pipedriveAtomic.toPage(response);
+ },
+});
diff --git a/packages/pieces/community/pipedrive/src/lib/actions/list-stages.ts b/packages/pieces/community/pipedrive/src/lib/actions/list-stages.ts
new file mode 100644
index 00000000000..4dd5f45844d
--- /dev/null
+++ b/packages/pieces/community/pipedrive/src/lib/actions/list-stages.ts
@@ -0,0 +1,60 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { pipedriveAuth } from '../auth';
+import { V2ListResponse, pipedriveAtomic } from '../common/atomic-helpers';
+import { listStagesActionOutputSchema } from '../output-schemas';
+
+export const listStagesAction = createAction({
+ auth: pipedriveAuth,
+ name: 'list-stages',
+ outputSchema: listStagesActionOutputSchema,
+ classification: 'SEARCH',
+ displayName: 'List Stages',
+ description: 'Lists pipeline stages.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Lists deal stages with their IDs, names and pipeline, optionally for one pipeline only, one page at a time. Use it to turn a stage name into the Stage ID that deal filters, Create Deal, Update Deal and Convert Lead to Deal expect. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ props: {
+ pipelineId: Property.Number({
+ displayName: 'Pipeline ID',
+ description: 'Only stages of this pipeline ID (from List Pipelines). Leave empty for all pipelines.',
+ required: false,
+ }),
+ sortBy: Property.StaticDropdown<string>({
+ displayName: 'Sort By',
+ description: 'Field to sort by. Defaults to ID.',
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'ID', value: 'id' },
+ { label: 'Update Time', value: 'update_time' },
+ { label: 'Add Time', value: 'add_time' },
+ { label: 'Order Number', value: 'order_nr' },
+ ],
+ },
+ }),
+ sortDirection: pipedriveAtomic.sortDirectionProp(),
+ ...pipedriveAtomic.paginationProps(),
+ },
+ async run(context) {
+ const props = context.propsValue;
+ const response = await pipedriveAtomic.call<V2ListResponse<Record<string, unknown>>>({
+ auth: context.auth,
+ method: HttpMethod.GET,
+ resourceUri: '/v2/stages',
+ resourceLabel: 'stages',
+ query: {
+ pipeline_id: props.pipelineId,
+ sort_by: props.sortBy,
+ sort_direction: props.sortDirection,
+ limit: pipedriveAtomic.clampLimit(props.limit),
+ cursor: pipedriveAtomic.emptyToUndefined(props.cursor),
+ },
+ });
+ return pipedriveAtomic.toPage(response);
+ },
+});
diff --git a/packages/pieces/community/pipedrive/src/lib/actions/list-users.ts b/packages/pieces/community/pipedrive/src/lib/actions/list-users.ts
new file mode 100644
index 00000000000..e4f6e28078b
--- /dev/null
+++ b/packages/pieces/community/pipedrive/src/lib/actions/list-users.ts
@@ -0,0 +1,31 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction } from '@activepieces/pieces-framework';
+import { pipedriveAuth } from '../auth';
+import { PipedriveEnvelope, pipedriveAtomic } from '../common/atomic-helpers';
+import { listUsersActionOutputSchema } from '../output-schemas';
+
+export const listUsersAction = createAction({
+ auth: pipedriveAuth,
+ name: 'list-users',
+ outputSchema: listUsersActionOutputSchema,
+ classification: 'SEARCH',
+ displayName: 'List Users',
+ description: 'Lists the users of the company.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Lists every user in the Pipedrive company with ID, name, email and active state. Use it to turn a teammate\'s name into the Owner ID or User ID other actions expect; Find User instead looks up one user by name or email, and Get Current User returns the connected user. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ props: {},
+ async run(context) {
+ const response = await pipedriveAtomic.call<PipedriveEnvelope<Record<string, unknown>[] | null>>({
+ auth: context.auth,
+ method: HttpMethod.GET,
+ resourceUri: '/v1/users',
+ resourceLabel: 'users',
+ });
+ const data = response.data ?? [];
+ return { found: data.length > 0, data };
+ },
+});
diff --git a/packages/pieces/community/pipedrive/src/lib/actions/merge-deals.ts b/packages/pieces/community/pipedrive/src/lib/actions/merge-deals.ts
new file mode 100644
index 00000000000..716c1b06864
--- /dev/null
+++ b/packages/pieces/community/pipedrive/src/lib/actions/merge-deals.ts
@@ -0,0 +1,47 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { pipedriveAuth } from '../auth';
+import { PipedriveEnvelope, pipedriveAtomic } from '../common/atomic-helpers';
+import { mergeDealsActionOutputSchema } from '../output-schemas';
+
+export const mergeDealsAction = createAction({
+ auth: pipedriveAuth,
+ name: 'merge-deals',
+ outputSchema: mergeDealsActionOutputSchema,
+ classification: 'DESTRUCTIVE',
+ displayName: 'Merge Deals',
+ description: 'Merges one deal into another, removing the first.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Merges one deal into another: the deal given as Deal ID To Merge Away is REMOVED, and its data, notes and activities move to the deal given as Surviving Deal ID, which is the only one that still exists afterwards. Irreversible - confirm both IDs with Get Deal before calling, and note the two deals must use the same currency. Not safe to retry.',
+ idempotent: false,
+ },
+ props: {
+ dealId: Property.Number({
+ displayName: 'Deal ID To Merge Away (this deal is removed)',
+ description:
+ 'The numeric ID of the deal that will be CONSUMED and no longer exist after the merge.',
+ required: true,
+ }),
+ mergeWithId: Property.Number({
+ displayName: 'Surviving Deal ID (this deal is kept)',
+ description:
+ 'The numeric ID of the deal that SURVIVES the merge and receives the other deal\'s data.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const { dealId, mergeWithId } = context.propsValue;
+ if (dealId === mergeWithId) {
+ throw new Error('A deal cannot be merged with itself.');
+ }
+ return pipedriveAtomic.call<PipedriveEnvelope<Record<string, unknown>>>({
+ auth: context.auth,
+ method: HttpMethod.PUT,
+ resourceUri: `/v1/deals/${dealId}/merge`,
+ resourceLabel: `Deal ${dealId}`,
+ body: { merge_with_id: mergeWithId },
+ });
+ },
+});
diff --git a/packages/pieces/community/pipedrive/src/lib/actions/merge-organizations.ts b/packages/pieces/community/pipedrive/src/lib/actions/merge-organizations.ts
new file mode 100644
index 00000000000..e8d5146996e
--- /dev/null
+++ b/packages/pieces/community/pipedrive/src/lib/actions/merge-organizations.ts
@@ -0,0 +1,47 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { pipedriveAuth } from '../auth';
+import { PipedriveEnvelope, pipedriveAtomic } from '../common/atomic-helpers';
+import { mergeOrganizationsActionOutputSchema } from '../output-schemas';
+
+export const mergeOrganizationsAction = createAction({
+ auth: pipedriveAuth,
+ name: 'merge-organizations',
+ outputSchema: mergeOrganizationsActionOutputSchema,
+ classification: 'DESTRUCTIVE',
+ displayName: 'Merge Organizations',
+ description: 'Merges one organization into another, removing the first.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Merges one organization into another: the organization given as Organization ID To Merge Away is REMOVED, and its people, deals and activities move to the organization given as Surviving Organization ID, which is the only one that still exists afterwards. Irreversible - confirm both IDs with Get Organization first. Not safe to retry.',
+ idempotent: false,
+ },
+ props: {
+ organizationId: Property.Number({
+ displayName: 'Organization ID To Merge Away (this organization is removed)',
+ description:
+ 'The numeric ID of the organization that will be CONSUMED and no longer exist after the merge.',
+ required: true,
+ }),
+ mergeWithId: Property.Number({
+ displayName: 'Surviving Organization ID (this organization is kept)',
+ description:
+ 'The numeric ID of the organization that SURVIVES the merge and will NOT be overwritten.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const { organizationId, mergeWithId } = context.propsValue;
+ if (organizationId === mergeWithId) {
+ throw new Error('An organization cannot be merged with itself.');
+ }
+ return pipedriveAtomic.call<PipedriveEnvelope<Record<string, unknown>>>({
+ auth: context.auth,
+ method: HttpMethod.PUT,
+ resourceUri: `/v1/organizations/${organizationId}/merge`,
+ resourceLabel: `Organization ${organizationId}`,
+ body: { merge_with_id: mergeWithId },
+ });
+ },
+});
diff --git a/packages/pieces/community/pipedrive/src/lib/actions/merge-persons.ts b/packages/pieces/community/pipedrive/src/lib/actions/merge-persons.ts
new file mode 100644
index 00000000000..05e8b7e00bd
--- /dev/null
+++ b/packages/pieces/community/pipedrive/src/lib/actions/merge-persons.ts
@@ -0,0 +1,47 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { pipedriveAuth } from '../auth';
+import { PipedriveEnvelope, pipedriveAtomic } from '../common/atomic-helpers';
+import { mergePersonsActionOutputSchema } from '../output-schemas';
+
+export const mergePersonsAction = createAction({
+ auth: pipedriveAuth,
+ name: 'merge-persons',
+ outputSchema: mergePersonsActionOutputSchema,
+ classification: 'DESTRUCTIVE',
+ displayName: 'Merge Persons',
+ description: 'Merges one person into another, removing the first.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Merges one person into another: the person given as Person ID To Merge Away is REMOVED, and their deals, notes and activities move to the person given as Surviving Person ID, whose own field values are not overwritten on conflict. Irreversible - confirm both IDs with Get Person first. Not safe to retry.',
+ idempotent: false,
+ },
+ props: {
+ personId: Property.Number({
+ displayName: 'Person ID To Merge Away (this person is removed)',
+ description:
+ 'The numeric ID of the person that will be CONSUMED and no longer exist after the merge.',
+ required: true,
+ }),
+ mergeWithId: Property.Number({
+ displayName: 'Surviving Person ID (this person is kept)',
+ description:
+ 'The numeric ID of the person that SURVIVES the merge and will NOT be overwritten.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const { personId, mergeWithId } = context.propsValue;
+ if (personId === mergeWithId) {
+ throw new Error('A person cannot be merged with themselves.');
+ }
+ return pipedriveAtomic.call<PipedriveEnvelope<Record<string, unknown>>>({
+ auth: context.auth,
+ method: HttpMethod.PUT,
+ resourceUri: `/v1/persons/${personId}/merge`,
+ resourceLabel: `Person ${personId}`,
+ body: { merge_with_id: mergeWithId },
+ });
+ },
+});
diff --git a/packages/pieces/community/pipedrive/src/lib/actions/remove-product-from-deal.ts b/packages/pieces/community/pipedrive/src/lib/actions/remove-product-from-deal.ts
new file mode 100644
index 00000000000..51eeeba69b0
--- /dev/null
+++ b/packages/pieces/community/pipedrive/src/lib/actions/remove-product-from-deal.ts
@@ -0,0 +1,42 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { pipedriveAuth } from '../auth';
+import { PipedriveEnvelope, pipedriveAtomic } from '../common/atomic-helpers';
+import { deleteRecordWithAdditionalDataActionOutputSchema } from '../output-schemas';
+
+export const removeProductFromDealAction = createAction({
+ auth: pipedriveAuth,
+ name: 'remove-product-from-deal',
+ outputSchema: deleteRecordWithAdditionalDataActionOutputSchema,
+ classification: 'DESTRUCTIVE',
+ displayName: 'Remove Product From Deal',
+ description: 'Removes a product line from a deal.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Removes one product line from a deal; the product itself stays in the catalog. Needs the row id returned by List Deal Products (the attachment ID), not the product_id. Not safe to retry blindly.',
+ idempotent: false,
+ },
+ props: {
+ dealId: Property.Number({
+ displayName: 'Deal ID',
+ description: 'The numeric ID of the deal the product is attached to.',
+ required: true,
+ }),
+ productAttachmentId: Property.Number({
+ displayName: 'Deal Product ID',
+ description:
+ 'The id of the row returned by List Deal Products (the attachment ID). This is not the product_id.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const { dealId, productAttachmentId } = context.propsValue;
+ return pipedriveAtomic.call<PipedriveEnvelope<{ id: number }>>({
+ auth: context.auth,
+ method: HttpMethod.DELETE,
+ resourceUri: `/v2/deals/${dealId}/products/${productAttachmentId}`,
+ resourceLabel: `Product line ${productAttachmentId} on deal ${dealId}`,
+ });
+ },
+});
diff --git a/packages/pieces/community/pipedrive/src/lib/actions/search-deals.ts b/packages/pieces/community/pipedrive/src/lib/actions/search-deals.ts
new file mode 100644
index 00000000000..265f08e27ca
--- /dev/null
+++ b/packages/pieces/community/pipedrive/src/lib/actions/search-deals.ts
@@ -0,0 +1,86 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { pipedriveAuth } from '../auth';
+import { V2SearchResponse, pipedriveAtomic } from '../common/atomic-helpers';
+import { searchDealsActionOutputSchema } from '../output-schemas';
+
+export const searchDealsAction = createAction({
+ auth: pipedriveAuth,
+ name: 'search-deals',
+ outputSchema: searchDealsActionOutputSchema,
+ classification: 'SEARCH',
+ displayName: 'Search Deals',
+ description: 'Searches deals by title, notes or custom field text.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Fuzzy text search over deal titles, notes and custom fields, ranked by relevance, optionally narrowed to a person, organization or status; returns one page with next_cursor. Use this to find a deal by name; Find Deal instead does an exact match on one chosen field. The term needs at least 2 characters (1 with Exact Match). Read-only and safe to retry.',
+ idempotent: true,
+ },
+ props: {
+ term: Property.ShortText({
+ displayName: 'Search Term',
+ description: 'Text to search for. At least 2 characters, or 1 when Exact Match is Yes.',
+ required: true,
+ }),
+ fields: Property.StaticMultiSelectDropdown<string>({
+ displayName: 'Search In',
+ description: 'Fields to search. Leave empty to search all of them.',
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'Title', value: 'title' },
+ { label: 'Notes', value: 'notes' },
+ { label: 'Custom Fields', value: 'custom_fields' },
+ ],
+ },
+ }),
+ exactMatch: pipedriveAtomic.exactMatchProp(),
+ personId: Property.Number({
+ displayName: 'Person ID',
+ description: 'Only deals linked to this person ID (from Search Persons).',
+ required: false,
+ }),
+ organizationId: Property.Number({
+ displayName: 'Organization ID',
+ description: 'Only deals linked to this organization ID (from Search Organizations).',
+ required: false,
+ }),
+ status: Property.StaticDropdown<string>({
+ displayName: 'Status',
+ description: 'Only deals with this status. Leave empty for any status.',
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'Open', value: 'open' },
+ { label: 'Won', value: 'won' },
+ { label: 'Lost', value: 'lost' },
+ ],
+ },
+ }),
+ ...pipedriveAtomic.paginationProps(),
+ },
+ async run(context) {
+ const props = context.propsValue;
+ const term = pipedriveAtomic.assertSearchTerm({ term: props.term, exactMatch: props.exactMatch });
+ const response = await pipedriveAtomic.call<V2SearchResponse>({
+ auth: context.auth,
+ method: HttpMethod.GET,
+ resourceUri: '/v2/deals/search',
+ resourceLabel: 'deal search',
+ query: {
+ term,
+ fields: props.fields && props.fields.length > 0 ? props.fields : undefined,
+ exact_match: props.exactMatch,
+ person_id: props.personId,
+ organization_id: props.organizationId,
+ status: props.status,
+ limit: pipedriveAtomic.clampLimit(props.limit),
+ cursor: pipedriveAtomic.emptyToUndefined(props.cursor),
+ },
+ });
+ return pipedriveAtomic.flattenSearchItems(response);
+ },
+});
diff --git a/packages/pieces/community/pipedrive/src/lib/actions/search-organizations.ts b/packages/pieces/community/pipedrive/src/lib/actions/search-organizations.ts
new file mode 100644
index 00000000000..8b7d4344310
--- /dev/null
+++ b/packages/pieces/community/pipedrive/src/lib/actions/search-organizations.ts
@@ -0,0 +1,61 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { pipedriveAuth } from '../auth';
+import { V2SearchResponse, pipedriveAtomic } from '../common/atomic-helpers';
+import { searchOrganizationsActionOutputSchema } from '../output-schemas';
+
+export const searchOrganizationsAction = createAction({
+ auth: pipedriveAuth,
+ name: 'search-organizations',
+ outputSchema: searchOrganizationsActionOutputSchema,
+ classification: 'SEARCH',
+ displayName: 'Search Organizations',
+ description: 'Searches organizations by name, address, notes or custom field text.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Fuzzy text search over organization names, addresses, notes and custom fields, ranked by relevance; returns one page with next_cursor. Use this to find a company by name; Find Organization instead does an exact match on one chosen field. The term needs at least 2 characters (1 with Exact Match). Read-only and safe to retry.',
+ idempotent: true,
+ },
+ props: {
+ term: Property.ShortText({
+ displayName: 'Search Term',
+ description: 'Text to search for. At least 2 characters, or 1 when Exact Match is Yes.',
+ required: true,
+ }),
+ fields: Property.StaticMultiSelectDropdown<string>({
+ displayName: 'Search In',
+ description: 'Fields to search. Leave empty to search all of them.',
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'Name', value: 'name' },
+ { label: 'Address', value: 'address' },
+ { label: 'Notes', value: 'notes' },
+ { label: 'Custom Fields', value: 'custom_fields' },
+ ],
+ },
+ }),
+ exactMatch: pipedriveAtomic.exactMatchProp(),
+ ...pipedriveAtomic.paginationProps(),
+ },
+ async run(context) {
+ const props = context.propsValue;
+ const term = pipedriveAtomic.assertSearchTerm({ term: props.term, exactMatch: props.exactMatch });
+ const response = await pipedriveAtomic.call<V2SearchResponse>({
+ auth: context.auth,
+ method: HttpMethod.GET,
+ resourceUri: '/v2/organizations/search',
+ resourceLabel: 'organization search',
+ query: {
+ term,
+ fields: props.fields && props.fields.length > 0 ? props.fields : undefined,
+ exact_match: props.exactMatch,
+ limit: pipedriveAtomic.clampLimit(props.limit),
+ cursor: pipedriveAtomic.emptyToUndefined(props.cursor),
+ },
+ });
+ return pipedriveAtomic.flattenSearchItems(response);
+ },
+});
diff --git a/packages/pieces/community/pipedrive/src/lib/actions/search-persons.ts b/packages/pieces/community/pipedrive/src/lib/actions/search-persons.ts
new file mode 100644
index 00000000000..38e96b3002e
--- /dev/null
+++ b/packages/pieces/community/pipedrive/src/lib/actions/search-persons.ts
@@ -0,0 +1,68 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { pipedriveAuth } from '../auth';
+import { V2SearchResponse, pipedriveAtomic } from '../common/atomic-helpers';
+import { searchPersonsActionOutputSchema } from '../output-schemas';
+
+export const searchPersonsAction = createAction({
+ auth: pipedriveAuth,
+ name: 'search-persons',
+ outputSchema: searchPersonsActionOutputSchema,
+ classification: 'SEARCH',
+ displayName: 'Search Persons',
+ description: 'Searches persons by name, email, phone, notes or custom field text.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Fuzzy text search over person names, emails, phones, notes and custom fields, ranked by relevance and optionally limited to one organization; returns one page with next_cursor. Use this to find a contact like "Jane at Acme"; Find Person instead does an exact match on one chosen field. The term needs at least 2 characters (1 with Exact Match). Read-only and safe to retry.',
+ idempotent: true,
+ },
+ props: {
+ term: Property.ShortText({
+ displayName: 'Search Term',
+ description: 'Text to search for. At least 2 characters, or 1 when Exact Match is Yes.',
+ required: true,
+ }),
+ fields: Property.StaticMultiSelectDropdown<string>({
+ displayName: 'Search In',
+ description: 'Fields to search. Leave empty to search all of them.',
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'Name', value: 'name' },
+ { label: 'Email', value: 'email' },
+ { label: 'Phone', value: 'phone' },
+ { label: 'Notes', value: 'notes' },
+ { label: 'Custom Fields', value: 'custom_fields' },
+ ],
+ },
+ }),
+ exactMatch: pipedriveAtomic.exactMatchProp(),
+ organizationId: Property.Number({
+ displayName: 'Organization ID',
+ description: 'Only persons linked to this organization ID (from Search Organizations).',
+ required: false,
+ }),
+ ...pipedriveAtomic.paginationProps(),
+ },
+ async run(context) {
+ const props = context.propsValue;
+ const term = pipedriveAtomic.assertSearchTerm({ term: props.term, exactMatch: props.exactMatch });
+ const response = await pipedriveAtomic.call<V2SearchResponse>({
+ auth: context.auth,
+ method: HttpMethod.GET,
+ resourceUri: '/v2/persons/search',
+ resourceLabel: 'person search',
+ query: {
+ term,
+ fields: props.fields && props.fields.length > 0 ? props.fields : undefined,
+ exact_match: props.exactMatch,
+ organization_id: props.organizationId,
+ limit: pipedriveAtomic.clampLimit(props.limit),
+ cursor: pipedriveAtomic.emptyToUndefined(props.cursor),
+ },
+ });
+ return pipedriveAtomic.flattenSearchItems(response);
+ },
+});
diff --git a/packages/pieces/community/pipedrive/src/lib/actions/update-note.ts b/packages/pieces/community/pipedrive/src/lib/actions/update-note.ts
new file mode 100644
index 00000000000..e1b114cb8da
--- /dev/null
+++ b/packages/pieces/community/pipedrive/src/lib/actions/update-note.ts
@@ -0,0 +1,101 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, isNil, Property } from '@activepieces/pieces-framework';
+import { pipedriveAuth } from '../auth';
+import { PipedriveEnvelope, pipedriveAtomic } from '../common/atomic-helpers';
+import { updateNoteActionOutputSchema } from '../output-schemas';
+
+export const updateNoteAction = createAction({
+ auth: pipedriveAuth,
+ name: 'update-note',
+ outputSchema: updateNoteActionOutputSchema,
+ classification: 'WRITE',
+ displayName: 'Update Note',
+ description: 'Updates an existing note.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Changes an existing note: its content, the deal, lead, person or organization it is attached to, its author, or its pinned flags. Only the fields you set are sent; at least one is required. To add a new note use Create Note. Setting the same values again gives the same result, so it is safe to retry.',
+ idempotent: true,
+ },
+ props: {
+ noteId: Property.Number({
+ displayName: 'Note ID',
+ description: 'The numeric ID of the note to update (from Find Notes or Create Note).',
+ required: true,
+ }),
+ content: Property.LongText({
+ displayName: 'Content',
+ description: 'New note content. HTML is allowed. Leave empty to keep the current content.',
+ required: false,
+ }),
+ dealId: Property.Number({
+ displayName: 'Deal ID',
+ description: 'Attach the note to this deal ID (from Search Deals).',
+ required: false,
+ }),
+ leadId: Property.ShortText({
+ displayName: 'Lead ID',
+ description: 'Attach the note to this lead UUID (from Find Lead).',
+ required: false,
+ }),
+ personId: Property.Number({
+ displayName: 'Person ID',
+ description: 'Attach the note to this person ID (from Search Persons).',
+ required: false,
+ }),
+ organizationId: Property.Number({
+ displayName: 'Organization ID',
+ description: 'Attach the note to this organization ID (from Search Organizations).',
+ required: false,
+ }),
+ userId: Property.Number({
+ displayName: 'Author User ID',
+ description: 'Make this user ID the note author (from List Users).',
+ required: false,
+ }),
+ pinnedToDeal: pinnedFlagProp('Pinned to Deal'),
+ pinnedToLead: pinnedFlagProp('Pinned to Lead'),
+ pinnedToPerson: pinnedFlagProp('Pinned to Person'),
+ pinnedToOrganization: pinnedFlagProp('Pinned to Organization'),
+ },
+ async run(context) {
+ const props = context.propsValue;
+ const body: Record<string, unknown> = {
+ content: pipedriveAtomic.emptyToUndefined(props.content),
+ deal_id: props.dealId,
+ lead_id: pipedriveAtomic.emptyToUndefined(props.leadId),
+ person_id: props.personId,
+ org_id: props.organizationId,
+ user_id: props.userId,
+ pinned_to_deal_flag: props.pinnedToDeal,
+ pinned_to_lead_flag: props.pinnedToLead,
+ pinned_to_person_flag: props.pinnedToPerson,
+ pinned_to_organization_flag: props.pinnedToOrganization,
+ };
+ if (Object.values(body).every((value) => isNil(value))) {
+ throw new Error('Set at least one field to update on the note.');
+ }
+ return pipedriveAtomic.call<PipedriveEnvelope<Record<string, unknown>>>({
+ auth: context.auth,
+ method: HttpMethod.PUT,
+ resourceUri: `/v1/notes/${props.noteId}`,
+ resourceLabel: `Note ${props.noteId}`,
+ body,
+ });
+ },
+});
+
+function pinnedFlagProp(displayName: string) {
+ return Property.StaticDropdown<number>({
+ displayName,
+ description: 'Yes to pin, No to unpin. Leave empty to keep the current setting.',
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'Yes', value: 1 },
+ { label: 'No', value: 0 },
+ ],
+ },
+ });
+}
diff --git a/packages/pieces/community/pipedrive/src/lib/common/atomic-helpers.ts b/packages/pieces/community/pipedrive/src/lib/common/atomic-helpers.ts
new file mode 100644
index 00000000000..f842a36800d
--- /dev/null
+++ b/packages/pieces/community/pipedrive/src/lib/common/atomic-helpers.ts
@@ -0,0 +1,332 @@
+import { AuthenticationType, httpClient, HttpError, HttpMethod } from '@activepieces/pieces-common';
+import { isNil, Property } from '@activepieces/pieces-framework';
+import { GetField } from './types';
+
+function readVendorMessage(body: unknown): string {
+ if (typeof body === 'string') {
+ return body;
+ }
+ if (typeof body !== 'object' || body === null) {
+ return '';
+ }
+ const parts: string[] = [];
+ if ('error' in body && typeof body.error === 'string') {
+ parts.push(body.error);
+ }
+ if ('error_info' in body && typeof body.error_info === 'string') {
+ parts.push(body.error_info);
+ }
+ if (parts.length === 0 && 'statusText' in body && typeof body.statusText === 'string') {
+ parts.push(body.statusText);
+ }
+ return parts.join(' ');
+}
+
+function describeFailure({
+ status,
+ body,
+ resourceLabel,
+}: {
+ status: number;
+ body: unknown;
+ resourceLabel: string;
+}): string {
+ const vendorMessage = readVendorMessage(body);
+ switch (status) {
+ case 400:
+ return `Pipedrive rejected the request: ${vendorMessage || 'invalid parameters'}.`;
+ case 401:
+ return 'Pipedrive rejected the connection. Reconnect your Pipedrive account and try again.';
+ case 403:
+ return `Pipedrive denied access to ${resourceLabel}: the connected user lacks permission (visibility or role) or the connection lacks the required scope. ${vendorMessage}`.trim();
+ case 404:
+ return `${resourceLabel} was not found (it may be deleted). ${vendorMessage}`.trim();
+ case 429:
+ return 'Pipedrive rate limit reached; retry later.';
+ default:
+ return `Pipedrive returned HTTP ${status} for ${resourceLabel}. ${vendorMessage}`.trim();
+ }
+}
+
+function readApiDomain(auth: PipedriveAtomicAuth): string {
+ const apiDomain = auth.data['api_domain'];
+ if (typeof apiDomain !== 'string' || apiDomain.length === 0) {
+ throw new Error('The Pipedrive connection has no API domain. Reconnect your Pipedrive account.');
+ }
+ return apiDomain;
+}
+
+function toQueryString(query: PipedriveAtomicQuery | undefined): Record<string, string> {
+ const qs: Record<string, string> = {};
+ if (isNil(query)) {
+ return qs;
+ }
+ for (const [key, value] of Object.entries(query)) {
+ if (isNil(value)) {
+ continue;
+ }
+ qs[key] = Array.isArray(value) ? value.map(String).join(',') : String(value);
+ }
+ return qs;
+}
+
+function dropNilValues(body: Record<string, unknown> | undefined): Record<string, unknown> | undefined {
+ if (isNil(body)) {
+ return undefined;
+ }
+ const cleaned: Record<string, unknown> = {};
+ for (const [key, value] of Object.entries(body)) {
+ if (!isNil(value)) {
+ cleaned[key] = value;
+ }
+ }
+ return cleaned;
+}
+
+async function call<T>({
+ auth,
+ method,
+ resourceUri,
+ resourceLabel = 'the requested Pipedrive record',
+ query,
+ body,
+}: PipedriveAtomicCallParams): Promise<T> {
+ const apiDomain = readApiDomain(auth);
+ try {
+ const response = await httpClient.sendRequest<T>({
+ method,
+ url: `${apiDomain}/api${resourceUri}`,
+ authentication: {
+ type: AuthenticationType.BEARER_TOKEN,
+ token: auth.access_token,
+ },
+ queryParams: toQueryString(query),
+ body: dropNilValues(body),
+ });
+ return response.body;
+ } catch (error) {
+ if (error instanceof HttpError) {
+ throw new Error(
+ describeFailure({
+ status: error.response.status,
+ body: error.response.body,
+ resourceLabel,
+ }),
+ );
+ }
+ throw error;
+ }
+}
+
+async function fetchCustomFieldDefinitions({
+ auth,
+ resourceUri,
+}: {
+ auth: PipedriveAtomicAuth;
+ resourceUri: string;
+}): Promise<GetField[]> {
+ const fields: GetField[] = [];
+ let start: number | undefined = 0;
+ while (!isNil(start)) {
+ const response: V1FieldsPage = await call<V1FieldsPage>({
+ auth,
+ method: HttpMethod.GET,
+ resourceUri,
+ resourceLabel: 'custom field definitions',
+ query: { start, limit: 500 },
+ });
+ fields.push(...(response.data ?? []));
+ const pagination = response.additional_data?.pagination;
+ start = pagination?.more_items_in_collection ? pagination.next_start : undefined;
+ }
+ return fields;
+}
+
+function paginationProps() {
+ return {
+ limit: Property.Number({
+ displayName: 'Limit',
+ description: 'Maximum number of items to return in this page (1-500). Defaults to 50.',
+ required: false,
+ defaultValue: DEFAULT_PAGE_LIMIT,
+ }),
+ cursor: Property.ShortText({
+ displayName: 'Cursor',
+ description:
+ 'The next_cursor value from the previous call, to fetch the next page. Leave empty for the first page.',
+ required: false,
+ }),
+ };
+}
+
+function clampLimit(limit: number | undefined): number {
+ if (isNil(limit) || !Number.isFinite(limit)) {
+ return DEFAULT_PAGE_LIMIT;
+ }
+ return Math.min(MAX_PAGE_LIMIT, Math.max(1, Math.floor(limit)));
+}
+
+function emptyToUndefined(value: string | undefined): string | undefined {
+ if (isNil(value)) {
+ return undefined;
+ }
+ const trimmed = value.trim();
+ return trimmed.length === 0 ? undefined : trimmed;
+}
+
+function toRfc3339({ value, label }: { value: string | undefined; label: string }): string | undefined {
+ if (isNil(value) || value.trim().length === 0) {
+ return undefined;
+ }
+ const parsed = new Date(value);
+ if (Number.isNaN(parsed.getTime())) {
+ throw new Error(`${label} must be a valid date and time.`);
+ }
+ return parsed.toISOString().replace(/\.\d{3}Z$/, 'Z');
+}
+
+function assertSearchTerm({
+ term,
+ exactMatch,
+}: {
+ term: string | undefined;
+ exactMatch: boolean | undefined;
+}): string {
+ const trimmed = (term ?? '').trim();
+ const minimum = exactMatch === true ? 1 : 2;
+ if (trimmed.length < minimum) {
+ throw new Error(
+ exactMatch === true
+ ? 'Search Term must contain at least 1 character.'
+ : 'Search Term must contain at least 2 characters (or 1 character when Exact Match is Yes).',
+ );
+ }
+ return trimmed;
+}
+
+function toPage<T>(response: V2ListResponse<T>): AtomicPage<T> {
+ const data = response.data ?? [];
+ return {
+ found: data.length > 0,
+ data,
+ next_cursor: response.additional_data?.next_cursor ?? null,
+ };
+}
+
+function flattenSearchItems(
+ response: V2SearchResponse,
+): AtomicPage<Record<string, unknown>> {
+ const items = response.data?.items ?? [];
+ const data = items.map(({ result_score, item }) => ({ ...item, result_score }));
+ return {
+ found: data.length > 0,
+ data,
+ next_cursor: response.additional_data?.next_cursor ?? null,
+ };
+}
+
+function sortDirectionProp() {
+ return Property.StaticDropdown<string>({
+ displayName: 'Sort Direction',
+ description: 'Sort order. Defaults to ascending.',
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'Ascending', value: 'asc' },
+ { label: 'Descending', value: 'desc' },
+ ],
+ },
+ });
+}
+
+function exactMatchProp() {
+ return Property.StaticDropdown<boolean>({
+ displayName: 'Exact Match',
+ description:
+ 'Yes returns only exact matches of the full term. Leave empty for partial matching.',
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'Yes', value: true },
+ { label: 'No', value: false },
+ ],
+ },
+ });
+}
+
+const DEFAULT_PAGE_LIMIT = 50;
+const MAX_PAGE_LIMIT = 500;
+
+export const pipedriveAtomic = {
+ call,
+ fetchCustomFieldDefinitions,
+ paginationProps,
+ clampLimit,
+ emptyToUndefined,
+ toRfc3339,
+ assertSearchTerm,
+ toPage,
+ flattenSearchItems,
+ sortDirectionProp,
+ exactMatchProp,
+};
+
+type V1FieldsPage = {
+ data: GetField[] | null;
+ additional_data?: {
+ pagination?: {
+ more_items_in_collection?: boolean;
+ next_start?: number;
+ };
+ };
+};
+
+export type PipedriveAtomicAuth = {
+ access_token: string;
+ data: Record<string, unknown>;
+};
+
+export type PipedriveAtomicQuery = Record<
+ string,
+ string | number | boolean | string[] | number[] | null | undefined
+>;
+
+export type PipedriveAtomicCallParams = {
+ auth: PipedriveAtomicAuth;
+ method: HttpMethod;
+ resourceUri: string;
+ resourceLabel?: string;
+ query?: PipedriveAtomicQuery;
+ body?: Record<string, unknown>;
+};
+
+export type V2ListResponse<T> = {
+ success: boolean;
+ data: T[] | null;
+ additional_data?: {
+ next_cursor?: string | null;
+ };
+};
+
+export type V2SearchResponse = {
+ success: boolean;
+ data: {
+ items?: Array<{ result_score: number; item: Record<string, unknown> }>;
+ } | null;
+ additional_data?: {
+ next_cursor?: string | null;
+ };
+};
+
+export type PipedriveEnvelope<T> = {
+ success: boolean;
+ data: T;
+};
+
+export type AtomicPage<T> = {
+ found: boolean;
+ data: T[];
+ next_cursor: string | null;
+};
diff --git a/packages/pieces/community/pipedrive/src/lib/output-schemas.ts b/packages/pieces/community/pipedrive/src/lib/output-schemas.ts
index aaa35ebdf2b..2da0d84668e 100644
--- a/packages/pieces/community/pipedrive/src/lib/output-schemas.ts
+++ b/packages/pieces/community/pipedrive/src/lib/output-schemas.ts
@@ -320,6 +320,392 @@ const fileFields: OutputSchema['fields'] = [
{ key: 'update_time', label: 'Updated At', format: 'datetime' },
];
+const idNameFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+];
+
+const orgWithAddressFields: OutputSchema['fields'] = [
+ ...idNameFields,
+ { key: 'address', label: 'Address' },
+];
+
+const searchScoreField: OutputSchema['fields'] = [
+ { key: 'result_score', label: 'Result Score', format: 'number' },
+];
+
+const dealSearchItemFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Deal ID', format: 'number' },
+ { key: 'type', label: 'Type' },
+ { key: 'title', label: 'Title' },
+ { key: 'value', label: 'Value', format: 'number' },
+ { key: 'currency', label: 'Currency' },
+ { key: 'status', label: 'Status' },
+ { key: 'is_archived', label: 'Archived', format: 'boolean' },
+ { key: 'visible_to', label: 'Visible To' },
+ { key: 'owner', label: 'Owner', children: [{ key: 'id', label: 'Owner ID', format: 'number' }] },
+ { key: 'stage', label: 'Stage', children: idNameFields },
+ { key: 'pipeline', label: 'Pipeline', children: [{ key: 'id', label: 'Pipeline ID', format: 'number' }] },
+ { key: 'person', label: 'Person', children: idNameFields },
+ { key: 'organization', label: 'Organization', children: orgWithAddressFields },
+ { key: 'custom_fields', label: 'Custom Fields' },
+ { key: 'notes', label: 'Notes' },
+ ...searchScoreField,
+];
+
+const personSearchItemFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Person ID', format: 'number' },
+ { key: 'type', label: 'Type' },
+ { key: 'name', label: 'Name' },
+ { key: 'phones', label: 'Phones' },
+ { key: 'emails', label: 'Emails' },
+ { key: 'primary_email', label: 'Primary Email', format: 'email' },
+ { key: 'visible_to', label: 'Visible To' },
+ { key: 'owner', label: 'Owner', children: [{ key: 'id', label: 'Owner ID', format: 'number' }] },
+ { key: 'organization', label: 'Organization', children: orgWithAddressFields },
+ { key: 'custom_fields', label: 'Custom Fields' },
+ { key: 'notes', label: 'Notes' },
+ { key: 'update_time', label: 'Updated At', format: 'datetime' },
+ ...searchScoreField,
+];
+
+const organizationSearchItemFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Organization ID', format: 'number' },
+ { key: 'type', label: 'Type' },
+ { key: 'name', label: 'Name' },
+ { key: 'address', label: 'Address' },
+ { key: 'visible_to', label: 'Visible To' },
+ { key: 'owner', label: 'Owner', children: [{ key: 'id', label: 'Owner ID', format: 'number' }] },
+ { key: 'custom_fields', label: 'Custom Fields' },
+ { key: 'notes', label: 'Notes' },
+ ...searchScoreField,
+];
+
+const pipelineFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Pipeline ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'order_nr', label: 'Order', format: 'number' },
+ { key: 'is_deal_probability_enabled', label: 'Deal Probability Enabled', format: 'boolean' },
+ { key: 'is_deleted', label: 'Deleted', format: 'boolean' },
+ { key: 'add_time', label: 'Created At', format: 'datetime' },
+ { key: 'update_time', label: 'Updated At', format: 'datetime' },
+];
+
+const stageFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Stage ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'pipeline_id', label: 'Pipeline ID', format: 'number' },
+ { key: 'order_nr', label: 'Order', format: 'number' },
+ { key: 'deal_probability', label: 'Deal Probability', format: 'number' },
+ { key: 'is_deal_rot_enabled', label: 'Rotting Enabled', format: 'boolean' },
+ { key: 'days_to_rotten', label: 'Days to Rotten', format: 'number' },
+ { key: 'is_deleted', label: 'Deleted', format: 'boolean' },
+ { key: 'add_time', label: 'Created At', format: 'datetime' },
+ { key: 'update_time', label: 'Updated At', format: 'datetime' },
+];
+
+const activityTypeFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Activity Type ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'key_string', label: 'Key' },
+ { key: 'icon_key', label: 'Icon' },
+ { key: 'color', label: 'Color' },
+ { key: 'order_nr', label: 'Order', format: 'number' },
+ { key: 'active_flag', label: 'Active', format: 'boolean' },
+ { key: 'is_custom_flag', label: 'Custom', format: 'boolean' },
+ { key: 'add_time', label: 'Created At' },
+ { key: 'update_time', label: 'Updated At' },
+];
+
+const userDetailFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'User ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'email', label: 'Email', format: 'email' },
+ { key: 'phone', label: 'Phone' },
+ { key: 'active_flag', label: 'Active', format: 'boolean' },
+ { key: 'is_deleted', label: 'Deleted', format: 'boolean' },
+ { key: 'has_created_company', label: 'Has Created Company', format: 'boolean' },
+ {
+ key: 'access',
+ label: 'Access',
+ labelKey: 'app',
+ listItems: [
+ { key: 'app', label: 'App' },
+ { key: 'admin', label: 'Admin', format: 'boolean' },
+ { key: 'permission_set_id', label: 'Permission Set ID' },
+ ],
+ },
+ { key: 'is_admin', label: 'Admin' },
+ { key: 'role_id', label: 'Role ID', format: 'number' },
+ { key: 'default_currency', label: 'Default Currency' },
+ { key: 'locale', label: 'Locale' },
+ { key: 'lang', label: 'Language ID', format: 'number' },
+ { key: 'timezone_name', label: 'Timezone' },
+ { key: 'timezone_offset', label: 'Timezone Offset' },
+ { key: 'icon_url', label: 'Icon URL', format: 'url' },
+ { key: 'is_you', label: 'Is Connected User', format: 'boolean' },
+ { key: 'last_login', label: 'Last Login' },
+ { key: 'created', label: 'Created At' },
+ { key: 'modified', label: 'Updated At' },
+];
+
+const currentUserFields: OutputSchema['fields'] = [
+ ...userDetailFields,
+ { key: 'company_id', label: 'Company ID', format: 'number' },
+ { key: 'company_name', label: 'Company Name' },
+ { key: 'company_domain', label: 'Company Domain' },
+ { key: 'company_country', label: 'Company Country' },
+ {
+ key: 'language',
+ label: 'Language',
+ children: [
+ { key: 'language_code', label: 'Language Code' },
+ { key: 'country_code', label: 'Country Code' },
+ ],
+ },
+];
+
+const leadConversionFields: OutputSchema['fields'] = [
+ { key: 'conversion_id', label: 'Conversion ID' },
+ { key: 'status', label: 'Status' },
+ { key: 'deal_id', label: 'Deal ID', format: 'number' },
+];
+
+const deleteResultFields: OutputSchema['fields'] = [{ key: 'id', label: 'Deleted ID' }];
+
+const customFieldsField: OutputSchema['fields'] = [
+ { key: 'custom_fields', label: 'Custom Fields', dynamicKey: true },
+];
+
+const dealExtraFields: OutputSchema['fields'] = [
+ { key: 'archive_time', label: 'Archived At', format: 'datetime' },
+ { key: 'channel', label: 'Channel' },
+ { key: 'channel_id', label: 'Channel ID' },
+ { key: 'origin', label: 'Origin' },
+ { key: 'origin_id', label: 'Origin ID' },
+ { key: 'local_close_date', label: 'Local Close Date', format: 'date' },
+ { key: 'local_won_date', label: 'Local Won Date', format: 'date' },
+ { key: 'local_lost_date', label: 'Local Lost Date', format: 'date' },
+];
+
+const atomicDealListFields: OutputSchema['fields'] = [
+ ...dealCoreFields,
+ ...dealExtraFields,
+ ...customFieldsField,
+];
+
+const atomicDealDetailFields: OutputSchema['fields'] = [
+ ...dealDetailFields,
+ ...dealExtraFields,
+ { key: 'first_won_time', label: 'First Won At', format: 'datetime' },
+ { key: 'email_messages_count', label: 'Email Messages', format: 'number' },
+ { key: 'last_incoming_mail_time', label: 'Last Incoming Mail', format: 'datetime' },
+ { key: 'last_outgoing_mail_time', label: 'Last Outgoing Mail', format: 'datetime' },
+];
+
+const relatedDealCountFields: OutputSchema['fields'] = [
+ { key: 'related_open_deals_count', label: 'Related Open Deals', format: 'number' },
+ { key: 'related_closed_deals_count', label: 'Related Closed Deals', format: 'number' },
+ { key: 'related_won_deals_count', label: 'Related Won Deals', format: 'number' },
+ { key: 'related_lost_deals_count', label: 'Related Lost Deals', format: 'number' },
+ { key: 'email_messages_count', label: 'Email Messages', format: 'number' },
+];
+
+const atomicPersonListFields: OutputSchema['fields'] = [
+ ...personCoreFields,
+ { key: 'picture_id', label: 'Picture ID', format: 'number' },
+ ...customFieldsField,
+];
+
+const atomicPersonDetailFields: OutputSchema['fields'] = [
+ ...personDetailFields,
+ ...relatedDealCountFields,
+ { key: 'picture_id', label: 'Picture ID', format: 'number' },
+ { key: 'participant_open_deals_count', label: 'Participant Open Deals', format: 'number' },
+ { key: 'participant_closed_deals_count', label: 'Participant Closed Deals', format: 'number' },
+];
+
+const atomicOrganizationListFields: OutputSchema['fields'] = [
+ ...organizationCoreFields,
+ ...customFieldsField,
+];
+
+const mergedRecordFields: OutputSchema['fields'] = [
+ { key: 'merge_what_id', label: 'Merged-Away Record ID', format: 'number' },
+];
+
+const mergedOrganizationFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Surviving Organization ID', format: 'number' },
+];
+
+const atomicOrganizationDetailFields: OutputSchema['fields'] = [
+ ...organizationDetailFields,
+ ...relatedDealCountFields,
+ { key: 'done_activities_count', label: 'Done Activities', format: 'number' },
+ { key: 'undone_activities_count', label: 'Undone Activities', format: 'number' },
+];
+
+const atomicActivityListFields: OutputSchema['fields'] = [
+ ...activityFields,
+ { key: 'private', label: 'Private', format: 'boolean' },
+ { key: 'project_id', label: 'Project ID', format: 'number' },
+ { key: 'conference_meeting_client', label: 'Meeting Client' },
+ { key: 'conference_meeting_id', label: 'Meeting ID' },
+ ...customFieldsField,
+];
+
+const atomicActivityDetailFields: OutputSchema['fields'] = [
+ ...atomicActivityListFields,
+ { key: 'attendees', label: 'Attendees' },
+];
+
+const atomicLeadFields: OutputSchema['fields'] = [
+ ...leadFields,
+ { key: 'archive_time', label: 'Archived At', format: 'datetime' },
+ { key: 'archive_reason', label: 'Archive Reason' },
+ { key: 'channel_id', label: 'Channel ID' },
+ { key: 'origin', label: 'Origin' },
+ { key: 'origin_id', label: 'Origin ID' },
+ { key: 'source_deal_id', label: 'Source Deal ID', format: 'number' },
+];
+
+const atomicNoteFields: OutputSchema['fields'] = [
+ ...noteFields.filter((field) => field.key !== 'user'),
+ {
+ key: 'user',
+ label: 'Author',
+ children: [
+ { key: 'name', label: 'Name' },
+ { key: 'email', label: 'Email', format: 'email' },
+ { key: 'icon_url', label: 'Icon URL', format: 'url' },
+ { key: 'is_you', label: 'Is Connected User', format: 'boolean' },
+ ],
+ },
+ { key: 'lead', label: 'Lead', children: [{ key: 'title', label: 'Title' }] },
+ { key: 'person', label: 'Person', children: [{ key: 'name', label: 'Name' }] },
+ { key: 'organization', label: 'Organization', children: [{ key: 'name', label: 'Name' }] },
+ { key: 'pinned_to_lead_flag', label: 'Pinned to Lead', format: 'boolean' },
+ { key: 'pinned_to_project_flag', label: 'Pinned to Project', format: 'boolean' },
+ { key: 'pinned_to_task_flag', label: 'Pinned to Task', format: 'boolean' },
+ { key: 'project_id', label: 'Project ID', format: 'number' },
+ { key: 'task_id', label: 'Task ID', format: 'number' },
+];
+
+const atomicDealProductFields: OutputSchema['fields'] = [
+ ...dealProductFields,
+ { key: 'billing_frequency', label: 'Billing Frequency' },
+ { key: 'billing_frequency_cycles', label: 'Billing Cycles', format: 'number' },
+ { key: 'billing_start_date', label: 'Billing Start Date', format: 'date' },
+ { key: 'product_variation_id', label: 'Product Variation ID', format: 'number' },
+];
+
+const mergedDealV1Fields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Surviving Deal ID', format: 'number' },
+ { key: 'title', label: 'Title' },
+ { key: 'value', label: 'Value', format: 'number' },
+ { key: 'formatted_value', label: 'Formatted Value' },
+ { key: 'currency', label: 'Currency' },
+ { key: 'status', label: 'Status' },
+ { key: 'pipeline_id', label: 'Pipeline ID', format: 'number' },
+ { key: 'stage_id', label: 'Stage ID', format: 'number' },
+ { key: 'stage_order_nr', label: 'Stage Order', format: 'number' },
+ { key: 'person_id', label: 'Person' },
+ { key: 'person_name', label: 'Person Name' },
+ { key: 'org_id', label: 'Organization' },
+ { key: 'org_name', label: 'Organization Name' },
+ { key: 'user_id', label: 'Owner User ID', format: 'number' },
+ { key: 'owner_name', label: 'Owner Name' },
+ { key: 'creator_user_id', label: 'Creator User ID', format: 'number' },
+ { key: 'probability', label: 'Probability', format: 'number' },
+ { key: 'weighted_value', label: 'Weighted Value', format: 'number' },
+ { key: 'expected_close_date', label: 'Expected Close Date', format: 'date' },
+ { key: 'close_time', label: 'Closed At', format: 'datetime' },
+ { key: 'won_time', label: 'Won At', format: 'datetime' },
+ { key: 'first_won_time', label: 'First Won At', format: 'datetime' },
+ { key: 'lost_time', label: 'Lost At', format: 'datetime' },
+ { key: 'lost_reason', label: 'Lost Reason' },
+ { key: 'label', label: 'Label' },
+ { key: 'active', label: 'Active', format: 'boolean' },
+ { key: 'deleted', label: 'Deleted', format: 'boolean' },
+ { key: 'is_archived', label: 'Archived', format: 'boolean' },
+ { key: 'visible_to', label: 'Visible To' },
+ { key: 'add_time', label: 'Created At', format: 'datetime' },
+ { key: 'update_time', label: 'Updated At', format: 'datetime' },
+ { key: 'stage_change_time', label: 'Stage Changed At', format: 'datetime' },
+ { key: 'next_activity_id', label: 'Next Activity ID', format: 'number' },
+ { key: 'next_activity_date', label: 'Next Activity Date', format: 'date' },
+ { key: 'next_activity_subject', label: 'Next Activity Subject' },
+ { key: 'last_activity_id', label: 'Last Activity ID', format: 'number' },
+ { key: 'last_activity_date', label: 'Last Activity Date', format: 'date' },
+ { key: 'activities_count', label: 'Activities', format: 'number' },
+ { key: 'done_activities_count', label: 'Done Activities', format: 'number' },
+ { key: 'undone_activities_count', label: 'Undone Activities', format: 'number' },
+ { key: 'notes_count', label: 'Notes', format: 'number' },
+ { key: 'files_count', label: 'Files', format: 'number' },
+ { key: 'followers_count', label: 'Followers', format: 'number' },
+ { key: 'participants_count', label: 'Participants', format: 'number' },
+ { key: 'products_count', label: 'Products', format: 'number' },
+ { key: 'email_messages_count', label: 'Email Messages', format: 'number' },
+ { key: 'cc_email', label: 'Smart BCC Email', format: 'email' },
+ { key: 'origin', label: 'Origin' },
+ { key: 'source_lead_id', label: 'Source Lead ID' },
+];
+
+const mergedPersonV1Fields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Surviving Person ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'first_name', label: 'First Name' },
+ { key: 'last_name', label: 'Last Name' },
+ { key: 'primary_email', label: 'Primary Email', format: 'email' },
+ { key: 'email', label: 'Emails', labelKey: 'value', listItems: contactChannelFields },
+ { key: 'phone', label: 'Phones', labelKey: 'value', listItems: contactChannelFields },
+ { key: 'org_id', label: 'Organization' },
+ { key: 'org_name', label: 'Organization Name' },
+ { key: 'owner_id', label: 'Owner ID', format: 'number' },
+ { key: 'owner_name', label: 'Owner Name' },
+ { key: 'job_title', label: 'Job Title' },
+ { key: 'birthday', label: 'Birthday', format: 'date' },
+ { key: 'label', label: 'Label' },
+ { key: 'label_ids', label: 'Label IDs' },
+ { key: 'visible_to', label: 'Visible To' },
+ { key: 'active_flag', label: 'Active', format: 'boolean' },
+ { key: 'add_time', label: 'Created At', format: 'datetime' },
+ { key: 'update_time', label: 'Updated At', format: 'datetime' },
+ { key: 'open_deals_count', label: 'Open Deals', format: 'number' },
+ { key: 'won_deals_count', label: 'Won Deals', format: 'number' },
+ { key: 'lost_deals_count', label: 'Lost Deals', format: 'number' },
+ { key: 'closed_deals_count', label: 'Closed Deals', format: 'number' },
+ { key: 'activities_count', label: 'Activities', format: 'number' },
+ { key: 'done_activities_count', label: 'Done Activities', format: 'number' },
+ { key: 'undone_activities_count', label: 'Undone Activities', format: 'number' },
+ { key: 'notes_count', label: 'Notes', format: 'number' },
+ { key: 'files_count', label: 'Files', format: 'number' },
+ { key: 'followers_count', label: 'Followers', format: 'number' },
+ { key: 'email_messages_count', label: 'Email Messages', format: 'number' },
+ { key: 'last_activity_id', label: 'Last Activity ID', format: 'number' },
+ { key: 'next_activity_id', label: 'Next Activity ID', format: 'number' },
+ { key: 'next_activity_date', label: 'Next Activity Date', format: 'date' },
+ { key: 'last_incoming_mail_time', label: 'Last Incoming Mail', format: 'datetime' },
+ { key: 'last_outgoing_mail_time', label: 'Last Outgoing Mail', format: 'datetime' },
+ { key: 'postal_address_formatted_address', label: 'Postal Address' },
+ { key: 'cc_email', label: 'Smart BCC Email', format: 'email' },
+];
+
+function v1Envelope({
+ label,
+ fields,
+}: {
+ label: string;
+ fields: OutputSchema['fields'];
+}): OutputSchema {
+ return {
+ fields: [
+ ...envelope(label, fields).fields,
+ { key: 'additional_data', label: 'Additional Data' },
+ ],
+ };
+}
+
function envelope(label: string, fields: OutputSchema['fields']): OutputSchema {
return {
fields: [
@@ -346,6 +732,23 @@ function search({
};
}
+function page({
+ label,
+ fields,
+ labelKey,
+}: {
+ label: string;
+ fields: OutputSchema['fields'];
+ labelKey: string;
+}): OutputSchema {
+ return {
+ fields: [
+ ...search({ label, fields, labelKey }).fields,
+ { key: 'next_cursor', label: 'Next Cursor' },
+ ],
+ };
+}
+
export const createPersonActionOutputSchema = envelope('Person', personCoreFields);
export const updatePersonActionOutputSchema = envelope('Person', personCoreFields);
export const addLabelsToPersonActionOutputSchema = envelope('Person', personCoreFields);
@@ -421,6 +824,101 @@ export const findProductsActionOutputSchema = search({
export const addFollowerActionOutputSchema = envelope('Follower', followerFields);
export const attachFileActionOutputSchema = envelope('File', fileFields);
+export const getDealActionOutputSchema = envelope('Deal', atomicDealDetailFields);
+export const getPersonActionOutputSchema = envelope('Person', atomicPersonDetailFields);
+export const getOrganizationActionOutputSchema = envelope('Organization', atomicOrganizationDetailFields);
+export const mergeDealsActionOutputSchema = envelope('Surviving Deal', [
+ ...mergedDealV1Fields,
+ ...mergedRecordFields,
+]);
+export const mergePersonsActionOutputSchema = envelope('Surviving Person', [
+ ...mergedPersonV1Fields,
+ ...mergedRecordFields,
+]);
+export const mergeOrganizationsActionOutputSchema = envelope(
+ 'Surviving Organization',
+ mergedOrganizationFields
+);
+export const getActivityActionOutputSchema = envelope('Activity', atomicActivityDetailFields);
+export const getLeadActionOutputSchema = v1Envelope({ label: 'Lead', fields: atomicLeadFields });
+export const updateNoteActionOutputSchema = envelope('Note', atomicNoteFields);
+export const getCurrentUserActionOutputSchema = v1Envelope({ label: 'User', fields: currentUserFields });
+export const getLeadConversionStatusActionOutputSchema = v1Envelope({ label: 'Conversion', fields: leadConversionFields });
+export const convertLeadToDealActionOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'conversion_id', label: 'Conversion ID' },
+ { key: 'lead_id', label: 'Lead ID' },
+ ],
+};
+export const deleteRecordActionOutputSchema = envelope('Deleted Record', deleteResultFields);
+export const deleteRecordWithAdditionalDataActionOutputSchema = v1Envelope({ label: 'Deleted Record', fields: deleteResultFields });
+export const deleteNoteActionOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'success', label: 'Success', format: 'boolean' },
+ { key: 'data', label: 'Deleted', format: 'boolean' },
+ ],
+};
+export const listDealsActionOutputSchema = page({
+ label: 'Deals',
+ fields: atomicDealListFields,
+ labelKey: 'title',
+});
+export const searchDealsActionOutputSchema = page({
+ label: 'Deals',
+ fields: dealSearchItemFields,
+ labelKey: 'title',
+});
+export const listDealProductsActionOutputSchema = page({
+ label: 'Deal Products',
+ fields: atomicDealProductFields,
+ labelKey: 'name',
+});
+export const listPersonsActionOutputSchema = page({
+ label: 'People',
+ fields: atomicPersonListFields,
+ labelKey: 'name',
+});
+export const searchPersonsActionOutputSchema = page({
+ label: 'People',
+ fields: personSearchItemFields,
+ labelKey: 'name',
+});
+export const listOrganizationsActionOutputSchema = page({
+ label: 'Organizations',
+ fields: atomicOrganizationListFields,
+ labelKey: 'name',
+});
+export const searchOrganizationsActionOutputSchema = page({
+ label: 'Organizations',
+ fields: organizationSearchItemFields,
+ labelKey: 'name',
+});
+export const listActivitiesActionOutputSchema = page({
+ label: 'Activities',
+ fields: atomicActivityListFields,
+ labelKey: 'subject',
+});
+export const listPipelinesActionOutputSchema = page({
+ label: 'Pipelines',
+ fields: pipelineFields,
+ labelKey: 'name',
+});
+export const listStagesActionOutputSchema = page({
+ label: 'Stages',
+ fields: stageFields,
+ labelKey: 'name',
+});
+export const listActivityTypesActionOutputSchema = search({
+ label: 'Activity Types',
+ fields: activityTypeFields,
+ labelKey: 'name',
+});
+export const listUsersActionOutputSchema = search({
+ label: 'Users',
+ fields: userDetailFields,
+ labelKey: 'name',
+});
+
export const newPersonTriggerOutputSchema: OutputSchema = { fields: personDetailFields };
export const updatedPersonTriggerOutputSchema: OutputSchema = { fields: personDetailFields };
export const newDealTriggerOutputSchema: OutputSchema = { fields: dealDetailFields };