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
TypeScript ai-agentai-agent-toolsai-agentsai-agents-frameworkmcpmcp-servermcp-toolsmcpsn8n-alternativeno-code-automationworkflowworkflow-automationworkflows
feat(mautic): add AI actions and output schemas (#16316)
Kishan Parmarfe54de014196
diff --git a/bun.lock b/bun.lockindex d0cf2afa617..781fdf2f88f 100644--- a/bun.lock+++ b/bun.lock@@ -5620,12 +5620,13 @@},"packages/pieces/community/mautic": {"name": "@activepieces/piece-mautic",- "version": "0.6.1",+ "version": "0.7.0","dependencies": {"@activepieces/core-piece-types": "workspace:*","@activepieces/core-utils": "workspace:*","@activepieces/pieces-common": "workspace:*","@activepieces/pieces-framework": "workspace:*",+ "form-data": "4.0.6",},"devDependencies": {"tslib": "2.6.2",diff --git a/packages/pieces/community/mautic/package.json b/packages/pieces/community/mautic/package.jsonindex 500476d897d..c55d87079ed 100644--- a/packages/pieces/community/mautic/package.json+++ b/packages/pieces/community/mautic/package.json@@ -1,6 +1,6 @@{"name": "@activepieces/piece-mautic",- "version": "0.6.1",+ "version": "0.7.0","main": "./dist/src/index.js","types": "./dist/src/index.d.ts","scripts": {@@ -12,7 +12,8 @@"@activepieces/pieces-common": "workspace:*","@activepieces/pieces-framework": "workspace:*","@activepieces/core-piece-types": "workspace:*",- "@activepieces/core-utils": "workspace:*"+ "@activepieces/core-utils": "workspace:*",+ "form-data": "4.0.6"},"devDependencies": {"tslib": "2.6.2"diff --git a/packages/pieces/community/mautic/src/index.ts b/packages/pieces/community/mautic/src/index.tsindex 680f81622b9..2f74d81d21d 100644--- a/packages/pieces/community/mautic/src/index.ts+++ b/packages/pieces/community/mautic/src/index.ts@@ -1,56 +1,39 @@import { createCustomApiCallAction } from '@activepieces/pieces-common';-import {- PieceAuth,- PiecePropValueSchema,- Property,- createPiece,-} from '@activepieces/pieces-framework';-import { PieceCategory } from '@activepieces/pieces-framework';-import {- createCompany,- createContact,- searchCompany,- searchContact,- updateCompany,- updateContact,-} from './lib/actions';-import { triggers } from './lib/triggers';+import { createPiece, PieceCategory } from '@activepieces/pieces-framework';+import { createCompanyAction } from './lib/actions/create-company';+import { createContactAction } from './lib/actions/create-contact';+import { searchCompanyAction } from './lib/actions/search-company';+import { searchContactAction } from './lib/actions/search-contact';+import { updateCompanyAction } from './lib/actions/update-company';+import { updateContactAction } from './lib/actions/update-contact';+import { mauticAiActions } from './lib/actions/ai';import { mauticAuth } from './lib/auth';--const markdownDescription = `-Follow these steps:--1. **Enter the Base URL:** Open your Mautic instance and copy the URL from the address bar. If your dashboard link is "https://mautic.ddev.site/s/dashboard", set your base URL as "https://mautic.ddev.site/".--2. **Enable Basic Authentication:** Log in to Mautic, go to **Settings** > **Configuration** > **API Settings**, and ensure that Basic Authentication is enabled.--`;+import { mauticClient } from './lib/common/client';+import { contactChannelSubscriptionChangedTrigger } from './lib/triggers/contact-channel-subscription-changed';+import { contactCompanyChangedTrigger } from './lib/triggers/contact-company-changed';+import { contactUpdatedTrigger } from './lib/triggers/contact-updated';+import { newContactTrigger } from './lib/triggers/new-contact';export const mautic = createPiece({displayName: 'Mautic',description: 'Open-source marketing automation software',- minimumSupportedRelease: '0.30.0',+ minimumSupportedRelease: '0.88.2',logoUrl: 'https://cdn.activepieces.com/pieces/mautic.png',authors: ["bibhuty-did-this","kanarelo","kishanprmr","MoShizzle","khaledmashaly","abuaboud"],categories: [PieceCategory.MARKETING],auth: mauticAuth,actions: [- createContact,- searchContact,- updateContact,- createCompany,- searchCompany,- updateCompany,+ createContactAction,+ searchContactAction,+ updateContactAction,+ createCompanyAction,+ searchCompanyAction,+ updateCompanyAction,+ ...mauticAiActions,createCustomApiCallAction({auth: mauticAuth,- baseUrl: (auth) => {- if (!auth) {- return '';- }- const { base_url } = auth.props;- return `${base_url.endsWith('/') ? base_url : base_url + '/'}api/`;- },+ baseUrl: (auth) => (auth ? mauticClient.baseUrl({ auth }) : ''),authMapping: async (auth) => {const { username, password } = auth.props;return {@@ -62,5 +45,10 @@ export const mautic = createPiece({},}),],- triggers,+ triggers: [+ contactUpdatedTrigger,+ contactCompanyChangedTrigger,+ contactChannelSubscriptionChangedTrigger,+ newContactTrigger,+ ],});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/assets/create-asset.ts b/packages/pieces/community/mautic/src/lib/actions/ai/assets/create-asset.tsnew file mode 100644index 00000000000..6aadf1a4cf3--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/assets/create-asset.ts@@ -0,0 +1,66 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticCreateAssetOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticCreateAssetAction = createAction({+ auth: mauticAuth,+ name: 'mautic_create_asset',+ outputSchema: mauticCreateAssetOutputSchema,+ displayName: 'Create Asset',+ description: 'Creates a Mautic asset.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Creates an asset that points to a file at a remote URL. Title and Remote URL are required.',+ idempotent: false,+ },+ props: {+ title: Property.ShortText({ displayName: 'Title', required: true }),+ file: Property.ShortText({+ displayName: 'Remote URL',+ description:+ 'Public URL of the file, e.g. "https://example.com/guide.pdf". Mautic links to it rather than storing a copy.',+ required: true,+ }),+ alias: Property.ShortText({ displayName: 'Alias', required: false }),+ description: Property.LongText({ displayName: 'Description', required: false }),+ isPublished: mauticAiProps.yesNo({ displayName: 'Published' }),+ category: Property.Number({+ displayName: 'Category Id',+ description: 'Category id, from List Categories.',+ required: false,+ }),+ language: Property.ShortText({+ displayName: 'Language',+ description: 'Locale code, e.g. "en".',+ required: false,+ }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other asset properties, e.g. "publishUp", "publishDown". The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const { additionalFields, title, file, alias, description, isPublished, category, language } =+ context.propsValue;+ return await mauticApi.createRecord({+ auth: context.auth,+ resource: 'assets',+ body: {+ ...additionalFields,+ storageLocation: 'remote',+ ...spreadIfDefined('title', title),+ ...spreadIfDefined('file', file),+ ...spreadIfDefined('alias', alias),+ ...spreadIfDefined('description', description),+ ...spreadIfDefined('isPublished', isPublished),+ ...spreadIfDefined('category', category),+ ...spreadIfDefined('language', language),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/assets/delete-asset.ts b/packages/pieces/community/mautic/src/lib/actions/ai/assets/delete-asset.tsnew file mode 100644index 00000000000..a25493f378b--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/assets/delete-asset.ts@@ -0,0 +1,33 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticDeleteAssetOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticDeleteAssetAction = createAction({+ auth: mauticAuth,+ name: 'mautic_delete_asset',+ outputSchema: mauticDeleteAssetOutputSchema,+ displayName: 'Delete Asset',+ description: 'Permanently deletes a Mautic asset.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description: 'Permanently deletes an asset and its download stats. Cannot be undone.',+ idempotent: false,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Asset Id',+ description: 'Numeric asset id, from List Assets or Create Asset.',+ }),+ },+ async run(context) {+ return await mauticApi.deleteRecord({+ auth: context.auth,+ resource: 'assets',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/assets/get-asset.ts b/packages/pieces/community/mautic/src/lib/actions/ai/assets/get-asset.tsnew file mode 100644index 00000000000..d3dff6d7a47--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/assets/get-asset.ts@@ -0,0 +1,33 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticGetAssetOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticGetAssetAction = createAction({+ auth: mauticAuth,+ name: 'mautic_get_asset',+ outputSchema: mauticGetAssetOutputSchema,+ displayName: 'Get Asset',+ description: 'Gets one Mautic asset by id.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description: 'Gets a single asset by its numeric id, with its download URL.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Asset Id',+ description: 'Numeric asset id, from List Assets or Create Asset.',+ }),+ },+ async run(context) {+ return await mauticApi.getRecord({+ auth: context.auth,+ resource: 'assets',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/assets/list-assets.ts b/packages/pieces/community/mautic/src/lib/actions/ai/assets/list-assets.tsnew file mode 100644index 00000000000..6728cff7358--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/assets/list-assets.ts@@ -0,0 +1,32 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListAssetsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticListAssetsAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_assets',+ outputSchema: mauticListAssetsOutputSchema,+ displayName: 'List Assets',+ description: 'Lists Mautic assets.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists assets (downloadable files) with their download counts. Page with Start and Limit; the response has the total count.',+ idempotent: true,+ },+ props: {+ ...mauticAiProps.listOptions,+ },+ async run(context) {+ return await mauticApi.listRecords({+ auth: context.auth,+ resource: 'assets',+ key: 'assets',+ query: context.propsValue,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/assets/output-schemas.ts b/packages/pieces/community/mautic/src/lib/actions/ai/assets/output-schemas.tsnew file mode 100644index 00000000000..5a670dd68c1--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/assets/output-schemas.ts@@ -0,0 +1,76 @@+import { OutputSchema } from '@activepieces/pieces-framework';++import { assetFields, categoryFields } from '../../../output-schemas';++export const mauticCreateAssetOutputSchema: OutputSchema = {+ fields: [{ key: 'asset', label: 'Asset', children: assetFields }],+};++export const mauticDeleteAssetOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'asset',+ label: 'Asset',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified' },+ { key: 'id', label: 'ID' },+ { key: 'title', label: 'Title' },+ { key: 'alias', label: 'Alias' },+ { key: 'category', label: 'Category', children: categoryFields },+ { key: 'description', label: 'Description' },+ { key: 'language', label: 'Language' },+ { key: 'publishUp', label: 'Publish Up' },+ { key: 'publishDown', label: 'Publish Down' },+ { key: 'downloadCount', label: 'Download Count', format: 'number' },+ { key: 'uniqueDownloadCount', label: 'Unique Download Count', format: 'number' },+ { key: 'revision', label: 'Revision', format: 'number' },+ { key: 'extension', label: 'Extension' },+ { key: 'mime', label: 'Mime' },+ { key: 'size', label: 'Size', format: 'filesize' },+ { key: 'downloadUrl', label: 'Download URL', format: 'url' },+ { key: 'storageLocation', label: 'Storage Location' },+ { key: 'disallow', label: 'Disallow', format: 'boolean' },+ ],+ },+ ],+};++export const mauticGetAssetOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'asset',+ label: 'Asset',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified', format: 'datetime' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'title', label: 'Title' },+ { key: 'alias', label: 'Alias' },+ { key: 'category', label: 'Category', children: categoryFields },+ { key: 'description', label: 'Description' },+ { key: 'language', label: 'Language' },+ { key: 'publishUp', label: 'Publish Up' },+ { key: 'publishDown', label: 'Publish Down' },+ { key: 'downloadCount', label: 'Download Count', format: 'number' },+ { key: 'uniqueDownloadCount', label: 'Unique Download Count', format: 'number' },+ { key: 'revision', label: 'Revision', format: 'number' },+ { key: 'extension', label: 'Extension' },+ { key: 'mime', label: 'Mime' },+ { key: 'size', label: 'Size', format: 'filesize' },+ { key: 'downloadUrl', label: 'Download URL', format: 'url' },+ { key: 'storageLocation', label: 'Storage Location' },+ { key: 'disallow', label: 'Disallow', format: 'boolean' },+ ],+ },+ ],+};++export const mauticListAssetsOutputSchema: OutputSchema = {+ fields: [+ { key: 'total', label: 'Total', format: 'number' },+ { key: 'assets', label: 'Assets', labelKey: 'title', listItems: assetFields },+ ],+};diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/assets/update-asset.ts b/packages/pieces/community/mautic/src/lib/actions/ai/assets/update-asset.tsnew file mode 100644index 00000000000..c3ee1cf1a90--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/assets/update-asset.ts@@ -0,0 +1,79 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticGetAssetOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticUpdateAssetAction = createAction({+ auth: mauticAuth,+ name: 'mautic_update_asset',+ outputSchema: mauticGetAssetOutputSchema,+ displayName: 'Update Asset',+ description: 'Updates fields of a Mautic asset.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Updates an existing asset; a new Remote URL replaces the file. Only the fields given are changed.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Asset Id',+ description: 'Numeric asset id, from List Assets or Create Asset.',+ }),+ title: Property.ShortText({ displayName: 'Title', required: false }),+ file: Property.ShortText({+ displayName: 'Remote URL',+ description:+ 'Public URL of the file, e.g. "https://example.com/guide.pdf". Mautic links to it rather than storing a copy.',+ required: false,+ }),+ alias: Property.ShortText({ displayName: 'Alias', required: false }),+ description: Property.LongText({ displayName: 'Description', required: false }),+ isPublished: mauticAiProps.yesNo({ displayName: 'Published' }),+ category: Property.Number({+ displayName: 'Category Id',+ description: 'Category id, from List Categories.',+ required: false,+ }),+ language: Property.ShortText({+ displayName: 'Language',+ description: 'Locale code, e.g. "en".',+ required: false,+ }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other asset properties, e.g. "publishUp", "publishDown". The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const {+ id,+ additionalFields,+ title,+ file,+ alias,+ description,+ isPublished,+ category,+ language,+ } = context.propsValue;+ return await mauticApi.updateRecord({+ auth: context.auth,+ resource: 'assets',+ id,+ body: {+ ...additionalFields,+ ...spreadIfDefined('title', title),+ ...(file ? { file, storageLocation: 'remote' } : {}),+ ...spreadIfDefined('alias', alias),+ ...spreadIfDefined('description', description),+ ...spreadIfDefined('isPublished', isPublished),+ ...spreadIfDefined('category', category),+ ...spreadIfDefined('language', language),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/add-contact-to-campaign.ts b/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/add-contact-to-campaign.tsnew file mode 100644index 00000000000..b1a2b784174--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/add-contact-to-campaign.ts@@ -0,0 +1,40 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticAdjustContactPointsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticAddContactToCampaignAction = createAction({+ auth: mauticAuth,+ name: 'mautic_add_contact_to_campaign',+ outputSchema: mauticAdjustContactPointsOutputSchema,+ displayName: 'Add Contact to Campaign',+ description: 'Adds a contact to a Mautic campaign.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Adds a contact to a campaign manually, so it starts receiving the campaign events. Repeating it leaves the contact in the campaign.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Campaign Id',+ description: 'Numeric campaign id, from List Campaigns or Create Campaign.',+ }),+ contactId: mauticAiProps.recordId({+ displayName: 'Contact Id',+ description: 'Numeric contact id, from List Contacts.',+ }),+ },+ async run(context) {+ return await mauticApi.changeMembership({+ auth: context.auth,+ resource: 'campaigns',+ id: context.propsValue.id,+ contactId: context.propsValue.contactId,+ change: 'add',+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/batch-reschedule-contact-campaign-events.ts b/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/batch-reschedule-contact-campaign-events.tsnew file mode 100644index 00000000000..df03ad7220b--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/batch-reschedule-contact-campaign-events.ts@@ -0,0 +1,34 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticBatchRescheduleContactCampaignEventsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';+import { mauticUtils } from '../../../common/utils';++export const mauticBatchRescheduleContactCampaignEventsAction = createAction({+ auth: mauticAuth,+ name: 'mautic_batch_reschedule_contact_campaign_events',+ outputSchema: mauticBatchRescheduleContactCampaignEventsOutputSchema,+ displayName: 'Batch Reschedule Contact Campaign Events',+ description: 'Changes when several Mautic campaign events run for contacts.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Reschedules many contact campaign events in one request. Each record has "eventId", "contactId" and "triggerDate" (or "dateTriggered"). Per-record errors are in the response.',+ idempotent: true,+ },+ props: {+ records: mauticAiProps.records({+ description:+ 'Each an object like {"eventId": 3, "contactId": 12, "triggerDate": "2026-05-01 09:00:00"}.',+ }),+ },+ async run(context) {+ return await mauticApi.batchRescheduleContactCampaignEvents({+ auth: context.auth,+ records: mauticUtils.toBatchRecords({ records: context.propsValue.records }),+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/clone-campaign.ts b/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/clone-campaign.tsnew file mode 100644index 00000000000..79c2ef60fc4--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/clone-campaign.ts@@ -0,0 +1,30 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticCloneCampaignOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticCloneCampaignAction = createAction({+ auth: mauticAuth,+ name: 'mautic_clone_campaign',+ outputSchema: mauticCloneCampaignOutputSchema,+ displayName: 'Clone Campaign',+ description: 'Copies a Mautic campaign.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Creates an unpublished copy of a campaign with the same events. Each call makes another copy. Returns the new campaign.',+ idempotent: false,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Campaign Id',+ description: 'Numeric campaign id, from List Campaigns or Create Campaign.',+ }),+ },+ async run(context) {+ return await mauticApi.cloneCampaign({ auth: context.auth, id: context.propsValue.id });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/create-campaign.ts b/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/create-campaign.tsnew file mode 100644index 00000000000..f15c683eada--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/create-campaign.ts@@ -0,0 +1,75 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticCreateCampaignOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticCreateCampaignAction = createAction({+ auth: mauticAuth,+ name: 'mautic_create_campaign',+ outputSchema: mauticCreateCampaignOutputSchema,+ displayName: 'Create Campaign',+ description: 'Creates a Mautic campaign.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Creates a campaign. Name, at least one event and a contact source (a segment in "lists" or a form in "forms") are required; Mautic rejects a campaign without them. Events, source segments and forms go in Additional Fields, e.g. {"events": [{"id": "new1", "name": "Add points", "type": "lead.changepoints", "eventType": "action", "order": 1, "properties": {"points": 1}, "triggerMode": "immediate"}], "lists": [{"id": 1}], "canvasSettings": {"nodes": [...], "connections": [...]}}.',+ idempotent: false,+ },+ props: {+ name: Property.ShortText({ displayName: 'Name', required: true }),+ description: Property.LongText({ displayName: 'Description', required: false }),+ isPublished: mauticAiProps.yesNo({ displayName: 'Published' }),+ category: Property.Number({+ displayName: 'Category Id',+ description: 'Category id, from List Categories.',+ required: false,+ }),+ allowRestart: mauticAiProps.yesNo({+ displayName: 'Allow Restart',+ description: 'Whether contacts can go through the campaign more than once.',+ }),+ publishUp: Property.ShortText({+ displayName: 'Publish Up',+ description: 'Start date/time, e.g. "2026-01-01 09:00:00".',+ required: false,+ }),+ publishDown: Property.ShortText({+ displayName: 'Publish Down',+ description: 'End date/time, e.g. "2026-12-31 18:00:00".',+ required: false,+ }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other campaign properties, such as "events", "lists" (segment ids as [{"id": 1}]), "forms" and "canvasSettings", in the shape Get Campaign returns. The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const {+ additionalFields,+ name,+ description,+ isPublished,+ category,+ allowRestart,+ publishUp,+ publishDown,+ } = context.propsValue;+ return await mauticApi.createRecord({+ auth: context.auth,+ resource: 'campaigns',+ body: {+ ...additionalFields,+ ...spreadIfDefined('name', name),+ ...spreadIfDefined('description', description),+ ...spreadIfDefined('isPublished', isPublished),+ ...spreadIfDefined('category', category),+ ...spreadIfDefined('allowRestart', allowRestart),+ ...spreadIfDefined('publishUp', publishUp),+ ...spreadIfDefined('publishDown', publishDown),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/delete-campaign.ts b/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/delete-campaign.tsnew file mode 100644index 00000000000..474d8433262--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/delete-campaign.ts@@ -0,0 +1,33 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticDeleteCampaignOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticDeleteCampaignAction = createAction({+ auth: mauticAuth,+ name: 'mautic_delete_campaign',+ outputSchema: mauticDeleteCampaignOutputSchema,+ displayName: 'Delete Campaign',+ description: 'Permanently deletes a Mautic campaign.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description: 'Permanently deletes a campaign and its event history. Cannot be undone.',+ idempotent: false,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Campaign Id',+ description: 'Numeric campaign id, from List Campaigns or Create Campaign.',+ }),+ },+ async run(context) {+ return await mauticApi.deleteRecord({+ auth: context.auth,+ resource: 'campaigns',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/get-campaign-event.ts b/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/get-campaign-event.tsnew file mode 100644index 00000000000..4732e781bc2--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/get-campaign-event.ts@@ -0,0 +1,34 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticGetCampaignEventOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticGetCampaignEventAction = createAction({+ auth: mauticAuth,+ name: 'mautic_get_campaign_event',+ outputSchema: mauticGetCampaignEventOutputSchema,+ displayName: 'Get Campaign Event',+ description: 'Gets one Mautic event by id.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description:+ 'Gets a single campaign event by id, with its type, trigger settings and properties.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Event Id',+ description: 'Numeric event id, from List Campaign Events or Get Campaign.',+ }),+ },+ async run(context) {+ return await mauticApi.getRecord({+ auth: context.auth,+ resource: 'campaigns/events',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/get-campaign.ts b/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/get-campaign.tsnew file mode 100644index 00000000000..40d9dd13c54--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/get-campaign.ts@@ -0,0 +1,33 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticGetCampaignOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticGetCampaignAction = createAction({+ auth: mauticAuth,+ name: 'mautic_get_campaign',+ outputSchema: mauticGetCampaignOutputSchema,+ displayName: 'Get Campaign',+ description: 'Gets one Mautic campaign by id.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description: 'Gets a single campaign by its numeric id, with its events, segments and forms.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Campaign Id',+ description: 'Numeric campaign id, from List Campaigns or Create Campaign.',+ }),+ },+ async run(context) {+ return await mauticApi.getRecord({+ auth: context.auth,+ resource: 'campaigns',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/list-campaign-contact-events.ts b/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/list-campaign-contact-events.tsnew file mode 100644index 00000000000..0bd6315f967--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/list-campaign-contact-events.ts@@ -0,0 +1,40 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListCampaignContactEventsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticListCampaignContactEventsAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_campaign_contact_events',+ outputSchema: mauticListCampaignContactEventsOutputSchema,+ displayName: 'List Campaign Contact Events',+ description: 'Lists the events of one Mautic campaign for a contact.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ "Lists the events of one campaign that a contact has been through or is scheduled for, with the log of each and the contact's membership.",+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Campaign Id',+ description: 'Numeric campaign id, from List Campaigns or Create Campaign.',+ }),+ contactId: mauticAiProps.recordId({+ displayName: 'Contact Id',+ description: 'Numeric contact id, from List Contacts.',+ }),+ ...mauticAiProps.pageOptions,+ },+ async run(context) {+ return await mauticApi.listContactCampaignEvents({+ auth: context.auth,+ campaignId: context.propsValue.id,+ contactId: context.propsValue.contactId,+ query: context.propsValue,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/list-campaign-contacts.ts b/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/list-campaign-contacts.tsnew file mode 100644index 00000000000..4effbade787--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/list-campaign-contacts.ts@@ -0,0 +1,37 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListCampaignContactsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticListCampaignContactsAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_campaign_contacts',+ outputSchema: mauticListCampaignContactsOutputSchema,+ displayName: 'List Campaign Contacts',+ description: 'Lists the contacts in a Mautic campaign.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists the contacts in a campaign with their membership dates (contact ids, not full records; use Get Contact for details). Page with Start and Limit.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Campaign Id',+ description: 'Numeric campaign id, from List Campaigns or Create Campaign.',+ }),+ start: mauticAiProps.pageOptions.start,+ limit: mauticAiProps.pageOptions.limit,+ where: mauticAiProps.listOptions.where,+ },+ async run(context) {+ return await mauticApi.listCampaignContacts({+ auth: context.auth,+ id: context.propsValue.id,+ query: context.propsValue,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/list-campaign-events.ts b/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/list-campaign-events.tsnew file mode 100644index 00000000000..3d170da0f38--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/list-campaign-events.ts@@ -0,0 +1,32 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListCampaignEventsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticListCampaignEventsAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_campaign_events',+ outputSchema: mauticListCampaignEventsOutputSchema,+ displayName: 'List Campaign Events',+ description: 'Lists Mautic campaign events.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists the events (actions, decisions and conditions) across all campaigns, with their campaign. Use Where on "campaign" to narrow to one campaign. Page with Start and Limit; the response has the total count.',+ idempotent: true,+ },+ props: {+ ...mauticAiProps.filterOptions,+ },+ async run(context) {+ return await mauticApi.listRecords({+ auth: context.auth,+ resource: 'campaigns/events',+ key: 'events',+ query: context.propsValue,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/list-campaigns.ts b/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/list-campaigns.tsnew file mode 100644index 00000000000..8b5d4651c98--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/list-campaigns.ts@@ -0,0 +1,32 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListCampaignsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticListCampaignsAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_campaigns',+ outputSchema: mauticListCampaignsOutputSchema,+ displayName: 'List Campaigns',+ description: 'Lists Mautic campaigns.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists campaigns with their events. Use Search for free text or Where for exact column conditions. Page with Start and Limit; the response has the total count.',+ idempotent: true,+ },+ props: {+ ...mauticAiProps.listOptions,+ },+ async run(context) {+ return await mauticApi.listRecords({+ auth: context.auth,+ resource: 'campaigns',+ key: 'campaigns',+ query: context.propsValue,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/list-contact-campaign-events.ts b/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/list-contact-campaign-events.tsnew file mode 100644index 00000000000..90f6011fa5c--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/list-contact-campaign-events.ts@@ -0,0 +1,35 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListContactCampaignEventsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticListContactCampaignEventsAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_contact_campaign_events',+ outputSchema: mauticListContactCampaignEventsOutputSchema,+ displayName: 'List Contact Campaign Events',+ description: 'Lists the campaign events of a Mautic contact.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists every campaign event a contact has been through or is scheduled for, across all campaigns, with the log of each. Use List Campaign Contact Events for one campaign.',+ idempotent: true,+ },+ props: {+ contactId: mauticAiProps.recordId({+ displayName: 'Contact Id',+ description: 'Numeric contact id, from List Contacts.',+ }),+ ...mauticAiProps.pageOptions,+ },+ async run(context) {+ return await mauticApi.listContactCampaignEvents({+ auth: context.auth,+ contactId: context.propsValue.contactId,+ query: context.propsValue,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/output-schemas.ts b/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/output-schemas.tsnew file mode 100644index 00000000000..b832f6a38f8--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/output-schemas.ts@@ -0,0 +1,348 @@+import { OutputSchema } from '@activepieces/pieces-framework';++import {+ campaign2Fields,+ campaignEventsFields,+ campaignFields,+ campaignListsFields,+ categoryFields,+ eventFields,+} from '../../../output-schemas';++export const mauticAdjustContactPointsOutputSchema: OutputSchema = {+ fields: [{ key: 'success', label: 'Success', format: 'number' }],+};++export const mauticBatchRescheduleContactCampaignEventsOutputSchema: OutputSchema = {+ fields: [+ { key: 'events', label: 'Events', dynamicKey: true, labelKey: 'name' },+ {+ key: 'errors',+ label: 'Errors',+ listItems: [+ { key: 'code', label: 'Code', format: 'number' },+ { key: 'message', label: 'Message' },+ { key: 'details', label: 'Details' },+ { key: 'type', label: 'Type' },+ ],+ },+ ],+};++export const mauticCloneCampaignOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'campaign',+ label: 'Campaign',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified', format: 'datetime' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'name', label: 'Name' },+ { key: 'category', label: 'Category', children: categoryFields },+ { key: 'description', label: 'Description' },+ { key: 'allowRestart', label: 'Allow Restart', format: 'boolean' },+ { key: 'publishUp', label: 'Publish Up', format: 'datetime' },+ { key: 'publishDown', label: 'Publish Down', format: 'datetime' },+ { key: 'events', label: 'Events' },+ { key: 'forms', label: 'Forms' },+ { key: 'lists', label: 'Lists' },+ {+ key: 'canvasSettings',+ label: 'Canvas Settings',+ children: [+ {+ key: 'nodes',+ label: 'Nodes',+ labelKey: 'id',+ listItems: [+ { key: 'id', label: 'ID' },+ { key: 'positionX', label: 'Position X' },+ { key: 'positionY', label: 'Position Y' },+ ],+ },+ {+ key: 'connections',+ label: 'Connections',+ listItems: [+ {+ key: 'anchors',+ label: 'Anchors',+ children: [+ { key: 'source', label: 'Source' },+ { key: 'target', label: 'Target' },+ ],+ },+ { key: 'sourceId', label: 'Source ID' },+ { key: 'targetId', label: 'Target ID' },+ ],+ },+ ],+ },+ ],+ },+ ],+};++export const mauticCreateCampaignOutputSchema: OutputSchema = {+ fields: [{ key: 'campaign', label: 'Campaign', children: campaignFields }],+};++export const mauticDeleteCampaignOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'campaign',+ label: 'Campaign',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified', format: 'datetime' },+ { key: 'id', label: 'ID' },+ { key: 'name', label: 'Name' },+ { key: 'category', label: 'Category', children: categoryFields },+ { key: 'description', label: 'Description' },+ { key: 'allowRestart', label: 'Allow Restart', format: 'boolean' },+ { key: 'publishUp', label: 'Publish Up', format: 'datetime' },+ { key: 'publishDown', label: 'Publish Down', format: 'datetime' },+ { key: 'events', label: 'Events' },+ { key: 'forms', label: 'Forms' },+ { key: 'lists', label: 'Lists' },+ {+ key: 'canvasSettings',+ label: 'Canvas Settings',+ children: [+ {+ key: 'nodes',+ label: 'Nodes',+ labelKey: 'id',+ listItems: [+ { key: 'id', label: 'ID' },+ { key: 'positionX', label: 'Position X' },+ { key: 'positionY', label: 'Position Y' },+ ],+ },+ {+ key: 'connections',+ label: 'Connections',+ listItems: [+ {+ key: 'anchors',+ label: 'Anchors',+ children: [+ { key: 'source', label: 'Source' },+ { key: 'target', label: 'Target' },+ ],+ },+ { key: 'sourceId', label: 'Source ID' },+ { key: 'targetId', label: 'Target ID' },+ ],+ },+ ],+ },+ ],+ },+ ],+};++export const mauticGetCampaignEventOutputSchema: OutputSchema = {+ fields: [{ key: 'event', label: 'Event', children: eventFields }],+};++export const mauticGetCampaignOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'campaign',+ label: 'Campaign',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified', format: 'datetime' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'name', label: 'Name' },+ { key: 'category', label: 'Category', children: categoryFields },+ { key: 'description', label: 'Description' },+ { key: 'allowRestart', label: 'Allow Restart', format: 'boolean' },+ { key: 'publishUp', label: 'Publish Up', format: 'datetime' },+ { key: 'publishDown', label: 'Publish Down', format: 'datetime' },+ { key: 'events', label: 'Events', labelKey: 'name', listItems: campaignEventsFields },+ { key: 'forms', label: 'Forms' },+ { key: 'lists', label: 'Lists', labelKey: 'name', listItems: campaignListsFields },+ {+ key: 'canvasSettings',+ label: 'Canvas Settings',+ children: [+ {+ key: 'nodes',+ label: 'Nodes',+ labelKey: 'id',+ listItems: [+ { key: 'id', label: 'ID' },+ { key: 'positionX', label: 'Position X' },+ { key: 'positionY', label: 'Position Y' },+ ],+ },+ {+ key: 'connections',+ label: 'Connections',+ listItems: [+ {+ key: 'anchors',+ label: 'Anchors',+ children: [+ { key: 'source', label: 'Source' },+ { key: 'target', label: 'Target' },+ ],+ },+ { key: 'sourceId', label: 'Source ID' },+ { key: 'targetId', label: 'Target ID' },+ ],+ },+ ],+ },+ ],+ },+ ],+};++export const mauticListCampaignContactEventsOutputSchema: OutputSchema = {+ fields: [+ { key: 'total', label: 'Total', format: 'number' },+ {+ key: 'events',+ label: 'Events',+ labelKey: 'name',+ listItems: [+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'name', label: 'Name' },+ { key: 'description', label: 'Description' },+ { key: 'type', label: 'Type' },+ { key: 'eventType', label: 'Event Type' },+ { key: 'channel', label: 'Channel' },+ { key: 'channelId', label: 'Channel ID' },+ { key: 'order', label: 'Order', format: 'number' },+ { key: 'triggerDate', label: 'Trigger Date' },+ { key: 'triggerInterval', label: 'Trigger Interval', format: 'number' },+ { key: 'triggerIntervalUnit', label: 'Trigger Interval Unit' },+ { key: 'triggerHour', label: 'Trigger Hour' },+ { key: 'triggerRestrictedStartHour', label: 'Trigger Restricted Start Hour' },+ { key: 'triggerRestrictedStopHour', label: 'Trigger Restricted Stop Hour' },+ { key: 'triggerRestrictedDaysOfWeek', label: 'Trigger Restricted Days Of Week' },+ { key: 'triggerMode', label: 'Trigger Mode' },+ { key: 'decisionPath', label: 'Decision Path' },+ { key: 'parent', label: 'Parent' },+ { key: 'contactLog', label: 'Contact Log' },+ ],+ },+ { key: 'campaign', label: 'Campaign', children: campaign2Fields },+ {+ key: 'membership',+ label: 'Membership',+ listItems: [+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'manuallyRemoved', label: 'Manually Removed', format: 'boolean' },+ { key: 'manuallyAdded', label: 'Manually Added', format: 'boolean' },+ { key: 'rotation', label: 'Rotation', format: 'number' },+ { key: 'dateLastExited', label: 'Date Last Exited' },+ ],+ },+ ],+};++export const mauticListCampaignContactsOutputSchema: OutputSchema = {+ fields: [+ { key: 'total', label: 'Total' },+ {+ key: 'contacts',+ label: 'Contacts',+ listItems: [+ { key: 'campaign_id', label: 'Campaign ID' },+ { key: 'lead_id', label: 'Lead ID' },+ { key: 'date_added', label: 'Date Added', format: 'datetime' },+ { key: 'manually_removed', label: 'Manually Removed' },+ { key: 'manually_added', label: 'Manually Added' },+ { key: 'rotation', label: 'Rotation' },+ ],+ },+ ],+};++export const mauticListCampaignEventsOutputSchema: OutputSchema = {+ fields: [+ { key: 'total', label: 'Total', format: 'number' },+ { key: 'events', label: 'Events', labelKey: 'name', listItems: eventFields },+ ],+};++export const mauticListCampaignsOutputSchema: OutputSchema = {+ fields: [+ { key: 'total', label: 'Total', format: 'number' },+ { key: 'campaigns', label: 'Campaigns', labelKey: 'name', listItems: campaignFields },+ ],+};++export const mauticListContactCampaignEventsOutputSchema: OutputSchema = {+ fields: [+ { key: 'total', label: 'Total', format: 'number' },+ { key: 'events', label: 'Events' },+ ],+};++export const mauticRescheduleContactCampaignEventOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'event',+ label: 'Event',+ children: [+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'name', label: 'Name' },+ { key: 'description', label: 'Description' },+ { key: 'type', label: 'Type' },+ { key: 'eventType', label: 'Event Type' },+ { key: 'channel', label: 'Channel' },+ { key: 'channelId', label: 'Channel ID' },+ { key: 'order', label: 'Order', format: 'number' },+ { key: 'triggerDate', label: 'Trigger Date' },+ { key: 'triggerInterval', label: 'Trigger Interval', format: 'number' },+ { key: 'triggerIntervalUnit', label: 'Trigger Interval Unit' },+ { key: 'triggerHour', label: 'Trigger Hour' },+ { key: 'triggerRestrictedStartHour', label: 'Trigger Restricted Start Hour' },+ { key: 'triggerRestrictedStopHour', label: 'Trigger Restricted Stop Hour' },+ { key: 'triggerRestrictedDaysOfWeek', label: 'Trigger Restricted Days Of Week' },+ { key: 'triggerMode', label: 'Trigger Mode' },+ { key: 'decisionPath', label: 'Decision Path' },+ { key: 'parent', label: 'Parent' },+ {+ key: 'campaign',+ label: 'Campaign',+ children: [+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'name', label: 'Name' },+ { key: 'category', label: 'Category' },+ { key: 'description', label: 'Description' },+ { key: 'allowRestart', label: 'Allow Restart', format: 'boolean' },+ { key: 'publishUp', label: 'Publish Up', format: 'datetime' },+ { key: 'publishDown', label: 'Publish Down', format: 'datetime' },+ { key: 'events', label: 'Events' },+ { key: 'deleted', label: 'Deleted' },+ ],+ },+ {+ key: 'contactLog',+ label: 'Contact Log',+ listItems: [+ { key: 'ipAddress', label: 'IP Address' },+ { key: 'dateTriggered', label: 'Date Triggered', format: 'datetime' },+ { key: 'isScheduled', label: 'Is Scheduled', format: 'boolean' },+ { key: 'triggerDate', label: 'Trigger Date', format: 'datetime' },+ { key: 'metadata', label: 'Metadata' },+ { key: 'nonActionPathTaken', label: 'Non Action Path Taken', format: 'boolean' },+ { key: 'channel', label: 'Channel' },+ { key: 'channelId', label: 'Channel ID' },+ { key: 'rotation', label: 'Rotation', format: 'number' },+ ],+ },+ ],+ },+ ],+};diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/remove-contact-from-campaign.ts b/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/remove-contact-from-campaign.tsnew file mode 100644index 00000000000..6b2a756a243--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/remove-contact-from-campaign.ts@@ -0,0 +1,40 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticAdjustContactPointsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticRemoveContactFromCampaignAction = createAction({+ auth: mauticAuth,+ name: 'mautic_remove_contact_from_campaign',+ outputSchema: mauticAdjustContactPointsOutputSchema,+ displayName: 'Remove Contact from Campaign',+ description: 'Removes a contact from a Mautic campaign.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Removes a contact from a campaign manually; it stops receiving the campaign events. Repeating it leaves the contact out.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Campaign Id',+ description: 'Numeric campaign id, from List Campaigns or Create Campaign.',+ }),+ contactId: mauticAiProps.recordId({+ displayName: 'Contact Id',+ description: 'Numeric contact id, from List Contacts.',+ }),+ },+ async run(context) {+ return await mauticApi.changeMembership({+ auth: context.auth,+ resource: 'campaigns',+ id: context.propsValue.id,+ contactId: context.propsValue.contactId,+ change: 'remove',+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/reschedule-contact-campaign-event.ts b/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/reschedule-contact-campaign-event.tsnew file mode 100644index 00000000000..8a33916389f--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/reschedule-contact-campaign-event.ts@@ -0,0 +1,53 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticRescheduleContactCampaignEventOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticRescheduleContactCampaignEventAction = createAction({+ auth: mauticAuth,+ name: 'mautic_reschedule_contact_campaign_event',+ outputSchema: mauticRescheduleContactCampaignEventOutputSchema,+ displayName: 'Reschedule Contact Campaign Event',+ description: 'Changes when a Mautic campaign event runs for a contact.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Sets when a campaign action runs for a contact who is in the campaign, or marks it as already run with Date Triggered. Fails if the event already ran for the contact or is a decision. Setting the same date again changes nothing.',+ idempotent: true,+ },+ props: {+ eventId: mauticAiProps.recordId({+ displayName: 'Event Id',+ description: 'Numeric campaign event id, from List Campaign Events or Get Campaign.',+ }),+ contactId: mauticAiProps.recordId({+ displayName: 'Contact Id',+ description: 'Numeric contact id, from List Contacts.',+ }),+ triggerDate: Property.ShortText({+ displayName: 'Trigger Date',+ description: 'When the event should run, e.g. "2026-05-01 09:00:00".',+ required: false,+ }),+ dateTriggered: Property.ShortText({+ displayName: 'Date Triggered',+ description: 'Marks the event as run at this date/time instead of scheduling it.',+ required: false,+ }),+ },+ async run(context) {+ const { eventId, contactId, triggerDate, dateTriggered } = context.propsValue;+ return await mauticApi.rescheduleContactCampaignEvent({+ auth: context.auth,+ eventId,+ contactId,+ body: {+ ...spreadIfDefined('triggerDate', triggerDate),+ ...spreadIfDefined('dateTriggered', dateTriggered),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/update-campaign.ts b/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/update-campaign.tsnew file mode 100644index 00000000000..0cfa1bd8a8a--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/campaigns/update-campaign.ts@@ -0,0 +1,81 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticGetCampaignOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticUpdateCampaignAction = createAction({+ auth: mauticAuth,+ name: 'mautic_update_campaign',+ outputSchema: mauticGetCampaignOutputSchema,+ displayName: 'Update Campaign',+ description: 'Updates fields of a Mautic campaign.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Updates an existing campaign, e.g. to publish or unpublish it. Only the fields given are changed.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Campaign Id',+ description: 'Numeric campaign id, from List Campaigns or Create Campaign.',+ }),+ name: Property.ShortText({ displayName: 'Name', required: false }),+ description: Property.LongText({ displayName: 'Description', required: false }),+ isPublished: mauticAiProps.yesNo({ displayName: 'Published' }),+ category: Property.Number({+ displayName: 'Category Id',+ description: 'Category id, from List Categories.',+ required: false,+ }),+ allowRestart: mauticAiProps.yesNo({+ displayName: 'Allow Restart',+ description: 'Whether contacts can go through the campaign more than once.',+ }),+ publishUp: Property.ShortText({+ displayName: 'Publish Up',+ description: 'Start date/time, e.g. "2026-01-01 09:00:00".',+ required: false,+ }),+ publishDown: Property.ShortText({+ displayName: 'Publish Down',+ description: 'End date/time, e.g. "2026-12-31 18:00:00".',+ required: false,+ }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other campaign properties, such as "events", "lists" (segment ids as [{"id": 1}]), "forms" and "canvasSettings", in the shape Get Campaign returns. The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const {+ id,+ additionalFields,+ name,+ description,+ isPublished,+ category,+ allowRestart,+ publishUp,+ publishDown,+ } = context.propsValue;+ return await mauticApi.updateRecord({+ auth: context.auth,+ resource: 'campaigns',+ id,+ body: {+ ...additionalFields,+ ...spreadIfDefined('name', name),+ ...spreadIfDefined('description', description),+ ...spreadIfDefined('isPublished', isPublished),+ ...spreadIfDefined('category', category),+ ...spreadIfDefined('allowRestart', allowRestart),+ ...spreadIfDefined('publishUp', publishUp),+ ...spreadIfDefined('publishDown', publishDown),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/categories/create-category.ts b/packages/pieces/community/mautic/src/lib/actions/ai/categories/create-category.tsnew file mode 100644index 00000000000..7df29b7df06--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/categories/create-category.ts@@ -0,0 +1,72 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticCreateCategoryOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticCreateCategoryAction = createAction({+ auth: mauticAuth,+ name: 'mautic_create_category',+ outputSchema: mauticCreateCategoryOutputSchema,+ displayName: 'Create Category',+ description: 'Creates a Mautic category.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description: 'Creates a category. Title and Bundle are required.',+ idempotent: false,+ },+ props: {+ title: Property.ShortText({ displayName: 'Title', required: true }),+ bundle: Property.StaticDropdown({+ displayName: 'Bundle',+ description: 'Where the category can be used. Global works everywhere.',+ required: true,+ options: {+ options: [+ { label: 'Global', value: 'global' },+ { label: 'Asset', value: 'asset' },+ { label: 'Campaign', value: 'campaign' },+ { label: 'Email', value: 'email' },+ { label: 'Form', value: 'form' },+ { label: 'Page', value: 'page' },+ { label: 'Point', value: 'point' },+ { label: 'Segment', value: 'segment' },+ { label: 'Stage', value: 'stage' },+ { label: 'Text Message', value: 'sms' },+ { label: 'Dynamic Content', value: 'dynamicContent' },+ { label: 'Focus', value: 'plugin:focus' },+ { label: 'Marketing Message', value: 'messages' },+ { label: 'Web Push', value: 'notification' },+ ],+ },+ }),+ description: Property.LongText({ displayName: 'Description', required: false }),+ color: Property.ShortText({+ displayName: 'Color',+ description: 'Hex color without "#", e.g. "4e5d9d".',+ required: false,+ }),+ isPublished: mauticAiProps.yesNo({ displayName: 'Published' }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other category properties, e.g. "alias". The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const { additionalFields, title, bundle, description, color, isPublished } = context.propsValue;+ return await mauticApi.createRecord({+ auth: context.auth,+ resource: 'categories',+ body: {+ ...additionalFields,+ ...spreadIfDefined('title', title),+ ...spreadIfDefined('bundle', bundle),+ ...spreadIfDefined('description', description),+ ...spreadIfDefined('color', color),+ ...spreadIfDefined('isPublished', isPublished),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/categories/delete-category.ts b/packages/pieces/community/mautic/src/lib/actions/ai/categories/delete-category.tsnew file mode 100644index 00000000000..20415d79128--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/categories/delete-category.ts@@ -0,0 +1,34 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticDeleteCategoryOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticDeleteCategoryAction = createAction({+ auth: mauticAuth,+ name: 'mautic_delete_category',+ outputSchema: mauticDeleteCategoryOutputSchema,+ displayName: 'Delete Category',+ description: 'Permanently deletes a Mautic category.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description:+ 'Permanently deletes a category; items in it become uncategorized. Cannot be undone.',+ idempotent: false,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Category Id',+ description: 'Numeric category id, from List Categories or Create Category.',+ }),+ },+ async run(context) {+ return await mauticApi.deleteRecord({+ auth: context.auth,+ resource: 'categories',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/categories/get-category.ts b/packages/pieces/community/mautic/src/lib/actions/ai/categories/get-category.tsnew file mode 100644index 00000000000..bf33c858673--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/categories/get-category.ts@@ -0,0 +1,33 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticCreateCategoryOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticGetCategoryAction = createAction({+ auth: mauticAuth,+ name: 'mautic_get_category',+ outputSchema: mauticCreateCategoryOutputSchema,+ displayName: 'Get Category',+ description: 'Gets one Mautic category by id.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description: 'Gets a single category by its numeric id.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Category Id',+ description: 'Numeric category id, from List Categories or Create Category.',+ }),+ },+ async run(context) {+ return await mauticApi.getRecord({+ auth: context.auth,+ resource: 'categories',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/categories/list-categories.ts b/packages/pieces/community/mautic/src/lib/actions/ai/categories/list-categories.tsnew file mode 100644index 00000000000..4da9a93185c--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/categories/list-categories.ts@@ -0,0 +1,32 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListCategoriesOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticListCategoriesAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_categories',+ outputSchema: mauticListCategoriesOutputSchema,+ displayName: 'List Categories',+ description: 'Lists Mautic categories.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists categories with the bundle each one applies to. Category ids are used by emails, segments, campaigns, assets and more. Page with Start and Limit; the response has the total count.',+ idempotent: true,+ },+ props: {+ ...mauticAiProps.listOptions,+ },+ async run(context) {+ return await mauticApi.listRecords({+ auth: context.auth,+ resource: 'categories',+ key: 'categories',+ query: context.propsValue,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/categories/output-schemas.ts b/packages/pieces/community/mautic/src/lib/actions/ai/categories/output-schemas.tsnew file mode 100644index 00000000000..f6013b61ea2--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/categories/output-schemas.ts@@ -0,0 +1,31 @@+import { OutputSchema } from '@activepieces/pieces-framework';++import { categoryFields } from '../../../output-schemas';++export const mauticCreateCategoryOutputSchema: OutputSchema = {+ fields: [{ key: 'category', label: 'Category', children: categoryFields }],+};++export const mauticDeleteCategoryOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'category',+ label: 'Category',+ children: [+ { key: 'id', label: 'ID' },+ { key: 'title', label: 'Title' },+ { key: 'alias', label: 'Alias' },+ { key: 'description', label: 'Description' },+ { key: 'color', label: 'Color' },+ { key: 'bundle', label: 'Bundle' },+ ],+ },+ ],+};++export const mauticListCategoriesOutputSchema: OutputSchema = {+ fields: [+ { key: 'total', label: 'Total', format: 'number' },+ { key: 'categories', label: 'Categories', labelKey: 'title', listItems: categoryFields },+ ],+};diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/categories/update-category.ts b/packages/pieces/community/mautic/src/lib/actions/ai/categories/update-category.tsnew file mode 100644index 00000000000..22f79225e12--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/categories/update-category.ts@@ -0,0 +1,78 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticCreateCategoryOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticUpdateCategoryAction = createAction({+ auth: mauticAuth,+ name: 'mautic_update_category',+ outputSchema: mauticCreateCategoryOutputSchema,+ displayName: 'Update Category',+ description: 'Updates fields of a Mautic category.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description: 'Updates an existing category. Only the fields given are changed.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Category Id',+ description: 'Numeric category id, from List Categories or Create Category.',+ }),+ title: Property.ShortText({ displayName: 'Title', required: false }),+ bundle: Property.StaticDropdown({+ displayName: 'Bundle',+ description: 'Where the category can be used. Global works everywhere.',+ required: false,+ options: {+ options: [+ { label: 'Global', value: 'global' },+ { label: 'Asset', value: 'asset' },+ { label: 'Campaign', value: 'campaign' },+ { label: 'Email', value: 'email' },+ { label: 'Form', value: 'form' },+ { label: 'Page', value: 'page' },+ { label: 'Point', value: 'point' },+ { label: 'Segment', value: 'segment' },+ { label: 'Stage', value: 'stage' },+ { label: 'Text Message', value: 'sms' },+ { label: 'Dynamic Content', value: 'dynamicContent' },+ { label: 'Focus', value: 'plugin:focus' },+ { label: 'Marketing Message', value: 'messages' },+ { label: 'Web Push', value: 'notification' },+ ],+ },+ }),+ description: Property.LongText({ displayName: 'Description', required: false }),+ color: Property.ShortText({+ displayName: 'Color',+ description: 'Hex color without "#", e.g. "4e5d9d".',+ required: false,+ }),+ isPublished: mauticAiProps.yesNo({ displayName: 'Published' }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other category properties, e.g. "alias". The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const { id, additionalFields, title, bundle, description, color, isPublished } =+ context.propsValue;+ return await mauticApi.updateRecord({+ auth: context.auth,+ resource: 'categories',+ id,+ body: {+ ...additionalFields,+ ...spreadIfDefined('title', title),+ ...spreadIfDefined('bundle', bundle),+ ...spreadIfDefined('description', description),+ ...spreadIfDefined('color', color),+ ...spreadIfDefined('isPublished', isPublished),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/companies/add-contact-to-company.ts b/packages/pieces/community/mautic/src/lib/actions/ai/companies/add-contact-to-company.tsnew file mode 100644index 00000000000..8e10a3f7cc4--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/companies/add-contact-to-company.ts@@ -0,0 +1,39 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticAdjustContactPointsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticAddContactToCompanyAction = createAction({+ auth: mauticAuth,+ name: 'mautic_add_contact_to_company',+ outputSchema: mauticAdjustContactPointsOutputSchema,+ displayName: 'Add Contact to Company',+ description: 'Adds a contact to a Mautic company.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description: 'Links a contact to a company. Repeating it leaves the link as is.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Company Id',+ description: 'Numeric company id, from List Companies or Create Company.',+ }),+ contactId: mauticAiProps.recordId({+ displayName: 'Contact Id',+ description: 'Numeric contact id, from List Contacts.',+ }),+ },+ async run(context) {+ return await mauticApi.changeMembership({+ auth: context.auth,+ resource: 'companies',+ id: context.propsValue.id,+ contactId: context.propsValue.contactId,+ change: 'add',+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/companies/batch-create-companies.ts b/packages/pieces/community/mautic/src/lib/actions/ai/companies/batch-create-companies.tsnew file mode 100644index 00000000000..5987088eeb2--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/companies/batch-create-companies.ts@@ -0,0 +1,34 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticBatchCreateCompaniesOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';+import { mauticUtils } from '../../../common/utils';++export const mauticBatchCreateCompaniesAction = createAction({+ auth: mauticAuth,+ name: 'mautic_batch_create_companies',+ outputSchema: mauticBatchCreateCompaniesOutputSchema,+ displayName: 'Batch Create Companies',+ description: 'Creates several Mautic companies in one request.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Creates up to 200 companies in one request. Each record is an object of field values keyed by alias and needs "companyname", e.g. {"companyname": "Acme", "companywebsite": "https://acme.com"}. Per-record errors are in the response.',+ idempotent: false,+ },+ props: {+ records: mauticAiProps.records({+ description: 'Companies to create, each an object of field values keyed by field alias.',+ }),+ },+ async run(context) {+ return await mauticApi.batchCreateRecords({+ auth: context.auth,+ resource: 'companies',+ records: mauticUtils.toBatchRecords({ records: context.propsValue.records }),+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/companies/batch-delete-companies.ts b/packages/pieces/community/mautic/src/lib/actions/ai/companies/batch-delete-companies.tsnew file mode 100644index 00000000000..188576093ba--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/companies/batch-delete-companies.ts@@ -0,0 +1,34 @@+import { Property, createAction } from '@activepieces/pieces-framework';++import { mauticBatchDeleteCompaniesOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticApi } from '../../../common/api';+import { mauticUtils } from '../../../common/utils';++export const mauticBatchDeleteCompaniesAction = createAction({+ auth: mauticAuth,+ name: 'mautic_batch_delete_companies',+ outputSchema: mauticBatchDeleteCompaniesOutputSchema,+ displayName: 'Batch Delete Companies',+ description: 'Permanently deletes several Mautic companies.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description: 'Permanently deletes up to 200 companies by id in one request. Cannot be undone.',+ idempotent: false,+ },+ props: {+ ids: Property.Array({+ displayName: 'Company Ids',+ description: 'Numeric company ids, from List Companies.',+ required: true,+ }),+ },+ async run(context) {+ return await mauticApi.batchDeleteRecords({+ auth: context.auth,+ resource: 'companies',+ ids: mauticUtils.toBatchIds({ ids: context.propsValue.ids }),+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/companies/batch-update-companies.ts b/packages/pieces/community/mautic/src/lib/actions/ai/companies/batch-update-companies.tsnew file mode 100644index 00000000000..6a322661a39--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/companies/batch-update-companies.ts@@ -0,0 +1,35 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticBatchUpdateCompaniesOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';+import { mauticUtils } from '../../../common/utils';++export const mauticBatchUpdateCompaniesAction = createAction({+ auth: mauticAuth,+ name: 'mautic_batch_update_companies',+ outputSchema: mauticBatchUpdateCompaniesOutputSchema,+ displayName: 'Batch Update Companies',+ description: 'Updates several Mautic companies in one request.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Updates up to 200 companies in one request. Each record has the company "id" plus only the fields to change; other fields are left alone. Per-record errors are in the response.',+ idempotent: true,+ },+ props: {+ records: mauticAiProps.records({+ description:+ 'Companies to update, each an object with "id" and the field values to change, keyed by field alias.',+ }),+ },+ async run(context) {+ return await mauticApi.batchUpdateRecords({+ auth: context.auth,+ resource: 'companies',+ records: mauticUtils.toBatchRecords({ records: context.propsValue.records }),+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/companies/create-company.ts b/packages/pieces/community/mautic/src/lib/actions/ai/companies/create-company.tsnew file mode 100644index 00000000000..9da7568f8cb--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/companies/create-company.ts@@ -0,0 +1,64 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticCreateCompanyOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticCreateCompanyAction = createAction({+ auth: mauticAuth,+ name: 'mautic_create_company',+ outputSchema: mauticCreateCompanyOutputSchema,+ displayName: 'Create Company',+ description: 'Creates a Mautic company.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Creates a company from the given field values. Company Name is required. Mautic may merge into an existing company with the same unique identifier fields.',+ idempotent: false,+ },+ props: {+ companyname: Property.ShortText({ displayName: 'Company Name', required: true }),+ companyemail: Property.ShortText({ displayName: 'Email', required: false }),+ companyphone: Property.ShortText({ displayName: 'Phone', required: false }),+ companywebsite: Property.ShortText({ displayName: 'Website', required: false }),+ companycity: Property.ShortText({ displayName: 'City', required: false }),+ companycountry: Property.ShortText({ displayName: 'Country', required: false }),+ owner: Property.Number({+ displayName: 'Owner Id',+ description: 'Id of the Mautic user who owns the company, from List Contact Owners.',+ required: false,+ }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other company fields keyed by field alias, e.g. {"companyindustry": "Software", "companyaddress1": "1 Main St"}. Aliases come from List Fields with object "company". The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const {+ additionalFields,+ companyname,+ companyemail,+ companyphone,+ companywebsite,+ companycity,+ companycountry,+ owner,+ } = context.propsValue;+ return await mauticApi.createRecord({+ auth: context.auth,+ resource: 'companies',+ body: {+ ...additionalFields,+ ...spreadIfDefined('companyname', companyname),+ ...spreadIfDefined('companyemail', companyemail),+ ...spreadIfDefined('companyphone', companyphone),+ ...spreadIfDefined('companywebsite', companywebsite),+ ...spreadIfDefined('companycity', companycity),+ ...spreadIfDefined('companycountry', companycountry),+ ...spreadIfDefined('owner', owner),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/companies/delete-company.ts b/packages/pieces/community/mautic/src/lib/actions/ai/companies/delete-company.tsnew file mode 100644index 00000000000..92eb3677fe7--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/companies/delete-company.ts@@ -0,0 +1,34 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticDeleteCompanyOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticDeleteCompanyAction = createAction({+ auth: mauticAuth,+ name: 'mautic_delete_company',+ outputSchema: mauticDeleteCompanyOutputSchema,+ displayName: 'Delete Company',+ description: 'Permanently deletes a Mautic company.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description:+ 'Permanently deletes a company. Its contacts are kept but unlinked. Cannot be undone.',+ idempotent: false,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Company Id',+ description: 'Numeric company id, from List Companies or Create Company.',+ }),+ },+ async run(context) {+ return await mauticApi.deleteRecord({+ auth: context.auth,+ resource: 'companies',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/companies/get-company.ts b/packages/pieces/community/mautic/src/lib/actions/ai/companies/get-company.tsnew file mode 100644index 00000000000..28ffd10cc16--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/companies/get-company.ts@@ -0,0 +1,34 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticGetCompanyOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticGetCompanyAction = createAction({+ auth: mauticAuth,+ name: 'mautic_get_company',+ outputSchema: mauticGetCompanyOutputSchema,+ displayName: 'Get Company',+ description: 'Gets one Mautic company by id.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description:+ 'Gets a single company by its numeric id, with all field values. Get the id from List Companies.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Company Id',+ description: 'Numeric company id, from List Companies or Create Company.',+ }),+ },+ async run(context) {+ return await mauticApi.getRecord({+ auth: context.auth,+ resource: 'companies',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/companies/list-companies.ts b/packages/pieces/community/mautic/src/lib/actions/ai/companies/list-companies.tsnew file mode 100644index 00000000000..ba743b80165--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/companies/list-companies.ts@@ -0,0 +1,32 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListCompaniesOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticListCompaniesAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_companies',+ outputSchema: mauticListCompaniesOutputSchema,+ displayName: 'List Companies',+ description: 'Lists Mautic companies.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists companies with paging, sorting and filters. Use Search for free text or commands like "companyname:Acme", or Where for exact column conditions. Page with Start and Limit; the response has the total count.',+ idempotent: true,+ },+ props: {+ ...mauticAiProps.listOptions,+ },+ async run(context) {+ return await mauticApi.listRecords({+ auth: context.auth,+ resource: 'companies',+ key: 'companies',+ query: context.propsValue,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/companies/output-schemas.ts b/packages/pieces/community/mautic/src/lib/actions/ai/companies/output-schemas.tsnew file mode 100644index 00000000000..3e72ef99294--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/companies/output-schemas.ts@@ -0,0 +1,249 @@+import { OutputSchema } from '@activepieces/pieces-framework';++import { fieldsAll3Fields, fieldsAllFields } from '../../../output-schemas';++export const mauticAdjustContactPointsOutputSchema: OutputSchema = {+ fields: [{ key: 'success', label: 'Success', format: 'number' }],+};++export const mauticBatchCreateCompaniesOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'companies',+ label: 'Companies',+ labelKey: 'id',+ listItems: [+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'score', label: 'Score', format: 'number' },+ {+ key: 'fields',+ label: 'Fields',+ children: [{ key: 'all', label: 'All', children: fieldsAllFields }],+ },+ ],+ },+ { key: 'statusCodes', label: 'Status Codes' },+ ],+};++export const mauticBatchDeleteCompaniesOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'companies',+ label: 'Companies',+ labelKey: 'id',+ listItems: [+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'score', label: 'Score', format: 'number' },+ {+ key: 'fields',+ label: 'Fields',+ children: [+ { key: 'other', label: 'Other' },+ { key: 'all', label: 'All', children: fieldsAll3Fields },+ ],+ },+ ],+ },+ ],+};++export const mauticBatchUpdateCompaniesOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'companies',+ label: 'Companies',+ labelKey: 'id',+ listItems: [+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'score', label: 'Score', format: 'number' },+ {+ key: 'fields',+ label: 'Fields',+ children: [+ { key: 'other', label: 'Other' },+ { key: 'all', label: 'All', children: fieldsAll3Fields },+ ],+ },+ ],+ },+ { key: 'statusCodes', label: 'Status Codes' },+ ],+};++export const mauticCreateCompanyOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'company',+ label: 'Company',+ children: [+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'score', label: 'Score', format: 'number' },+ {+ key: 'fields',+ label: 'Fields',+ children: [+ {+ key: 'all',+ label: 'All',+ children: [+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'companyaddress1', label: 'Company Address 1' },+ { key: 'companyaddress2', label: 'Company Address 2' },+ { key: 'companyemail', label: 'Company Email', format: 'email' },+ { key: 'companyphone', label: 'Company Phone' },+ { key: 'companycity', label: 'Company City' },+ { key: 'companystate', label: 'Company State' },+ { key: 'companyzipcode', label: 'Company Zip Code' },+ { key: 'companycountry', label: 'Company Country' },+ { key: 'companyname', label: 'Company Name' },+ { key: 'companywebsite', label: 'Company Website', format: 'url' },+ { key: 'companynumber_of_employees', label: 'Company Number of Employees' },+ { key: 'companyfax', label: 'Company Fax' },+ { key: 'companyannual_revenue', label: 'Company Annual Revenue' },+ { key: 'companyindustry', label: 'Company Industry' },+ { key: 'companydescription', label: 'Company Description' },+ ],+ },+ ],+ },+ ],+ },+ ],+};++export const mauticDeleteCompanyOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'company',+ label: 'Company',+ children: [+ { key: 'id', label: 'ID' },+ { key: 'score', label: 'Score', format: 'number' },+ {+ key: 'fields',+ label: 'Fields',+ children: [+ { key: 'other', label: 'Other' },+ {+ key: 'all',+ label: 'All',+ children: [+ { key: 'id', label: 'ID' },+ { key: 'companyaddress1', label: 'Company Address 1' },+ { key: 'companyaddress2', label: 'Company Address 2' },+ { key: 'companyemail', label: 'Company Email', format: 'email' },+ { key: 'companyphone', label: 'Company Phone' },+ { key: 'companycity', label: 'Company City' },+ { key: 'companystate', label: 'Company State' },+ { key: 'companyzipcode', label: 'Company Zip Code' },+ { key: 'companycountry', label: 'Company Country' },+ { key: 'companyname', label: 'Company Name' },+ { key: 'companywebsite', label: 'Company Website', format: 'url' },+ {+ key: 'companynumber_of_employees',+ label: 'Company Number of Employees',+ format: 'number',+ },+ { key: 'companyfax', label: 'Company Fax' },+ { key: 'companyannual_revenue', label: 'Company Annual Revenue' },+ { key: 'companyindustry', label: 'Company Industry' },+ { key: 'companydescription', label: 'Company Description' },+ ],+ },+ ],+ },+ ],+ },+ ],+};++export const mauticGetCompanyOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'company',+ label: 'Company',+ children: [+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'score', label: 'Score', format: 'number' },+ {+ key: 'fields',+ label: 'Fields',+ children: [+ { key: 'other', label: 'Other' },+ {+ key: 'all',+ label: 'All',+ children: [+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'companyaddress1', label: 'Company Address 1' },+ { key: 'companyaddress2', label: 'Company Address 2' },+ { key: 'companyemail', label: 'Company Email', format: 'email' },+ { key: 'companyphone', label: 'Company Phone' },+ { key: 'companycity', label: 'Company City' },+ { key: 'companystate', label: 'Company State' },+ { key: 'companyzipcode', label: 'Company Zip Code' },+ { key: 'companycountry', label: 'Company Country' },+ { key: 'companyname', label: 'Company Name' },+ { key: 'companywebsite', label: 'Company Website', format: 'url' },+ {+ key: 'companynumber_of_employees',+ label: 'Company Number of Employees',+ format: 'number',+ },+ { key: 'companyfax', label: 'Company Fax' },+ { key: 'companyannual_revenue', label: 'Company Annual Revenue' },+ { key: 'companyindustry', label: 'Company Industry' },+ { key: 'companydescription', label: 'Company Description' },+ ],+ },+ ],+ },+ ],+ },+ ],+};++export const mauticListCompaniesOutputSchema: OutputSchema = {+ fields: [+ { key: 'total', label: 'Total' },+ {+ key: 'companies',+ label: 'Companies',+ labelKey: 'id',+ listItems: [+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'score', label: 'Score', format: 'number' },+ {+ key: 'fields',+ label: 'Fields',+ children: [+ { key: 'other', label: 'Other' },+ {+ key: 'all',+ label: 'All',+ children: [+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'companyemail', label: 'Company Email', format: 'email' },+ { key: 'companyaddress1', label: 'Company Address 1' },+ { key: 'companyaddress2', label: 'Company Address 2' },+ { key: 'companyphone', label: 'Company Phone' },+ { key: 'companycity', label: 'Company City' },+ { key: 'companystate', label: 'Company State' },+ { key: 'companyzipcode', label: 'Company Zip Code' },+ { key: 'companycountry', label: 'Company Country' },+ { key: 'companyname', label: 'Company Name' },+ { key: 'companywebsite', label: 'Company Website', format: 'url' },+ { key: 'companyindustry', label: 'Company Industry' },+ { key: 'companydescription', label: 'Company Description' },+ { key: 'companynumber_of_employees', label: 'Company Number of Employees' },+ { key: 'companyfax', label: 'Company Fax' },+ { key: 'companyannual_revenue', label: 'Company Annual Revenue' },+ ],+ },+ ],+ },+ ],+ },+ ],+};diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/companies/remove-contact-from-company.ts b/packages/pieces/community/mautic/src/lib/actions/ai/companies/remove-contact-from-company.tsnew file mode 100644index 00000000000..6be987b5817--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/companies/remove-contact-from-company.ts@@ -0,0 +1,39 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticAdjustContactPointsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticRemoveContactFromCompanyAction = createAction({+ auth: mauticAuth,+ name: 'mautic_remove_contact_from_company',+ outputSchema: mauticAdjustContactPointsOutputSchema,+ displayName: 'Remove Contact from Company',+ description: 'Removes a contact from a Mautic company.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description: 'Unlinks a contact from a company. Repeating it leaves the contact unlinked.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Company Id',+ description: 'Numeric company id, from List Companies or Create Company.',+ }),+ contactId: mauticAiProps.recordId({+ displayName: 'Contact Id',+ description: 'Numeric contact id, from List Contacts.',+ }),+ },+ async run(context) {+ return await mauticApi.changeMembership({+ auth: context.auth,+ resource: 'companies',+ id: context.propsValue.id,+ contactId: context.propsValue.contactId,+ change: 'remove',+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/companies/update-company.ts b/packages/pieces/community/mautic/src/lib/actions/ai/companies/update-company.tsnew file mode 100644index 00000000000..7f200569221--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/companies/update-company.ts@@ -0,0 +1,70 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticGetCompanyOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticUpdateCompanyAction = createAction({+ auth: mauticAuth,+ name: 'mautic_update_company',+ outputSchema: mauticGetCompanyOutputSchema,+ displayName: 'Update Company',+ description: 'Updates fields of a Mautic company.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Updates an existing company. Fails if the company id does not exist. Only the fields given are changed.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Company Id',+ description: 'Numeric company id, from List Companies or Create Company.',+ }),+ companyname: Property.ShortText({ displayName: 'Company Name', required: false }),+ companyemail: Property.ShortText({ displayName: 'Email', required: false }),+ companyphone: Property.ShortText({ displayName: 'Phone', required: false }),+ companywebsite: Property.ShortText({ displayName: 'Website', required: false }),+ companycity: Property.ShortText({ displayName: 'City', required: false }),+ companycountry: Property.ShortText({ displayName: 'Country', required: false }),+ owner: Property.Number({+ displayName: 'Owner Id',+ description: 'Id of the Mautic user who owns the company, from List Contact Owners.',+ required: false,+ }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other company fields keyed by field alias, e.g. {"companyindustry": "Software", "companyaddress1": "1 Main St"}. Aliases come from List Fields with object "company". The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const {+ id,+ additionalFields,+ companyname,+ companyemail,+ companyphone,+ companywebsite,+ companycity,+ companycountry,+ owner,+ } = context.propsValue;+ return await mauticApi.updateRecord({+ auth: context.auth,+ resource: 'companies',+ id,+ body: {+ ...additionalFields,+ ...spreadIfDefined('companyname', companyname),+ ...spreadIfDefined('companyemail', companyemail),+ ...spreadIfDefined('companyphone', companyphone),+ ...spreadIfDefined('companywebsite', companywebsite),+ ...spreadIfDefined('companycity', companycity),+ ...spreadIfDefined('companycountry', companycountry),+ ...spreadIfDefined('owner', owner),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/contacts/add-contact-utm-tags.ts b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/add-contact-utm-tags.tsnew file mode 100644index 00000000000..b0f3b01f7e9--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/add-contact-utm-tags.ts@@ -0,0 +1,59 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticAddContactUtmTagsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticAddContactUtmTagsAction = createAction({+ auth: mauticAuth,+ name: 'mautic_add_contact_utm_tags',+ outputSchema: mauticAddContactUtmTagsOutputSchema,+ displayName: 'Add Contact UTM Tags',+ description: 'Records a set of UTM tags on a Mautic contact.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Records one UTM tag entry (campaign, source, medium, content, term, URL, referrer) on a contact. Each call adds a new entry. Returns the contact with its UTM tags; each entry id is what Remove Contact UTM Tags takes.',+ idempotent: false,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Contact Id',+ description: 'Numeric contact id, from List Contacts or Create Contact.',+ }),+ utm_campaign: Property.ShortText({ displayName: 'UTM Campaign', required: false }),+ utm_source: Property.ShortText({ displayName: 'UTM Source', required: false }),+ utm_medium: Property.ShortText({ displayName: 'UTM Medium', required: false }),+ utm_content: Property.ShortText({ displayName: 'UTM Content', required: false }),+ utm_term: Property.ShortText({ displayName: 'UTM Term', required: false }),+ url: Property.ShortText({ displayName: 'Page URL', required: false }),+ referer: Property.ShortText({ displayName: 'Referrer URL', required: false }),+ query: Property.ShortText({+ displayName: 'Query',+ description: 'Extra query parameters as a query string, e.g. "cid=abc&cond=new".',+ required: false,+ }),+ userAgent: Property.ShortText({+ displayName: 'User Agent',+ description: 'Browser user agent; Mautic records a device for it.',+ required: false,+ }),+ remotehost: Property.ShortText({ displayName: 'Remote Host', required: false }),+ lastActive: Property.ShortText({+ displayName: 'Last Active',+ description:+ 'When the visit happened, e.g. "2026-01-17T00:30:08+00:00". Also updates the contact\'s last active date.',+ required: false,+ }),+ },+ async run(context) {+ const { id, userAgent, ...utm } = context.propsValue;+ return await mauticApi.addContactUtmTags({+ auth: context.auth,+ id,+ body: { ...utm, ...spreadIfDefined('Useragent', userAgent) },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/contacts/add-do-not-contact.ts b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/add-do-not-contact.tsnew file mode 100644index 00000000000..a3317bb3aed--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/add-do-not-contact.ts@@ -0,0 +1,69 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticAddDoNotContactOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticAddDoNotContactAction = createAction({+ auth: mauticAuth,+ name: 'mautic_add_do_not_contact',+ outputSchema: mauticAddDoNotContactOutputSchema,+ displayName: 'Add Do Not Contact',+ description: 'Marks a Mautic contact as do not contact on a channel.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Adds a do-not-contact entry for a contact on the email or SMS channel, so Mautic stops sending on that channel. Remove it with Remove Do Not Contact.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Contact Id',+ description: 'Numeric contact id, from List Contacts or Create Contact.',+ }),+ channel: Property.StaticDropdown({+ displayName: 'Channel',+ required: true,+ options: {+ options: [+ { label: 'Email', value: 'email' },+ { label: 'SMS', value: 'sms' },+ ],+ },+ }),+ reason: Property.StaticDropdown({+ displayName: 'Reason',+ description: 'Defaults to Manual.',+ required: false,+ options: {+ options: [+ { label: 'Unsubscribed', value: 1 },+ { label: 'Bounced', value: 2 },+ { label: 'Manual', value: 3 },+ ],+ },+ }),+ channelId: Property.Number({+ displayName: 'Channel Id',+ description: 'Id of the email or text message that caused the entry.',+ required: false,+ }),+ comments: Property.LongText({ displayName: 'Comments', required: false }),+ },+ async run(context) {+ const { id, channel, reason, channelId, comments } = context.propsValue;+ return await mauticApi.setDoNotContact({+ auth: context.auth,+ id,+ channel,+ change: 'add',+ body: {+ ...spreadIfDefined('reason', reason),+ ...spreadIfDefined('channelId', channelId),+ ...spreadIfDefined('comments', comments),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/contacts/adjust-contact-group-points.ts b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/adjust-contact-group-points.tsnew file mode 100644index 00000000000..3b972c67f54--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/adjust-contact-group-points.ts@@ -0,0 +1,68 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticAdjustContactGroupPointsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticAdjustContactGroupPointsAction = createAction({+ auth: mauticAuth,+ name: 'mautic_adjust_contact_group_points',+ outputSchema: mauticAdjustContactGroupPointsOutputSchema,+ displayName: 'Adjust Contact Group Points',+ description: 'Changes the score of a Mautic contact in one point group.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ "Changes the contact's score in one point group by the operator and value, or sets it with Set. Add, Subtract, Multiply and Divide apply again on every call; Set is the only repeatable choice. Needs Mautic 5.1 or later.",+ idempotent: false,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Contact Id',+ description: 'Numeric contact id, from List Contacts or Create Contact.',+ }),+ groupId: mauticAiProps.recordId({+ displayName: 'Point Group Id',+ description: 'Point group id, from List Contact Point Groups.',+ }),+ operator: Property.StaticDropdown({+ displayName: 'Operator',+ required: true,+ options: {+ options: [+ { label: 'Add', value: 'plus' },+ { label: 'Subtract', value: 'minus' },+ { label: 'Multiply', value: 'times' },+ { label: 'Divide', value: 'divide' },+ { label: 'Set', value: 'set' },+ ],+ },+ }),+ value: Property.Number({ displayName: 'Value', required: true }),+ eventName: Property.ShortText({+ displayName: 'Event Name',+ description: 'Label shown in the contact points history.',+ required: false,+ }),+ actionName: Property.ShortText({+ displayName: 'Action Name',+ description: 'Action label shown in the contact points history.',+ required: false,+ }),+ },+ async run(context) {+ return await mauticApi.adjustContactGroupPoints({+ auth: context.auth,+ id: context.propsValue.id,+ groupId: context.propsValue.groupId,+ operator: context.propsValue.operator,+ value: context.propsValue.value,+ body: {+ ...spreadIfDefined('eventName', context.propsValue.eventName),+ ...spreadIfDefined('actionName', context.propsValue.actionName),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/contacts/adjust-contact-points.ts b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/adjust-contact-points.tsnew file mode 100644index 00000000000..16028ed9969--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/adjust-contact-points.ts@@ -0,0 +1,62 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticAdjustContactPointsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticAdjustContactPointsAction = createAction({+ auth: mauticAuth,+ name: 'mautic_adjust_contact_points',+ outputSchema: mauticAdjustContactPointsOutputSchema,+ displayName: 'Adjust Contact Points',+ description: 'Adds, subtracts, multiplies or divides the points of a Mautic contact.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ "Changes a contact's total points by applying the operator with the value, e.g. Add 10. Each call applies again, so repeating it changes the score again. Use Adjust Contact Group Points for a point group score.",+ idempotent: false,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Contact Id',+ description: 'Numeric contact id, from List Contacts or Create Contact.',+ }),+ operator: Property.StaticDropdown({+ displayName: 'Operator',+ required: true,+ options: {+ options: [+ { label: 'Add', value: 'plus' },+ { label: 'Subtract', value: 'minus' },+ { label: 'Multiply', value: 'times' },+ { label: 'Divide', value: 'divide' },+ ],+ },+ }),+ value: Property.Number({ displayName: 'Value', required: true }),+ eventName: Property.ShortText({+ displayName: 'Event Name',+ description: 'Label shown in the contact points history.',+ required: false,+ }),+ actionName: Property.ShortText({+ displayName: 'Action Name',+ description: 'Action label shown in the contact points history.',+ required: false,+ }),+ },+ async run(context) {+ return await mauticApi.adjustContactPoints({+ auth: context.auth,+ id: context.propsValue.id,+ operator: context.propsValue.operator,+ delta: context.propsValue.value,+ body: {+ ...spreadIfDefined('eventName', context.propsValue.eventName),+ ...spreadIfDefined('actionName', context.propsValue.actionName),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/contacts/batch-create-contacts.ts b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/batch-create-contacts.tsnew file mode 100644index 00000000000..98f9035d67b--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/batch-create-contacts.ts@@ -0,0 +1,34 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticBatchCreateContactsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';+import { mauticUtils } from '../../../common/utils';++export const mauticBatchCreateContactsAction = createAction({+ auth: mauticAuth,+ name: 'mautic_batch_create_contacts',+ outputSchema: mauticBatchCreateContactsOutputSchema,+ displayName: 'Batch Create Contacts',+ description: 'Creates several Mautic contacts in one request.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Creates up to 200 contacts in one request. Each record is an object of field values keyed by alias, e.g. {"email": "[email protected]", "firstname": "Jane"}. Mautic merges records whose unique identifier (email by default) matches an existing contact. Per-record errors are in the response.',+ idempotent: false,+ },+ props: {+ records: mauticAiProps.records({+ description: 'Contacts to create, each an object of field values keyed by field alias.',+ }),+ },+ async run(context) {+ return await mauticApi.batchCreateRecords({+ auth: context.auth,+ resource: 'contacts',+ records: mauticUtils.toBatchRecords({ records: context.propsValue.records }),+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/contacts/batch-delete-contacts.ts b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/batch-delete-contacts.tsnew file mode 100644index 00000000000..9922f004272--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/batch-delete-contacts.ts@@ -0,0 +1,34 @@+import { Property, createAction } from '@activepieces/pieces-framework';++import { mauticBatchDeleteContactsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticApi } from '../../../common/api';+import { mauticUtils } from '../../../common/utils';++export const mauticBatchDeleteContactsAction = createAction({+ auth: mauticAuth,+ name: 'mautic_batch_delete_contacts',+ outputSchema: mauticBatchDeleteContactsOutputSchema,+ displayName: 'Batch Delete Contacts',+ description: 'Permanently deletes several Mautic contacts.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description: 'Permanently deletes up to 200 contacts by id in one request. Cannot be undone.',+ idempotent: false,+ },+ props: {+ ids: Property.Array({+ displayName: 'Contact Ids',+ description: 'Numeric contact ids, from List Contacts.',+ required: true,+ }),+ },+ async run(context) {+ return await mauticApi.batchDeleteRecords({+ auth: context.auth,+ resource: 'contacts',+ ids: mauticUtils.toBatchIds({ ids: context.propsValue.ids }),+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/contacts/batch-update-contacts.ts b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/batch-update-contacts.tsnew file mode 100644index 00000000000..84a7dd54536--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/batch-update-contacts.ts@@ -0,0 +1,35 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticBatchUpdateContactsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';+import { mauticUtils } from '../../../common/utils';++export const mauticBatchUpdateContactsAction = createAction({+ auth: mauticAuth,+ name: 'mautic_batch_update_contacts',+ outputSchema: mauticBatchUpdateContactsOutputSchema,+ displayName: 'Batch Update Contacts',+ description: 'Updates several Mautic contacts in one request.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Updates up to 200 contacts in one request. Each record has the contact "id" plus only the fields to change; other fields are left alone. Per-record errors are in the response.',+ idempotent: true,+ },+ props: {+ records: mauticAiProps.records({+ description:+ 'Contacts to update, each an object with "id" and the field values to change, keyed by field alias.',+ }),+ },+ async run(context) {+ return await mauticApi.batchUpdateRecords({+ auth: context.auth,+ resource: 'contacts',+ records: mauticUtils.toBatchRecords({ records: context.propsValue.records }),+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/contacts/create-contact.ts b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/create-contact.tsnew file mode 100644index 00000000000..082489a1d96--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/create-contact.ts@@ -0,0 +1,55 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticCreateContactOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticCreateContactAction = createAction({+ auth: mauticAuth,+ name: 'mautic_create_contact',+ outputSchema: mauticCreateContactOutputSchema,+ displayName: 'Create Contact',+ description: 'Creates a Mautic contact.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Creates a contact from the given field values. Mautic merges into an existing contact when a unique identifier field (email by default) matches, so the returned contact may be an existing one with updated fields.',+ idempotent: false,+ },+ props: {+ email: Property.ShortText({ displayName: 'Email', required: false }),+ firstname: Property.ShortText({ displayName: 'First Name', required: false }),+ lastname: Property.ShortText({ displayName: 'Last Name', required: false }),+ owner: Property.Number({+ displayName: 'Owner Id',+ description: 'Id of the Mautic user who owns the contact, from List Contact Owners.',+ required: false,+ }),+ tags: Property.Array({+ displayName: 'Tags',+ description: 'Tag names to add. Prefix a name with "-" to remove that tag.',+ required: false,+ }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other contact fields keyed by field alias, e.g. {"phone": "+15550100", "city": "Berlin"}. Aliases come from List Contact Fields. The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const { additionalFields, email, firstname, lastname, owner, tags } = context.propsValue;+ return await mauticApi.createRecord({+ auth: context.auth,+ resource: 'contacts',+ body: {+ ...additionalFields,+ ...spreadIfDefined('email', email),+ ...spreadIfDefined('firstname', firstname),+ ...spreadIfDefined('lastname', lastname),+ ...spreadIfDefined('owner', owner),+ ...spreadIfDefined('tags', tags),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/contacts/delete-contact.ts b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/delete-contact.tsnew file mode 100644index 00000000000..c2d55cb5026--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/delete-contact.ts@@ -0,0 +1,34 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticDeleteContactOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticDeleteContactAction = createAction({+ auth: mauticAuth,+ name: 'mautic_delete_contact',+ outputSchema: mauticDeleteContactOutputSchema,+ displayName: 'Delete Contact',+ description: 'Permanently deletes a Mautic contact.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description:+ 'Permanently deletes a contact and its history. Cannot be undone. Get the id from List Contacts.',+ idempotent: false,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Contact Id',+ description: 'Numeric contact id, from List Contacts or Create Contact.',+ }),+ },+ async run(context) {+ return await mauticApi.deleteRecord({+ auth: context.auth,+ resource: 'contacts',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/contacts/get-contact-point-group.ts b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/get-contact-point-group.tsnew file mode 100644index 00000000000..4a9c5a80bde--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/get-contact-point-group.ts@@ -0,0 +1,38 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticAdjustContactGroupPointsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticGetContactPointGroupAction = createAction({+ auth: mauticAuth,+ name: 'mautic_get_contact_point_group',+ outputSchema: mauticAdjustContactGroupPointsOutputSchema,+ displayName: 'Get Contact Point Group',+ description: 'Gets the score of a Mautic contact in one point group.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description:+ "Gets the contact's score in one point group. The group id comes from List Contact Point Groups. Needs Mautic 5.1 or later.",+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Contact Id',+ description: 'Numeric contact id, from List Contacts or Create Contact.',+ }),+ groupId: mauticAiProps.recordId({+ displayName: 'Point Group Id',+ description: 'Point group id, from List Contact Point Groups.',+ }),+ },+ async run(context) {+ return await mauticApi.getContactPointGroup({+ auth: context.auth,+ id: context.propsValue.id,+ groupId: context.propsValue.groupId,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/contacts/get-contact.ts b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/get-contact.tsnew file mode 100644index 00000000000..c4b1f91604f--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/get-contact.ts@@ -0,0 +1,34 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticGetContactOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticGetContactAction = createAction({+ auth: mauticAuth,+ name: 'mautic_get_contact',+ outputSchema: mauticGetContactOutputSchema,+ displayName: 'Get Contact',+ description: 'Gets one Mautic contact by id.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description:+ 'Gets a single contact by its numeric id, with all field values, tags, UTM tags, points, owner and do-not-contact entries. Get the id from List Contacts.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Contact Id',+ description: 'Numeric contact id, from List Contacts or Create Contact.',+ }),+ },+ async run(context) {+ return await mauticApi.getRecord({+ auth: context.auth,+ resource: 'contacts',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/contacts/list-activity.ts b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/list-activity.tsnew file mode 100644index 00000000000..fcbed809029--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/list-activity.ts@@ -0,0 +1,30 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListActivityOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticListActivityAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_activity',+ outputSchema: mauticListActivityOutputSchema,+ displayName: 'List Activity',+ description: 'Lists activity events across all Mautic contacts.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists timeline events (page hits, email opens, form submissions, point changes and more) across all contacts, newest first by default. Filter by event type and date range; page with Page and Limit. Use List Contact Activity for a single contact.',+ idempotent: true,+ },+ props: {+ ...mauticAiProps.activityOptions,+ },+ async run(context) {+ return await mauticApi.listActivity({+ auth: context.auth,+ query: context.propsValue,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/contacts/list-available-segments.ts b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/list-available-segments.tsnew file mode 100644index 00000000000..f40365ba7ac--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/list-available-segments.ts@@ -0,0 +1,24 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListAvailableSegmentsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticApi } from '../../../common/api';++export const mauticListAvailableSegmentsAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_available_segments',+ outputSchema: mauticListAvailableSegmentsOutputSchema,+ displayName: 'List Available Segments',+ description: 'Lists the segments contacts can be added to.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists the segments the connected user can assign contacts to, with id, name and alias. Use List Contact Segments for the segments one contact belongs to.',+ idempotent: true,+ },+ props: {},+ async run(context) {+ return await mauticApi.listContactOptions({ auth: context.auth, list: 'segments' });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/contacts/list-contact-activity.ts b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/list-contact-activity.tsnew file mode 100644index 00000000000..49dbaed75fa--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/list-contact-activity.ts@@ -0,0 +1,35 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListContactActivityOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticListContactActivityAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_contact_activity',+ outputSchema: mauticListContactActivityOutputSchema,+ displayName: 'List Contact Activity',+ description: 'Lists activity events of one Mautic contact.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists the timeline events of one contact (page hits, email opens, form submissions, point changes and more). Filter by event type and date range; page with Page and Limit.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Contact Id',+ description: 'Numeric contact id, from List Contacts or Create Contact.',+ }),+ ...mauticAiProps.activityOptions,+ },+ async run(context) {+ return await mauticApi.listActivity({+ auth: context.auth,+ contactId: context.propsValue.id,+ query: context.propsValue,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/contacts/list-contact-campaigns.ts b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/list-contact-campaigns.tsnew file mode 100644index 00000000000..7344db2636d--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/list-contact-campaigns.ts@@ -0,0 +1,34 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListContactCampaignsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticListContactCampaignsAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_contact_campaigns',+ outputSchema: mauticListContactCampaignsOutputSchema,+ displayName: 'List Contact Campaigns',+ description: 'Lists the campaigns of a Mautic contact.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists the campaigns a contact is a member of, with the date added and whether membership was manual.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Contact Id',+ description: 'Numeric contact id, from List Contacts or Create Contact.',+ }),+ },+ async run(context) {+ return await mauticApi.listContactRelation({+ auth: context.auth,+ id: context.propsValue.id,+ relation: 'campaigns',+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/contacts/list-contact-companies.ts b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/list-contact-companies.tsnew file mode 100644index 00000000000..d5151982f7f--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/list-contact-companies.ts@@ -0,0 +1,33 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListContactCompaniesOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticListContactCompaniesAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_contact_companies',+ outputSchema: mauticListContactCompaniesOutputSchema,+ displayName: 'List Contact Companies',+ description: 'Lists the companies of a Mautic contact.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description: 'Lists the companies a contact is linked to, including which one is primary.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Contact Id',+ description: 'Numeric contact id, from List Contacts or Create Contact.',+ }),+ },+ async run(context) {+ return await mauticApi.listContactRelation({+ auth: context.auth,+ id: context.propsValue.id,+ relation: 'companies',+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/contacts/list-contact-devices.ts b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/list-contact-devices.tsnew file mode 100644index 00000000000..0ff549d716b--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/list-contact-devices.ts@@ -0,0 +1,36 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListContactDevicesOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticListContactDevicesAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_contact_devices',+ outputSchema: mauticListContactDevicesOutputSchema,+ displayName: 'List Contact Devices',+ description: 'Lists the devices of a Mautic contact.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists the devices (browser, OS, device type) a contact has used; page with Start and Limit. Order By takes a column with the "d." prefix, e.g. "d.dateAdded"; a bare column name fails.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Contact Id',+ description: 'Numeric contact id, from List Contacts or Create Contact.',+ }),+ ...mauticAiProps.pageOptions,+ },+ async run(context) {+ return await mauticApi.listContactRelation({+ auth: context.auth,+ id: context.propsValue.id,+ relation: 'devices',+ query: context.propsValue,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/contacts/list-contact-fields.ts b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/list-contact-fields.tsnew file mode 100644index 00000000000..ffcb645dce0--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/list-contact-fields.ts@@ -0,0 +1,24 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListContactFieldsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticApi } from '../../../common/api';++export const mauticListContactFieldsAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_contact_fields',+ outputSchema: mauticListContactFieldsOutputSchema,+ displayName: 'List Contact Fields',+ description: 'Lists the contact fields available in Mautic.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists every contact field, including custom ones, with its alias. Use the aliases as keys in Additional Fields of Create Contact and Update Contact, and as columns in List Contacts filters.',+ idempotent: true,+ },+ props: {},+ async run(context) {+ return await mauticApi.listContactOptions({ auth: context.auth, list: 'fields' });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/contacts/list-contact-notes.ts b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/list-contact-notes.tsnew file mode 100644index 00000000000..e70361199b0--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/list-contact-notes.ts@@ -0,0 +1,36 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListContactNotesOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticListContactNotesAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_contact_notes',+ outputSchema: mauticListContactNotesOutputSchema,+ displayName: 'List Contact Notes',+ description: 'Lists the notes of a Mautic contact.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists the notes on a contact, newest first by default; page with Start and Limit. Order By takes a column with the "n." prefix, e.g. "n.dateAdded"; a bare column name fails.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Contact Id',+ description: 'Numeric contact id, from List Contacts or Create Contact.',+ }),+ ...mauticAiProps.pageOptions,+ },+ async run(context) {+ return await mauticApi.listContactRelation({+ auth: context.auth,+ id: context.propsValue.id,+ relation: 'notes',+ query: context.propsValue,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/contacts/list-contact-owners.ts b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/list-contact-owners.tsnew file mode 100644index 00000000000..ce8444564e2--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/list-contact-owners.ts@@ -0,0 +1,42 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticListContactOwnersOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticListContactOwnersAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_contact_owners',+ outputSchema: mauticListContactOwnersOutputSchema,+ displayName: 'List Contact Owners',+ description: 'Lists the Mautic users that can own contacts.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists users that can be set as a contact owner, with their ids. Use an id as Owner Id in Create Contact or Update Contact.',+ idempotent: true,+ },+ props: {+ filter: Property.ShortText({+ displayName: 'Filter',+ description: 'Part of the user name to match.',+ required: false,+ }),+ start: mauticAiProps.pageOptions.start,+ limit: mauticAiProps.pageOptions.limit,+ },+ async run(context) {+ const { filter, start, limit } = context.propsValue;+ return await mauticApi.listContactOptions({+ auth: context.auth,+ list: 'owners',+ query: {+ ...spreadIfDefined('filter', filter),+ ...spreadIfDefined('start', start?.toString()),+ ...spreadIfDefined('limit', limit?.toString()),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/contacts/list-contact-point-groups.ts b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/list-contact-point-groups.tsnew file mode 100644index 00000000000..b6ddb973c4a--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/list-contact-point-groups.ts@@ -0,0 +1,33 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListContactPointGroupsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticListContactPointGroupsAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_contact_point_groups',+ outputSchema: mauticListContactPointGroupsOutputSchema,+ displayName: 'List Contact Point Groups',+ description: 'Lists the point group scores of a Mautic contact.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ "Lists the contact's score in every point group, with group id and name. Needs Mautic 5.1 or later.",+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Contact Id',+ description: 'Numeric contact id, from List Contacts or Create Contact.',+ }),+ },+ async run(context) {+ return await mauticApi.listContactPointGroups({+ auth: context.auth,+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/contacts/list-contact-segments.ts b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/list-contact-segments.tsnew file mode 100644index 00000000000..7bc7610dc16--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/list-contact-segments.ts@@ -0,0 +1,33 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListContactSegmentsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticListContactSegmentsAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_contact_segments',+ outputSchema: mauticListContactSegmentsOutputSchema,+ displayName: 'List Contact Segments',+ description: 'Lists the segments of a Mautic contact.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description: 'Lists the segments a contact belongs to.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Contact Id',+ description: 'Numeric contact id, from List Contacts or Create Contact.',+ }),+ },+ async run(context) {+ return await mauticApi.listContactRelation({+ auth: context.auth,+ id: context.propsValue.id,+ relation: 'segments',+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/contacts/list-contacts.ts b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/list-contacts.tsnew file mode 100644index 00000000000..ab0427d4c97--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/list-contacts.ts@@ -0,0 +1,32 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListContactsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticListContactsAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_contacts',+ outputSchema: mauticListContactsOutputSchema,+ displayName: 'List Contacts',+ description: 'Lists Mautic contacts, filtered by a search string or field conditions.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists contacts with paging, sorting and filters. Use Search for free text or commands like "email:[email protected]", or Where for exact column conditions such as email eq a value. Returns the matching contacts and the total count; page with Start and Limit.',+ idempotent: true,+ },+ props: {+ ...mauticAiProps.listOptions,+ },+ async run(context) {+ return await mauticApi.listRecords({+ auth: context.auth,+ resource: 'contacts',+ key: 'contacts',+ query: context.propsValue,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/contacts/output-schemas.ts b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/output-schemas.tsnew file mode 100644index 00000000000..7a1697b2610--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/output-schemas.ts@@ -0,0 +1,654 @@+import { OutputSchema } from '@activepieces/pieces-framework';++import {+ contactDoNotContactFields,+ contactOwner2Fields,+ contactOwnerFields,+ contacts2Fields,+ contactsFields,+ fieldsAll2Fields,+ fieldsAll4Fields,+ filtersFields,+ typesFields,+} from '../../../output-schemas';++export const mauticAddContactUtmTagsOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'contact',+ label: 'Contact',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified', format: 'datetime' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'points', label: 'Points', format: 'number' },+ { key: 'firstname', label: 'First Name' },+ { key: 'lastname', label: 'Last Name' },+ { key: 'position', label: 'Position' },+ { key: 'email', label: 'Email', format: 'email' },+ { key: 'phone', label: 'Phone' },+ { key: 'city', label: 'City' },+ { key: 'fields', label: 'Fields' },+ { key: 'lastActive', label: 'Last Active', format: 'datetime' },+ { key: 'owner', label: 'Owner', children: contactOwnerFields },+ { key: 'ipAddresses', label: 'IP Addresses' },+ {+ key: 'tags',+ label: 'Tags',+ labelKey: 'id',+ listItems: [+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'tag', label: 'Tag' },+ ],+ },+ {+ key: 'utmtags',+ label: 'UTM Tags',+ labelKey: 'id',+ listItems: [+ { key: 'id', label: 'ID', format: 'number' },+ {+ key: 'query',+ label: 'Query',+ children: [{ key: 'x', label: 'X' }],+ },+ { key: 'referer', label: 'Referer', format: 'url' },+ { key: 'remoteHost', label: 'Remote Host' },+ { key: 'url', label: 'URL', format: 'url' },+ { key: 'utmCampaign', label: 'Utm Campaign' },+ { key: 'utmContent', label: 'Utm Content' },+ { key: 'utmMedium', label: 'Utm Medium' },+ { key: 'utmSource', label: 'Utm Source' },+ { key: 'utmTerm', label: 'Utm Term' },+ ],+ },+ { key: 'dateIdentified', label: 'Date Identified', format: 'datetime' },+ { key: 'doNotContact', label: 'Do Not Contact' },+ { key: 'frequencyRules', label: 'Frequency Rules' },+ ],+ },+ ],+};++export const mauticAddDoNotContactOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'contact',+ label: 'Contact',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'points', label: 'Points', format: 'number' },+ { key: 'fields', label: 'Fields' },+ { key: 'ipAddresses', label: 'IP Addresses' },+ { key: 'tags', label: 'Tags' },+ { key: 'utmtags', label: 'UTM Tags' },+ {+ key: 'doNotContact',+ label: 'Do Not Contact',+ labelKey: 'id',+ listItems: contactDoNotContactFields,+ },+ { key: 'frequencyRules', label: 'Frequency Rules' },+ { key: 'dateModified', label: 'Date Modified', format: 'datetime' },+ { key: 'company', label: 'Company' },+ { key: 'dateIdentified', label: 'Date Identified', format: 'datetime' },+ ],+ },+ ],+};++export const mauticAdjustContactGroupPointsOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'groupScore',+ label: 'Group Score',+ children: [+ { key: 'score', label: 'Score', format: 'number' },+ {+ key: 'group',+ label: 'Group',+ children: [+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'name', label: 'Name' },+ { key: 'description', label: 'Description' },+ ],+ },+ ],+ },+ ],+};++export const mauticAdjustContactPointsOutputSchema: OutputSchema = {+ fields: [{ key: 'success', label: 'Success', format: 'number' }],+};++export const mauticBatchCreateContactsOutputSchema: OutputSchema = {+ fields: [+ { key: 'contacts', label: 'Contacts', labelKey: 'id', listItems: contactsFields },+ { key: 'statusCodes', label: 'Status Codes' },+ ],+};++export const mauticBatchDeleteContactsOutputSchema: OutputSchema = {+ fields: [{ key: 'contacts', label: 'Contacts', labelKey: 'id', listItems: contacts2Fields }],+};++export const mauticBatchUpdateContactsOutputSchema: OutputSchema = {+ fields: [+ { key: 'contacts', label: 'Contacts', labelKey: 'id', listItems: contacts2Fields },+ { key: 'statusCodes', label: 'Status Codes' },+ ],+};++export const mauticCreateContactOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'contact',+ label: 'Contact',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'points', label: 'Points', format: 'number' },+ { key: 'color', label: 'Color' },+ {+ key: 'fields',+ label: 'Fields',+ children: [{ key: 'all', label: 'All', children: fieldsAll2Fields }],+ },+ { key: 'lastActive', label: 'Last Active' },+ { key: 'owner', label: 'Owner', children: contactOwner2Fields },+ { key: 'ipAddresses', label: 'IP Addresses' },+ {+ key: 'tags',+ label: 'Tags',+ labelKey: 'id',+ listItems: [+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'tag', label: 'Tag' },+ { key: 'description', label: 'Description' },+ ],+ },+ { key: 'utmtags', label: 'UTM Tags' },+ { key: 'stage', label: 'Stage' },+ { key: 'dateIdentified', label: 'Date Identified', format: 'datetime' },+ { key: 'preferredProfileImage', label: 'Preferred Profile Image' },+ { key: 'doNotContact', label: 'Do Not Contact' },+ { key: 'frequencyRules', label: 'Frequency Rules' },+ ],+ },+ ],+};++export const mauticDeleteContactOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'contact',+ label: 'Contact',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified', format: 'datetime' },+ { key: 'id', label: 'ID' },+ { key: 'points', label: 'Points', format: 'number' },+ { key: 'color', label: 'Color' },+ {+ key: 'fields',+ label: 'Fields',+ children: [+ {+ key: 'all',+ label: 'All',+ children: [+ { key: 'id', label: 'ID' },+ { key: 'title', label: 'Title' },+ { key: 'firstname', label: 'First Name' },+ { key: 'lastname', label: 'Last Name' },+ { key: 'company', label: 'Company' },+ { key: 'position', label: 'Position' },+ { key: 'email', label: 'Email', format: 'email' },+ { key: 'mobile', label: 'Mobile' },+ { key: 'phone', label: 'Phone' },+ { key: 'points', label: 'Points', format: 'number' },+ { key: 'fax', label: 'Fax' },+ { key: 'address1', label: 'Address 1' },+ { key: 'address2', label: 'Address 2' },+ { key: 'city', label: 'City' },+ { key: 'state', label: 'State' },+ { key: 'zipcode', label: 'Zip Code' },+ { key: 'country', label: 'Country' },+ { key: 'preferred_locale', label: 'Preferred Locale' },+ { key: 'timezone', label: 'Timezone' },+ { key: 'last_active', label: 'Last Active', format: 'datetime' },+ { key: 'attribution_date', label: 'Attribution Date' },+ { key: 'attribution', label: 'Attribution' },+ { key: 'website', label: 'Website' },+ { key: 'facebook', label: 'Facebook' },+ { key: 'foursquare', label: 'Foursquare' },+ { key: 'instagram', label: 'Instagram' },+ { key: 'linkedin', label: 'LinkedIn' },+ { key: 'skype', label: 'Skype' },+ { key: 'twitter', label: 'Twitter' },+ ],+ },+ ],+ },+ { key: 'lastActive', label: 'Last Active', format: 'datetime' },+ { key: 'owner', label: 'Owner', children: contactOwner2Fields },+ { key: 'ipAddresses', label: 'IP Addresses' },+ { key: 'tags', label: 'Tags' },+ { key: 'utmtags', label: 'UTM Tags' },+ { key: 'stage', label: 'Stage' },+ { key: 'dateIdentified', label: 'Date Identified', format: 'datetime' },+ { key: 'preferredProfileImage', label: 'Preferred Profile Image' },+ {+ key: 'doNotContact',+ label: 'Do Not Contact',+ listItems: [+ { key: 'id', label: 'ID' },+ { key: 'reason', label: 'Reason', format: 'number' },+ { key: 'comments', label: 'Comments' },+ { key: 'channel', label: 'Channel' },+ { key: 'channelId', label: 'Channel ID' },+ ],+ },+ { key: 'frequencyRules', label: 'Frequency Rules' },+ ],+ },+ ],+};++export const mauticGetContactOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'contact',+ label: 'Contact',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified', format: 'datetime' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'points', label: 'Points', format: 'number' },+ { key: 'color', label: 'Color' },+ {+ key: 'fields',+ label: 'Fields',+ children: [{ key: 'all', label: 'All', children: fieldsAll2Fields }],+ },+ { key: 'lastActive', label: 'Last Active' },+ { key: 'owner', label: 'Owner', children: contactOwner2Fields },+ { key: 'ipAddresses', label: 'IP Addresses' },+ {+ key: 'tags',+ label: 'Tags',+ labelKey: 'id',+ listItems: [+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'tag', label: 'Tag' },+ { key: 'description', label: 'Description' },+ ],+ },+ { key: 'utmtags', label: 'UTM Tags' },+ { key: 'stage', label: 'Stage' },+ { key: 'dateIdentified', label: 'Date Identified', format: 'datetime' },+ { key: 'preferredProfileImage', label: 'Preferred Profile Image' },+ { key: 'doNotContact', label: 'Do Not Contact' },+ { key: 'frequencyRules', label: 'Frequency Rules' },+ ],+ },+ ],+};++export const mauticListActivityOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'events',+ label: 'Events',+ listItems: [+ { key: 'event', label: 'Event' },+ { key: 'eventId', label: 'Event ID' },+ { key: 'eventType', label: 'Event Type' },+ {+ key: 'eventLabel',+ label: 'Event Label',+ children: [{ key: 'href', label: 'Href', format: 'url' }],+ },+ { key: 'timestamp', label: 'Timestamp', format: 'datetime' },+ { key: 'contactId', label: 'Contact ID' },+ {+ key: 'details',+ label: 'Details',+ children: [+ { key: 'objectDescription', label: 'Object Description' },+ { key: 'asset', label: 'Asset' },+ { key: 'assetDownloadUrl', label: 'Asset Download URL', format: 'url' },+ ],+ },+ ],+ },+ { key: 'filters', label: 'Filters', children: filtersFields },+ { key: 'order', label: 'Order' },+ { key: 'types', label: 'Types', children: typesFields },+ { key: 'total', label: 'Total', format: 'number' },+ { key: 'page', label: 'Page', format: 'number' },+ { key: 'limit', label: 'Limit', format: 'number' },+ { key: 'maxPages', label: 'Max Pages', format: 'number' },+ ],+};++export const mauticListAvailableSegmentsOutputSchema: OutputSchema = {+ fields: [{ key: 'segments', label: 'Segments' }],+};++export const mauticListContactActivityOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'events',+ label: 'Events',+ listItems: [+ { key: 'event', label: 'Event' },+ { key: 'eventId', label: 'Event ID' },+ { key: 'eventLabel', label: 'Event Label' },+ { key: 'eventType', label: 'Event Type' },+ { key: 'timestamp', label: 'Timestamp', format: 'datetime' },+ { key: 'contactId', label: 'Contact ID' },+ {+ key: 'details',+ label: 'Details',+ children: [+ {+ key: 'log',+ label: 'Log',+ children: [+ { key: 'eventName', label: 'Event Name' },+ { key: 'actionName', label: 'Action Name' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'type', label: 'Type' },+ { key: 'delta', label: 'Delta' },+ { key: 'id', label: 'ID' },+ { key: 'lead_id', label: 'Lead ID' },+ ],+ },+ { key: 'objectDescription', label: 'Object Description' },+ ],+ },+ ],+ },+ { key: 'filters', label: 'Filters', children: filtersFields },+ { key: 'order', label: 'Order' },+ { key: 'types', label: 'Types', children: typesFields },+ { key: 'total', label: 'Total', format: 'number' },+ { key: 'page', label: 'Page', format: 'number' },+ { key: 'limit', label: 'Limit', format: 'number' },+ { key: 'maxPages', label: 'Max Pages', format: 'number' },+ ],+};++export const mauticListContactCampaignsOutputSchema: OutputSchema = {+ fields: [+ { key: 'total', label: 'Total', format: 'number' },+ {+ key: 'campaigns',+ label: 'Campaigns',+ labelKey: 'name',+ listItems: [+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'name', label: 'Name' },+ { key: 'listMembership', label: 'List Membership' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'manuallyRemoved', label: 'Manually Removed', format: 'boolean' },+ { key: 'manuallyAdded', label: 'Manually Added', format: 'boolean' },+ ],+ },+ ],+};++export const mauticListContactCompaniesOutputSchema: OutputSchema = {+ fields: [+ { key: 'total', label: 'Total', format: 'number' },+ {+ key: 'companies',+ label: 'Companies',+ labelKey: 'id',+ listItems: [+ { key: 'company_id', label: 'Company ID' },+ { key: 'date_associated', label: 'Date Associated', format: 'datetime' },+ { key: 'is_primary', label: 'Is Primary' },+ { key: 'id', label: 'ID' },+ { key: 'owner_id', label: 'Owner ID' },+ { key: 'is_published', label: 'Published' },+ { key: 'date_added', label: 'Date Added', format: 'datetime' },+ { key: 'created_by', label: 'Created By' },+ { key: 'created_by_user', label: 'Created By User' },+ { key: 'date_modified', label: 'Date Modified', format: 'datetime' },+ { key: 'modified_by', label: 'Modified By' },+ { key: 'modified_by_user', label: 'Modified By User' },+ { key: 'social_cache', label: 'Social Cache' },+ { key: 'score', label: 'Score' },+ { key: 'companyemail', label: 'Company Email', format: 'email' },+ { key: 'companyphone', label: 'Company Phone' },+ { key: 'companycity', label: 'Company City' },+ { key: 'companycountry', label: 'Company Country' },+ { key: 'companyname', label: 'Company Name' },+ { key: 'companywebsite', label: 'Company Website', format: 'url' },+ { key: 'companydescription', label: 'Company Description' },+ { key: 'companynumber_of_employees', label: 'Company Number of Employees' },+ ],+ },+ ],+};++export const mauticListContactDevicesOutputSchema: OutputSchema = {+ fields: [+ { key: 'total', label: 'Total', format: 'number' },+ {+ key: 'devices',+ label: 'Devices',+ labelKey: 'id',+ listItems: [+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'lead', label: 'Lead' },+ { key: 'clientInfo', label: 'Client Info' },+ { key: 'device', label: 'Device' },+ { key: 'deviceBrand', label: 'Device Brand' },+ { key: 'deviceModel', label: 'Device Model' },+ { key: 'deviceOsName', label: 'Device Os Name' },+ { key: 'deviceOsShortName', label: 'Device Os Short Name' },+ { key: 'deviceOsVersion', label: 'Device Os Version' },+ { key: 'deviceOsPlatform', label: 'Device Os Platform' },+ ],+ },+ ],+};++export const mauticListContactFieldsOutputSchema: OutputSchema = {+ fields: [{ key: 'fields', label: 'Fields', dynamicKey: true, labelKey: 'label' }],+};++export const mauticListContactNotesOutputSchema: OutputSchema = {+ fields: [+ { key: 'total', label: 'Total', format: 'number' },+ {+ key: 'notes',+ label: 'Notes',+ labelKey: 'id',+ listItems: [+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'text', label: 'Text' },+ { key: 'type', label: 'Type' },+ { key: 'dateTime', label: 'Date Time', format: 'datetime' },+ { key: 'lead', label: 'Lead' },+ ],+ },+ ],+};++export const mauticListContactOwnersOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'owners',+ label: 'Owners',+ labelKey: 'id',+ listItems: [+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'firstName', label: 'First Name' },+ { key: 'lastName', label: 'Last Name' },+ ],+ },+ ],+};++export const mauticListContactPointGroupsOutputSchema: OutputSchema = {+ fields: [+ { key: 'total', label: 'Total', format: 'number' },+ {+ key: 'groupScores',+ label: 'Group Scores',+ listItems: [+ { key: 'score', label: 'Score', format: 'number' },+ {+ key: 'group',+ label: 'Group',+ children: [+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'name', label: 'Name' },+ { key: 'description', label: 'Description' },+ ],+ },+ ],+ },+ ],+};++export const mauticListContactSegmentsOutputSchema: OutputSchema = {+ fields: [+ { key: 'total', label: 'Total', format: 'number' },+ {+ key: 'lists',+ label: 'Lists',+ labelKey: 'name',+ listItems: [+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'name', label: 'Name' },+ { key: 'alias', label: 'Alias' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'manuallyRemoved', label: 'Manually Removed', format: 'boolean' },+ { key: 'manuallyAdded', label: 'Manually Added', format: 'boolean' },+ ],+ },+ ],+};++export const mauticListContactsOutputSchema: OutputSchema = {+ fields: [+ { key: 'total', label: 'Total' },+ {+ key: 'contacts',+ label: 'Contacts',+ labelKey: 'id',+ listItems: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'points', label: 'Points', format: 'number' },+ { key: 'color', label: 'Color' },+ {+ key: 'fields',+ label: 'Fields',+ children: [{ key: 'all', label: 'All', children: fieldsAll4Fields }],+ },+ { key: 'lastActive', label: 'Last Active' },+ { key: 'owner', label: 'Owner', children: contactOwner2Fields },+ { key: 'ipAddresses', label: 'IP Addresses' },+ {+ key: 'tags',+ label: 'Tags',+ labelKey: 'id',+ listItems: [+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'tag', label: 'Tag' },+ { key: 'description', label: 'Description' },+ ],+ },+ { key: 'utmtags', label: 'UTM Tags' },+ { key: 'stage', label: 'Stage' },+ { key: 'dateIdentified', label: 'Date Identified', format: 'datetime' },+ { key: 'preferredProfileImage', label: 'Preferred Profile Image' },+ { key: 'doNotContact', label: 'Do Not Contact' },+ { key: 'frequencyRules', label: 'Frequency Rules' },+ ],+ },+ ],+};++export const mauticRemoveContactUtmTagsOutputSchema: OutputSchema = {+ fields: [+ { key: 'recordFound', label: 'Record Found', format: 'boolean' },+ {+ key: 'contact',+ label: 'Contact',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified', format: 'datetime' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'points', label: 'Points', format: 'number' },+ { key: 'firstname', label: 'First Name' },+ { key: 'lastname', label: 'Last Name' },+ { key: 'position', label: 'Position' },+ { key: 'email', label: 'Email', format: 'email' },+ { key: 'phone', label: 'Phone' },+ { key: 'city', label: 'City' },+ { key: 'fields', label: 'Fields' },+ { key: 'lastActive', label: 'Last Active', format: 'datetime' },+ { key: 'owner', label: 'Owner', children: contactOwnerFields },+ { key: 'ipAddresses', label: 'IP Addresses' },+ {+ key: 'tags',+ label: 'Tags',+ labelKey: 'id',+ listItems: [+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'tag', label: 'Tag' },+ ],+ },+ { key: 'utmtags', label: 'UTM Tags' },+ { key: 'dateIdentified', label: 'Date Identified', format: 'datetime' },+ { key: 'doNotContact', label: 'Do Not Contact' },+ { key: 'frequencyRules', label: 'Frequency Rules' },+ ],+ },+ ],+};++export const mauticRemoveDoNotContactOutputSchema: OutputSchema = {+ fields: [+ { key: 'recordFound', label: 'Record Found', format: 'boolean' },+ {+ key: 'contact',+ label: 'Contact',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'points', label: 'Points', format: 'number' },+ { key: 'fields', label: 'Fields' },+ { key: 'ipAddresses', label: 'IP Addresses' },+ { key: 'tags', label: 'Tags' },+ { key: 'utmtags', label: 'UTM Tags' },+ {+ key: 'doNotContact',+ label: 'Do Not Contact',+ labelKey: 'id',+ listItems: contactDoNotContactFields,+ },+ { key: 'frequencyRules', label: 'Frequency Rules' },+ ],+ },+ ],+};diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/contacts/remove-contact-utm-tags.ts b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/remove-contact-utm-tags.tsnew file mode 100644index 00000000000..19394a26b7e--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/remove-contact-utm-tags.ts@@ -0,0 +1,38 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticRemoveContactUtmTagsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticRemoveContactUtmTagsAction = createAction({+ auth: mauticAuth,+ name: 'mautic_remove_contact_utm_tags',+ outputSchema: mauticRemoveContactUtmTagsOutputSchema,+ displayName: 'Remove Contact UTM Tags',+ description: 'Removes one UTM tag entry from a Mautic contact.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description:+ "Removes one UTM tag entry from a contact. The UTM id is the id of an entry in the contact's utmtags, from Get Contact.",+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Contact Id',+ description: 'Numeric contact id, from List Contacts or Create Contact.',+ }),+ utmId: mauticAiProps.recordId({+ displayName: 'UTM Id',+ description: 'Id of the UTM tag entry, from the utmtags of Get Contact.',+ }),+ },+ async run(context) {+ return await mauticApi.removeContactUtmTags({+ auth: context.auth,+ id: context.propsValue.id,+ utmId: context.propsValue.utmId,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/contacts/remove-do-not-contact.ts b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/remove-do-not-contact.tsnew file mode 100644index 00000000000..709dfcff8e3--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/remove-do-not-contact.ts@@ -0,0 +1,45 @@+import { Property, createAction } from '@activepieces/pieces-framework';++import { mauticRemoveDoNotContactOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticRemoveDoNotContactAction = createAction({+ auth: mauticAuth,+ name: 'mautic_remove_do_not_contact',+ outputSchema: mauticRemoveDoNotContactOutputSchema,+ displayName: 'Remove Do Not Contact',+ description: 'Removes the do not contact entry of a Mautic contact on a channel.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Removes the do-not-contact entry of a contact on the email or SMS channel, so Mautic can send on it again.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Contact Id',+ description: 'Numeric contact id, from List Contacts or Create Contact.',+ }),+ channel: Property.StaticDropdown({+ displayName: 'Channel',+ required: true,+ options: {+ options: [+ { label: 'Email', value: 'email' },+ { label: 'SMS', value: 'sms' },+ ],+ },+ }),+ },+ async run(context) {+ return await mauticApi.setDoNotContact({+ auth: context.auth,+ id: context.propsValue.id,+ channel: context.propsValue.channel,+ change: 'remove',+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/contacts/update-contact.ts b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/update-contact.tsnew file mode 100644index 00000000000..b9f257f8828--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/contacts/update-contact.ts@@ -0,0 +1,60 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticGetContactOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticUpdateContactAction = createAction({+ auth: mauticAuth,+ name: 'mautic_update_contact',+ outputSchema: mauticGetContactOutputSchema,+ displayName: 'Update Contact',+ description: 'Updates fields of a Mautic contact.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Updates only the fields given on an existing contact; fields left empty are not changed. Fails if the contact id does not exist. Tags are added, and a tag prefixed with "-" is removed.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Contact Id',+ description: 'Numeric contact id, from List Contacts or Create Contact.',+ }),+ email: Property.ShortText({ displayName: 'Email', required: false }),+ firstname: Property.ShortText({ displayName: 'First Name', required: false }),+ lastname: Property.ShortText({ displayName: 'Last Name', required: false }),+ owner: Property.Number({+ displayName: 'Owner Id',+ description: 'Id of the Mautic user who owns the contact, from List Contact Owners.',+ required: false,+ }),+ tags: Property.Array({+ displayName: 'Tags',+ description: 'Tag names to add. Prefix a name with "-" to remove that tag.',+ required: false,+ }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other contact fields keyed by field alias, e.g. {"phone": "+15550100", "city": "Berlin"}. Aliases come from List Contact Fields. The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const { id, additionalFields, email, firstname, lastname, owner, tags } = context.propsValue;+ return await mauticApi.updateRecord({+ auth: context.auth,+ resource: 'contacts',+ id,+ body: {+ ...additionalFields,+ ...spreadIfDefined('email', email),+ ...spreadIfDefined('firstname', firstname),+ ...spreadIfDefined('lastname', lastname),+ ...spreadIfDefined('owner', owner),+ ...spreadIfDefined('tags', tags),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/devices/create-device.ts b/packages/pieces/community/mautic/src/lib/actions/ai/devices/create-device.tsnew file mode 100644index 00000000000..bd6afce9da4--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/devices/create-device.ts@@ -0,0 +1,99 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticCreateDeviceOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticCreateDeviceAction = createAction({+ auth: mauticAuth,+ name: 'mautic_create_device',+ outputSchema: mauticCreateDeviceOutputSchema,+ displayName: 'Create Device',+ description: 'Creates a Mautic device.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description: 'Records a device for a contact. Contact Id and Device Type are required.',+ idempotent: false,+ },+ props: {+ lead: Property.ShortText({+ displayName: 'Contact Id',+ description: 'Numeric id of the contact who uses the device, from List Contacts.',+ required: true,+ }),+ device: Property.StaticDropdown({+ displayName: 'Device Type',+ required: true,+ options: {+ options: [+ { label: 'Desktop', value: 'desktop' },+ { label: 'Smartphone', value: 'smartphone' },+ { label: 'Tablet', value: 'tablet' },+ { label: 'Phablet', value: 'phablet' },+ { label: 'Tv', value: 'tv' },+ { label: 'Console', value: 'console' },+ { label: 'Car browser', value: 'car browser' },+ { label: 'Camera', value: 'camera' },+ { label: 'Portable media player', value: 'portable media player' },+ { label: 'Feature phone', value: 'feature phone' },+ ],+ },+ }),+ deviceBrand: Property.ShortText({+ displayName: 'Brand',+ description: 'e.g. "AP" for Apple.',+ required: false,+ }),+ deviceModel: Property.ShortText({ displayName: 'Model', required: false }),+ deviceOsName: Property.ShortText({+ displayName: 'OS Name',+ description: 'e.g. "Mac".',+ required: false,+ }),+ deviceOsShortName: Property.ShortText({+ displayName: 'OS Short Name',+ description: 'e.g. "MAC".',+ required: false,+ }),+ deviceOsVersion: Property.ShortText({ displayName: 'OS Version', required: false }),+ deviceOsPlatform: Property.ShortText({+ displayName: 'OS Platform',+ description: 'e.g. "x64".',+ required: false,+ }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other device properties, e.g. "clientInfo" as {"type": "browser", "name": "Chrome", "version": "120.0"}. The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const {+ additionalFields,+ lead,+ device,+ deviceBrand,+ deviceModel,+ deviceOsName,+ deviceOsShortName,+ deviceOsVersion,+ deviceOsPlatform,+ } = context.propsValue;+ return await mauticApi.createRecord({+ auth: context.auth,+ resource: 'devices',+ body: {+ ...additionalFields,+ ...spreadIfDefined('lead', lead),+ ...spreadIfDefined('device', device),+ ...spreadIfDefined('deviceBrand', deviceBrand),+ ...spreadIfDefined('deviceModel', deviceModel),+ ...spreadIfDefined('deviceOsName', deviceOsName),+ ...spreadIfDefined('deviceOsShortName', deviceOsShortName),+ ...spreadIfDefined('deviceOsVersion', deviceOsVersion),+ ...spreadIfDefined('deviceOsPlatform', deviceOsPlatform),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/devices/delete-device.ts b/packages/pieces/community/mautic/src/lib/actions/ai/devices/delete-device.tsnew file mode 100644index 00000000000..ab3a63fe070--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/devices/delete-device.ts@@ -0,0 +1,33 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticDeleteDeviceOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticDeleteDeviceAction = createAction({+ auth: mauticAuth,+ name: 'mautic_delete_device',+ outputSchema: mauticDeleteDeviceOutputSchema,+ displayName: 'Delete Device',+ description: 'Permanently deletes a Mautic device.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description: 'Permanently deletes a device record. Cannot be undone.',+ idempotent: false,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Device Id',+ description: 'Numeric device id, from List Devices or Create Device.',+ }),+ },+ async run(context) {+ return await mauticApi.deleteRecord({+ auth: context.auth,+ resource: 'devices',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/devices/get-device.ts b/packages/pieces/community/mautic/src/lib/actions/ai/devices/get-device.tsnew file mode 100644index 00000000000..b5409242dbc--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/devices/get-device.ts@@ -0,0 +1,33 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticGetDeviceOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticGetDeviceAction = createAction({+ auth: mauticAuth,+ name: 'mautic_get_device',+ outputSchema: mauticGetDeviceOutputSchema,+ displayName: 'Get Device',+ description: 'Gets one Mautic device by id.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description: 'Gets a single device by its numeric id, with its contact.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Device Id',+ description: 'Numeric device id, from List Devices or Create Device.',+ }),+ },+ async run(context) {+ return await mauticApi.getRecord({+ auth: context.auth,+ resource: 'devices',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/devices/list-devices.ts b/packages/pieces/community/mautic/src/lib/actions/ai/devices/list-devices.tsnew file mode 100644index 00000000000..7704dbd3d88--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/devices/list-devices.ts@@ -0,0 +1,32 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListDevicesOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticListDevicesAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_devices',+ outputSchema: mauticListDevicesOutputSchema,+ displayName: 'List Devices',+ description: 'Lists Mautic devices.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists the devices tracked for contacts. Use List Contact Devices for one contact. Page with Start and Limit; the response has the total count.',+ idempotent: true,+ },+ props: {+ ...mauticAiProps.filterOptions,+ },+ async run(context) {+ return await mauticApi.listRecords({+ auth: context.auth,+ resource: 'devices',+ key: 'devices',+ query: context.propsValue,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/devices/output-schemas.ts b/packages/pieces/community/mautic/src/lib/actions/ai/devices/output-schemas.tsnew file mode 100644index 00000000000..951d277d948--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/devices/output-schemas.ts@@ -0,0 +1,99 @@+import { OutputSchema } from '@activepieces/pieces-framework';++import { deviceFields, deviceLeadFields, leadOwnerFields } from '../../../output-schemas';++export const mauticCreateDeviceOutputSchema: OutputSchema = {+ fields: [{ key: 'device', label: 'Device', children: deviceFields }],+};++export const mauticDeleteDeviceOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'device',+ label: 'Device',+ children: [+ { key: 'id', label: 'ID' },+ { key: 'lead', label: 'Lead', children: deviceLeadFields },+ { key: 'clientInfo', label: 'Client Info' },+ { key: 'device', label: 'Device' },+ { key: 'deviceBrand', label: 'Device Brand' },+ { key: 'deviceModel', label: 'Device Model' },+ { key: 'deviceOsName', label: 'Device Os Name' },+ { key: 'deviceOsShortName', label: 'Device Os Short Name' },+ { key: 'deviceOsVersion', label: 'Device Os Version' },+ { key: 'deviceOsPlatform', label: 'Device Os Platform' },+ ],+ },+ ],+};++export const mauticGetDeviceOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'device',+ label: 'Device',+ children: [+ { key: 'id', label: 'ID', format: 'number' },+ {+ key: 'lead',+ label: 'Lead',+ children: [+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'points', label: 'Points', format: 'number' },+ { key: 'color', label: 'Color' },+ { key: 'title', label: 'Title' },+ { key: 'firstname', label: 'First Name' },+ { key: 'lastname', label: 'Last Name' },+ { key: 'company', label: 'Company' },+ { key: 'position', label: 'Position' },+ { key: 'email', label: 'Email', format: 'email' },+ { key: 'phone', label: 'Phone' },+ { key: 'mobile', label: 'Mobile' },+ { key: 'address1', label: 'Address 1' },+ { key: 'address2', label: 'Address 2' },+ { key: 'city', label: 'City' },+ { key: 'state', label: 'State' },+ { key: 'zipcode', label: 'Zip Code' },+ { key: 'timezone', label: 'Timezone' },+ { key: 'country', label: 'Country' },+ { key: 'fields', label: 'Fields' },+ { key: 'lastActive', label: 'Last Active', format: 'datetime' },+ { key: 'owner', label: 'Owner', children: leadOwnerFields },+ { key: 'ipAddresses', label: 'IP Addresses' },+ {+ key: 'tags',+ label: 'Tags',+ labelKey: 'id',+ listItems: [+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'tag', label: 'Tag' },+ { key: 'description', label: 'Description' },+ ],+ },+ { key: 'utmtags', label: 'UTM Tags' },+ { key: 'stage', label: 'Stage' },+ { key: 'dateIdentified', label: 'Date Identified', format: 'datetime' },+ { key: 'preferredProfileImage', label: 'Preferred Profile Image' },+ { key: 'doNotContact', label: 'Do Not Contact' },+ { key: 'frequencyRules', label: 'Frequency Rules' },+ ],+ },+ { key: 'clientInfo', label: 'Client Info' },+ { key: 'device', label: 'Device' },+ { key: 'deviceBrand', label: 'Device Brand' },+ { key: 'deviceModel', label: 'Device Model' },+ { key: 'deviceOsName', label: 'Device Os Name' },+ { key: 'deviceOsShortName', label: 'Device Os Short Name' },+ { key: 'deviceOsVersion', label: 'Device Os Version' },+ { key: 'deviceOsPlatform', label: 'Device Os Platform' },+ ],+ },+ ],+};++export const mauticListDevicesOutputSchema: OutputSchema = {+ fields: [+ { key: 'total', label: 'Total', format: 'number' },+ { key: 'devices', label: 'Devices', labelKey: 'id', listItems: deviceFields },+ ],+};diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/devices/update-device.ts b/packages/pieces/community/mautic/src/lib/actions/ai/devices/update-device.tsnew file mode 100644index 00000000000..8a5af9432a5--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/devices/update-device.ts@@ -0,0 +1,105 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticGetDeviceOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticUpdateDeviceAction = createAction({+ auth: mauticAuth,+ name: 'mautic_update_device',+ outputSchema: mauticGetDeviceOutputSchema,+ displayName: 'Update Device',+ description: 'Updates fields of a Mautic device.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description: 'Updates an existing device. Only the fields given are changed.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Device Id',+ description: 'Numeric device id, from List Devices or Create Device.',+ }),+ lead: Property.ShortText({+ displayName: 'Contact Id',+ description: 'Numeric id of the contact who uses the device, from List Contacts.',+ required: false,+ }),+ device: Property.StaticDropdown({+ displayName: 'Device Type',+ required: false,+ options: {+ options: [+ { label: 'Desktop', value: 'desktop' },+ { label: 'Smartphone', value: 'smartphone' },+ { label: 'Tablet', value: 'tablet' },+ { label: 'Phablet', value: 'phablet' },+ { label: 'Tv', value: 'tv' },+ { label: 'Console', value: 'console' },+ { label: 'Car browser', value: 'car browser' },+ { label: 'Camera', value: 'camera' },+ { label: 'Portable media player', value: 'portable media player' },+ { label: 'Feature phone', value: 'feature phone' },+ ],+ },+ }),+ deviceBrand: Property.ShortText({+ displayName: 'Brand',+ description: 'e.g. "AP" for Apple.',+ required: false,+ }),+ deviceModel: Property.ShortText({ displayName: 'Model', required: false }),+ deviceOsName: Property.ShortText({+ displayName: 'OS Name',+ description: 'e.g. "Mac".',+ required: false,+ }),+ deviceOsShortName: Property.ShortText({+ displayName: 'OS Short Name',+ description: 'e.g. "MAC".',+ required: false,+ }),+ deviceOsVersion: Property.ShortText({ displayName: 'OS Version', required: false }),+ deviceOsPlatform: Property.ShortText({+ displayName: 'OS Platform',+ description: 'e.g. "x64".',+ required: false,+ }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other device properties, e.g. "clientInfo" as {"type": "browser", "name": "Chrome", "version": "120.0"}. The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const {+ id,+ additionalFields,+ lead,+ device,+ deviceBrand,+ deviceModel,+ deviceOsName,+ deviceOsShortName,+ deviceOsVersion,+ deviceOsPlatform,+ } = context.propsValue;+ return await mauticApi.updateRecord({+ auth: context.auth,+ resource: 'devices',+ id,+ body: {+ ...additionalFields,+ ...spreadIfDefined('lead', lead),+ ...spreadIfDefined('device', device),+ ...spreadIfDefined('deviceBrand', deviceBrand),+ ...spreadIfDefined('deviceModel', deviceModel),+ ...spreadIfDefined('deviceOsName', deviceOsName),+ ...spreadIfDefined('deviceOsShortName', deviceOsShortName),+ ...spreadIfDefined('deviceOsVersion', deviceOsVersion),+ ...spreadIfDefined('deviceOsPlatform', deviceOsPlatform),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/dynamic-content/create-dynamic-content.ts b/packages/pieces/community/mautic/src/lib/actions/ai/dynamic-content/create-dynamic-content.tsnew file mode 100644index 00000000000..11beca47518--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/dynamic-content/create-dynamic-content.ts@@ -0,0 +1,88 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticCreateDynamicContentOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticCreateDynamicContentAction = createAction({+ auth: mauticAuth,+ name: 'mautic_create_dynamic_content',+ outputSchema: mauticCreateDynamicContentOutputSchema,+ displayName: 'Create Dynamic Content',+ description: 'Creates a Mautic dynamic content.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description: 'Creates a dynamic content item. Name is required.',+ idempotent: false,+ },+ props: {+ name: Property.ShortText({ displayName: 'Name', required: true }),+ content: Property.LongText({+ displayName: 'Content',+ description: 'HTML shown to matching contacts.',+ required: false,+ }),+ description: Property.LongText({ displayName: 'Description', required: false }),+ isCampaignBased: mauticAiProps.yesNo({+ displayName: 'Campaign Based',+ description: 'Yes when a campaign decides who sees it; No to use Slot Name and Filters.',+ }),+ slotName: Property.ShortText({+ displayName: 'Slot Name',+ description: 'Name of the slot on your site the content fills, when not campaign based.',+ required: false,+ }),+ filters: Property.Array({+ displayName: 'Filters',+ description: 'Contact filters that decide who sees it, in the segment filter shape.',+ required: false,+ }),+ isPublished: mauticAiProps.yesNo({ displayName: 'Published' }),+ category: Property.Number({+ displayName: 'Category Id',+ description: 'Category id, from List Categories.',+ required: false,+ }),+ language: Property.ShortText({+ displayName: 'Language',+ description: 'Locale code, e.g. "en".',+ required: false,+ }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other dynamic content properties, e.g. "publishUp", "publishDown", "utmTags". The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const {+ additionalFields,+ name,+ content,+ description,+ isCampaignBased,+ slotName,+ filters,+ isPublished,+ category,+ language,+ } = context.propsValue;+ return await mauticApi.createRecord({+ auth: context.auth,+ resource: 'dynamiccontents',+ body: {+ ...additionalFields,+ ...spreadIfDefined('name', name),+ ...spreadIfDefined('content', content),+ ...spreadIfDefined('description', description),+ ...spreadIfDefined('isCampaignBased', isCampaignBased),+ ...spreadIfDefined('slotName', slotName),+ ...spreadIfDefined('filters', filters),+ ...spreadIfDefined('isPublished', isPublished),+ ...spreadIfDefined('category', category),+ ...spreadIfDefined('language', language),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/dynamic-content/delete-dynamic-content.ts b/packages/pieces/community/mautic/src/lib/actions/ai/dynamic-content/delete-dynamic-content.tsnew file mode 100644index 00000000000..8d7d95445ad--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/dynamic-content/delete-dynamic-content.ts@@ -0,0 +1,34 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticDeleteDynamicContentOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticDeleteDynamicContentAction = createAction({+ auth: mauticAuth,+ name: 'mautic_delete_dynamic_content',+ outputSchema: mauticDeleteDynamicContentOutputSchema,+ displayName: 'Delete Dynamic Content',+ description: 'Permanently deletes a Mautic dynamic content.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description: 'Permanently deletes a dynamic content item. Cannot be undone.',+ idempotent: false,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Dynamic Content Id',+ description:+ 'Numeric dynamic content id, from List Dynamic Contents or Create Dynamic Content.',+ }),+ },+ async run(context) {+ return await mauticApi.deleteRecord({+ auth: context.auth,+ resource: 'dynamiccontents',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/dynamic-content/get-dynamic-content.ts b/packages/pieces/community/mautic/src/lib/actions/ai/dynamic-content/get-dynamic-content.tsnew file mode 100644index 00000000000..5a28c9104ca--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/dynamic-content/get-dynamic-content.ts@@ -0,0 +1,34 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticGetDynamicContentOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticGetDynamicContentAction = createAction({+ auth: mauticAuth,+ name: 'mautic_get_dynamic_content',+ outputSchema: mauticGetDynamicContentOutputSchema,+ displayName: 'Get Dynamic Content',+ description: 'Gets one Mautic dynamic content by id.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description: 'Gets a single dynamic content item by its numeric id.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Dynamic Content Id',+ description:+ 'Numeric dynamic content id, from List Dynamic Contents or Create Dynamic Content.',+ }),+ },+ async run(context) {+ return await mauticApi.getRecord({+ auth: context.auth,+ resource: 'dynamiccontents',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/dynamic-content/list-dynamic-contents.ts b/packages/pieces/community/mautic/src/lib/actions/ai/dynamic-content/list-dynamic-contents.tsnew file mode 100644index 00000000000..26116e03c09--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/dynamic-content/list-dynamic-contents.ts@@ -0,0 +1,32 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListDynamicContentsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticListDynamicContentsAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_dynamic_contents',+ outputSchema: mauticListDynamicContentsOutputSchema,+ displayName: 'List Dynamic Contents',+ description: 'Lists Mautic dynamic contents.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists dynamic content items, the personalized HTML blocks for websites and emails. Page with Start and Limit; the response has the total count.',+ idempotent: true,+ },+ props: {+ ...mauticAiProps.listOptions,+ },+ async run(context) {+ return await mauticApi.listRecords({+ auth: context.auth,+ resource: 'dynamiccontents',+ key: 'dynamicContents',+ query: context.propsValue,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/dynamic-content/output-schemas.ts b/packages/pieces/community/mautic/src/lib/actions/ai/dynamic-content/output-schemas.tsnew file mode 100644index 00000000000..5ebac772922--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/dynamic-content/output-schemas.ts@@ -0,0 +1,136 @@+import { OutputSchema } from '@activepieces/pieces-framework';++import {+ categoryFields,+ dynamicContentFiltersFields,+ dynamicContentUtmTags2Fields,+ dynamicContentUtmTagsFields,+} from '../../../output-schemas';++export const mauticCreateDynamicContentOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'dynamicContent',+ label: 'Dynamic Content',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'name', label: 'Name' },+ { key: 'category', label: 'Category', children: categoryFields },+ { key: 'publishUp', label: 'Publish Up' },+ { key: 'publishDown', label: 'Publish Down' },+ { key: 'sentCount', label: 'Sent Count', format: 'number' },+ { key: 'variantParent', label: 'Variant Parent' },+ { key: 'variantChildren', label: 'Variant Children' },+ { key: 'content', label: 'Content' },+ { key: 'utmTags', label: 'Utm Tags', children: dynamicContentUtmTagsFields },+ { key: 'filters', label: 'Filters', listItems: dynamicContentFiltersFields },+ { key: 'isCampaignBased', label: 'Is Campaign Based', format: 'boolean' },+ { key: 'slotName', label: 'Slot Name' },+ ],+ },+ ],+};++export const mauticDeleteDynamicContentOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'dynamicContent',+ label: 'Dynamic Content',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified' },+ { key: 'id', label: 'ID' },+ { key: 'name', label: 'Name' },+ { key: 'category', label: 'Category', children: categoryFields },+ { key: 'publishUp', label: 'Publish Up' },+ { key: 'publishDown', label: 'Publish Down' },+ { key: 'sentCount', label: 'Sent Count', format: 'number' },+ { key: 'variantParent', label: 'Variant Parent' },+ {+ key: 'variantChildren',+ label: 'Variant Children',+ labelKey: 'name',+ listItems: [+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'name', label: 'Name' },+ { key: 'category', label: 'Category' },+ { key: 'publishUp', label: 'Publish Up' },+ { key: 'publishDown', label: 'Publish Down' },+ { key: 'sentCount', label: 'Sent Count', format: 'number' },+ { key: 'variantChildren', label: 'Variant Children' },+ { key: 'content', label: 'Content' },+ { key: 'utmTags', label: 'Utm Tags', children: dynamicContentUtmTags2Fields },+ { key: 'filters', label: 'Filters' },+ { key: 'isCampaignBased', label: 'Is Campaign Based', format: 'boolean' },+ { key: 'slotName', label: 'Slot Name' },+ ],+ },+ { key: 'content', label: 'Content' },+ { key: 'utmTags', label: 'Utm Tags', children: dynamicContentUtmTags2Fields },+ { key: 'filters', label: 'Filters', listItems: dynamicContentFiltersFields },+ { key: 'isCampaignBased', label: 'Is Campaign Based', format: 'boolean' },+ { key: 'slotName', label: 'Slot Name' },+ ],+ },+ ],+};++export const mauticGetDynamicContentOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'dynamicContent',+ label: 'Dynamic Content',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified', format: 'datetime' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'name', label: 'Name' },+ { key: 'category', label: 'Category', children: categoryFields },+ { key: 'publishUp', label: 'Publish Up' },+ { key: 'publishDown', label: 'Publish Down' },+ { key: 'sentCount', label: 'Sent Count', format: 'number' },+ { key: 'variantParent', label: 'Variant Parent' },+ { key: 'variantChildren', label: 'Variant Children' },+ { key: 'content', label: 'Content' },+ { key: 'utmTags', label: 'Utm Tags', children: dynamicContentUtmTags2Fields },+ { key: 'filters', label: 'Filters', listItems: dynamicContentFiltersFields },+ { key: 'isCampaignBased', label: 'Is Campaign Based', format: 'boolean' },+ { key: 'slotName', label: 'Slot Name' },+ ],+ },+ ],+};++export const mauticListDynamicContentsOutputSchema: OutputSchema = {+ fields: [+ { key: 'total', label: 'Total', format: 'number' },+ {+ key: 'dynamicContents',+ label: 'Dynamic Contents',+ labelKey: 'name',+ listItems: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'name', label: 'Name' },+ { key: 'category', label: 'Category', children: categoryFields },+ { key: 'publishUp', label: 'Publish Up' },+ { key: 'publishDown', label: 'Publish Down' },+ { key: 'sentCount', label: 'Sent Count', format: 'number' },+ { key: 'variantParent', label: 'Variant Parent' },+ { key: 'variantChildren', label: 'Variant Children' },+ { key: 'content', label: 'Content' },+ { key: 'utmTags', label: 'Utm Tags', children: dynamicContentUtmTags2Fields },+ { key: 'filters', label: 'Filters', listItems: dynamicContentFiltersFields },+ { key: 'isCampaignBased', label: 'Is Campaign Based', format: 'boolean' },+ { key: 'slotName', label: 'Slot Name' },+ ],+ },+ ],+};diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/dynamic-content/update-dynamic-content.ts b/packages/pieces/community/mautic/src/lib/actions/ai/dynamic-content/update-dynamic-content.tsnew file mode 100644index 00000000000..08c9910e0f6--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/dynamic-content/update-dynamic-content.ts@@ -0,0 +1,95 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticGetDynamicContentOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticUpdateDynamicContentAction = createAction({+ auth: mauticAuth,+ name: 'mautic_update_dynamic_content',+ outputSchema: mauticGetDynamicContentOutputSchema,+ displayName: 'Update Dynamic Content',+ description: 'Updates fields of a Mautic dynamic content.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description: 'Updates an existing dynamic content item. Only the fields given are changed.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Dynamic Content Id',+ description:+ 'Numeric dynamic content id, from List Dynamic Contents or Create Dynamic Content.',+ }),+ name: Property.ShortText({ displayName: 'Name', required: false }),+ content: Property.LongText({+ displayName: 'Content',+ description: 'HTML shown to matching contacts.',+ required: false,+ }),+ description: Property.LongText({ displayName: 'Description', required: false }),+ isCampaignBased: mauticAiProps.yesNo({+ displayName: 'Campaign Based',+ description: 'Yes when a campaign decides who sees it; No to use Slot Name and Filters.',+ }),+ slotName: Property.ShortText({+ displayName: 'Slot Name',+ description: 'Name of the slot on your site the content fills, when not campaign based.',+ required: false,+ }),+ filters: Property.Array({+ displayName: 'Filters',+ description: 'Contact filters that decide who sees it, in the segment filter shape.',+ required: false,+ }),+ isPublished: mauticAiProps.yesNo({ displayName: 'Published' }),+ category: Property.Number({+ displayName: 'Category Id',+ description: 'Category id, from List Categories.',+ required: false,+ }),+ language: Property.ShortText({+ displayName: 'Language',+ description: 'Locale code, e.g. "en".',+ required: false,+ }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other dynamic content properties, e.g. "publishUp", "publishDown", "utmTags". The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const {+ id,+ additionalFields,+ name,+ content,+ description,+ isCampaignBased,+ slotName,+ filters,+ isPublished,+ category,+ language,+ } = context.propsValue;+ return await mauticApi.updateRecord({+ auth: context.auth,+ resource: 'dynamiccontents',+ id,+ body: {+ ...additionalFields,+ ...spreadIfDefined('name', name),+ ...spreadIfDefined('content', content),+ ...spreadIfDefined('description', description),+ ...spreadIfDefined('isCampaignBased', isCampaignBased),+ ...spreadIfDefined('slotName', slotName),+ ...spreadIfDefined('filters', filters),+ ...spreadIfDefined('isPublished', isPublished),+ ...spreadIfDefined('category', category),+ ...spreadIfDefined('language', language),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/emails/create-email.ts b/packages/pieces/community/mautic/src/lib/actions/ai/emails/create-email.tsnew file mode 100644index 00000000000..d81c5fc7589--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/emails/create-email.ts@@ -0,0 +1,110 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticCreateEmailOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticCreateEmailAction = createAction({+ auth: mauticAuth,+ name: 'mautic_create_email',+ outputSchema: mauticCreateEmailOutputSchema,+ displayName: 'Create Email',+ description: 'Creates a Mautic email.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Creates an email. Name and Subject are required; set Email Type to "list" with Segment Ids for a segment email. Mautic sends it from campaigns, or as a segment email from the Mautic app.',+ idempotent: false,+ },+ props: {+ name: Property.ShortText({+ displayName: 'Name',+ description: 'Internal name of the email.',+ required: true,+ }),+ subject: Property.ShortText({ displayName: 'Subject', required: true }),+ customHtml: Property.LongText({+ displayName: 'HTML Body',+ description:+ 'Full HTML content. Tokens like {contactfield=firstname} are replaced per contact.',+ required: false,+ }),+ plainText: Property.LongText({ displayName: 'Plain Text Body', required: false }),+ emailType: Property.StaticDropdown({+ displayName: 'Email Type',+ description:+ 'Template emails go to single contacts and from campaigns; segment emails go to their segments.',+ required: false,+ options: {+ options: [+ { label: 'Template (sent one by one)', value: 'template' },+ { label: 'Segment (sent to segments)', value: 'list' },+ ],+ },+ }),+ lists: Property.Array({+ displayName: 'Segment Ids',+ description: 'Segment ids a segment email is sent to, from List Segments.',+ required: false,+ }),+ fromAddress: Property.ShortText({ displayName: 'From Address', required: false }),+ fromName: Property.ShortText({ displayName: 'From Name', required: false }),+ replyToAddress: Property.ShortText({ displayName: 'Reply-To Address', required: false }),+ preheaderText: Property.ShortText({ displayName: 'Preheader Text', required: false }),+ isPublished: mauticAiProps.yesNo({ displayName: 'Published' }),+ category: Property.Number({+ displayName: 'Category Id',+ description: 'Category id, from List Categories.',+ required: false,+ }),+ language: Property.ShortText({+ displayName: 'Language',+ description: 'Locale code, e.g. "en".',+ required: false,+ }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other email properties, e.g. "bccAddress", "utmTags", "publishUp", "assetAttachments", "headers", "template". The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const {+ additionalFields,+ name,+ subject,+ customHtml,+ plainText,+ emailType,+ lists,+ fromAddress,+ fromName,+ replyToAddress,+ preheaderText,+ isPublished,+ category,+ language,+ } = context.propsValue;+ return await mauticApi.createRecord({+ auth: context.auth,+ resource: 'emails',+ body: {+ ...additionalFields,+ ...spreadIfDefined('name', name),+ ...spreadIfDefined('subject', subject),+ ...spreadIfDefined('customHtml', customHtml),+ ...spreadIfDefined('plainText', plainText),+ ...spreadIfDefined('emailType', emailType),+ ...spreadIfDefined('lists', lists),+ ...spreadIfDefined('fromAddress', fromAddress),+ ...spreadIfDefined('fromName', fromName),+ ...spreadIfDefined('replyToAddress', replyToAddress),+ ...spreadIfDefined('preheaderText', preheaderText),+ ...spreadIfDefined('isPublished', isPublished),+ ...spreadIfDefined('category', category),+ ...spreadIfDefined('language', language),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/emails/delete-email.ts b/packages/pieces/community/mautic/src/lib/actions/ai/emails/delete-email.tsnew file mode 100644index 00000000000..659119e5438--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/emails/delete-email.ts@@ -0,0 +1,33 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticDeleteEmailOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticDeleteEmailAction = createAction({+ auth: mauticAuth,+ name: 'mautic_delete_email',+ outputSchema: mauticDeleteEmailOutputSchema,+ displayName: 'Delete Email',+ description: 'Permanently deletes a Mautic email.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description: 'Permanently deletes an email and its stats. Cannot be undone.',+ idempotent: false,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Email Id',+ description: 'Numeric email id, from List Emails or Create Email.',+ }),+ },+ async run(context) {+ return await mauticApi.deleteRecord({+ auth: context.auth,+ resource: 'emails',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/emails/get-email.ts b/packages/pieces/community/mautic/src/lib/actions/ai/emails/get-email.tsnew file mode 100644index 00000000000..52775436144--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/emails/get-email.ts@@ -0,0 +1,34 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticCreateEmailOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticGetEmailAction = createAction({+ auth: mauticAuth,+ name: 'mautic_get_email',+ outputSchema: mauticCreateEmailOutputSchema,+ displayName: 'Get Email',+ description: 'Gets one Mautic email by id.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description:+ 'Gets a single email by its numeric id, with content, segments and sent/read counts.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Email Id',+ description: 'Numeric email id, from List Emails or Create Email.',+ }),+ },+ async run(context) {+ return await mauticApi.getRecord({+ auth: context.auth,+ resource: 'emails',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/emails/list-emails.ts b/packages/pieces/community/mautic/src/lib/actions/ai/emails/list-emails.tsnew file mode 100644index 00000000000..06b1dbeffdf--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/emails/list-emails.ts@@ -0,0 +1,32 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListEmailsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticListEmailsAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_emails',+ outputSchema: mauticListEmailsOutputSchema,+ displayName: 'List Emails',+ description: 'Lists Mautic emails.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists emails with their type, subject and sent counts. Use Search for free text or Where for exact column conditions. Page with Start and Limit; the response has the total count.',+ idempotent: true,+ },+ props: {+ ...mauticAiProps.listOptions,+ },+ async run(context) {+ return await mauticApi.listRecords({+ auth: context.auth,+ resource: 'emails',+ key: 'emails',+ query: context.propsValue,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/emails/output-schemas.ts b/packages/pieces/community/mautic/src/lib/actions/ai/emails/output-schemas.tsnew file mode 100644index 00000000000..034c8168bc2--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/emails/output-schemas.ts@@ -0,0 +1,197 @@+import { OutputSchema } from '@activepieces/pieces-framework';++import {+ campaignListsFields,+ categoryFields,+ dynamicContentUtmTagsFields,+ emailFields,+ filtersFiltersFields,+} from '../../../output-schemas';++export const mauticCreateEmailOutputSchema: OutputSchema = {+ fields: [{ key: 'email', label: 'Email', children: emailFields }],+};++export const mauticDeleteEmailOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'email',+ label: 'Email',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified', format: 'datetime' },+ { key: 'id', label: 'ID' },+ { key: 'name', label: 'Name' },+ { key: 'subject', label: 'Subject' },+ { key: 'language', label: 'Language' },+ { key: 'category', label: 'Category', children: categoryFields },+ { key: 'fromAddress', label: 'From Address', format: 'email' },+ { key: 'fromName', label: 'From Name' },+ { key: 'replyToAddress', label: 'Reply To Address', format: 'email' },+ { key: 'bccAddress', label: 'Bcc Address' },+ { key: 'useOwnerAsMailer', label: 'Use Owner As Mailer' },+ { key: 'utmTags', label: 'Utm Tags', children: dynamicContentUtmTagsFields },+ { key: 'preheaderText', label: 'Preheader Text' },+ { key: 'customHtml', label: 'Custom HTML' },+ { key: 'plainText', label: 'Plain Text' },+ { key: 'template', label: 'Template' },+ { key: 'emailType', label: 'Email Type' },+ { key: 'publishUp', label: 'Publish Up' },+ { key: 'publishDown', label: 'Publish Down' },+ { key: 'publicPreview', label: 'Public Preview', format: 'boolean' },+ { key: 'readCount', label: 'Read Count', format: 'number' },+ { key: 'sentCount', label: 'Sent Count', format: 'number' },+ { key: 'revision', label: 'Revision', format: 'number' },+ { key: 'assetAttachments', label: 'Asset Attachments' },+ { key: 'variantStartDate', label: 'Variant Start Date' },+ { key: 'variantSentCount', label: 'Variant Sent Count', format: 'number' },+ { key: 'variantReadCount', label: 'Variant Read Count', format: 'number' },+ { key: 'variantParent', label: 'Variant Parent' },+ { key: 'variantChildren', label: 'Variant Children' },+ { key: 'translationParent', label: 'Translation Parent' },+ {+ key: 'translationChildren',+ label: 'Translation Children',+ labelKey: 'name',+ listItems: [+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'name', label: 'Name' },+ { key: 'subject', label: 'Subject' },+ { key: 'language', label: 'Language' },+ { key: 'category', label: 'Category', children: categoryFields },+ { key: 'fromAddress', label: 'From Address', format: 'email' },+ { key: 'fromName', label: 'From Name' },+ { key: 'replyToAddress', label: 'Reply To Address', format: 'email' },+ { key: 'bccAddress', label: 'Bcc Address' },+ { key: 'useOwnerAsMailer', label: 'Use Owner As Mailer' },+ { key: 'utmTags', label: 'Utm Tags', children: dynamicContentUtmTagsFields },+ { key: 'preheaderText', label: 'Preheader Text' },+ { key: 'customHtml', label: 'Custom HTML' },+ { key: 'plainText', label: 'Plain Text' },+ { key: 'template', label: 'Template' },+ { key: 'emailType', label: 'Email Type' },+ { key: 'publishUp', label: 'Publish Up' },+ { key: 'publishDown', label: 'Publish Down' },+ { key: 'publicPreview', label: 'Public Preview', format: 'boolean' },+ { key: 'readCount', label: 'Read Count', format: 'number' },+ { key: 'sentCount', label: 'Sent Count', format: 'number' },+ { key: 'revision', label: 'Revision', format: 'number' },+ { key: 'assetAttachments', label: 'Asset Attachments' },+ { key: 'variantStartDate', label: 'Variant Start Date' },+ { key: 'variantSentCount', label: 'Variant Sent Count', format: 'number' },+ { key: 'variantReadCount', label: 'Variant Read Count', format: 'number' },+ { key: 'variantParent', label: 'Variant Parent' },+ { key: 'variantChildren', label: 'Variant Children' },+ { key: 'translationChildren', label: 'Translation Children' },+ { key: 'unsubscribeForm', label: 'Unsubscribe Form' },+ {+ key: 'dynamicContent',+ label: 'Dynamic Content',+ listItems: [+ { key: 'tokenName', label: 'Token Name' },+ { key: 'content', label: 'Content' },+ {+ key: 'filters',+ label: 'Filters',+ listItems: [+ { key: 'content', label: 'Content' },+ { key: 'filters', label: 'Filters' },+ ],+ },+ ],+ },+ { key: 'lists', label: 'Lists' },+ ],+ },+ { key: 'unsubscribeForm', label: 'Unsubscribe Form' },+ {+ key: 'dynamicContent',+ label: 'Dynamic Content',+ listItems: [+ { key: 'tokenName', label: 'Token Name' },+ { key: 'content', label: 'Content' },+ {+ key: 'filters',+ label: 'Filters',+ listItems: [+ { key: 'content', label: 'Content' },+ { key: 'filters', label: 'Filters', listItems: filtersFiltersFields },+ ],+ },+ ],+ },+ { key: 'lists', label: 'Lists' },+ ],+ },+ ],+};++export const mauticGetEmailOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'email',+ label: 'Email',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified', format: 'datetime' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'name', label: 'Name' },+ { key: 'subject', label: 'Subject' },+ { key: 'language', label: 'Language' },+ { key: 'category', label: 'Category', children: categoryFields },+ { key: 'fromAddress', label: 'From Address', format: 'email' },+ { key: 'fromName', label: 'From Name' },+ { key: 'replyToAddress', label: 'Reply To Address', format: 'email' },+ { key: 'bccAddress', label: 'Bcc Address' },+ { key: 'useOwnerAsMailer', label: 'Use Owner As Mailer' },+ { key: 'utmTags', label: 'Utm Tags', children: dynamicContentUtmTagsFields },+ { key: 'preheaderText', label: 'Preheader Text' },+ { key: 'customHtml', label: 'Custom HTML' },+ { key: 'plainText', label: 'Plain Text' },+ { key: 'template', label: 'Template' },+ { key: 'emailType', label: 'Email Type' },+ { key: 'publishUp', label: 'Publish Up' },+ { key: 'publishDown', label: 'Publish Down' },+ { key: 'publicPreview', label: 'Public Preview', format: 'boolean' },+ { key: 'readCount', label: 'Read Count', format: 'number' },+ { key: 'sentCount', label: 'Sent Count', format: 'number' },+ { key: 'revision', label: 'Revision', format: 'number' },+ { key: 'assetAttachments', label: 'Asset Attachments' },+ { key: 'variantStartDate', label: 'Variant Start Date' },+ { key: 'variantSentCount', label: 'Variant Sent Count', format: 'number' },+ { key: 'variantReadCount', label: 'Variant Read Count', format: 'number' },+ { key: 'variantParent', label: 'Variant Parent' },+ { key: 'variantChildren', label: 'Variant Children' },+ { key: 'translationParent', label: 'Translation Parent' },+ { key: 'translationChildren', label: 'Translation Children' },+ { key: 'unsubscribeForm', label: 'Unsubscribe Form' },+ {+ key: 'dynamicContent',+ label: 'Dynamic Content',+ listItems: [+ { key: 'tokenName', label: 'Token Name' },+ { key: 'content', label: 'Content' },+ {+ key: 'filters',+ label: 'Filters',+ listItems: [+ { key: 'content', label: 'Content' },+ { key: 'filters', label: 'Filters', listItems: filtersFiltersFields },+ ],+ },+ ],+ },+ { key: 'lists', label: 'Lists', labelKey: 'name', listItems: campaignListsFields },+ ],+ },+ ],+};++export const mauticListEmailsOutputSchema: OutputSchema = {+ fields: [+ { key: 'total', label: 'Total', format: 'number' },+ { key: 'emails', label: 'Emails', labelKey: 'name', listItems: emailFields },+ ],+};diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/emails/update-email.ts b/packages/pieces/community/mautic/src/lib/actions/ai/emails/update-email.tsnew file mode 100644index 00000000000..a4bd8413d45--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/emails/update-email.ts@@ -0,0 +1,115 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticGetEmailOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticUpdateEmailAction = createAction({+ auth: mauticAuth,+ name: 'mautic_update_email',+ outputSchema: mauticGetEmailOutputSchema,+ displayName: 'Update Email',+ description: 'Updates fields of a Mautic email.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description: 'Updates an existing email. Only the fields given are changed.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Email Id',+ description: 'Numeric email id, from List Emails or Create Email.',+ }),+ name: Property.ShortText({+ displayName: 'Name',+ description: 'Internal name of the email.',+ required: false,+ }),+ subject: Property.ShortText({ displayName: 'Subject', required: false }),+ customHtml: Property.LongText({+ displayName: 'HTML Body',+ description:+ 'Full HTML content. Tokens like {contactfield=firstname} are replaced per contact.',+ required: false,+ }),+ plainText: Property.LongText({ displayName: 'Plain Text Body', required: false }),+ emailType: Property.StaticDropdown({+ displayName: 'Email Type',+ description:+ 'Template emails go to single contacts and from campaigns; segment emails go to their segments.',+ required: false,+ options: {+ options: [+ { label: 'Template (sent one by one)', value: 'template' },+ { label: 'Segment (sent to segments)', value: 'list' },+ ],+ },+ }),+ lists: Property.Array({+ displayName: 'Segment Ids',+ description: 'Segment ids a segment email is sent to, from List Segments.',+ required: false,+ }),+ fromAddress: Property.ShortText({ displayName: 'From Address', required: false }),+ fromName: Property.ShortText({ displayName: 'From Name', required: false }),+ replyToAddress: Property.ShortText({ displayName: 'Reply-To Address', required: false }),+ preheaderText: Property.ShortText({ displayName: 'Preheader Text', required: false }),+ isPublished: mauticAiProps.yesNo({ displayName: 'Published' }),+ category: Property.Number({+ displayName: 'Category Id',+ description: 'Category id, from List Categories.',+ required: false,+ }),+ language: Property.ShortText({+ displayName: 'Language',+ description: 'Locale code, e.g. "en".',+ required: false,+ }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other email properties, e.g. "bccAddress", "utmTags", "publishUp", "assetAttachments", "headers", "template". The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const {+ id,+ additionalFields,+ name,+ subject,+ customHtml,+ plainText,+ emailType,+ lists,+ fromAddress,+ fromName,+ replyToAddress,+ preheaderText,+ isPublished,+ category,+ language,+ } = context.propsValue;+ return await mauticApi.updateRecord({+ auth: context.auth,+ resource: 'emails',+ id,+ body: {+ ...additionalFields,+ ...spreadIfDefined('name', name),+ ...spreadIfDefined('subject', subject),+ ...spreadIfDefined('customHtml', customHtml),+ ...spreadIfDefined('plainText', plainText),+ ...spreadIfDefined('emailType', emailType),+ ...spreadIfDefined('lists', lists),+ ...spreadIfDefined('fromAddress', fromAddress),+ ...spreadIfDefined('fromName', fromName),+ ...spreadIfDefined('replyToAddress', replyToAddress),+ ...spreadIfDefined('preheaderText', preheaderText),+ ...spreadIfDefined('isPublished', isPublished),+ ...spreadIfDefined('category', category),+ ...spreadIfDefined('language', language),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/fields/create-field.ts b/packages/pieces/community/mautic/src/lib/actions/ai/fields/create-field.tsnew file mode 100644index 00000000000..094c55740b1--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/fields/create-field.ts@@ -0,0 +1,129 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticCreateFieldOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticCreateFieldAction = createAction({+ auth: mauticAuth,+ name: 'mautic_create_field',+ outputSchema: mauticCreateFieldOutputSchema,+ displayName: 'Create Field',+ description: 'Creates a Mautic field.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Creates a custom contact or company field. Label is required. Needs an administrator account.',+ idempotent: false,+ },+ props: {+ object: Property.StaticDropdown({+ displayName: 'Object',+ required: true,+ options: {+ options: [+ { label: 'Contact', value: 'contact' },+ { label: 'Company', value: 'company' },+ ],+ },+ }),+ label: Property.ShortText({ displayName: 'Label', required: true }),+ alias: Property.ShortText({+ displayName: 'Alias',+ description: 'Unique alias used as the field key; generated from the label when empty.',+ required: false,+ }),+ type: Property.StaticDropdown({+ displayName: 'Type',+ description: 'Defaults to text.',+ required: false,+ options: {+ options: [+ { label: 'text', value: 'text' },+ { label: 'textarea', value: 'textarea' },+ { label: 'email', value: 'email' },+ { label: 'number', value: 'number' },+ { label: 'boolean', value: 'boolean' },+ { label: 'select', value: 'select' },+ { label: 'multiselect', value: 'multiselect' },+ { label: 'date', value: 'date' },+ { label: 'datetime', value: 'datetime' },+ { label: 'time', value: 'time' },+ { label: 'url', value: 'url' },+ { label: 'tel', value: 'tel' },+ { label: 'country', value: 'country' },+ { label: 'region', value: 'region' },+ { label: 'timezone', value: 'timezone' },+ { label: 'locale', value: 'locale' },+ { label: 'lookup', value: 'lookup' },+ { label: 'html', value: 'html' },+ ],+ },+ }),+ group: Property.StaticDropdown({+ displayName: 'Group',+ description: 'Defaults to core.',+ required: false,+ options: {+ options: [+ { label: 'Core', value: 'core' },+ { label: 'Social', value: 'social' },+ { label: 'Personal', value: 'personal' },+ { label: 'Professional', value: 'professional' },+ ],+ },+ }),+ defaultValue: Property.ShortText({ displayName: 'Default Value', required: false }),+ isRequired: mauticAiProps.yesNo({ displayName: 'Required' }),+ isUniqueIdentifier: mauticAiProps.yesNo({+ displayName: 'Unique Identifier',+ description: 'Whether contacts are merged on this field.',+ }),+ isPubliclyUpdatable: mauticAiProps.yesNo({+ displayName: 'Publicly Updatable',+ description: 'Whether tracking requests and forms can set it.',+ }),+ properties: Property.Json({+ displayName: 'Properties',+ description:+ 'Type settings, e.g. {"list": [{"label": "Small", "value": "s"}]} for select fields.',+ required: false,+ }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other field properties, e.g. "order", "description", "isVisible". The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const {+ additionalFields,+ label,+ alias,+ type,+ group,+ defaultValue,+ isRequired,+ isUniqueIdentifier,+ isPubliclyUpdatable,+ properties,+ } = context.propsValue;+ return await mauticApi.createRecord({+ auth: context.auth,+ resource: `fields/${context.propsValue.object}`,+ body: {+ ...additionalFields,+ ...spreadIfDefined('label', label),+ ...spreadIfDefined('alias', alias),+ ...spreadIfDefined('type', type),+ ...spreadIfDefined('group', group),+ ...spreadIfDefined('defaultValue', defaultValue),+ ...spreadIfDefined('isRequired', isRequired),+ ...spreadIfDefined('isUniqueIdentifier', isUniqueIdentifier),+ ...spreadIfDefined('isPubliclyUpdatable', isPubliclyUpdatable),+ ...spreadIfDefined('properties', properties),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/fields/delete-field.ts b/packages/pieces/community/mautic/src/lib/actions/ai/fields/delete-field.tsnew file mode 100644index 00000000000..ede6cce20b4--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/fields/delete-field.ts@@ -0,0 +1,44 @@+import { Property, createAction } from '@activepieces/pieces-framework';++import { mauticDeleteFieldOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticDeleteFieldAction = createAction({+ auth: mauticAuth,+ name: 'mautic_delete_field',+ outputSchema: mauticDeleteFieldOutputSchema,+ displayName: 'Delete Field',+ description: 'Permanently deletes a Mautic field.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description:+ 'Permanently deletes a custom field and the value it holds on every contact or company. Needs an administrator account. Cannot be undone.',+ idempotent: false,+ },+ props: {+ object: Property.StaticDropdown({+ displayName: 'Object',+ required: true,+ options: {+ options: [+ { label: 'Contact', value: 'contact' },+ { label: 'Company', value: 'company' },+ ],+ },+ }),+ id: mauticAiProps.recordId({+ displayName: 'Field Id',+ description: 'Numeric field id, from List Fields or Create Field.',+ }),+ },+ async run(context) {+ return await mauticApi.deleteRecord({+ auth: context.auth,+ resource: `fields/${context.propsValue.object}`,+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/fields/get-field.ts b/packages/pieces/community/mautic/src/lib/actions/ai/fields/get-field.tsnew file mode 100644index 00000000000..97061db0615--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/fields/get-field.ts@@ -0,0 +1,43 @@+import { Property, createAction } from '@activepieces/pieces-framework';++import { mauticGetFieldOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticGetFieldAction = createAction({+ auth: mauticAuth,+ name: 'mautic_get_field',+ outputSchema: mauticGetFieldOutputSchema,+ displayName: 'Get Field',+ description: 'Gets one Mautic field by id.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description: 'Gets a single contact or company field by its numeric id.',+ idempotent: true,+ },+ props: {+ object: Property.StaticDropdown({+ displayName: 'Object',+ required: true,+ options: {+ options: [+ { label: 'Contact', value: 'contact' },+ { label: 'Company', value: 'company' },+ ],+ },+ }),+ id: mauticAiProps.recordId({+ displayName: 'Field Id',+ description: 'Numeric field id, from List Fields or Create Field.',+ }),+ },+ async run(context) {+ return await mauticApi.getRecord({+ auth: context.auth,+ resource: `fields/${context.propsValue.object}`,+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/fields/list-fields.ts b/packages/pieces/community/mautic/src/lib/actions/ai/fields/list-fields.tsnew file mode 100644index 00000000000..03e679d141f--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/fields/list-fields.ts@@ -0,0 +1,42 @@+import { Property, createAction } from '@activepieces/pieces-framework';++import { mauticListFieldsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticListFieldsAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_fields',+ outputSchema: mauticListFieldsOutputSchema,+ displayName: 'List Fields',+ description: 'Lists Mautic fields.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists the custom and core fields of contacts or companies with alias, type and options. The aliases are the keys for contact and company field values. Page with Start and Limit; the response has the total count.',+ idempotent: true,+ },+ props: {+ object: Property.StaticDropdown({+ displayName: 'Object',+ required: true,+ options: {+ options: [+ { label: 'Contact', value: 'contact' },+ { label: 'Company', value: 'company' },+ ],+ },+ }),+ ...mauticAiProps.listOptions,+ },+ async run(context) {+ return await mauticApi.listRecords({+ auth: context.auth,+ resource: `fields/${context.propsValue.object}`,+ key: 'fields',+ query: context.propsValue,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/fields/output-schemas.ts b/packages/pieces/community/mautic/src/lib/actions/ai/fields/output-schemas.tsnew file mode 100644index 00000000000..8e649e77412--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/fields/output-schemas.ts@@ -0,0 +1,106 @@+import { OutputSchema } from '@activepieces/pieces-framework';++import { fieldFields } from '../../../output-schemas';++export const mauticCreateFieldOutputSchema: OutputSchema = {+ fields: [{ key: 'field', label: 'Field', children: fieldFields }],+};++export const mauticDeleteFieldOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'field',+ label: 'Field',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified' },+ { key: 'id', label: 'ID' },+ { key: 'label', label: 'Label' },+ { key: 'alias', label: 'Alias' },+ { key: 'type', label: 'Type' },+ { key: 'group', label: 'Group' },+ { key: 'order', label: 'Order', format: 'number' },+ { key: 'object', label: 'Object' },+ { key: 'defaultValue', label: 'Default Value' },+ { key: 'isRequired', label: 'Is Required', format: 'boolean' },+ { key: 'isFixed', label: 'Is Fixed', format: 'boolean' },+ { key: 'isListable', label: 'Is Listable', format: 'boolean' },+ { key: 'isVisible', label: 'Is Visible', format: 'boolean' },+ { key: 'isShortVisible', label: 'Is Short Visible', format: 'boolean' },+ { key: 'isUniqueIdentifier', label: 'Is Unique Identifier', format: 'boolean' },+ { key: 'isPubliclyUpdatable', label: 'Is Publicly Updatable', format: 'boolean' },+ {+ key: 'properties',+ label: 'Properties',+ children: [+ {+ key: 'list',+ label: 'List',+ labelKey: 'label',+ listItems: [+ { key: 'label', label: 'Label' },+ { key: 'value', label: 'Value' },+ ],+ },+ ],+ },+ { key: 'isIndex', label: 'Is Index', format: 'boolean' },+ { key: 'charLengthLimit', label: 'Char Length Limit', format: 'number' },+ ],+ },+ ],+};++export const mauticGetFieldOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'field',+ label: 'Field',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified', format: 'datetime' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'label', label: 'Label' },+ { key: 'alias', label: 'Alias' },+ { key: 'type', label: 'Type' },+ { key: 'group', label: 'Group' },+ { key: 'order', label: 'Order', format: 'number' },+ { key: 'object', label: 'Object' },+ { key: 'defaultValue', label: 'Default Value' },+ { key: 'isRequired', label: 'Is Required', format: 'boolean' },+ { key: 'isFixed', label: 'Is Fixed', format: 'boolean' },+ { key: 'isListable', label: 'Is Listable', format: 'boolean' },+ { key: 'isVisible', label: 'Is Visible', format: 'boolean' },+ { key: 'isShortVisible', label: 'Is Short Visible', format: 'boolean' },+ { key: 'isUniqueIdentifier', label: 'Is Unique Identifier', format: 'boolean' },+ { key: 'isPubliclyUpdatable', label: 'Is Publicly Updatable', format: 'boolean' },+ {+ key: 'properties',+ label: 'Properties',+ children: [+ {+ key: 'list',+ label: 'List',+ labelKey: 'label',+ listItems: [+ { key: 'label', label: 'Label' },+ { key: 'value', label: 'Value' },+ ],+ },+ ],+ },+ { key: 'isIndex', label: 'Is Index', format: 'boolean' },+ { key: 'charLengthLimit', label: 'Char Length Limit', format: 'number' },+ ],+ },+ ],+};++export const mauticListFieldsOutputSchema: OutputSchema = {+ fields: [+ { key: 'total', label: 'Total', format: 'number' },+ { key: 'fields', label: 'Fields', labelKey: 'label', listItems: fieldFields },+ ],+};diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/fields/update-field.ts b/packages/pieces/community/mautic/src/lib/actions/ai/fields/update-field.tsnew file mode 100644index 00000000000..285aba9769c--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/fields/update-field.ts@@ -0,0 +1,135 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticGetFieldOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticUpdateFieldAction = createAction({+ auth: mauticAuth,+ name: 'mautic_update_field',+ outputSchema: mauticGetFieldOutputSchema,+ displayName: 'Update Field',+ description: 'Updates fields of a Mautic field.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Updates an existing contact or company field. The type of an existing field cannot change. Needs an administrator account. Only the fields given are changed.',+ idempotent: true,+ },+ props: {+ object: Property.StaticDropdown({+ displayName: 'Object',+ required: true,+ options: {+ options: [+ { label: 'Contact', value: 'contact' },+ { label: 'Company', value: 'company' },+ ],+ },+ }),+ id: mauticAiProps.recordId({+ displayName: 'Field Id',+ description: 'Numeric field id, from List Fields or Create Field.',+ }),+ label: Property.ShortText({ displayName: 'Label', required: false }),+ alias: Property.ShortText({+ displayName: 'Alias',+ description: 'Unique alias used as the field key; generated from the label when empty.',+ required: false,+ }),+ type: Property.StaticDropdown({+ displayName: 'Type',+ description: 'Defaults to text.',+ required: false,+ options: {+ options: [+ { label: 'text', value: 'text' },+ { label: 'textarea', value: 'textarea' },+ { label: 'email', value: 'email' },+ { label: 'number', value: 'number' },+ { label: 'boolean', value: 'boolean' },+ { label: 'select', value: 'select' },+ { label: 'multiselect', value: 'multiselect' },+ { label: 'date', value: 'date' },+ { label: 'datetime', value: 'datetime' },+ { label: 'time', value: 'time' },+ { label: 'url', value: 'url' },+ { label: 'tel', value: 'tel' },+ { label: 'country', value: 'country' },+ { label: 'region', value: 'region' },+ { label: 'timezone', value: 'timezone' },+ { label: 'locale', value: 'locale' },+ { label: 'lookup', value: 'lookup' },+ { label: 'html', value: 'html' },+ ],+ },+ }),+ group: Property.StaticDropdown({+ displayName: 'Group',+ description: 'Defaults to core.',+ required: false,+ options: {+ options: [+ { label: 'Core', value: 'core' },+ { label: 'Social', value: 'social' },+ { label: 'Personal', value: 'personal' },+ { label: 'Professional', value: 'professional' },+ ],+ },+ }),+ defaultValue: Property.ShortText({ displayName: 'Default Value', required: false }),+ isRequired: mauticAiProps.yesNo({ displayName: 'Required' }),+ isUniqueIdentifier: mauticAiProps.yesNo({+ displayName: 'Unique Identifier',+ description: 'Whether contacts are merged on this field.',+ }),+ isPubliclyUpdatable: mauticAiProps.yesNo({+ displayName: 'Publicly Updatable',+ description: 'Whether tracking requests and forms can set it.',+ }),+ properties: Property.Json({+ displayName: 'Properties',+ description:+ 'Type settings, e.g. {"list": [{"label": "Small", "value": "s"}]} for select fields.',+ required: false,+ }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other field properties, e.g. "order", "description", "isVisible". The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const {+ id,+ additionalFields,+ label,+ alias,+ type,+ group,+ defaultValue,+ isRequired,+ isUniqueIdentifier,+ isPubliclyUpdatable,+ properties,+ } = context.propsValue;+ return await mauticApi.updateRecord({+ auth: context.auth,+ resource: `fields/${context.propsValue.object}`,+ id,+ body: {+ ...additionalFields,+ ...spreadIfDefined('label', label),+ ...spreadIfDefined('alias', alias),+ ...spreadIfDefined('type', type),+ ...spreadIfDefined('group', group),+ ...spreadIfDefined('defaultValue', defaultValue),+ ...spreadIfDefined('isRequired', isRequired),+ ...spreadIfDefined('isUniqueIdentifier', isUniqueIdentifier),+ ...spreadIfDefined('isPubliclyUpdatable', isPubliclyUpdatable),+ ...spreadIfDefined('properties', properties),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/files/delete-file.ts b/packages/pieces/community/mautic/src/lib/actions/ai/files/delete-file.tsnew file mode 100644index 00000000000..37d87f37336--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/files/delete-file.ts@@ -0,0 +1,50 @@+import { Property, createAction } from '@activepieces/pieces-framework';++import { mauticDeleteFileOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticDeleteFileAction = createAction({+ auth: mauticAuth,+ name: 'mautic_delete_file',+ outputSchema: mauticDeleteFileOutputSchema,+ displayName: 'Delete File',+ description: 'Deletes a file from the Mautic media folders.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description:+ 'Permanently deletes a file from the images or media folder; emails and pages linking to it break. File names come from List Files.',+ idempotent: false,+ },+ props: {+ dir: Property.StaticDropdown({+ displayName: 'Folder',+ required: true,+ options: {+ options: [+ { label: 'Images', value: 'images' },+ { label: 'Media', value: 'media' },+ ],+ },+ }),+ file: mauticAiProps.recordId({+ displayName: 'File Name',+ description: 'File name with extension, from List Files.',+ }),+ subdir: Property.ShortText({+ displayName: 'Subfolder',+ description: 'Optional subfolder inside the folder, e.g. "banners".',+ required: false,+ }),+ },+ async run(context) {+ return await mauticApi.deleteFile({+ auth: context.auth,+ dir: context.propsValue.dir,+ file: context.propsValue.file,+ subdir: context.propsValue.subdir,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/files/delete-theme.ts b/packages/pieces/community/mautic/src/lib/actions/ai/files/delete-theme.tsnew file mode 100644index 00000000000..11b9b88fd49--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/files/delete-theme.ts@@ -0,0 +1,30 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticDeleteFileOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticDeleteThemeAction = createAction({+ auth: mauticAuth,+ name: 'mautic_delete_theme',+ outputSchema: mauticDeleteFileOutputSchema,+ displayName: 'Delete Theme',+ description: 'Deletes an installed Mautic theme.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description:+ 'Permanently deletes an installed theme; emails and pages built on it lose their layout. Default themes cannot be deleted.',+ idempotent: false,+ },+ props: {+ theme: mauticAiProps.recordId({+ displayName: 'Theme',+ description: 'Theme folder name, from List Themes.',+ }),+ },+ async run(context) {+ return await mauticApi.deleteTheme({ auth: context.auth, theme: context.propsValue.theme });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/files/get-theme.ts b/packages/pieces/community/mautic/src/lib/actions/ai/files/get-theme.tsnew file mode 100644index 00000000000..1848e9ae984--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/files/get-theme.ts@@ -0,0 +1,35 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticGetThemeOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticGetThemeAction = createAction({+ auth: mauticAuth,+ name: 'mautic_get_theme',+ outputSchema: mauticGetThemeOutputSchema,+ displayName: 'Get Theme',+ description: 'Downloads a Mautic theme as a zip file.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description:+ 'Downloads an installed theme as a zip file and returns the file. Theme names come from List Themes.',+ idempotent: true,+ },+ props: {+ theme: mauticAiProps.recordId({+ displayName: 'Theme',+ description: 'Theme folder name, from List Themes.',+ }),+ },+ async run(context) {+ const { theme } = context.propsValue;+ const data = await mauticApi.getTheme({ auth: context.auth, theme });+ return {+ theme,+ file: await context.files.write({ fileName: `${theme}.zip`, data }),+ };+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/files/list-files.ts b/packages/pieces/community/mautic/src/lib/actions/ai/files/list-files.tsnew file mode 100644index 00000000000..88ab672ef0e--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/files/list-files.ts@@ -0,0 +1,44 @@+import { Property, createAction } from '@activepieces/pieces-framework';++import { mauticListFilesOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticApi } from '../../../common/api';++export const mauticListFilesAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_files',+ outputSchema: mauticListFilesOutputSchema,+ displayName: 'List Files',+ description: 'Lists the files in the Mautic media folders.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists the file names in the images or media (asset uploads) folder, or a subfolder of it.',+ idempotent: true,+ },+ props: {+ dir: Property.StaticDropdown({+ displayName: 'Folder',+ required: true,+ options: {+ options: [+ { label: 'Images', value: 'images' },+ { label: 'Media', value: 'media' },+ ],+ },+ }),+ subdir: Property.ShortText({+ displayName: 'Subfolder',+ description: 'Optional subfolder inside the folder, e.g. "banners".',+ required: false,+ }),+ },+ async run(context) {+ return await mauticApi.listFiles({+ auth: context.auth,+ dir: context.propsValue.dir,+ subdir: context.propsValue.subdir,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/files/list-themes.ts b/packages/pieces/community/mautic/src/lib/actions/ai/files/list-themes.tsnew file mode 100644index 00000000000..0c1e7cabcf3--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/files/list-themes.ts@@ -0,0 +1,24 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListThemesOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticApi } from '../../../common/api';++export const mauticListThemesAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_themes',+ outputSchema: mauticListThemesOutputSchema,+ displayName: 'List Themes',+ description: 'Lists the installed Mautic themes.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists the installed themes for emails, landing pages and forms, keyed by theme folder name.',+ idempotent: true,+ },+ props: {},+ async run(context) {+ return await mauticApi.listThemes({ auth: context.auth });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/files/output-schemas.ts b/packages/pieces/community/mautic/src/lib/actions/ai/files/output-schemas.tsnew file mode 100644index 00000000000..69e3b71e1b0--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/files/output-schemas.ts@@ -0,0 +1,39 @@+import { OutputSchema } from '@activepieces/pieces-framework';++export const mauticDeleteFileOutputSchema: OutputSchema = {+ fields: [{ key: 'success', label: 'Success', format: 'boolean' }],+};++export const mauticGetThemeOutputSchema: OutputSchema = {+ fields: [+ { key: 'theme', label: 'Theme' },+ { key: 'file', label: 'File', format: 'url' },+ ],+};++export const mauticListFilesOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'files',+ label: 'Files',+ children: [{ key: '2', label: '2' }],+ },+ ],+};++export const mauticListThemesOutputSchema: OutputSchema = {+ fields: [{ key: 'themes', label: 'Themes', dynamicKey: true, labelKey: 'name' }],+};++export const mauticUploadFileOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'file',+ label: 'File',+ children: [+ { key: 'link', label: 'Link', format: 'image' },+ { key: 'name', label: 'Name' },+ ],+ },+ ],+};diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/files/upload-file.ts b/packages/pieces/community/mautic/src/lib/actions/ai/files/upload-file.tsnew file mode 100644index 00000000000..08d15bb3698--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/files/upload-file.ts@@ -0,0 +1,46 @@+import { Property, createAction } from '@activepieces/pieces-framework';++import { mauticUploadFileOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticApi } from '../../../common/api';++export const mauticUploadFileAction = createAction({+ auth: mauticAuth,+ name: 'mautic_upload_file',+ outputSchema: mauticUploadFileOutputSchema,+ displayName: 'Upload File',+ description: 'Uploads a file to the Mautic media folders.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Uploads a file to the images or media (asset uploads) folder. Mautic stores it under a new random name and returns that name, plus a public link for images, e.g. for use in email or page HTML. Only extensions allowed in Mautic settings are accepted.',+ idempotent: false,+ },+ props: {+ dir: Property.StaticDropdown({+ displayName: 'Folder',+ required: true,+ options: {+ options: [+ { label: 'Images', value: 'images' },+ { label: 'Media', value: 'media' },+ ],+ },+ }),+ file: Property.File({ displayName: 'File', required: true }),+ subdir: Property.ShortText({+ displayName: 'Subfolder',+ description: 'Optional subfolder inside the folder, e.g. "banners".',+ required: false,+ }),+ },+ async run(context) {+ return await mauticApi.uploadFile({+ auth: context.auth,+ path: `files/${context.propsValue.dir}/new`,+ file: context.propsValue.file,+ subdir: context.propsValue.subdir,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/files/upload-theme.ts b/packages/pieces/community/mautic/src/lib/actions/ai/files/upload-theme.tsnew file mode 100644index 00000000000..f131d9b3515--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/files/upload-theme.ts@@ -0,0 +1,30 @@+import { Property, createAction } from '@activepieces/pieces-framework';++import { mauticDeleteFileOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticApi } from '../../../common/api';++export const mauticUploadThemeAction = createAction({+ auth: mauticAuth,+ name: 'mautic_upload_theme',+ outputSchema: mauticDeleteFileOutputSchema,+ displayName: 'Upload Theme',+ description: 'Installs a Mautic theme from a zip file.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Installs a theme from a zip file with the theme folder inside; an existing theme with the same name is replaced.',+ idempotent: false,+ },+ props: {+ file: Property.File({ displayName: 'Theme Zip', required: true }),+ },+ async run(context) {+ return await mauticApi.uploadFile({+ auth: context.auth,+ path: 'themes/new',+ file: context.propsValue.file,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/focus-items/create-focus-item.ts b/packages/pieces/community/mautic/src/lib/actions/ai/focus-items/create-focus-item.tsnew file mode 100644index 00000000000..5ef806e7745--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/focus-items/create-focus-item.ts@@ -0,0 +1,103 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticCreateFocusItemOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticCreateFocusItemAction = createAction({+ auth: mauticAuth,+ name: 'mautic_create_focus_item',+ outputSchema: mauticCreateFocusItemOutputSchema,+ displayName: 'Create Focus Item',+ description: 'Creates a Mautic focus item.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description: 'Creates a focus item. Name, Type and Style are required. Needs the Focus plugin.',+ idempotent: false,+ },+ props: {+ name: Property.ShortText({ displayName: 'Name', required: true }),+ type: Property.StaticDropdown({+ displayName: 'Type',+ required: true,+ options: {+ options: [+ { label: 'Collect data (form)', value: 'form' },+ { label: 'Display a notice', value: 'notice' },+ { label: 'Emphasize a link', value: 'link' },+ ],+ },+ }),+ style: Property.StaticDropdown({+ displayName: 'Style',+ required: true,+ options: {+ options: [+ { label: 'Bar', value: 'bar' },+ { label: 'Modal', value: 'modal' },+ { label: 'Notification', value: 'notification' },+ { label: 'Full page', value: 'page' },+ ],+ },+ }),+ website: Property.ShortText({+ displayName: 'Website',+ description: 'URL of the site the focus item runs on.',+ required: false,+ }),+ form: Property.Number({+ displayName: 'Form Id',+ description: 'Form to show for the "form" type, from List Forms.',+ required: false,+ }),+ description: Property.LongText({ displayName: 'Description', required: false }),+ isPublished: mauticAiProps.yesNo({ displayName: 'Published' }),+ category: Property.Number({+ displayName: 'Category Id',+ description: 'Category id, from List Categories.',+ required: false,+ }),+ properties: Property.Json({+ displayName: 'Properties',+ description:+ 'Display settings, e.g. {"bar": {"size": "large", "placement": "top"}, "content": {"headline": "Hi", "link_text": "Go", "link_url": "https://example.com"}, "when": "immediately"}.',+ required: false,+ }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other focus item properties, e.g. "publishUp", "publishDown", "utmTags", "html". The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const {+ additionalFields,+ name,+ type,+ style,+ website,+ form,+ description,+ isPublished,+ category,+ properties,+ } = context.propsValue;+ return await mauticApi.createRecord({+ auth: context.auth,+ resource: 'focus',+ body: {+ ...additionalFields,+ ...spreadIfDefined('name', name),+ ...spreadIfDefined('type', type),+ ...spreadIfDefined('style', style),+ ...spreadIfDefined('website', website),+ ...spreadIfDefined('form', form),+ ...spreadIfDefined('description', description),+ ...spreadIfDefined('isPublished', isPublished),+ ...spreadIfDefined('category', category),+ ...spreadIfDefined('properties', properties),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/focus-items/delete-focus-item.ts b/packages/pieces/community/mautic/src/lib/actions/ai/focus-items/delete-focus-item.tsnew file mode 100644index 00000000000..58eaad0af0f--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/focus-items/delete-focus-item.ts@@ -0,0 +1,33 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticDeleteFocusItemOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticDeleteFocusItemAction = createAction({+ auth: mauticAuth,+ name: 'mautic_delete_focus_item',+ outputSchema: mauticDeleteFocusItemOutputSchema,+ displayName: 'Delete Focus Item',+ description: 'Permanently deletes a Mautic focus item.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description: 'Permanently deletes a focus item. Needs the Focus plugin. Cannot be undone.',+ idempotent: false,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Focus Item Id',+ description: 'Numeric focus item id, from List Focus Items or Create Focus Item.',+ }),+ },+ async run(context) {+ return await mauticApi.deleteRecord({+ auth: context.auth,+ resource: 'focus',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/focus-items/generate-focus-item-js.ts b/packages/pieces/community/mautic/src/lib/actions/ai/focus-items/generate-focus-item-js.tsnew file mode 100644index 00000000000..c2554a77afd--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/focus-items/generate-focus-item-js.ts@@ -0,0 +1,30 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticGenerateFocusItemJsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticGenerateFocusItemJsAction = createAction({+ auth: mauticAuth,+ name: 'mautic_generate_focus_item_js',+ outputSchema: mauticGenerateFocusItemJsOutputSchema,+ displayName: 'Generate Focus Item JS',+ description: 'Gets the embed JavaScript of a Mautic focus item.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description:+ 'Returns the JavaScript that shows a focus item on a website. Read-only. Needs the Focus plugin.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Focus Item Id',+ description: 'Numeric focus item id, from List Focus Items or Create Focus Item.',+ }),+ },+ async run(context) {+ return await mauticApi.generateFocusItemJs({ auth: context.auth, id: context.propsValue.id });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/focus-items/get-focus-item.ts b/packages/pieces/community/mautic/src/lib/actions/ai/focus-items/get-focus-item.tsnew file mode 100644index 00000000000..e82e4e339dc--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/focus-items/get-focus-item.ts@@ -0,0 +1,33 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticGetFocusItemOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticGetFocusItemAction = createAction({+ auth: mauticAuth,+ name: 'mautic_get_focus_item',+ outputSchema: mauticGetFocusItemOutputSchema,+ displayName: 'Get Focus Item',+ description: 'Gets one Mautic focus item by id.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description: 'Gets a single focus item by its numeric id. Needs the Focus plugin.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Focus Item Id',+ description: 'Numeric focus item id, from List Focus Items or Create Focus Item.',+ }),+ },+ async run(context) {+ return await mauticApi.getRecord({+ auth: context.auth,+ resource: 'focus',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/focus-items/list-focus-items.ts b/packages/pieces/community/mautic/src/lib/actions/ai/focus-items/list-focus-items.tsnew file mode 100644index 00000000000..5e2f936abf1--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/focus-items/list-focus-items.ts@@ -0,0 +1,32 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListFocusItemsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticListFocusItemsAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_focus_items',+ outputSchema: mauticListFocusItemsOutputSchema,+ displayName: 'List Focus Items',+ description: 'Lists Mautic focus items.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists focus items (website pop-ups, bars and notices). Needs the Focus plugin. Page with Start and Limit; the response has the total count.',+ idempotent: true,+ },+ props: {+ ...mauticAiProps.listOptions,+ },+ async run(context) {+ return await mauticApi.listRecords({+ auth: context.auth,+ resource: 'focus',+ key: 'focus',+ query: context.propsValue,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/focus-items/output-schemas.ts b/packages/pieces/community/mautic/src/lib/actions/ai/focus-items/output-schemas.tsnew file mode 100644index 00000000000..75aa49e0e0f--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/focus-items/output-schemas.ts@@ -0,0 +1,133 @@+import { OutputSchema } from '@activepieces/pieces-framework';++import {+ categoryFields,+ dynamicContentUtmTagsFields,+ focusPropertiesFields,+} from '../../../output-schemas';++export const mauticCreateFocusItemOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'focus',+ label: 'Focus',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'name', label: 'Name' },+ { key: 'category', label: 'Category', children: categoryFields },+ { key: 'description', label: 'Description' },+ { key: 'type', label: 'Type' },+ { key: 'website', label: 'Website', format: 'url' },+ { key: 'style', label: 'Style' },+ { key: 'publishUp', label: 'Publish Up' },+ { key: 'publishDown', label: 'Publish Down' },+ { key: 'properties', label: 'Properties', children: focusPropertiesFields },+ { key: 'utmTags', label: 'Utm Tags', children: dynamicContentUtmTagsFields },+ { key: 'form', label: 'Form', format: 'number' },+ { key: 'htmlMode', label: 'HTML Mode' },+ { key: 'html', label: 'HTML' },+ { key: 'editor', label: 'Editor' },+ { key: 'cache', label: 'Cache' },+ ],+ },+ ],+};++export const mauticDeleteFocusItemOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'focus',+ label: 'Focus',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified' },+ { key: 'id', label: 'ID' },+ { key: 'name', label: 'Name' },+ { key: 'category', label: 'Category', children: categoryFields },+ { key: 'description', label: 'Description' },+ { key: 'type', label: 'Type' },+ { key: 'website', label: 'Website', format: 'url' },+ { key: 'style', label: 'Style' },+ { key: 'publishUp', label: 'Publish Up' },+ { key: 'publishDown', label: 'Publish Down' },+ { key: 'properties', label: 'Properties', children: focusPropertiesFields },+ { key: 'utmTags', label: 'Utm Tags', children: dynamicContentUtmTagsFields },+ { key: 'form', label: 'Form', format: 'number' },+ { key: 'htmlMode', label: 'HTML Mode' },+ { key: 'html', label: 'HTML' },+ { key: 'editor', label: 'Editor' },+ { key: 'cache', label: 'Cache' },+ ],+ },+ ],+};++export const mauticGenerateFocusItemJsOutputSchema: OutputSchema = {+ fields: [{ key: 'js', label: 'Js' }],+};++export const mauticGetFocusItemOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'focus',+ label: 'Focus',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified', format: 'datetime' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'name', label: 'Name' },+ { key: 'category', label: 'Category', children: categoryFields },+ { key: 'description', label: 'Description' },+ { key: 'type', label: 'Type' },+ { key: 'website', label: 'Website', format: 'url' },+ { key: 'style', label: 'Style' },+ { key: 'publishUp', label: 'Publish Up' },+ { key: 'publishDown', label: 'Publish Down' },+ { key: 'properties', label: 'Properties', children: focusPropertiesFields },+ { key: 'utmTags', label: 'Utm Tags', children: dynamicContentUtmTagsFields },+ { key: 'form', label: 'Form', format: 'number' },+ { key: 'htmlMode', label: 'HTML Mode' },+ { key: 'html', label: 'HTML' },+ { key: 'editor', label: 'Editor' },+ { key: 'cache', label: 'Cache' },+ ],+ },+ ],+};++export const mauticListFocusItemsOutputSchema: OutputSchema = {+ fields: [+ { key: 'total', label: 'Total', format: 'number' },+ {+ key: 'focus',+ label: 'Focus',+ labelKey: 'name',+ listItems: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'name', label: 'Name' },+ { key: 'category', label: 'Category', children: categoryFields },+ { key: 'description', label: 'Description' },+ { key: 'type', label: 'Type' },+ { key: 'website', label: 'Website', format: 'url' },+ { key: 'style', label: 'Style' },+ { key: 'publishUp', label: 'Publish Up' },+ { key: 'publishDown', label: 'Publish Down' },+ { key: 'properties', label: 'Properties', children: focusPropertiesFields },+ { key: 'utmTags', label: 'Utm Tags', children: dynamicContentUtmTagsFields },+ { key: 'form', label: 'Form' },+ { key: 'htmlMode', label: 'HTML Mode' },+ { key: 'html', label: 'HTML' },+ { key: 'editor', label: 'Editor' },+ { key: 'cache', label: 'Cache' },+ ],+ },+ ],+};diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/focus-items/update-focus-item.ts b/packages/pieces/community/mautic/src/lib/actions/ai/focus-items/update-focus-item.tsnew file mode 100644index 00000000000..3b34177303f--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/focus-items/update-focus-item.ts@@ -0,0 +1,110 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticGetFocusItemOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticUpdateFocusItemAction = createAction({+ auth: mauticAuth,+ name: 'mautic_update_focus_item',+ outputSchema: mauticGetFocusItemOutputSchema,+ displayName: 'Update Focus Item',+ description: 'Updates fields of a Mautic focus item.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Updates an existing focus item. Needs the Focus plugin. Only the fields given are changed.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Focus Item Id',+ description: 'Numeric focus item id, from List Focus Items or Create Focus Item.',+ }),+ name: Property.ShortText({ displayName: 'Name', required: false }),+ type: Property.StaticDropdown({+ displayName: 'Type',+ required: false,+ options: {+ options: [+ { label: 'Collect data (form)', value: 'form' },+ { label: 'Display a notice', value: 'notice' },+ { label: 'Emphasize a link', value: 'link' },+ ],+ },+ }),+ style: Property.StaticDropdown({+ displayName: 'Style',+ required: false,+ options: {+ options: [+ { label: 'Bar', value: 'bar' },+ { label: 'Modal', value: 'modal' },+ { label: 'Notification', value: 'notification' },+ { label: 'Full page', value: 'page' },+ ],+ },+ }),+ website: Property.ShortText({+ displayName: 'Website',+ description: 'URL of the site the focus item runs on.',+ required: false,+ }),+ form: Property.Number({+ displayName: 'Form Id',+ description: 'Form to show for the "form" type, from List Forms.',+ required: false,+ }),+ description: Property.LongText({ displayName: 'Description', required: false }),+ isPublished: mauticAiProps.yesNo({ displayName: 'Published' }),+ category: Property.Number({+ displayName: 'Category Id',+ description: 'Category id, from List Categories.',+ required: false,+ }),+ properties: Property.Json({+ displayName: 'Properties',+ description:+ 'Display settings, e.g. {"bar": {"size": "large", "placement": "top"}, "content": {"headline": "Hi", "link_text": "Go", "link_url": "https://example.com"}, "when": "immediately"}.',+ required: false,+ }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other focus item properties, e.g. "publishUp", "publishDown", "utmTags", "html". The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const {+ id,+ additionalFields,+ name,+ type,+ style,+ website,+ form,+ description,+ isPublished,+ category,+ properties,+ } = context.propsValue;+ return await mauticApi.updateRecord({+ auth: context.auth,+ resource: 'focus',+ id,+ body: {+ ...additionalFields,+ ...spreadIfDefined('name', name),+ ...spreadIfDefined('type', type),+ ...spreadIfDefined('style', style),+ ...spreadIfDefined('website', website),+ ...spreadIfDefined('form', form),+ ...spreadIfDefined('description', description),+ ...spreadIfDefined('isPublished', isPublished),+ ...spreadIfDefined('category', category),+ ...spreadIfDefined('properties', properties),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/forms/create-form.ts b/packages/pieces/community/mautic/src/lib/actions/ai/forms/create-form.tsnew file mode 100644index 00000000000..0c4d395c8df--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/forms/create-form.ts@@ -0,0 +1,111 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticCreateFormOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticCreateFormAction = createAction({+ auth: mauticAuth,+ name: 'mautic_create_form',+ outputSchema: mauticCreateFormOutputSchema,+ displayName: 'Create Form',+ description: 'Creates a Mautic form.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description: 'Creates a form with its fields and submit actions. Name is required.',+ idempotent: false,+ },+ props: {+ name: Property.ShortText({ displayName: 'Name', required: true }),+ alias: Property.ShortText({+ displayName: 'Alias',+ description:+ 'Form alias; Mautic shortens it to 10 characters and replaces spaces with underscores.',+ required: false,+ }),+ description: Property.LongText({ displayName: 'Description', required: false }),+ formType: Property.StaticDropdown({+ displayName: 'Form Type',+ description: 'Defaults to standalone.',+ required: false,+ options: {+ options: [+ { label: 'Standalone', value: 'standalone' },+ { label: 'Campaign', value: 'campaign' },+ ],+ },+ }),+ postAction: Property.StaticDropdown({+ displayName: 'After Submit',+ required: false,+ options: {+ options: [+ { label: 'Show message', value: 'message' },+ { label: 'Redirect', value: 'redirect' },+ { label: 'Return to form', value: 'return' },+ ],+ },+ }),+ postActionProperty: Property.ShortText({+ displayName: 'After Submit Value',+ description: 'Message to show or URL to redirect to.',+ required: false,+ }),+ fields: Property.Array({+ displayName: 'Fields',+ description:+ 'Form fields, each like {"label": "Email", "type": "email", "alias": "email", "leadField": "email", "isRequired": true}. Include a {"label": "Submit", "type": "button"} field. On update, fields with an "id" are edited and others added.',+ required: false,+ }),+ actions: Property.Array({+ displayName: 'Actions',+ description:+ 'Submit actions, each like {"name": "Add to segment", "type": "lead.changelist", "properties": {"addToLists": [1]}}. On update, actions with an "id" are edited and others added.',+ required: false,+ }),+ isPublished: mauticAiProps.yesNo({ displayName: 'Published' }),+ category: Property.Number({+ displayName: 'Category Id',+ description: 'Category id, from List Categories.',+ required: false,+ }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other form properties, e.g. "cachedHtml", "template", "inKioskMode", "renderStyle". The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const {+ additionalFields,+ name,+ alias,+ description,+ formType,+ postAction,+ postActionProperty,+ fields,+ actions,+ isPublished,+ category,+ } = context.propsValue;+ return await mauticApi.createRecord({+ auth: context.auth,+ resource: 'forms',+ body: {+ ...additionalFields,+ ...spreadIfDefined('name', name),+ ...spreadIfDefined('alias', alias),+ ...spreadIfDefined('description', description),+ ...spreadIfDefined('formType', formType),+ ...spreadIfDefined('postAction', postAction),+ ...spreadIfDefined('postActionProperty', postActionProperty),+ ...spreadIfDefined('fields', fields),+ ...spreadIfDefined('actions', actions),+ ...spreadIfDefined('isPublished', isPublished),+ ...spreadIfDefined('category', category),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/forms/delete-form-actions.ts b/packages/pieces/community/mautic/src/lib/actions/ai/forms/delete-form-actions.tsnew file mode 100644index 00000000000..6a9b89a8488--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/forms/delete-form-actions.ts@@ -0,0 +1,41 @@+import { Property, createAction } from '@activepieces/pieces-framework';++import { mauticDeleteFormActionsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';+import { mauticUtils } from '../../../common/utils';++export const mauticDeleteFormActionsAction = createAction({+ auth: mauticAuth,+ name: 'mautic_delete_form_actions',+ outputSchema: mauticDeleteFormActionsOutputSchema,+ displayName: 'Delete Form Actions',+ description: 'Removes submit actions from a Mautic form.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description:+ 'Removes submit actions from a form by id. Repeating it with the same ids changes nothing. Returns the form.',+ idempotent: true,+ },+ props: {+ formId: mauticAiProps.recordId({+ displayName: 'Form Id',+ description: 'Numeric form id, from List Forms.',+ }),+ ids: Property.Array({+ displayName: 'Action Ids',+ description: 'Action ids to delete, from the actions of Get Form.',+ required: true,+ }),+ },+ async run(context) {+ return await mauticApi.deleteFormItems({+ auth: context.auth,+ formId: context.propsValue.formId,+ kind: 'actions',+ ids: mauticUtils.toBatchIds({ ids: context.propsValue.ids }),+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/forms/delete-form-fields.ts b/packages/pieces/community/mautic/src/lib/actions/ai/forms/delete-form-fields.tsnew file mode 100644index 00000000000..c62cea42669--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/forms/delete-form-fields.ts@@ -0,0 +1,41 @@+import { Property, createAction } from '@activepieces/pieces-framework';++import { mauticDeleteFormActionsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';+import { mauticUtils } from '../../../common/utils';++export const mauticDeleteFormFieldsAction = createAction({+ auth: mauticAuth,+ name: 'mautic_delete_form_fields',+ outputSchema: mauticDeleteFormActionsOutputSchema,+ displayName: 'Delete Form Fields',+ description: 'Removes fields from a Mautic form.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description:+ 'Removes fields from a form by id; past submissions lose those values. Repeating it with the same ids changes nothing. Returns the form.',+ idempotent: true,+ },+ props: {+ formId: mauticAiProps.recordId({+ displayName: 'Form Id',+ description: 'Numeric form id, from List Forms.',+ }),+ ids: Property.Array({+ displayName: 'Field Ids',+ description: 'Field ids to delete, from the fields of Get Form.',+ required: true,+ }),+ },+ async run(context) {+ return await mauticApi.deleteFormItems({+ auth: context.auth,+ formId: context.propsValue.formId,+ kind: 'fields',+ ids: mauticUtils.toBatchIds({ ids: context.propsValue.ids }),+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/forms/delete-form.ts b/packages/pieces/community/mautic/src/lib/actions/ai/forms/delete-form.tsnew file mode 100644index 00000000000..e4d6f46f012--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/forms/delete-form.ts@@ -0,0 +1,33 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticDeleteFormOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticDeleteFormAction = createAction({+ auth: mauticAuth,+ name: 'mautic_delete_form',+ outputSchema: mauticDeleteFormOutputSchema,+ displayName: 'Delete Form',+ description: 'Permanently deletes a Mautic form.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description: 'Permanently deletes a form and its submissions. Cannot be undone.',+ idempotent: false,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Form Id',+ description: 'Numeric form id, from List Forms or Create Form.',+ }),+ },+ async run(context) {+ return await mauticApi.deleteRecord({+ auth: context.auth,+ resource: 'forms',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/forms/get-form-submission.ts b/packages/pieces/community/mautic/src/lib/actions/ai/forms/get-form-submission.tsnew file mode 100644index 00000000000..ffebe88230f--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/forms/get-form-submission.ts@@ -0,0 +1,37 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticGetFormSubmissionOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticGetFormSubmissionAction = createAction({+ auth: mauticAuth,+ name: 'mautic_get_form_submission',+ outputSchema: mauticGetFormSubmissionOutputSchema,+ displayName: 'Get Form Submission',+ description: 'Gets one submission of a Mautic form.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description: 'Gets a single form submission by id with the submitted values.',+ idempotent: true,+ },+ props: {+ formId: mauticAiProps.recordId({+ displayName: 'Form Id',+ description: 'Numeric form id, from List Forms.',+ }),+ submissionId: mauticAiProps.recordId({+ displayName: 'Submission Id',+ description: 'Numeric submission id, from List Form Submissions.',+ }),+ },+ async run(context) {+ return await mauticApi.getFormSubmission({+ auth: context.auth,+ formId: context.propsValue.formId,+ submissionId: context.propsValue.submissionId,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/forms/get-form.ts b/packages/pieces/community/mautic/src/lib/actions/ai/forms/get-form.tsnew file mode 100644index 00000000000..e1423aca30d--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/forms/get-form.ts@@ -0,0 +1,33 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticCreateFormOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticGetFormAction = createAction({+ auth: mauticAuth,+ name: 'mautic_get_form',+ outputSchema: mauticCreateFormOutputSchema,+ displayName: 'Get Form',+ description: 'Gets one Mautic form by id.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description: 'Gets a single form by its numeric id, with its fields and submit actions.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Form Id',+ description: 'Numeric form id, from List Forms or Create Form.',+ }),+ },+ async run(context) {+ return await mauticApi.getRecord({+ auth: context.auth,+ resource: 'forms',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/forms/list-contact-form-submissions.ts b/packages/pieces/community/mautic/src/lib/actions/ai/forms/list-contact-form-submissions.tsnew file mode 100644index 00000000000..1daebd47b92--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/forms/list-contact-form-submissions.ts@@ -0,0 +1,40 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListContactFormSubmissionsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticListContactFormSubmissionsAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_contact_form_submissions',+ outputSchema: mauticListContactFormSubmissionsOutputSchema,+ displayName: 'List Contact Form Submissions',+ description: 'Lists the submissions of a Mautic form made by one contact.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists the submissions one contact made on a form, with the submitted values. Order By and Where columns take the "s." prefix, e.g. "s.date_submitted".',+ idempotent: true,+ },+ props: {+ formId: mauticAiProps.recordId({+ displayName: 'Form Id',+ description: 'Numeric form id, from List Forms.',+ }),+ contactId: mauticAiProps.recordId({+ displayName: 'Contact Id',+ description: 'Numeric contact id, from List Contacts.',+ }),+ ...mauticAiProps.filterOptions,+ },+ async run(context) {+ return await mauticApi.listFormSubmissions({+ auth: context.auth,+ formId: context.propsValue.formId,+ contactId: context.propsValue.contactId,+ query: context.propsValue,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/forms/list-form-submissions.ts b/packages/pieces/community/mautic/src/lib/actions/ai/forms/list-form-submissions.tsnew file mode 100644index 00000000000..26521a51f20--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/forms/list-form-submissions.ts@@ -0,0 +1,35 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListContactFormSubmissionsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticListFormSubmissionsAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_form_submissions',+ outputSchema: mauticListContactFormSubmissionsOutputSchema,+ displayName: 'List Form Submissions',+ description: 'Lists the submissions of a Mautic form.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists the submissions of a form with the submitted values, the contact and the page. Page with Start and Limit; the response has the total count. Order By and Where columns take the "s." prefix, e.g. "s.date_submitted"; a bare column name fails.',+ idempotent: true,+ },+ props: {+ formId: mauticAiProps.recordId({+ displayName: 'Form Id',+ description: 'Numeric form id, from List Forms.',+ }),+ ...mauticAiProps.filterOptions,+ },+ async run(context) {+ return await mauticApi.listFormSubmissions({+ auth: context.auth,+ formId: context.propsValue.formId,+ query: context.propsValue,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/forms/list-forms.ts b/packages/pieces/community/mautic/src/lib/actions/ai/forms/list-forms.tsnew file mode 100644index 00000000000..cd48bc551ab--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/forms/list-forms.ts@@ -0,0 +1,32 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListFormsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticListFormsAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_forms',+ outputSchema: mauticListFormsOutputSchema,+ displayName: 'List Forms',+ description: 'Lists Mautic forms.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists forms with their fields and submit actions. Page with Start and Limit; the response has the total count.',+ idempotent: true,+ },+ props: {+ ...mauticAiProps.listOptions,+ },+ async run(context) {+ return await mauticApi.listRecords({+ auth: context.auth,+ resource: 'forms',+ key: 'forms',+ query: context.propsValue,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/forms/output-schemas.ts b/packages/pieces/community/mautic/src/lib/actions/ai/forms/output-schemas.tsnew file mode 100644index 00000000000..b0ffa7e0a16--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/forms/output-schemas.ts@@ -0,0 +1,298 @@+import { OutputSchema } from '@activepieces/pieces-framework';++import {+ categoryFields,+ formActionsFields,+ formFieldsFields,+ submissionFormFields,+ submissionLeadFields,+} from '../../../output-schemas';++export const mauticCreateFormOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'form',+ label: 'Form',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified', format: 'datetime' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'name', label: 'Name' },+ { key: 'alias', label: 'Alias' },+ { key: 'category', label: 'Category', children: categoryFields },+ { key: 'description', label: 'Description' },+ { key: 'cachedHtml', label: 'Cached HTML' },+ { key: 'publishUp', label: 'Publish Up' },+ { key: 'publishDown', label: 'Publish Down' },+ { key: 'fields', label: 'Fields', labelKey: 'label', listItems: formFieldsFields },+ { key: 'actions', label: 'Actions', labelKey: 'name', listItems: formActionsFields },+ { key: 'template', label: 'Template' },+ { key: 'inKioskMode', label: 'In Kiosk Mode', format: 'boolean' },+ { key: 'renderStyle', label: 'Render Style', format: 'boolean' },+ { key: 'formType', label: 'Form Type' },+ { key: 'postAction', label: 'Post Action' },+ { key: 'postActionProperty', label: 'Post Action Property', format: 'url' },+ { key: 'noIndex', label: 'No Index' },+ { key: 'formAttributes', label: 'Form Attributes' },+ { key: 'language', label: 'Language' },+ ],+ },+ ],+};++export const mauticDeleteFormActionsOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'form',+ label: 'Form',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified', format: 'datetime' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'name', label: 'Name' },+ { key: 'alias', label: 'Alias' },+ {+ key: 'category',+ label: 'Category',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'title', label: 'Title' },+ { key: 'alias', label: 'Alias' },+ { key: 'description', label: 'Description' },+ { key: 'color', label: 'Color' },+ { key: 'bundle', label: 'Bundle' },+ ],+ },+ { key: 'description', label: 'Description' },+ { key: 'cachedHtml', label: 'Cached HTML' },+ {+ key: 'fields',+ label: 'Fields',+ labelKey: 'label',+ listItems: [+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'label', label: 'Label' },+ { key: 'showLabel', label: 'Show Label', format: 'boolean' },+ { key: 'alias', label: 'Alias' },+ { key: 'type', label: 'Type' },+ { key: 'isRequired', label: 'Is Required', format: 'boolean' },+ { key: 'order', label: 'Order', format: 'number' },+ { key: 'properties', label: 'Properties' },+ { key: 'validation', label: 'Validation' },+ { key: 'conditions', label: 'Conditions' },+ { key: 'leadField', label: 'Lead Field' },+ { key: 'saveResult', label: 'Save Result', format: 'boolean' },+ { key: 'isAutoFill', label: 'Is Auto Fill', format: 'boolean' },+ { key: 'mappedObject', label: 'Mapped Object' },+ { key: 'mappedField', label: 'Mapped Field' },+ ],+ },+ {+ key: 'actions',+ label: 'Actions',+ labelKey: 'name',+ listItems: [+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'name', label: 'Name' },+ { key: 'type', label: 'Type' },+ { key: 'order', label: 'Order', format: 'number' },+ {+ key: 'properties',+ label: 'Properties',+ children: [+ { key: 'operator', label: 'Operator' },+ { key: 'points', label: 'Points', format: 'number' },+ ],+ },+ ],+ },+ { key: 'inKioskMode', label: 'In Kiosk Mode', format: 'boolean' },+ { key: 'renderStyle', label: 'Render Style', format: 'boolean' },+ { key: 'formType', label: 'Form Type' },+ { key: 'postAction', label: 'Post Action' },+ { key: 'postActionProperty', label: 'Post Action Property', format: 'url' },+ ],+ },+ ],+};++export const mauticDeleteFormOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'form',+ label: 'Form',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified', format: 'datetime' },+ { key: 'id', label: 'ID' },+ { key: 'name', label: 'Name' },+ { key: 'alias', label: 'Alias' },+ { key: 'category', label: 'Category', children: categoryFields },+ { key: 'description', label: 'Description' },+ { key: 'cachedHtml', label: 'Cached HTML' },+ { key: 'publishUp', label: 'Publish Up' },+ { key: 'publishDown', label: 'Publish Down' },+ {+ key: 'fields',+ label: 'Fields',+ labelKey: 'label',+ listItems: [+ { key: 'id', label: 'ID' },+ { key: 'label', label: 'Label' },+ { key: 'showLabel', label: 'Show Label', format: 'boolean' },+ { key: 'alias', label: 'Alias' },+ { key: 'type', label: 'Type' },+ { key: 'defaultValue', label: 'Default Value' },+ { key: 'isRequired', label: 'Is Required', format: 'boolean' },+ { key: 'validationMessage', label: 'Validation Message' },+ { key: 'helpMessage', label: 'Help Message' },+ { key: 'order', label: 'Order', format: 'number' },+ { key: 'properties', label: 'Properties' },+ { key: 'validation', label: 'Validation' },+ { key: 'parent', label: 'Parent' },+ { key: 'conditions', label: 'Conditions' },+ { key: 'labelAttributes', label: 'Label Attributes' },+ { key: 'inputAttributes', label: 'Input Attributes' },+ { key: 'containerAttributes', label: 'Container Attributes' },+ { key: 'leadField', label: 'Lead Field' },+ { key: 'saveResult', label: 'Save Result', format: 'boolean' },+ { key: 'isAutoFill', label: 'Is Auto Fill', format: 'boolean' },+ { key: 'mappedObject', label: 'Mapped Object' },+ { key: 'mappedField', label: 'Mapped Field' },+ ],+ },+ {+ key: 'actions',+ label: 'Actions',+ labelKey: 'name',+ listItems: [+ { key: 'id', label: 'ID' },+ { key: 'name', label: 'Name' },+ { key: 'description', label: 'Description' },+ { key: 'type', label: 'Type' },+ { key: 'order', label: 'Order', format: 'number' },+ {+ key: 'properties',+ label: 'Properties',+ children: [+ { key: 'operator', label: 'Operator' },+ { key: 'points', label: 'Points', format: 'number' },+ { key: 'group', label: 'Group' },+ ],+ },+ ],+ },+ { key: 'template', label: 'Template' },+ { key: 'inKioskMode', label: 'In Kiosk Mode', format: 'boolean' },+ { key: 'renderStyle', label: 'Render Style', format: 'boolean' },+ { key: 'formType', label: 'Form Type' },+ { key: 'postAction', label: 'Post Action' },+ { key: 'postActionProperty', label: 'Post Action Property', format: 'url' },+ { key: 'noIndex', label: 'No Index' },+ { key: 'formAttributes', label: 'Form Attributes' },+ { key: 'language', label: 'Language' },+ ],+ },+ ],+};++export const mauticGetFormSubmissionOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'submission',+ label: 'Submission',+ children: [+ { key: 'id', label: 'ID', format: 'number' },+ {+ key: 'ipAddress',+ label: 'IP Address',+ children: [{ key: 'ipAddress', label: 'IP Address' }],+ },+ { key: 'form', label: 'Form', children: submissionFormFields },+ { key: 'lead', label: 'Lead', children: submissionLeadFields },+ { key: 'trackingId', label: 'Tracking ID' },+ { key: 'dateSubmitted', label: 'Date Submitted', format: 'datetime' },+ { key: 'referer', label: 'Referer' },+ { key: 'page', label: 'Page' },+ {+ key: 'results',+ label: 'Results',+ children: [+ { key: 'form_id', label: 'Form ID' },+ { key: 'email', label: 'Email', format: 'email' },+ ],+ },+ ],+ },+ ],+};++export const mauticListContactFormSubmissionsOutputSchema: OutputSchema = {+ fields: [+ { key: 'total', label: 'Total' },+ {+ key: 'submissions',+ label: 'Submissions',+ labelKey: 'id',+ listItems: [+ { key: 'id', label: 'ID', format: 'number' },+ {+ key: 'ipAddress',+ label: 'IP Address',+ children: [{ key: 'ipAddress', label: 'IP Address' }],+ },+ { key: 'form', label: 'Form', children: submissionFormFields },+ { key: 'lead', label: 'Lead', children: submissionLeadFields },+ { key: 'trackingId', label: 'Tracking ID' },+ { key: 'dateSubmitted', label: 'Date Submitted', format: 'datetime' },+ { key: 'referer', label: 'Referer' },+ { key: 'page', label: 'Page' },+ {+ key: 'results',+ label: 'Results',+ children: [{ key: 'email', label: 'Email', format: 'email' }],+ },+ ],+ },+ ],+};++export const mauticListFormsOutputSchema: OutputSchema = {+ fields: [+ { key: 'total', label: 'Total', format: 'number' },+ {+ key: 'forms',+ label: 'Forms',+ labelKey: 'name',+ listItems: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified', format: 'datetime' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'name', label: 'Name' },+ { key: 'alias', label: 'Alias' },+ { key: 'category', label: 'Category', children: categoryFields },+ { key: 'description', label: 'Description' },+ { key: 'cachedHtml', label: 'Cached HTML' },+ { key: 'publishUp', label: 'Publish Up' },+ { key: 'publishDown', label: 'Publish Down' },+ { key: 'fields', label: 'Fields', labelKey: 'label', listItems: formFieldsFields },+ { key: 'actions', label: 'Actions', labelKey: 'name', listItems: formActionsFields },+ { key: 'template', label: 'Template' },+ { key: 'inKioskMode', label: 'In Kiosk Mode', format: 'boolean' },+ { key: 'renderStyle', label: 'Render Style', format: 'boolean' },+ { key: 'formType', label: 'Form Type' },+ { key: 'postAction', label: 'Post Action' },+ { key: 'postActionProperty', label: 'Post Action Property' },+ { key: 'noIndex', label: 'No Index' },+ { key: 'formAttributes', label: 'Form Attributes' },+ { key: 'language', label: 'Language' },+ ],+ },+ ],+};diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/forms/update-form.ts b/packages/pieces/community/mautic/src/lib/actions/ai/forms/update-form.tsnew file mode 100644index 00000000000..12e3c7ce090--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/forms/update-form.ts@@ -0,0 +1,118 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticCreateFormOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticUpdateFormAction = createAction({+ auth: mauticAuth,+ name: 'mautic_update_form',+ outputSchema: mauticCreateFormOutputSchema,+ displayName: 'Update Form',+ description: 'Updates fields of a Mautic form.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Updates an existing form. Send After Submit on every update: Mautic resets it to "return" when it is left out. Remove fields or actions with Delete Form Fields or Delete Form Actions. Only the fields given are changed.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Form Id',+ description: 'Numeric form id, from List Forms or Create Form.',+ }),+ name: Property.ShortText({ displayName: 'Name', required: false }),+ alias: Property.ShortText({+ displayName: 'Alias',+ description:+ 'Form alias; Mautic shortens it to 10 characters and replaces spaces with underscores.',+ required: false,+ }),+ description: Property.LongText({ displayName: 'Description', required: false }),+ formType: Property.StaticDropdown({+ displayName: 'Form Type',+ description: 'Defaults to standalone.',+ required: false,+ options: {+ options: [+ { label: 'Standalone', value: 'standalone' },+ { label: 'Campaign', value: 'campaign' },+ ],+ },+ }),+ postAction: Property.StaticDropdown({+ displayName: 'After Submit',+ required: false,+ options: {+ options: [+ { label: 'Show message', value: 'message' },+ { label: 'Redirect', value: 'redirect' },+ { label: 'Return to form', value: 'return' },+ ],+ },+ }),+ postActionProperty: Property.ShortText({+ displayName: 'After Submit Value',+ description: 'Message to show or URL to redirect to.',+ required: false,+ }),+ fields: Property.Array({+ displayName: 'Fields',+ description:+ 'Form fields, each like {"label": "Email", "type": "email", "alias": "email", "leadField": "email", "isRequired": true}. Include a {"label": "Submit", "type": "button"} field. On update, fields with an "id" are edited and others added.',+ required: false,+ }),+ actions: Property.Array({+ displayName: 'Actions',+ description:+ 'Submit actions, each like {"name": "Add to segment", "type": "lead.changelist", "properties": {"addToLists": [1]}}. On update, actions with an "id" are edited and others added.',+ required: false,+ }),+ isPublished: mauticAiProps.yesNo({ displayName: 'Published' }),+ category: Property.Number({+ displayName: 'Category Id',+ description: 'Category id, from List Categories.',+ required: false,+ }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other form properties, e.g. "cachedHtml", "template", "inKioskMode", "renderStyle". The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const {+ id,+ additionalFields,+ name,+ alias,+ description,+ formType,+ postAction,+ postActionProperty,+ fields,+ actions,+ isPublished,+ category,+ } = context.propsValue;+ return await mauticApi.updateRecord({+ auth: context.auth,+ resource: 'forms',+ id,+ body: {+ ...additionalFields,+ ...spreadIfDefined('name', name),+ ...spreadIfDefined('alias', alias),+ ...spreadIfDefined('description', description),+ ...spreadIfDefined('formType', formType),+ ...spreadIfDefined('postAction', postAction),+ ...spreadIfDefined('postActionProperty', postActionProperty),+ ...spreadIfDefined('fields', fields),+ ...spreadIfDefined('actions', actions),+ ...spreadIfDefined('isPublished', isPublished),+ ...spreadIfDefined('category', category),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/index.ts b/packages/pieces/community/mautic/src/lib/actions/ai/index.tsnew file mode 100644index 00000000000..c435299e332--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/index.ts@@ -0,0 +1,389 @@+import { mauticCreateAssetAction } from './assets/create-asset';+import { mauticDeleteAssetAction } from './assets/delete-asset';+import { mauticGetAssetAction } from './assets/get-asset';+import { mauticListAssetsAction } from './assets/list-assets';+import { mauticUpdateAssetAction } from './assets/update-asset';+import { mauticAddContactToCampaignAction } from './campaigns/add-contact-to-campaign';+import { mauticBatchRescheduleContactCampaignEventsAction } from './campaigns/batch-reschedule-contact-campaign-events';+import { mauticCloneCampaignAction } from './campaigns/clone-campaign';+import { mauticCreateCampaignAction } from './campaigns/create-campaign';+import { mauticDeleteCampaignAction } from './campaigns/delete-campaign';+import { mauticGetCampaignAction } from './campaigns/get-campaign';+import { mauticGetCampaignEventAction } from './campaigns/get-campaign-event';+import { mauticListCampaignContactEventsAction } from './campaigns/list-campaign-contact-events';+import { mauticListCampaignContactsAction } from './campaigns/list-campaign-contacts';+import { mauticListCampaignEventsAction } from './campaigns/list-campaign-events';+import { mauticListCampaignsAction } from './campaigns/list-campaigns';+import { mauticListContactCampaignEventsAction } from './campaigns/list-contact-campaign-events';+import { mauticRemoveContactFromCampaignAction } from './campaigns/remove-contact-from-campaign';+import { mauticRescheduleContactCampaignEventAction } from './campaigns/reschedule-contact-campaign-event';+import { mauticUpdateCampaignAction } from './campaigns/update-campaign';+import { mauticCreateCategoryAction } from './categories/create-category';+import { mauticDeleteCategoryAction } from './categories/delete-category';+import { mauticGetCategoryAction } from './categories/get-category';+import { mauticListCategoriesAction } from './categories/list-categories';+import { mauticUpdateCategoryAction } from './categories/update-category';+import { mauticAddContactToCompanyAction } from './companies/add-contact-to-company';+import { mauticBatchCreateCompaniesAction } from './companies/batch-create-companies';+import { mauticBatchDeleteCompaniesAction } from './companies/batch-delete-companies';+import { mauticBatchUpdateCompaniesAction } from './companies/batch-update-companies';+import { mauticCreateCompanyAction } from './companies/create-company';+import { mauticDeleteCompanyAction } from './companies/delete-company';+import { mauticGetCompanyAction } from './companies/get-company';+import { mauticListCompaniesAction } from './companies/list-companies';+import { mauticRemoveContactFromCompanyAction } from './companies/remove-contact-from-company';+import { mauticUpdateCompanyAction } from './companies/update-company';+import { mauticAddContactUtmTagsAction } from './contacts/add-contact-utm-tags';+import { mauticAddDoNotContactAction } from './contacts/add-do-not-contact';+import { mauticAdjustContactGroupPointsAction } from './contacts/adjust-contact-group-points';+import { mauticAdjustContactPointsAction } from './contacts/adjust-contact-points';+import { mauticBatchCreateContactsAction } from './contacts/batch-create-contacts';+import { mauticBatchDeleteContactsAction } from './contacts/batch-delete-contacts';+import { mauticBatchUpdateContactsAction } from './contacts/batch-update-contacts';+import { mauticCreateContactAction } from './contacts/create-contact';+import { mauticDeleteContactAction } from './contacts/delete-contact';+import { mauticGetContactAction } from './contacts/get-contact';+import { mauticGetContactPointGroupAction } from './contacts/get-contact-point-group';+import { mauticListActivityAction } from './contacts/list-activity';+import { mauticListAvailableSegmentsAction } from './contacts/list-available-segments';+import { mauticListContactActivityAction } from './contacts/list-contact-activity';+import { mauticListContactCampaignsAction } from './contacts/list-contact-campaigns';+import { mauticListContactCompaniesAction } from './contacts/list-contact-companies';+import { mauticListContactDevicesAction } from './contacts/list-contact-devices';+import { mauticListContactFieldsAction } from './contacts/list-contact-fields';+import { mauticListContactNotesAction } from './contacts/list-contact-notes';+import { mauticListContactOwnersAction } from './contacts/list-contact-owners';+import { mauticListContactPointGroupsAction } from './contacts/list-contact-point-groups';+import { mauticListContactSegmentsAction } from './contacts/list-contact-segments';+import { mauticListContactsAction } from './contacts/list-contacts';+import { mauticRemoveContactUtmTagsAction } from './contacts/remove-contact-utm-tags';+import { mauticRemoveDoNotContactAction } from './contacts/remove-do-not-contact';+import { mauticUpdateContactAction } from './contacts/update-contact';+import { mauticCreateDeviceAction } from './devices/create-device';+import { mauticDeleteDeviceAction } from './devices/delete-device';+import { mauticGetDeviceAction } from './devices/get-device';+import { mauticListDevicesAction } from './devices/list-devices';+import { mauticUpdateDeviceAction } from './devices/update-device';+import { mauticCreateDynamicContentAction } from './dynamic-content/create-dynamic-content';+import { mauticDeleteDynamicContentAction } from './dynamic-content/delete-dynamic-content';+import { mauticGetDynamicContentAction } from './dynamic-content/get-dynamic-content';+import { mauticListDynamicContentsAction } from './dynamic-content/list-dynamic-contents';+import { mauticUpdateDynamicContentAction } from './dynamic-content/update-dynamic-content';+import { mauticCreateEmailAction } from './emails/create-email';+import { mauticDeleteEmailAction } from './emails/delete-email';+import { mauticGetEmailAction } from './emails/get-email';+import { mauticListEmailsAction } from './emails/list-emails';+import { mauticUpdateEmailAction } from './emails/update-email';+import { mauticCreateFieldAction } from './fields/create-field';+import { mauticDeleteFieldAction } from './fields/delete-field';+import { mauticGetFieldAction } from './fields/get-field';+import { mauticListFieldsAction } from './fields/list-fields';+import { mauticUpdateFieldAction } from './fields/update-field';+import { mauticDeleteFileAction } from './files/delete-file';+import { mauticDeleteThemeAction } from './files/delete-theme';+import { mauticGetThemeAction } from './files/get-theme';+import { mauticListFilesAction } from './files/list-files';+import { mauticListThemesAction } from './files/list-themes';+import { mauticUploadFileAction } from './files/upload-file';+import { mauticUploadThemeAction } from './files/upload-theme';+import { mauticCreateFocusItemAction } from './focus-items/create-focus-item';+import { mauticDeleteFocusItemAction } from './focus-items/delete-focus-item';+import { mauticGenerateFocusItemJsAction } from './focus-items/generate-focus-item-js';+import { mauticGetFocusItemAction } from './focus-items/get-focus-item';+import { mauticListFocusItemsAction } from './focus-items/list-focus-items';+import { mauticUpdateFocusItemAction } from './focus-items/update-focus-item';+import { mauticCreateFormAction } from './forms/create-form';+import { mauticDeleteFormAction } from './forms/delete-form';+import { mauticDeleteFormActionsAction } from './forms/delete-form-actions';+import { mauticDeleteFormFieldsAction } from './forms/delete-form-fields';+import { mauticGetFormAction } from './forms/get-form';+import { mauticGetFormSubmissionAction } from './forms/get-form-submission';+import { mauticListContactFormSubmissionsAction } from './forms/list-contact-form-submissions';+import { mauticListFormSubmissionsAction } from './forms/list-form-submissions';+import { mauticListFormsAction } from './forms/list-forms';+import { mauticUpdateFormAction } from './forms/update-form';+import { mauticCreatePageAction } from './landing-pages/create-page';+import { mauticDeletePageAction } from './landing-pages/delete-page';+import { mauticGetPageAction } from './landing-pages/get-page';+import { mauticListPagesAction } from './landing-pages/list-pages';+import { mauticUpdatePageAction } from './landing-pages/update-page';+import { mauticCreateMarketingMessageAction } from './marketing-messages/create-marketing-message';+import { mauticDeleteMarketingMessageAction } from './marketing-messages/delete-marketing-message';+import { mauticGetMarketingMessageAction } from './marketing-messages/get-marketing-message';+import { mauticListMarketingMessagesAction } from './marketing-messages/list-marketing-messages';+import { mauticUpdateMarketingMessageAction } from './marketing-messages/update-marketing-message';+import { mauticCreateNoteAction } from './notes/create-note';+import { mauticDeleteNoteAction } from './notes/delete-note';+import { mauticGetNoteAction } from './notes/get-note';+import { mauticListNotesAction } from './notes/list-notes';+import { mauticUpdateNoteAction } from './notes/update-note';+import { mauticCreatePointActionAction } from './point-actions/create-point-action';+import { mauticDeletePointActionAction } from './point-actions/delete-point-action';+import { mauticGetPointActionAction } from './point-actions/get-point-action';+import { mauticListPointActionTypesAction } from './point-actions/list-point-action-types';+import { mauticListPointActionsAction } from './point-actions/list-point-actions';+import { mauticUpdatePointActionAction } from './point-actions/update-point-action';+import { mauticCreatePointGroupAction } from './point-groups/create-point-group';+import { mauticDeletePointGroupAction } from './point-groups/delete-point-group';+import { mauticGetPointGroupAction } from './point-groups/get-point-group';+import { mauticListPointGroupsAction } from './point-groups/list-point-groups';+import { mauticUpdatePointGroupAction } from './point-groups/update-point-group';+import { mauticCreatePointTriggerAction } from './point-triggers/create-point-trigger';+import { mauticDeletePointTriggerAction } from './point-triggers/delete-point-trigger';+import { mauticDeletePointTriggerEventsAction } from './point-triggers/delete-point-trigger-events';+import { mauticGetPointTriggerAction } from './point-triggers/get-point-trigger';+import { mauticListPointTriggerEventTypesAction } from './point-triggers/list-point-trigger-event-types';+import { mauticListPointTriggersAction } from './point-triggers/list-point-triggers';+import { mauticUpdatePointTriggerAction } from './point-triggers/update-point-trigger';+import { mauticCreatePushNotificationAction } from './push-notifications/create-push-notification';+import { mauticDeletePushNotificationAction } from './push-notifications/delete-push-notification';+import { mauticGetPushNotificationAction } from './push-notifications/get-push-notification';+import { mauticListPushNotificationsAction } from './push-notifications/list-push-notifications';+import { mauticUpdatePushNotificationAction } from './push-notifications/update-push-notification';+import { mauticCreateReportAction } from './reports/create-report';+import { mauticDeleteReportAction } from './reports/delete-report';+import { mauticGetDashboardWidgetDataAction } from './reports/get-dashboard-widget-data';+import { mauticGetReportAction } from './reports/get-report';+import { mauticGetStatsAction } from './reports/get-stats';+import { mauticListDashboardWidgetTypesAction } from './reports/list-dashboard-widget-types';+import { mauticListReportsAction } from './reports/list-reports';+import { mauticUpdateReportAction } from './reports/update-report';+import { mauticAddContactToSegmentAction } from './segments/add-contact-to-segment';+import { mauticAddContactsToSegmentAction } from './segments/add-contacts-to-segment';+import { mauticCreateSegmentAction } from './segments/create-segment';+import { mauticDeleteSegmentAction } from './segments/delete-segment';+import { mauticGetSegmentAction } from './segments/get-segment';+import { mauticListSegmentsAction } from './segments/list-segments';+import { mauticRemoveContactFromSegmentAction } from './segments/remove-contact-from-segment';+import { mauticUpdateSegmentAction } from './segments/update-segment';+import { mauticAddContactToStageAction } from './stages/add-contact-to-stage';+import { mauticCreateStageAction } from './stages/create-stage';+import { mauticDeleteStageAction } from './stages/delete-stage';+import { mauticGetStageAction } from './stages/get-stage';+import { mauticListStagesAction } from './stages/list-stages';+import { mauticRemoveContactFromStageAction } from './stages/remove-contact-from-stage';+import { mauticUpdateStageAction } from './stages/update-stage';+import { mauticCreateTagAction } from './tags/create-tag';+import { mauticDeleteTagAction } from './tags/delete-tag';+import { mauticGetTagAction } from './tags/get-tag';+import { mauticListTagsAction } from './tags/list-tags';+import { mauticUpdateTagAction } from './tags/update-tag';+import { mauticCreateSmsAction } from './text-messages/create-sms';+import { mauticDeleteSmsAction } from './text-messages/delete-sms';+import { mauticGetSmsAction } from './text-messages/get-sms';+import { mauticListSmsesAction } from './text-messages/list-smses';+import { mauticUpdateSmsAction } from './text-messages/update-sms';+import { mauticCreateTweetAction } from './tweets/create-tweet';+import { mauticDeleteTweetAction } from './tweets/delete-tweet';+import { mauticGetTweetAction } from './tweets/get-tweet';+import { mauticListTweetsAction } from './tweets/list-tweets';+import { mauticUpdateTweetAction } from './tweets/update-tweet';+import { mauticCheckUserPermissionsAction } from './users/check-user-permissions';+import { mauticCreateRoleAction } from './users/create-role';+import { mauticCreateUserAction } from './users/create-user';+import { mauticDeleteRoleAction } from './users/delete-role';+import { mauticDeleteUserAction } from './users/delete-user';+import { mauticGetCurrentUserAction } from './users/get-current-user';+import { mauticGetRoleAction } from './users/get-role';+import { mauticGetUserAction } from './users/get-user';+import { mauticListAssignableRolesAction } from './users/list-assignable-roles';+import { mauticListRolesAction } from './users/list-roles';+import { mauticListUsersAction } from './users/list-users';+import { mauticUpdateRoleAction } from './users/update-role';+import { mauticUpdateUserAction } from './users/update-user';++export const mauticAiActions = [+ mauticListContactsAction,+ mauticGetContactAction,+ mauticCreateContactAction,+ mauticUpdateContactAction,+ mauticDeleteContactAction,+ mauticListActivityAction,+ mauticListContactActivityAction,+ mauticListContactFieldsAction,+ mauticListContactOwnersAction,+ mauticListAvailableSegmentsAction,+ mauticListContactCampaignsAction,+ mauticListContactCompaniesAction,+ mauticListContactNotesAction,+ mauticListContactSegmentsAction,+ mauticListContactDevicesAction,+ mauticAddDoNotContactAction,+ mauticRemoveDoNotContactAction,+ mauticAddContactUtmTagsAction,+ mauticRemoveContactUtmTagsAction,+ mauticAdjustContactPointsAction,+ mauticListContactPointGroupsAction,+ mauticGetContactPointGroupAction,+ mauticAdjustContactGroupPointsAction,+ mauticBatchCreateContactsAction,+ mauticBatchUpdateContactsAction,+ mauticBatchDeleteContactsAction,+ mauticListCompaniesAction,+ mauticGetCompanyAction,+ mauticCreateCompanyAction,+ mauticUpdateCompanyAction,+ mauticDeleteCompanyAction,+ mauticAddContactToCompanyAction,+ mauticRemoveContactFromCompanyAction,+ mauticBatchCreateCompaniesAction,+ mauticBatchUpdateCompaniesAction,+ mauticBatchDeleteCompaniesAction,+ mauticListSegmentsAction,+ mauticGetSegmentAction,+ mauticCreateSegmentAction,+ mauticUpdateSegmentAction,+ mauticDeleteSegmentAction,+ mauticAddContactToSegmentAction,+ mauticRemoveContactFromSegmentAction,+ mauticAddContactsToSegmentAction,+ mauticListCampaignsAction,+ mauticGetCampaignAction,+ mauticCreateCampaignAction,+ mauticUpdateCampaignAction,+ mauticDeleteCampaignAction,+ mauticCloneCampaignAction,+ mauticAddContactToCampaignAction,+ mauticRemoveContactFromCampaignAction,+ mauticListCampaignContactsAction,+ mauticListCampaignEventsAction,+ mauticGetCampaignEventAction,+ mauticListContactCampaignEventsAction,+ mauticListCampaignContactEventsAction,+ mauticRescheduleContactCampaignEventAction,+ mauticBatchRescheduleContactCampaignEventsAction,+ mauticListEmailsAction,+ mauticGetEmailAction,+ mauticCreateEmailAction,+ mauticUpdateEmailAction,+ mauticDeleteEmailAction,+ mauticListSmsesAction,+ mauticGetSmsAction,+ mauticCreateSmsAction,+ mauticUpdateSmsAction,+ mauticDeleteSmsAction,+ mauticListNotesAction,+ mauticGetNoteAction,+ mauticCreateNoteAction,+ mauticUpdateNoteAction,+ mauticDeleteNoteAction,+ mauticListTagsAction,+ mauticGetTagAction,+ mauticCreateTagAction,+ mauticUpdateTagAction,+ mauticDeleteTagAction,+ mauticListStagesAction,+ mauticGetStageAction,+ mauticCreateStageAction,+ mauticUpdateStageAction,+ mauticDeleteStageAction,+ mauticAddContactToStageAction,+ mauticRemoveContactFromStageAction,+ mauticListCategoriesAction,+ mauticGetCategoryAction,+ mauticCreateCategoryAction,+ mauticUpdateCategoryAction,+ mauticDeleteCategoryAction,+ mauticListFieldsAction,+ mauticGetFieldAction,+ mauticCreateFieldAction,+ mauticUpdateFieldAction,+ mauticDeleteFieldAction,+ mauticListFormsAction,+ mauticGetFormAction,+ mauticCreateFormAction,+ mauticUpdateFormAction,+ mauticDeleteFormAction,+ mauticListFormSubmissionsAction,+ mauticGetFormSubmissionAction,+ mauticListContactFormSubmissionsAction,+ mauticDeleteFormActionsAction,+ mauticDeleteFormFieldsAction,+ mauticListAssetsAction,+ mauticGetAssetAction,+ mauticCreateAssetAction,+ mauticUpdateAssetAction,+ mauticDeleteAssetAction,+ mauticListPagesAction,+ mauticGetPageAction,+ mauticCreatePageAction,+ mauticUpdatePageAction,+ mauticDeletePageAction,+ mauticListUsersAction,+ mauticGetUserAction,+ mauticCreateUserAction,+ mauticUpdateUserAction,+ mauticDeleteUserAction,+ mauticGetCurrentUserAction,+ mauticListAssignableRolesAction,+ mauticCheckUserPermissionsAction,+ mauticListRolesAction,+ mauticGetRoleAction,+ mauticCreateRoleAction,+ mauticUpdateRoleAction,+ mauticDeleteRoleAction,+ mauticListPointGroupsAction,+ mauticGetPointGroupAction,+ mauticCreatePointGroupAction,+ mauticUpdatePointGroupAction,+ mauticDeletePointGroupAction,+ mauticListReportsAction,+ mauticGetReportAction,+ mauticCreateReportAction,+ mauticUpdateReportAction,+ mauticDeleteReportAction,+ mauticGetStatsAction,+ mauticListDashboardWidgetTypesAction,+ mauticGetDashboardWidgetDataAction,+ mauticListDevicesAction,+ mauticGetDeviceAction,+ mauticCreateDeviceAction,+ mauticUpdateDeviceAction,+ mauticDeleteDeviceAction,+ mauticListDynamicContentsAction,+ mauticGetDynamicContentAction,+ mauticCreateDynamicContentAction,+ mauticUpdateDynamicContentAction,+ mauticDeleteDynamicContentAction,+ mauticListFocusItemsAction,+ mauticGetFocusItemAction,+ mauticCreateFocusItemAction,+ mauticUpdateFocusItemAction,+ mauticDeleteFocusItemAction,+ mauticGenerateFocusItemJsAction,+ mauticListMarketingMessagesAction,+ mauticGetMarketingMessageAction,+ mauticCreateMarketingMessageAction,+ mauticUpdateMarketingMessageAction,+ mauticDeleteMarketingMessageAction,+ mauticListPushNotificationsAction,+ mauticGetPushNotificationAction,+ mauticCreatePushNotificationAction,+ mauticUpdatePushNotificationAction,+ mauticDeletePushNotificationAction,+ mauticListTweetsAction,+ mauticGetTweetAction,+ mauticCreateTweetAction,+ mauticUpdateTweetAction,+ mauticDeleteTweetAction,+ mauticListPointActionsAction,+ mauticGetPointActionAction,+ mauticCreatePointActionAction,+ mauticUpdatePointActionAction,+ mauticDeletePointActionAction,+ mauticListPointActionTypesAction,+ mauticListPointTriggersAction,+ mauticGetPointTriggerAction,+ mauticCreatePointTriggerAction,+ mauticUpdatePointTriggerAction,+ mauticDeletePointTriggerAction,+ mauticListPointTriggerEventTypesAction,+ mauticDeletePointTriggerEventsAction,+ mauticListFilesAction,+ mauticUploadFileAction,+ mauticDeleteFileAction,+ mauticListThemesAction,+ mauticGetThemeAction,+ mauticUploadThemeAction,+ mauticDeleteThemeAction,+];diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/landing-pages/create-page.ts b/packages/pieces/community/mautic/src/lib/actions/ai/landing-pages/create-page.tsnew file mode 100644index 00000000000..145276faa75--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/landing-pages/create-page.ts@@ -0,0 +1,98 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticCreatePageOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticCreatePageAction = createAction({+ auth: mauticAuth,+ name: 'mautic_create_page',+ outputSchema: mauticCreatePageOutputSchema,+ displayName: 'Create Landing Page',+ description: 'Creates a Mautic landing page.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description: 'Creates a landing page. Title is required.',+ idempotent: false,+ },+ props: {+ title: Property.ShortText({ displayName: 'Title', required: true }),+ alias: Property.ShortText({+ displayName: 'Alias',+ description: 'Used in the page URL; generated from the title when empty.',+ required: false,+ }),+ customHtml: Property.LongText({+ displayName: 'HTML',+ description: 'Full HTML of the page.',+ required: false,+ }),+ template: Property.ShortText({+ displayName: 'Theme',+ description: 'Theme name to build the page from, e.g. "blank".',+ required: false,+ }),+ metaDescription: Property.ShortText({ displayName: 'Meta Description', required: false }),+ isPublished: mauticAiProps.yesNo({ displayName: 'Published' }),+ category: Property.Number({+ displayName: 'Category Id',+ description: 'Category id, from List Categories.',+ required: false,+ }),+ language: Property.ShortText({+ displayName: 'Language',+ description: 'Locale code, e.g. "en".',+ required: false,+ }),+ redirectType: Property.StaticDropdown({+ displayName: 'Redirect Type',+ description: 'Redirect used when the page is unpublished.',+ required: false,+ options: {+ options: [+ { label: '301 Permanent', value: '301' },+ { label: '302 Temporary', value: '302' },+ ],+ },+ }),+ redirectUrl: Property.ShortText({ displayName: 'Redirect URL', required: false }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other page properties, e.g. "publishUp", "publishDown", "isPreferenceCenter", "noIndex". The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const {+ additionalFields,+ title,+ alias,+ customHtml,+ template,+ metaDescription,+ isPublished,+ category,+ language,+ redirectType,+ redirectUrl,+ } = context.propsValue;+ return await mauticApi.createRecord({+ auth: context.auth,+ resource: 'pages',+ body: {+ ...additionalFields,+ ...spreadIfDefined('title', title),+ ...spreadIfDefined('alias', alias),+ ...spreadIfDefined('customHtml', customHtml),+ ...spreadIfDefined('template', template),+ ...spreadIfDefined('metaDescription', metaDescription),+ ...spreadIfDefined('isPublished', isPublished),+ ...spreadIfDefined('category', category),+ ...spreadIfDefined('language', language),+ ...spreadIfDefined('redirectType', redirectType),+ ...spreadIfDefined('redirectUrl', redirectUrl),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/landing-pages/delete-page.ts b/packages/pieces/community/mautic/src/lib/actions/ai/landing-pages/delete-page.tsnew file mode 100644index 00000000000..98c8f7db413--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/landing-pages/delete-page.ts@@ -0,0 +1,33 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticDeletePageOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticDeletePageAction = createAction({+ auth: mauticAuth,+ name: 'mautic_delete_page',+ outputSchema: mauticDeletePageOutputSchema,+ displayName: 'Delete Landing Page',+ description: 'Permanently deletes a Mautic landing page.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description: 'Permanently deletes a landing page and its hit stats. Cannot be undone.',+ idempotent: false,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Landing Page Id',+ description: 'Numeric landing page id, from List Landing Pages or Create Landing Page.',+ }),+ },+ async run(context) {+ return await mauticApi.deleteRecord({+ auth: context.auth,+ resource: 'pages',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/landing-pages/get-page.ts b/packages/pieces/community/mautic/src/lib/actions/ai/landing-pages/get-page.tsnew file mode 100644index 00000000000..8e8197fcd0c--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/landing-pages/get-page.ts@@ -0,0 +1,33 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticGetPageOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticGetPageAction = createAction({+ auth: mauticAuth,+ name: 'mautic_get_page',+ outputSchema: mauticGetPageOutputSchema,+ displayName: 'Get Landing Page',+ description: 'Gets one Mautic landing page by id.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description: 'Gets a single landing page by its numeric id, with its HTML and URL.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Landing Page Id',+ description: 'Numeric landing page id, from List Landing Pages or Create Landing Page.',+ }),+ },+ async run(context) {+ return await mauticApi.getRecord({+ auth: context.auth,+ resource: 'pages',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/landing-pages/list-pages.ts b/packages/pieces/community/mautic/src/lib/actions/ai/landing-pages/list-pages.tsnew file mode 100644index 00000000000..fb6006f0e4a--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/landing-pages/list-pages.ts@@ -0,0 +1,32 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListPagesOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticListPagesAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_pages',+ outputSchema: mauticListPagesOutputSchema,+ displayName: 'List Landing Pages',+ description: 'Lists Mautic landing pages.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists landing pages with their hit counts. Page with Start and Limit; the response has the total count.',+ idempotent: true,+ },+ props: {+ ...mauticAiProps.listOptions,+ },+ async run(context) {+ return await mauticApi.listRecords({+ auth: context.auth,+ resource: 'pages',+ key: 'pages',+ query: context.propsValue,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/landing-pages/output-schemas.ts b/packages/pieces/community/mautic/src/lib/actions/ai/landing-pages/output-schemas.tsnew file mode 100644index 00000000000..686106a4a55--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/landing-pages/output-schemas.ts@@ -0,0 +1,119 @@+import { OutputSchema } from '@activepieces/pieces-framework';++import { categoryFields, pageFields } from '../../../output-schemas';++export const mauticCreatePageOutputSchema: OutputSchema = {+ fields: [{ key: 'page', label: 'Page', children: pageFields }],+};++export const mauticDeletePageOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'page',+ label: 'Page',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified' },+ { key: 'id', label: 'ID' },+ { key: 'title', label: 'Title' },+ { key: 'alias', label: 'Alias' },+ { key: 'category', label: 'Category', children: categoryFields },+ { key: 'language', label: 'Language' },+ { key: 'publishUp', label: 'Publish Up' },+ { key: 'publishDown', label: 'Publish Down' },+ { key: 'hits', label: 'Hits', format: 'number' },+ { key: 'uniqueHits', label: 'Unique Hits', format: 'number' },+ { key: 'variantHits', label: 'Variant Hits', format: 'number' },+ { key: 'revision', label: 'Revision', format: 'number' },+ { key: 'metaDescription', label: 'Meta Description' },+ { key: 'redirectType', label: 'Redirect Type' },+ { key: 'redirectUrl', label: 'Redirect URL', format: 'url' },+ { key: 'isPreferenceCenter', label: 'Is Preference Center' },+ { key: 'noIndex', label: 'No Index' },+ { key: 'variantSettings', label: 'Variant Settings' },+ { key: 'variantStartDate', label: 'Variant Start Date' },+ { key: 'variantParent', label: 'Variant Parent' },+ { key: 'variantChildren', label: 'Variant Children' },+ { key: 'translationParent', label: 'Translation Parent' },+ {+ key: 'translationChildren',+ label: 'Translation Children',+ labelKey: 'title',+ listItems: [+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'title', label: 'Title' },+ { key: 'alias', label: 'Alias' },+ { key: 'category', label: 'Category' },+ { key: 'language', label: 'Language' },+ { key: 'publishUp', label: 'Publish Up' },+ { key: 'publishDown', label: 'Publish Down' },+ { key: 'hits', label: 'Hits', format: 'number' },+ { key: 'uniqueHits', label: 'Unique Hits', format: 'number' },+ { key: 'variantHits', label: 'Variant Hits', format: 'number' },+ { key: 'revision', label: 'Revision', format: 'number' },+ { key: 'metaDescription', label: 'Meta Description' },+ { key: 'redirectType', label: 'Redirect Type' },+ { key: 'redirectUrl', label: 'Redirect URL' },+ { key: 'isPreferenceCenter', label: 'Is Preference Center' },+ { key: 'noIndex', label: 'No Index' },+ { key: 'variantSettings', label: 'Variant Settings' },+ { key: 'variantStartDate', label: 'Variant Start Date' },+ { key: 'variantParent', label: 'Variant Parent' },+ { key: 'variantChildren', label: 'Variant Children' },+ { key: 'translationChildren', label: 'Translation Children' },+ { key: 'template', label: 'Template' },+ { key: 'customHtml', label: 'Custom HTML' },+ ],+ },+ { key: 'template', label: 'Template' },+ { key: 'customHtml', label: 'Custom HTML' },+ ],+ },+ ],+};++export const mauticGetPageOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'page',+ label: 'Page',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified', format: 'datetime' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'title', label: 'Title' },+ { key: 'alias', label: 'Alias' },+ { key: 'category', label: 'Category', children: categoryFields },+ { key: 'language', label: 'Language' },+ { key: 'publishUp', label: 'Publish Up' },+ { key: 'publishDown', label: 'Publish Down' },+ { key: 'hits', label: 'Hits', format: 'number' },+ { key: 'uniqueHits', label: 'Unique Hits', format: 'number' },+ { key: 'variantHits', label: 'Variant Hits', format: 'number' },+ { key: 'revision', label: 'Revision', format: 'number' },+ { key: 'metaDescription', label: 'Meta Description' },+ { key: 'redirectType', label: 'Redirect Type' },+ { key: 'redirectUrl', label: 'Redirect URL', format: 'url' },+ { key: 'isPreferenceCenter', label: 'Is Preference Center' },+ { key: 'noIndex', label: 'No Index' },+ { key: 'variantSettings', label: 'Variant Settings' },+ { key: 'variantStartDate', label: 'Variant Start Date' },+ { key: 'variantParent', label: 'Variant Parent' },+ { key: 'variantChildren', label: 'Variant Children' },+ { key: 'translationParent', label: 'Translation Parent' },+ { key: 'translationChildren', label: 'Translation Children' },+ { key: 'template', label: 'Template' },+ { key: 'customHtml', label: 'Custom HTML' },+ ],+ },+ ],+};++export const mauticListPagesOutputSchema: OutputSchema = {+ fields: [+ { key: 'total', label: 'Total', format: 'number' },+ { key: 'pages', label: 'Pages', labelKey: 'title', listItems: pageFields },+ ],+};diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/landing-pages/update-page.ts b/packages/pieces/community/mautic/src/lib/actions/ai/landing-pages/update-page.tsnew file mode 100644index 00000000000..f74f20a26cc--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/landing-pages/update-page.ts@@ -0,0 +1,104 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticGetPageOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticUpdatePageAction = createAction({+ auth: mauticAuth,+ name: 'mautic_update_page',+ outputSchema: mauticGetPageOutputSchema,+ displayName: 'Update Landing Page',+ description: 'Updates fields of a Mautic landing page.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description: 'Updates an existing landing page. Only the fields given are changed.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Landing Page Id',+ description: 'Numeric landing page id, from List Landing Pages or Create Landing Page.',+ }),+ title: Property.ShortText({ displayName: 'Title', required: false }),+ alias: Property.ShortText({+ displayName: 'Alias',+ description: 'Used in the page URL; generated from the title when empty.',+ required: false,+ }),+ customHtml: Property.LongText({+ displayName: 'HTML',+ description: 'Full HTML of the page.',+ required: false,+ }),+ template: Property.ShortText({+ displayName: 'Theme',+ description: 'Theme name to build the page from, e.g. "blank".',+ required: false,+ }),+ metaDescription: Property.ShortText({ displayName: 'Meta Description', required: false }),+ isPublished: mauticAiProps.yesNo({ displayName: 'Published' }),+ category: Property.Number({+ displayName: 'Category Id',+ description: 'Category id, from List Categories.',+ required: false,+ }),+ language: Property.ShortText({+ displayName: 'Language',+ description: 'Locale code, e.g. "en".',+ required: false,+ }),+ redirectType: Property.StaticDropdown({+ displayName: 'Redirect Type',+ description: 'Redirect used when the page is unpublished.',+ required: false,+ options: {+ options: [+ { label: '301 Permanent', value: '301' },+ { label: '302 Temporary', value: '302' },+ ],+ },+ }),+ redirectUrl: Property.ShortText({ displayName: 'Redirect URL', required: false }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other page properties, e.g. "publishUp", "publishDown", "isPreferenceCenter", "noIndex". The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const {+ id,+ additionalFields,+ title,+ alias,+ customHtml,+ template,+ metaDescription,+ isPublished,+ category,+ language,+ redirectType,+ redirectUrl,+ } = context.propsValue;+ return await mauticApi.updateRecord({+ auth: context.auth,+ resource: 'pages',+ id,+ body: {+ ...additionalFields,+ ...spreadIfDefined('title', title),+ ...spreadIfDefined('alias', alias),+ ...spreadIfDefined('customHtml', customHtml),+ ...spreadIfDefined('template', template),+ ...spreadIfDefined('metaDescription', metaDescription),+ ...spreadIfDefined('isPublished', isPublished),+ ...spreadIfDefined('category', category),+ ...spreadIfDefined('language', language),+ ...spreadIfDefined('redirectType', redirectType),+ ...spreadIfDefined('redirectUrl', redirectUrl),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/marketing-messages/create-marketing-message.ts b/packages/pieces/community/mautic/src/lib/actions/ai/marketing-messages/create-marketing-message.tsnew file mode 100644index 00000000000..5fc60d2421a--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/marketing-messages/create-marketing-message.ts@@ -0,0 +1,57 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticCreateMarketingMessageOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticCreateMarketingMessageAction = createAction({+ auth: mauticAuth,+ name: 'mautic_create_marketing_message',+ outputSchema: mauticCreateMarketingMessageOutputSchema,+ displayName: 'Create Marketing Message',+ description: 'Creates a Mautic marketing message.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Creates a marketing message. Name is required; link an email, text message or web push per channel.',+ idempotent: false,+ },+ props: {+ name: Property.ShortText({ displayName: 'Name', required: true }),+ description: Property.LongText({ displayName: 'Description', required: false }),+ channels: Property.Json({+ displayName: 'Channels',+ description:+ 'Channel settings keyed by channel, e.g. {"email": {"channel": "email", "channelId": 12, "isEnabled": true}, "sms": {"channel": "sms", "channelId": 3, "isEnabled": false}}.',+ required: false,+ }),+ isPublished: mauticAiProps.yesNo({ displayName: 'Published' }),+ category: Property.Number({+ displayName: 'Category Id',+ description: 'Category id, from List Categories.',+ required: false,+ }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other marketing message properties, e.g. "publishUp", "publishDown". The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const { additionalFields, name, description, channels, isPublished, category } =+ context.propsValue;+ return await mauticApi.createRecord({+ auth: context.auth,+ resource: 'messages',+ body: {+ ...additionalFields,+ ...spreadIfDefined('name', name),+ ...spreadIfDefined('description', description),+ ...spreadIfDefined('channels', channels),+ ...spreadIfDefined('isPublished', isPublished),+ ...spreadIfDefined('category', category),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/marketing-messages/delete-marketing-message.ts b/packages/pieces/community/mautic/src/lib/actions/ai/marketing-messages/delete-marketing-message.tsnew file mode 100644index 00000000000..350b3df55b4--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/marketing-messages/delete-marketing-message.ts@@ -0,0 +1,34 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticDeleteMarketingMessageOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticDeleteMarketingMessageAction = createAction({+ auth: mauticAuth,+ name: 'mautic_delete_marketing_message',+ outputSchema: mauticDeleteMarketingMessageOutputSchema,+ displayName: 'Delete Marketing Message',+ description: 'Permanently deletes a Mautic marketing message.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description: 'Permanently deletes a marketing message. Cannot be undone.',+ idempotent: false,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Marketing Message Id',+ description:+ 'Numeric marketing message id, from List Marketing Messages or Create Marketing Message.',+ }),+ },+ async run(context) {+ return await mauticApi.deleteRecord({+ auth: context.auth,+ resource: 'messages',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/marketing-messages/get-marketing-message.ts b/packages/pieces/community/mautic/src/lib/actions/ai/marketing-messages/get-marketing-message.tsnew file mode 100644index 00000000000..3b93f279c2a--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/marketing-messages/get-marketing-message.ts@@ -0,0 +1,34 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticGetMarketingMessageOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticGetMarketingMessageAction = createAction({+ auth: mauticAuth,+ name: 'mautic_get_marketing_message',+ outputSchema: mauticGetMarketingMessageOutputSchema,+ displayName: 'Get Marketing Message',+ description: 'Gets one Mautic marketing message by id.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description: 'Gets a single marketing message by its numeric id, with its channels.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Marketing Message Id',+ description:+ 'Numeric marketing message id, from List Marketing Messages or Create Marketing Message.',+ }),+ },+ async run(context) {+ return await mauticApi.getRecord({+ auth: context.auth,+ resource: 'messages',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/marketing-messages/list-marketing-messages.ts b/packages/pieces/community/mautic/src/lib/actions/ai/marketing-messages/list-marketing-messages.tsnew file mode 100644index 00000000000..1f6946d7357--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/marketing-messages/list-marketing-messages.ts@@ -0,0 +1,32 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListMarketingMessagesOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticListMarketingMessagesAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_marketing_messages',+ outputSchema: mauticListMarketingMessagesOutputSchema,+ displayName: 'List Marketing Messages',+ description: 'Lists Mautic marketing messages.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists marketing messages, which send through the channel each contact prefers. Page with Start and Limit; the response has the total count.',+ idempotent: true,+ },+ props: {+ ...mauticAiProps.listOptions,+ },+ async run(context) {+ return await mauticApi.listRecords({+ auth: context.auth,+ resource: 'messages',+ key: 'messages',+ query: context.propsValue,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/marketing-messages/output-schemas.ts b/packages/pieces/community/mautic/src/lib/actions/ai/marketing-messages/output-schemas.tsnew file mode 100644index 00000000000..94f5f5b31f4--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/marketing-messages/output-schemas.ts@@ -0,0 +1,99 @@+import { OutputSchema } from '@activepieces/pieces-framework';++import { categoryFields, messageChannelsFields } from '../../../output-schemas';++export const mauticCreateMarketingMessageOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'message',+ label: 'Message',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'name', label: 'Name' },+ { key: 'description', label: 'Description' },+ { key: 'publishUp', label: 'Publish Up', format: 'datetime' },+ { key: 'publishDown', label: 'Publish Down' },+ { key: 'channels', label: 'Channels', labelKey: 'id', listItems: messageChannelsFields },+ { key: 'category', label: 'Category', children: categoryFields },+ ],+ },+ ],+};++export const mauticDeleteMarketingMessageOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'message',+ label: 'Message',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified' },+ { key: 'id', label: 'ID' },+ { key: 'name', label: 'Name' },+ { key: 'description', label: 'Description' },+ { key: 'publishUp', label: 'Publish Up', format: 'datetime' },+ { key: 'publishDown', label: 'Publish Down' },+ {+ key: 'channels',+ label: 'Channels',+ listItems: [+ { key: 'id', label: 'ID' },+ { key: 'channel', label: 'Channel' },+ { key: 'channelId', label: 'Channel ID', format: 'number' },+ { key: 'channelName', label: 'Channel Name' },+ { key: 'isEnabled', label: 'Is Enabled', format: 'boolean' },+ ],+ },+ { key: 'category', label: 'Category', children: categoryFields },+ ],+ },+ ],+};++export const mauticGetMarketingMessageOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'message',+ label: 'Message',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified', format: 'datetime' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'name', label: 'Name' },+ { key: 'description', label: 'Description' },+ { key: 'publishUp', label: 'Publish Up', format: 'datetime' },+ { key: 'publishDown', label: 'Publish Down' },+ { key: 'channels', label: 'Channels', labelKey: 'id', listItems: messageChannelsFields },+ { key: 'category', label: 'Category', children: categoryFields },+ ],+ },+ ],+};++export const mauticListMarketingMessagesOutputSchema: OutputSchema = {+ fields: [+ { key: 'total', label: 'Total', format: 'number' },+ {+ key: 'messages',+ label: 'Messages',+ labelKey: 'name',+ listItems: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'name', label: 'Name' },+ { key: 'description', label: 'Description' },+ { key: 'publishUp', label: 'Publish Up' },+ { key: 'publishDown', label: 'Publish Down' },+ { key: 'channels', label: 'Channels', labelKey: 'id', listItems: messageChannelsFields },+ { key: 'category', label: 'Category', children: categoryFields },+ ],+ },+ ],+};diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/marketing-messages/update-marketing-message.ts b/packages/pieces/community/mautic/src/lib/actions/ai/marketing-messages/update-marketing-message.tsnew file mode 100644index 00000000000..696331ca742--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/marketing-messages/update-marketing-message.ts@@ -0,0 +1,62 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticGetMarketingMessageOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticUpdateMarketingMessageAction = createAction({+ auth: mauticAuth,+ name: 'mautic_update_marketing_message',+ outputSchema: mauticGetMarketingMessageOutputSchema,+ displayName: 'Update Marketing Message',+ description: 'Updates fields of a Mautic marketing message.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description: 'Updates an existing marketing message. Only the fields given are changed.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Marketing Message Id',+ description:+ 'Numeric marketing message id, from List Marketing Messages or Create Marketing Message.',+ }),+ name: Property.ShortText({ displayName: 'Name', required: false }),+ description: Property.LongText({ displayName: 'Description', required: false }),+ channels: Property.Json({+ displayName: 'Channels',+ description:+ 'Channel settings keyed by channel, e.g. {"email": {"channel": "email", "channelId": 12, "isEnabled": true}, "sms": {"channel": "sms", "channelId": 3, "isEnabled": false}}.',+ required: false,+ }),+ isPublished: mauticAiProps.yesNo({ displayName: 'Published' }),+ category: Property.Number({+ displayName: 'Category Id',+ description: 'Category id, from List Categories.',+ required: false,+ }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other marketing message properties, e.g. "publishUp", "publishDown". The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const { id, additionalFields, name, description, channels, isPublished, category } =+ context.propsValue;+ return await mauticApi.updateRecord({+ auth: context.auth,+ resource: 'messages',+ id,+ body: {+ ...additionalFields,+ ...spreadIfDefined('name', name),+ ...spreadIfDefined('description', description),+ ...spreadIfDefined('channels', channels),+ ...spreadIfDefined('isPublished', isPublished),+ ...spreadIfDefined('category', category),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/notes/create-note.ts b/packages/pieces/community/mautic/src/lib/actions/ai/notes/create-note.tsnew file mode 100644index 00000000000..5ee170c6c11--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/notes/create-note.ts@@ -0,0 +1,64 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticCreateNoteOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticCreateNoteAction = createAction({+ auth: mauticAuth,+ name: 'mautic_create_note',+ outputSchema: mauticCreateNoteOutputSchema,+ displayName: 'Create Note',+ description: 'Creates a Mautic note.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Adds a note to a contact. Contact Id and Text are required. Each call adds another note.',+ idempotent: false,+ },+ props: {+ lead: Property.ShortText({+ displayName: 'Contact Id',+ description: 'Numeric id of the contact the note belongs to, from List Contacts.',+ required: true,+ }),+ text: Property.LongText({ displayName: 'Text', required: true }),+ type: Property.StaticDropdown({+ displayName: 'Type',+ description: 'Defaults to General.',+ required: false,+ options: {+ options: [+ { label: 'General', value: 'general' },+ { label: 'Email', value: 'email' },+ { label: 'Call', value: 'call' },+ { label: 'Meeting', value: 'meeting' },+ ],+ },+ }),+ dateTime: Property.ShortText({+ displayName: 'Date',+ description: 'When the note happened, e.g. "2026-05-01 09:00:00".',+ required: false,+ }),+ additionalFields: mauticAiProps.additionalFields({+ description: 'Other note properties. The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const { additionalFields, lead, text, type, dateTime } = context.propsValue;+ return await mauticApi.createRecord({+ auth: context.auth,+ resource: 'notes',+ body: {+ ...additionalFields,+ ...spreadIfDefined('lead', lead),+ ...spreadIfDefined('text', text),+ ...spreadIfDefined('type', type),+ ...spreadIfDefined('dateTime', dateTime),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/notes/delete-note.ts b/packages/pieces/community/mautic/src/lib/actions/ai/notes/delete-note.tsnew file mode 100644index 00000000000..df8891d14b0--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/notes/delete-note.ts@@ -0,0 +1,33 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticDeleteNoteOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticDeleteNoteAction = createAction({+ auth: mauticAuth,+ name: 'mautic_delete_note',+ outputSchema: mauticDeleteNoteOutputSchema,+ displayName: 'Delete Note',+ description: 'Permanently deletes a Mautic note.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description: 'Permanently deletes a note. Cannot be undone.',+ idempotent: false,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Note Id',+ description: 'Numeric note id, from List Notes or Create Note.',+ }),+ },+ async run(context) {+ return await mauticApi.deleteRecord({+ auth: context.auth,+ resource: 'notes',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/notes/get-note.ts b/packages/pieces/community/mautic/src/lib/actions/ai/notes/get-note.tsnew file mode 100644index 00000000000..f6be01415f9--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/notes/get-note.ts@@ -0,0 +1,33 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticCreateNoteOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticGetNoteAction = createAction({+ auth: mauticAuth,+ name: 'mautic_get_note',+ outputSchema: mauticCreateNoteOutputSchema,+ displayName: 'Get Note',+ description: 'Gets one Mautic note by id.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description: 'Gets a single note by its numeric id.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Note Id',+ description: 'Numeric note id, from List Notes or Create Note.',+ }),+ },+ async run(context) {+ return await mauticApi.getRecord({+ auth: context.auth,+ resource: 'notes',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/notes/list-notes.ts b/packages/pieces/community/mautic/src/lib/actions/ai/notes/list-notes.tsnew file mode 100644index 00000000000..8f4eca8934e--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/notes/list-notes.ts@@ -0,0 +1,32 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListNotesOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticListNotesAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_notes',+ outputSchema: mauticListNotesOutputSchema,+ displayName: 'List Notes',+ description: 'Lists Mautic notes.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists notes across all contacts. Use Where with col "lead" to narrow to one contact, or List Contact Notes. Page with Start and Limit; the response has the total count.',+ idempotent: true,+ },+ props: {+ ...mauticAiProps.listOptions,+ },+ async run(context) {+ return await mauticApi.listRecords({+ auth: context.auth,+ resource: 'notes',+ key: 'notes',+ query: context.propsValue,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/notes/output-schemas.ts b/packages/pieces/community/mautic/src/lib/actions/ai/notes/output-schemas.tsnew file mode 100644index 00000000000..1d1b923682c--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/notes/output-schemas.ts@@ -0,0 +1,30 @@+import { OutputSchema } from '@activepieces/pieces-framework';++import { noteFields, noteLeadFields } from '../../../output-schemas';++export const mauticCreateNoteOutputSchema: OutputSchema = {+ fields: [{ key: 'note', label: 'Note', children: noteFields }],+};++export const mauticDeleteNoteOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'note',+ label: 'Note',+ children: [+ { key: 'id', label: 'ID' },+ { key: 'text', label: 'Text' },+ { key: 'type', label: 'Type' },+ { key: 'dateTime', label: 'Date Time', format: 'datetime' },+ { key: 'lead', label: 'Lead', children: noteLeadFields },+ ],+ },+ ],+};++export const mauticListNotesOutputSchema: OutputSchema = {+ fields: [+ { key: 'total', label: 'Total', format: 'number' },+ { key: 'notes', label: 'Notes', labelKey: 'id', listItems: noteFields },+ ],+};diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/notes/update-note.ts b/packages/pieces/community/mautic/src/lib/actions/ai/notes/update-note.tsnew file mode 100644index 00000000000..44854f0910b--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/notes/update-note.ts@@ -0,0 +1,68 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticCreateNoteOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticUpdateNoteAction = createAction({+ auth: mauticAuth,+ name: 'mautic_update_note',+ outputSchema: mauticCreateNoteOutputSchema,+ displayName: 'Update Note',+ description: 'Updates fields of a Mautic note.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description: 'Updates an existing note. Only the fields given are changed.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Note Id',+ description: 'Numeric note id, from List Notes or Create Note.',+ }),+ lead: Property.ShortText({+ displayName: 'Contact Id',+ description: 'Numeric id of the contact the note belongs to, from List Contacts.',+ required: false,+ }),+ text: Property.LongText({ displayName: 'Text', required: false }),+ type: Property.StaticDropdown({+ displayName: 'Type',+ description: 'Defaults to General.',+ required: false,+ options: {+ options: [+ { label: 'General', value: 'general' },+ { label: 'Email', value: 'email' },+ { label: 'Call', value: 'call' },+ { label: 'Meeting', value: 'meeting' },+ ],+ },+ }),+ dateTime: Property.ShortText({+ displayName: 'Date',+ description: 'When the note happened, e.g. "2026-05-01 09:00:00".',+ required: false,+ }),+ additionalFields: mauticAiProps.additionalFields({+ description: 'Other note properties. The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const { id, additionalFields, lead, text, type, dateTime } = context.propsValue;+ return await mauticApi.updateRecord({+ auth: context.auth,+ resource: 'notes',+ id,+ body: {+ ...additionalFields,+ ...spreadIfDefined('lead', lead),+ ...spreadIfDefined('text', text),+ ...spreadIfDefined('type', type),+ ...spreadIfDefined('dateTime', dateTime),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/point-actions/create-point-action.ts b/packages/pieces/community/mautic/src/lib/actions/ai/point-actions/create-point-action.tsnew file mode 100644index 00000000000..7b323b4d540--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/point-actions/create-point-action.ts@@ -0,0 +1,86 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticCreatePointActionOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticCreatePointActionAction = createAction({+ auth: mauticAuth,+ name: 'mautic_create_point_action',+ outputSchema: mauticCreatePointActionOutputSchema,+ displayName: 'Create Point Action',+ description: 'Creates a Mautic point action.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Creates a point action. Name, Type and Points are required. Mautic ignores Properties on create, so set them afterwards with Update Point Action.',+ idempotent: false,+ },+ props: {+ name: Property.ShortText({ displayName: 'Name', required: true }),+ type: Property.ShortText({+ displayName: 'Type',+ description:+ 'Action type key, e.g. "email.open", "form.submit", "page.hit", "url.hit", "asset.download", from List Point Action Types.',+ required: true,+ }),+ delta: Property.Number({+ displayName: 'Points',+ description: 'Points to add when the action happens; negative to subtract.',+ required: true,+ }),+ description: Property.LongText({ displayName: 'Description', required: false }),+ properties: Property.Json({+ displayName: 'Properties',+ description:+ 'Type settings, e.g. {"emails": [12]} for email.open or {"page_url": "https://example.com/pricing"} for url.hit.',+ required: false,+ }),+ group: Property.Number({+ displayName: 'Point Group Id',+ description:+ 'Point group to score in instead of the total, from List Point Groups (Mautic 5.1+).',+ required: false,+ }),+ isPublished: mauticAiProps.yesNo({ displayName: 'Published' }),+ category: Property.Number({+ displayName: 'Category Id',+ description: 'Category id, from List Categories.',+ required: false,+ }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other point action properties, e.g. "repeatable", "publishUp", "publishDown". The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const {+ additionalFields,+ name,+ type,+ delta,+ description,+ properties,+ group,+ isPublished,+ category,+ } = context.propsValue;+ return await mauticApi.createRecord({+ auth: context.auth,+ resource: 'points',+ body: {+ ...additionalFields,+ ...spreadIfDefined('name', name),+ ...spreadIfDefined('type', type),+ ...spreadIfDefined('delta', delta),+ ...spreadIfDefined('description', description),+ ...spreadIfDefined('properties', properties),+ ...spreadIfDefined('group', group),+ ...spreadIfDefined('isPublished', isPublished),+ ...spreadIfDefined('category', category),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/point-actions/delete-point-action.ts b/packages/pieces/community/mautic/src/lib/actions/ai/point-actions/delete-point-action.tsnew file mode 100644index 00000000000..1917b64fbad--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/point-actions/delete-point-action.ts@@ -0,0 +1,33 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticDeletePointActionOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticDeletePointActionAction = createAction({+ auth: mauticAuth,+ name: 'mautic_delete_point_action',+ outputSchema: mauticDeletePointActionOutputSchema,+ displayName: 'Delete Point Action',+ description: 'Permanently deletes a Mautic point action.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description: 'Permanently deletes a point action; points already given stay. Cannot be undone.',+ idempotent: false,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Point Action Id',+ description: 'Numeric point action id, from List Point Actions or Create Point Action.',+ }),+ },+ async run(context) {+ return await mauticApi.deleteRecord({+ auth: context.auth,+ resource: 'points',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/point-actions/get-point-action.ts b/packages/pieces/community/mautic/src/lib/actions/ai/point-actions/get-point-action.tsnew file mode 100644index 00000000000..094c186e032--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/point-actions/get-point-action.ts@@ -0,0 +1,33 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticGetPointActionOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticGetPointActionAction = createAction({+ auth: mauticAuth,+ name: 'mautic_get_point_action',+ outputSchema: mauticGetPointActionOutputSchema,+ displayName: 'Get Point Action',+ description: 'Gets one Mautic point action by id.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description: 'Gets a single point action by its numeric id.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Point Action Id',+ description: 'Numeric point action id, from List Point Actions or Create Point Action.',+ }),+ },+ async run(context) {+ return await mauticApi.getRecord({+ auth: context.auth,+ resource: 'points',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/point-actions/list-point-action-types.ts b/packages/pieces/community/mautic/src/lib/actions/ai/point-actions/list-point-action-types.tsnew file mode 100644index 00000000000..178221d87e0--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/point-actions/list-point-action-types.ts@@ -0,0 +1,23 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListPointActionTypesOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticApi } from '../../../common/api';++export const mauticListPointActionTypesAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_point_action_types',+ outputSchema: mauticListPointActionTypesOutputSchema,+ displayName: 'List Point Action Types',+ description: 'Lists the Mautic point action types.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description: 'Lists the action type keys and labels that Create Point Action takes as Type.',+ idempotent: true,+ },+ props: {},+ async run(context) {+ return await mauticApi.listPointTypes({ auth: context.auth, kind: 'actions' });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/point-actions/list-point-actions.ts b/packages/pieces/community/mautic/src/lib/actions/ai/point-actions/list-point-actions.tsnew file mode 100644index 00000000000..41f08562beb--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/point-actions/list-point-actions.ts@@ -0,0 +1,32 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListPointActionsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticListPointActionsAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_point_actions',+ outputSchema: mauticListPointActionsOutputSchema,+ displayName: 'List Point Actions',+ description: 'Lists Mautic point actions.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists point actions, the rules that give contacts points for what they do. Page with Start and Limit; the response has the total count.',+ idempotent: true,+ },+ props: {+ ...mauticAiProps.listOptions,+ },+ async run(context) {+ return await mauticApi.listRecords({+ auth: context.auth,+ resource: 'points',+ key: 'points',+ query: context.propsValue,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/point-actions/output-schemas.ts b/packages/pieces/community/mautic/src/lib/actions/ai/point-actions/output-schemas.tsnew file mode 100644index 00000000000..93be1e157fc--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/point-actions/output-schemas.ts@@ -0,0 +1,70 @@+import { OutputSchema } from '@activepieces/pieces-framework';++import { categoryFields, pointFields } from '../../../output-schemas';++export const mauticCreatePointActionOutputSchema: OutputSchema = {+ fields: [{ key: 'point', label: 'Point', children: pointFields }],+};++export const mauticDeletePointActionOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'point',+ label: 'Point',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified' },+ { key: 'id', label: 'ID' },+ { key: 'name', label: 'Name' },+ { key: 'category', label: 'Category', children: categoryFields },+ { key: 'type', label: 'Type' },+ { key: 'description', label: 'Description' },+ { key: 'publishUp', label: 'Publish Up' },+ { key: 'publishDown', label: 'Publish Down' },+ { key: 'delta', label: 'Delta', format: 'number' },+ { key: 'properties', label: 'Properties' },+ { key: 'repeatable', label: 'Repeatable', format: 'boolean' },+ ],+ },+ ],+};++export const mauticGetPointActionOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'point',+ label: 'Point',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified', format: 'datetime' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'name', label: 'Name' },+ { key: 'category', label: 'Category', children: categoryFields },+ { key: 'type', label: 'Type' },+ { key: 'description', label: 'Description' },+ { key: 'publishUp', label: 'Publish Up' },+ { key: 'publishDown', label: 'Publish Down' },+ { key: 'delta', label: 'Delta', format: 'number' },+ {+ key: 'properties',+ label: 'Properties',+ children: [{ key: 'page_url', label: 'Page URL', format: 'url' }],+ },+ { key: 'repeatable', label: 'Repeatable', format: 'boolean' },+ ],+ },+ ],+};++export const mauticListPointActionTypesOutputSchema: OutputSchema = {+ fields: [{ key: 'pointActionTypes', label: 'Point Action Types', dynamicKey: true }],+};++export const mauticListPointActionsOutputSchema: OutputSchema = {+ fields: [+ { key: 'total', label: 'Total', format: 'number' },+ { key: 'points', label: 'Points', labelKey: 'name', listItems: pointFields },+ ],+};diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/point-actions/update-point-action.ts b/packages/pieces/community/mautic/src/lib/actions/ai/point-actions/update-point-action.tsnew file mode 100644index 00000000000..0939303fa2a--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/point-actions/update-point-action.ts@@ -0,0 +1,91 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticGetPointActionOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticUpdatePointActionAction = createAction({+ auth: mauticAuth,+ name: 'mautic_update_point_action',+ outputSchema: mauticGetPointActionOutputSchema,+ displayName: 'Update Point Action',+ description: 'Updates fields of a Mautic point action.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description: 'Updates an existing point action. Only the fields given are changed.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Point Action Id',+ description: 'Numeric point action id, from List Point Actions or Create Point Action.',+ }),+ name: Property.ShortText({ displayName: 'Name', required: false }),+ type: Property.ShortText({+ displayName: 'Type',+ description:+ 'Action type key, e.g. "email.open", "form.submit", "page.hit", "url.hit", "asset.download", from List Point Action Types.',+ required: false,+ }),+ delta: Property.Number({+ displayName: 'Points',+ description: 'Points to add when the action happens; negative to subtract.',+ required: false,+ }),+ description: Property.LongText({ displayName: 'Description', required: false }),+ properties: Property.Json({+ displayName: 'Properties',+ description:+ 'Type settings, e.g. {"emails": [12]} for email.open or {"page_url": "https://example.com/pricing"} for url.hit.',+ required: false,+ }),+ group: Property.Number({+ displayName: 'Point Group Id',+ description:+ 'Point group to score in instead of the total, from List Point Groups (Mautic 5.1+).',+ required: false,+ }),+ isPublished: mauticAiProps.yesNo({ displayName: 'Published' }),+ category: Property.Number({+ displayName: 'Category Id',+ description: 'Category id, from List Categories.',+ required: false,+ }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other point action properties, e.g. "repeatable", "publishUp", "publishDown". The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const {+ id,+ additionalFields,+ name,+ type,+ delta,+ description,+ properties,+ group,+ isPublished,+ category,+ } = context.propsValue;+ return await mauticApi.updateRecord({+ auth: context.auth,+ resource: 'points',+ id,+ body: {+ ...additionalFields,+ ...spreadIfDefined('name', name),+ ...spreadIfDefined('type', type),+ ...spreadIfDefined('delta', delta),+ ...spreadIfDefined('description', description),+ ...spreadIfDefined('properties', properties),+ ...spreadIfDefined('group', group),+ ...spreadIfDefined('isPublished', isPublished),+ ...spreadIfDefined('category', category),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/point-groups/create-point-group.ts b/packages/pieces/community/mautic/src/lib/actions/ai/point-groups/create-point-group.tsnew file mode 100644index 00000000000..8c3ef1ab49d--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/point-groups/create-point-group.ts@@ -0,0 +1,43 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticCreatePointGroupOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticCreatePointGroupAction = createAction({+ auth: mauticAuth,+ name: 'mautic_create_point_group',+ outputSchema: mauticCreatePointGroupOutputSchema,+ displayName: 'Create Point Group',+ description: 'Creates a Mautic point group.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ "Creates a point group. Name is required. Adjust a contact's score in it with Adjust Contact Group Points. Needs Mautic 5.1 or later.",+ idempotent: false,+ },+ props: {+ name: Property.ShortText({ displayName: 'Name', required: true }),+ description: Property.LongText({ displayName: 'Description', required: false }),+ isPublished: mauticAiProps.yesNo({ displayName: 'Published' }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other point group properties. The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const { additionalFields, name, description, isPublished } = context.propsValue;+ return await mauticApi.createRecord({+ auth: context.auth,+ resource: 'points/groups',+ body: {+ ...additionalFields,+ ...spreadIfDefined('name', name),+ ...spreadIfDefined('description', description),+ ...spreadIfDefined('isPublished', isPublished),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/point-groups/delete-point-group.ts b/packages/pieces/community/mautic/src/lib/actions/ai/point-groups/delete-point-group.tsnew file mode 100644index 00000000000..cf69f2cb766--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/point-groups/delete-point-group.ts@@ -0,0 +1,34 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticDeletePointGroupOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticDeletePointGroupAction = createAction({+ auth: mauticAuth,+ name: 'mautic_delete_point_group',+ outputSchema: mauticDeletePointGroupOutputSchema,+ displayName: 'Delete Point Group',+ description: 'Permanently deletes a Mautic point group.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description:+ 'Permanently deletes a point group and every contact score in it. Needs Mautic 5.1 or later. Cannot be undone.',+ idempotent: false,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Point Group Id',+ description: 'Numeric point group id, from List Point Groups or Create Point Group.',+ }),+ },+ async run(context) {+ return await mauticApi.deleteRecord({+ auth: context.auth,+ resource: 'points/groups',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/point-groups/get-point-group.ts b/packages/pieces/community/mautic/src/lib/actions/ai/point-groups/get-point-group.tsnew file mode 100644index 00000000000..5c2cbb6ea9f--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/point-groups/get-point-group.ts@@ -0,0 +1,33 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticGetPointGroupOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticGetPointGroupAction = createAction({+ auth: mauticAuth,+ name: 'mautic_get_point_group',+ outputSchema: mauticGetPointGroupOutputSchema,+ displayName: 'Get Point Group',+ description: 'Gets one Mautic point group by id.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description: 'Gets a single point group by its numeric id. Needs Mautic 5.1 or later.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Point Group Id',+ description: 'Numeric point group id, from List Point Groups or Create Point Group.',+ }),+ },+ async run(context) {+ return await mauticApi.getRecord({+ auth: context.auth,+ resource: 'points/groups',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/point-groups/list-point-groups.ts b/packages/pieces/community/mautic/src/lib/actions/ai/point-groups/list-point-groups.tsnew file mode 100644index 00000000000..a1fa08f5b8c--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/point-groups/list-point-groups.ts@@ -0,0 +1,32 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListPointGroupsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticListPointGroupsAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_point_groups',+ outputSchema: mauticListPointGroupsOutputSchema,+ displayName: 'List Point Groups',+ description: 'Lists Mautic point groups.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists point groups, which keep separate scores per contact. Needs Mautic 5.1 or later. Page with Start and Limit; the response has the total count.',+ idempotent: true,+ },+ props: {+ ...mauticAiProps.listOptions,+ },+ async run(context) {+ return await mauticApi.listRecords({+ auth: context.auth,+ resource: 'points/groups',+ key: 'pointGroups',+ query: context.propsValue,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/point-groups/output-schemas.ts b/packages/pieces/community/mautic/src/lib/actions/ai/point-groups/output-schemas.tsnew file mode 100644index 00000000000..011a5a344a7--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/point-groups/output-schemas.ts@@ -0,0 +1,48 @@+import { OutputSchema } from '@activepieces/pieces-framework';++import { pointGroupFields } from '../../../output-schemas';++export const mauticCreatePointGroupOutputSchema: OutputSchema = {+ fields: [{ key: 'pointGroup', label: 'Point Group', children: pointGroupFields }],+};++export const mauticDeletePointGroupOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'pointGroup',+ label: 'Point Group',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified' },+ { key: 'id', label: 'ID' },+ { key: 'name', label: 'Name' },+ { key: 'description', label: 'Description' },+ ],+ },+ ],+};++export const mauticGetPointGroupOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'pointGroup',+ label: 'Point Group',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified', format: 'datetime' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'name', label: 'Name' },+ { key: 'description', label: 'Description' },+ ],+ },+ ],+};++export const mauticListPointGroupsOutputSchema: OutputSchema = {+ fields: [+ { key: 'total', label: 'Total', format: 'number' },+ { key: 'pointGroups', label: 'Point Groups', labelKey: 'name', listItems: pointGroupFields },+ ],+};diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/point-groups/update-point-group.ts b/packages/pieces/community/mautic/src/lib/actions/ai/point-groups/update-point-group.tsnew file mode 100644index 00000000000..eba17979607--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/point-groups/update-point-group.ts@@ -0,0 +1,48 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticGetPointGroupOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticUpdatePointGroupAction = createAction({+ auth: mauticAuth,+ name: 'mautic_update_point_group',+ outputSchema: mauticGetPointGroupOutputSchema,+ displayName: 'Update Point Group',+ description: 'Updates fields of a Mautic point group.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Updates an existing point group. Needs Mautic 5.1 or later. Only the fields given are changed.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Point Group Id',+ description: 'Numeric point group id, from List Point Groups or Create Point Group.',+ }),+ name: Property.ShortText({ displayName: 'Name', required: false }),+ description: Property.LongText({ displayName: 'Description', required: false }),+ isPublished: mauticAiProps.yesNo({ displayName: 'Published' }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other point group properties. The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const { id, additionalFields, name, description, isPublished } = context.propsValue;+ return await mauticApi.updateRecord({+ auth: context.auth,+ resource: 'points/groups',+ id,+ body: {+ ...additionalFields,+ ...spreadIfDefined('name', name),+ ...spreadIfDefined('description', description),+ ...spreadIfDefined('isPublished', isPublished),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/point-triggers/create-point-trigger.ts b/packages/pieces/community/mautic/src/lib/actions/ai/point-triggers/create-point-trigger.tsnew file mode 100644index 00000000000..dd556ff0303--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/point-triggers/create-point-trigger.ts@@ -0,0 +1,90 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticCreatePointTriggerOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticCreatePointTriggerAction = createAction({+ auth: mauticAuth,+ name: 'mautic_create_point_trigger',+ outputSchema: mauticCreatePointTriggerOutputSchema,+ displayName: 'Create Point Trigger',+ description: 'Creates a Mautic point trigger.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description: 'Creates a point trigger. Name and Points are required.',+ idempotent: false,+ },+ props: {+ name: Property.ShortText({ displayName: 'Name', required: true }),+ points: Property.Number({+ displayName: 'Points',+ description: 'Score at which the trigger fires.',+ required: true,+ }),+ events: Property.Array({+ displayName: 'Events',+ description:+ 'What happens when it fires, each like {"name": "Add tag", "type": "lead.changetags", "properties": {"add_tags": ["hot"]}}. Types come from List Point Trigger Event Types. On update, events with an "id" are edited and others added.',+ required: false,+ }),+ triggerExistingLeads: mauticAiProps.yesNo({+ displayName: 'Apply to Existing Contacts',+ description: 'Whether contacts already at the score get the events.',+ }),+ color: Property.ShortText({+ displayName: 'Color',+ description: 'Hex color without "#", e.g. "a0acb8".',+ required: false,+ }),+ description: Property.LongText({ displayName: 'Description', required: false }),+ group: Property.Number({+ displayName: 'Point Group Id',+ description:+ 'Point group whose score is watched instead of the total, from List Point Groups (Mautic 5.1+).',+ required: false,+ }),+ isPublished: mauticAiProps.yesNo({ displayName: 'Published' }),+ category: Property.Number({+ displayName: 'Category Id',+ description: 'Category id, from List Categories.',+ required: false,+ }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other point trigger properties, e.g. "publishUp", "publishDown". The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const {+ additionalFields,+ name,+ points,+ events,+ triggerExistingLeads,+ color,+ description,+ group,+ isPublished,+ category,+ } = context.propsValue;+ return await mauticApi.createRecord({+ auth: context.auth,+ resource: 'points/triggers',+ body: {+ ...additionalFields,+ ...spreadIfDefined('name', name),+ ...spreadIfDefined('points', points),+ ...spreadIfDefined('events', events),+ ...spreadIfDefined('triggerExistingLeads', triggerExistingLeads),+ ...spreadIfDefined('color', color),+ ...spreadIfDefined('description', description),+ ...spreadIfDefined('group', group),+ ...spreadIfDefined('isPublished', isPublished),+ ...spreadIfDefined('category', category),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/point-triggers/delete-point-trigger-events.ts b/packages/pieces/community/mautic/src/lib/actions/ai/point-triggers/delete-point-trigger-events.tsnew file mode 100644index 00000000000..555a30a4ac1--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/point-triggers/delete-point-trigger-events.ts@@ -0,0 +1,40 @@+import { Property, createAction } from '@activepieces/pieces-framework';++import { mauticDeletePointTriggerEventsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';+import { mauticUtils } from '../../../common/utils';++export const mauticDeletePointTriggerEventsAction = createAction({+ auth: mauticAuth,+ name: 'mautic_delete_point_trigger_events',+ outputSchema: mauticDeletePointTriggerEventsOutputSchema,+ displayName: 'Delete Point Trigger Events',+ description: 'Removes events from a Mautic point trigger.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description:+ 'Removes events from a point trigger by id. Repeating it with the same ids changes nothing. Returns the trigger.',+ idempotent: true,+ },+ props: {+ triggerId: mauticAiProps.recordId({+ displayName: 'Point Trigger Id',+ description: 'Numeric point trigger id, from List Point Triggers.',+ }),+ ids: Property.Array({+ displayName: 'Event Ids',+ description: 'Event ids to delete, from the events of Get Point Trigger.',+ required: true,+ }),+ },+ async run(context) {+ return await mauticApi.deletePointTriggerEvents({+ auth: context.auth,+ triggerId: context.propsValue.triggerId,+ eventIds: mauticUtils.toBatchIds({ ids: context.propsValue.ids }),+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/point-triggers/delete-point-trigger.ts b/packages/pieces/community/mautic/src/lib/actions/ai/point-triggers/delete-point-trigger.tsnew file mode 100644index 00000000000..3320ed60856--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/point-triggers/delete-point-trigger.ts@@ -0,0 +1,33 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticDeletePointTriggerOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticDeletePointTriggerAction = createAction({+ auth: mauticAuth,+ name: 'mautic_delete_point_trigger',+ outputSchema: mauticDeletePointTriggerOutputSchema,+ displayName: 'Delete Point Trigger',+ description: 'Permanently deletes a Mautic point trigger.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description: 'Permanently deletes a point trigger and its events. Cannot be undone.',+ idempotent: false,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Point Trigger Id',+ description: 'Numeric point trigger id, from List Point Triggers or Create Point Trigger.',+ }),+ },+ async run(context) {+ return await mauticApi.deleteRecord({+ auth: context.auth,+ resource: 'points/triggers',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/point-triggers/get-point-trigger.ts b/packages/pieces/community/mautic/src/lib/actions/ai/point-triggers/get-point-trigger.tsnew file mode 100644index 00000000000..a715a19eee0--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/point-triggers/get-point-trigger.ts@@ -0,0 +1,33 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticCreatePointTriggerOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticGetPointTriggerAction = createAction({+ auth: mauticAuth,+ name: 'mautic_get_point_trigger',+ outputSchema: mauticCreatePointTriggerOutputSchema,+ displayName: 'Get Point Trigger',+ description: 'Gets one Mautic point trigger by id.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description: 'Gets a single point trigger by its numeric id, with its events.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Point Trigger Id',+ description: 'Numeric point trigger id, from List Point Triggers or Create Point Trigger.',+ }),+ },+ async run(context) {+ return await mauticApi.getRecord({+ auth: context.auth,+ resource: 'points/triggers',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/point-triggers/list-point-trigger-event-types.ts b/packages/pieces/community/mautic/src/lib/actions/ai/point-triggers/list-point-trigger-event-types.tsnew file mode 100644index 00000000000..0246a25456c--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/point-triggers/list-point-trigger-event-types.ts@@ -0,0 +1,23 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListPointTriggerEventTypesOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticApi } from '../../../common/api';++export const mauticListPointTriggerEventTypesAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_point_trigger_event_types',+ outputSchema: mauticListPointTriggerEventTypesOutputSchema,+ displayName: 'List Point Trigger Event Types',+ description: 'Lists the Mautic point trigger event types.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description: 'Lists the event type keys and labels that point trigger events take as "type".',+ idempotent: true,+ },+ props: {},+ async run(context) {+ return await mauticApi.listPointTypes({ auth: context.auth, kind: 'triggers/events' });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/point-triggers/list-point-triggers.ts b/packages/pieces/community/mautic/src/lib/actions/ai/point-triggers/list-point-triggers.tsnew file mode 100644index 00000000000..10249045ca8--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/point-triggers/list-point-triggers.ts@@ -0,0 +1,32 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListPointTriggersOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticListPointTriggersAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_point_triggers',+ outputSchema: mauticListPointTriggersOutputSchema,+ displayName: 'List Point Triggers',+ description: 'Lists Mautic point triggers.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists point triggers, which act when a contact reaches a score. Page with Start and Limit; the response has the total count.',+ idempotent: true,+ },+ props: {+ ...mauticAiProps.listOptions,+ },+ async run(context) {+ return await mauticApi.listRecords({+ auth: context.auth,+ resource: 'points/triggers',+ key: 'triggers',+ query: context.propsValue,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/point-triggers/output-schemas.ts b/packages/pieces/community/mautic/src/lib/actions/ai/point-triggers/output-schemas.tsnew file mode 100644index 00000000000..4535cfc534b--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/point-triggers/output-schemas.ts@@ -0,0 +1,115 @@+import { OutputSchema } from '@activepieces/pieces-framework';++import { categoryFields, triggerFields } from '../../../output-schemas';++export const mauticCreatePointTriggerOutputSchema: OutputSchema = {+ fields: [{ key: 'trigger', label: 'Trigger', children: triggerFields }],+};++export const mauticDeletePointTriggerEventsOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'trigger',+ label: 'Trigger',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified', format: 'datetime' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'name', label: 'Name' },+ {+ key: 'category',+ label: 'Category',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified', format: 'datetime' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'title', label: 'Title' },+ { key: 'alias', label: 'Alias' },+ { key: 'description', label: 'Description' },+ { key: 'color', label: 'Color' },+ { key: 'bundle', label: 'Bundle' },+ ],+ },+ { key: 'description', label: 'Description' },+ { key: 'points', label: 'Points', format: 'number' },+ { key: 'color', label: 'Color' },+ {+ key: 'events',+ label: 'Events',+ labelKey: 'name',+ listItems: [+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'name', label: 'Name' },+ { key: 'type', label: 'Type' },+ { key: 'order', label: 'Order', format: 'number' },+ {+ key: 'properties',+ label: 'Properties',+ children: [+ { key: 'add_tags', label: 'Add Tags' },+ { key: 'remove_tags', label: 'Remove Tags' },+ ],+ },+ ],+ },+ { key: 'triggerExistingLeads', label: 'Trigger Existing Leads', format: 'boolean' },+ ],+ },+ ],+};++export const mauticDeletePointTriggerOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'trigger',+ label: 'Trigger',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified', format: 'datetime' },+ { key: 'id', label: 'ID' },+ { key: 'name', label: 'Name' },+ { key: 'category', label: 'Category', children: categoryFields },+ { key: 'description', label: 'Description' },+ { key: 'publishUp', label: 'Publish Up' },+ { key: 'publishDown', label: 'Publish Down' },+ { key: 'points', label: 'Points', format: 'number' },+ { key: 'color', label: 'Color' },+ {+ key: 'events',+ label: 'Events',+ labelKey: 'name',+ listItems: [+ { key: 'id', label: 'ID' },+ { key: 'name', label: 'Name' },+ { key: 'description', label: 'Description' },+ { key: 'type', label: 'Type' },+ { key: 'order', label: 'Order', format: 'number' },+ {+ key: 'properties',+ label: 'Properties',+ children: [+ { key: 'add_tags', label: 'Add Tags' },+ { key: 'remove_tags', label: 'Remove Tags' },+ ],+ },+ ],+ },+ { key: 'triggerExistingLeads', label: 'Trigger Existing Leads', format: 'boolean' },+ ],+ },+ ],+};++export const mauticListPointTriggerEventTypesOutputSchema: OutputSchema = {+ fields: [{ key: 'eventTypes', label: 'Event Types', dynamicKey: true }],+};++export const mauticListPointTriggersOutputSchema: OutputSchema = {+ fields: [+ { key: 'total', label: 'Total', format: 'number' },+ { key: 'triggers', label: 'Triggers', labelKey: 'name', listItems: triggerFields },+ ],+};diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/point-triggers/update-point-trigger.ts b/packages/pieces/community/mautic/src/lib/actions/ai/point-triggers/update-point-trigger.tsnew file mode 100644index 00000000000..5b6cb1347be--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/point-triggers/update-point-trigger.ts@@ -0,0 +1,97 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticCreatePointTriggerOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticUpdatePointTriggerAction = createAction({+ auth: mauticAuth,+ name: 'mautic_update_point_trigger',+ outputSchema: mauticCreatePointTriggerOutputSchema,+ displayName: 'Update Point Trigger',+ description: 'Updates fields of a Mautic point trigger.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Updates an existing point trigger. Remove events with Delete Point Trigger Events. Only the fields given are changed.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Point Trigger Id',+ description: 'Numeric point trigger id, from List Point Triggers or Create Point Trigger.',+ }),+ name: Property.ShortText({ displayName: 'Name', required: false }),+ points: Property.Number({+ displayName: 'Points',+ description: 'Score at which the trigger fires.',+ required: false,+ }),+ events: Property.Array({+ displayName: 'Events',+ description:+ 'What happens when it fires, each like {"name": "Add tag", "type": "lead.changetags", "properties": {"add_tags": ["hot"]}}. Types come from List Point Trigger Event Types. On update, events with an "id" are edited and others added.',+ required: false,+ }),+ triggerExistingLeads: mauticAiProps.yesNo({+ displayName: 'Apply to Existing Contacts',+ description: 'Whether contacts already at the score get the events.',+ }),+ color: Property.ShortText({+ displayName: 'Color',+ description: 'Hex color without "#", e.g. "a0acb8".',+ required: false,+ }),+ description: Property.LongText({ displayName: 'Description', required: false }),+ group: Property.Number({+ displayName: 'Point Group Id',+ description:+ 'Point group whose score is watched instead of the total, from List Point Groups (Mautic 5.1+).',+ required: false,+ }),+ isPublished: mauticAiProps.yesNo({ displayName: 'Published' }),+ category: Property.Number({+ displayName: 'Category Id',+ description: 'Category id, from List Categories.',+ required: false,+ }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other point trigger properties, e.g. "publishUp", "publishDown". The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const {+ id,+ additionalFields,+ name,+ points,+ events,+ triggerExistingLeads,+ color,+ description,+ group,+ isPublished,+ category,+ } = context.propsValue;+ return await mauticApi.updateRecord({+ auth: context.auth,+ resource: 'points/triggers',+ id,+ body: {+ ...additionalFields,+ ...spreadIfDefined('name', name),+ ...spreadIfDefined('points', points),+ ...spreadIfDefined('events', events),+ ...spreadIfDefined('triggerExistingLeads', triggerExistingLeads),+ ...spreadIfDefined('color', color),+ ...spreadIfDefined('description', description),+ ...spreadIfDefined('group', group),+ ...spreadIfDefined('isPublished', isPublished),+ ...spreadIfDefined('category', category),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/push-notifications/create-push-notification.ts b/packages/pieces/community/mautic/src/lib/actions/ai/push-notifications/create-push-notification.tsnew file mode 100644index 00000000000..dacefba0d94--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/push-notifications/create-push-notification.ts@@ -0,0 +1,64 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticCreatePushNotificationOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticCreatePushNotificationAction = createAction({+ auth: mauticAuth,+ name: 'mautic_create_push_notification',+ outputSchema: mauticCreatePushNotificationOutputSchema,+ displayName: 'Create Push Notification',+ description: 'Creates a Mautic push notification.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Creates a web push notification. Name, Heading and Message are required. Sending needs a push provider configured in Mautic.',+ idempotent: false,+ },+ props: {+ name: Property.ShortText({ displayName: 'Name', required: true }),+ heading: Property.ShortText({ displayName: 'Heading', required: true }),+ message: Property.LongText({ displayName: 'Message', required: true }),+ url: Property.ShortText({+ displayName: 'URL',+ description: 'Page opened when the notification is clicked.',+ required: false,+ }),+ isPublished: mauticAiProps.yesNo({ displayName: 'Published' }),+ category: Property.Number({+ displayName: 'Category Id',+ description: 'Category id, from List Categories.',+ required: false,+ }),+ language: Property.ShortText({+ displayName: 'Language',+ description: 'Locale code, e.g. "en".',+ required: false,+ }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other web push properties, e.g. "button", "utmTags", "publishUp", "publishDown". The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const { additionalFields, name, heading, message, url, isPublished, category, language } =+ context.propsValue;+ return await mauticApi.createRecord({+ auth: context.auth,+ resource: 'notifications',+ body: {+ ...additionalFields,+ ...spreadIfDefined('name', name),+ ...spreadIfDefined('heading', heading),+ ...spreadIfDefined('message', message),+ ...spreadIfDefined('url', url),+ ...spreadIfDefined('isPublished', isPublished),+ ...spreadIfDefined('category', category),+ ...spreadIfDefined('language', language),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/push-notifications/delete-push-notification.ts b/packages/pieces/community/mautic/src/lib/actions/ai/push-notifications/delete-push-notification.tsnew file mode 100644index 00000000000..3dede0591ba--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/push-notifications/delete-push-notification.ts@@ -0,0 +1,34 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticDeletePushNotificationOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticDeletePushNotificationAction = createAction({+ auth: mauticAuth,+ name: 'mautic_delete_push_notification',+ outputSchema: mauticDeletePushNotificationOutputSchema,+ displayName: 'Delete Push Notification',+ description: 'Permanently deletes a Mautic push notification.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description: 'Permanently deletes a web push notification. Cannot be undone.',+ idempotent: false,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Push Notification Id',+ description:+ 'Numeric push notification id, from List Push Notifications or Create Push Notification.',+ }),+ },+ async run(context) {+ return await mauticApi.deleteRecord({+ auth: context.auth,+ resource: 'notifications',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/push-notifications/get-push-notification.ts b/packages/pieces/community/mautic/src/lib/actions/ai/push-notifications/get-push-notification.tsnew file mode 100644index 00000000000..e03636a15ab--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/push-notifications/get-push-notification.ts@@ -0,0 +1,34 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticGetPushNotificationOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticGetPushNotificationAction = createAction({+ auth: mauticAuth,+ name: 'mautic_get_push_notification',+ outputSchema: mauticGetPushNotificationOutputSchema,+ displayName: 'Get Push Notification',+ description: 'Gets one Mautic push notification by id.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description: 'Gets a single web push notification by its numeric id.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Push Notification Id',+ description:+ 'Numeric push notification id, from List Push Notifications or Create Push Notification.',+ }),+ },+ async run(context) {+ return await mauticApi.getRecord({+ auth: context.auth,+ resource: 'notifications',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/push-notifications/list-push-notifications.ts b/packages/pieces/community/mautic/src/lib/actions/ai/push-notifications/list-push-notifications.tsnew file mode 100644index 00000000000..a102671d1a7--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/push-notifications/list-push-notifications.ts@@ -0,0 +1,32 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListPushNotificationsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticListPushNotificationsAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_push_notifications',+ outputSchema: mauticListPushNotificationsOutputSchema,+ displayName: 'List Push Notifications',+ description: 'Lists Mautic push notifications.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists web push notifications with their sent counts. Page with Start and Limit; the response has the total count.',+ idempotent: true,+ },+ props: {+ ...mauticAiProps.listOptions,+ },+ async run(context) {+ return await mauticApi.listRecords({+ auth: context.auth,+ resource: 'notifications',+ key: 'notifications',+ query: context.propsValue,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/push-notifications/output-schemas.ts b/packages/pieces/community/mautic/src/lib/actions/ai/push-notifications/output-schemas.tsnew file mode 100644index 00000000000..42e84962c60--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/push-notifications/output-schemas.ts@@ -0,0 +1,77 @@+import { OutputSchema } from '@activepieces/pieces-framework';++import {+ categoryFields,+ dynamicContentUtmTagsFields,+ notificationFields,+} from '../../../output-schemas';++export const mauticCreatePushNotificationOutputSchema: OutputSchema = {+ fields: [{ key: 'notification', label: 'Notification', children: notificationFields }],+};++export const mauticDeletePushNotificationOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'notification',+ label: 'Notification',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified' },+ { key: 'id', label: 'ID' },+ { key: 'name', label: 'Name' },+ { key: 'heading', label: 'Heading' },+ { key: 'message', label: 'Message' },+ { key: 'url', label: 'URL', format: 'url' },+ { key: 'language', label: 'Language' },+ { key: 'category', label: 'Category', children: categoryFields },+ { key: 'button', label: 'Button' },+ { key: 'utmTags', label: 'Utm Tags', children: dynamicContentUtmTagsFields },+ { key: 'publishUp', label: 'Publish Up' },+ { key: 'publishDown', label: 'Publish Down' },+ { key: 'readCount', label: 'Read Count', format: 'number' },+ { key: 'sentCount', label: 'Sent Count', format: 'number' },+ ],+ },+ ],+};++export const mauticGetPushNotificationOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'notification',+ label: 'Notification',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified', format: 'datetime' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'name', label: 'Name' },+ { key: 'heading', label: 'Heading' },+ { key: 'message', label: 'Message' },+ { key: 'url', label: 'URL', format: 'url' },+ { key: 'language', label: 'Language' },+ { key: 'category', label: 'Category', children: categoryFields },+ { key: 'button', label: 'Button' },+ { key: 'utmTags', label: 'Utm Tags', children: dynamicContentUtmTagsFields },+ { key: 'publishUp', label: 'Publish Up' },+ { key: 'publishDown', label: 'Publish Down' },+ { key: 'readCount', label: 'Read Count', format: 'number' },+ { key: 'sentCount', label: 'Sent Count', format: 'number' },+ ],+ },+ ],+};++export const mauticListPushNotificationsOutputSchema: OutputSchema = {+ fields: [+ { key: 'total', label: 'Total', format: 'number' },+ {+ key: 'notifications',+ label: 'Notifications',+ labelKey: 'name',+ listItems: notificationFields,+ },+ ],+};diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/push-notifications/update-push-notification.ts b/packages/pieces/community/mautic/src/lib/actions/ai/push-notifications/update-push-notification.tsnew file mode 100644index 00000000000..03f15defe23--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/push-notifications/update-push-notification.ts@@ -0,0 +1,69 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticGetPushNotificationOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticUpdatePushNotificationAction = createAction({+ auth: mauticAuth,+ name: 'mautic_update_push_notification',+ outputSchema: mauticGetPushNotificationOutputSchema,+ displayName: 'Update Push Notification',+ description: 'Updates fields of a Mautic push notification.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description: 'Updates an existing web push notification. Only the fields given are changed.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Push Notification Id',+ description:+ 'Numeric push notification id, from List Push Notifications or Create Push Notification.',+ }),+ name: Property.ShortText({ displayName: 'Name', required: false }),+ heading: Property.ShortText({ displayName: 'Heading', required: false }),+ message: Property.LongText({ displayName: 'Message', required: false }),+ url: Property.ShortText({+ displayName: 'URL',+ description: 'Page opened when the notification is clicked.',+ required: false,+ }),+ isPublished: mauticAiProps.yesNo({ displayName: 'Published' }),+ category: Property.Number({+ displayName: 'Category Id',+ description: 'Category id, from List Categories.',+ required: false,+ }),+ language: Property.ShortText({+ displayName: 'Language',+ description: 'Locale code, e.g. "en".',+ required: false,+ }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other web push properties, e.g. "button", "utmTags", "publishUp", "publishDown". The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const { id, additionalFields, name, heading, message, url, isPublished, category, language } =+ context.propsValue;+ return await mauticApi.updateRecord({+ auth: context.auth,+ resource: 'notifications',+ id,+ body: {+ ...additionalFields,+ ...spreadIfDefined('name', name),+ ...spreadIfDefined('heading', heading),+ ...spreadIfDefined('message', message),+ ...spreadIfDefined('url', url),+ ...spreadIfDefined('isPublished', isPublished),+ ...spreadIfDefined('category', category),+ ...spreadIfDefined('language', language),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/reports/create-report.ts b/packages/pieces/community/mautic/src/lib/actions/ai/reports/create-report.tsnew file mode 100644index 00000000000..f915775dbdf--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/reports/create-report.ts@@ -0,0 +1,69 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticCreateReportOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticCreateReportAction = createAction({+ auth: mauticAuth,+ name: 'mautic_create_report',+ outputSchema: mauticCreateReportOutputSchema,+ displayName: 'Create Report',+ description: 'Creates a Mautic report.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description: 'Creates a report. Name and Source are required, with the columns to show.',+ idempotent: false,+ },+ props: {+ name: Property.ShortText({ displayName: 'Name', required: true }),+ source: Property.ShortText({+ displayName: 'Source',+ description:+ 'Data source, e.g. "leads", "companies", "email.stats", "page.hits", "form.submissions", "asset.downloads", "campaign_lead_event_log".',+ required: true,+ }),+ columns: Property.Array({+ displayName: 'Columns',+ description:+ 'Column keys to include, e.g. ["l.id", "l.email", "l.firstname"]. Get Report on an existing report shows valid keys.',+ required: false,+ }),+ filters: Property.Array({+ displayName: 'Filters',+ description:+ 'Filters, each like {"column": "l.email", "condition": "like", "value": "%@example.com", "glue": "and"}.',+ required: false,+ }),+ description: Property.LongText({ displayName: 'Description', required: false }),+ isPublished: mauticAiProps.yesNo({ displayName: 'Published' }),+ system: mauticAiProps.yesNo({+ displayName: 'Visible to Everyone',+ description: 'Whether all users can see the report.',+ }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other report properties, e.g. "tableOrder", "graphs", "groupBy", "aggregators", "isScheduled", "scheduleUnit", "toAddress". The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const { additionalFields, name, source, columns, filters, description, isPublished, system } =+ context.propsValue;+ return await mauticApi.createRecord({+ auth: context.auth,+ resource: 'reports',+ body: {+ ...additionalFields,+ ...spreadIfDefined('name', name),+ ...spreadIfDefined('source', source),+ ...spreadIfDefined('columns', columns),+ ...spreadIfDefined('filters', filters),+ ...spreadIfDefined('description', description),+ ...spreadIfDefined('isPublished', isPublished),+ ...spreadIfDefined('system', system),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/reports/delete-report.ts b/packages/pieces/community/mautic/src/lib/actions/ai/reports/delete-report.tsnew file mode 100644index 00000000000..ddc092f1de8--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/reports/delete-report.ts@@ -0,0 +1,33 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticDeleteReportOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticDeleteReportAction = createAction({+ auth: mauticAuth,+ name: 'mautic_delete_report',+ outputSchema: mauticDeleteReportOutputSchema,+ displayName: 'Delete Report',+ description: 'Permanently deletes a Mautic report.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description: 'Permanently deletes a report. Cannot be undone.',+ idempotent: false,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Report Id',+ description: 'Numeric report id, from List Reports or Create Report.',+ }),+ },+ async run(context) {+ return await mauticApi.deleteRecord({+ auth: context.auth,+ resource: 'reports',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/reports/get-dashboard-widget-data.ts b/packages/pieces/community/mautic/src/lib/actions/ai/reports/get-dashboard-widget-data.tsnew file mode 100644index 00000000000..a688e81a308--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/reports/get-dashboard-widget-data.ts@@ -0,0 +1,75 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticGetDashboardWidgetDataOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticGetDashboardWidgetDataAction = createAction({+ auth: mauticAuth,+ name: 'mautic_get_dashboard_widget_data',+ outputSchema: mauticGetDashboardWidgetDataOutputSchema,+ displayName: 'Get Dashboard Widget Data',+ description: 'Gets the data of a Mautic dashboard widget.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description:+ 'Gets the chart or table data of one dashboard widget type for a date range, e.g. contacts created per day. Widget types come from List Dashboard Widget Types.',+ idempotent: true,+ },+ props: {+ type: mauticAiProps.recordId({+ displayName: 'Widget Type',+ description: 'Widget type key, from List Dashboard Widget Types.',+ }),+ dateFrom: Property.ShortText({+ displayName: 'Date From',+ description: 'Date in UTC, e.g. "2026-01-31".',+ required: false,+ }),+ dateTo: Property.ShortText({+ displayName: 'Date To',+ description: 'Date in UTC, e.g. "2026-01-31".',+ required: false,+ }),+ timeUnit: Property.StaticDropdown({+ displayName: 'Time Unit',+ description: 'Grouping of time charts. Defaults to Year.',+ required: false,+ options: {+ options: [+ { label: 'Year', value: 'Y' },+ { label: 'Month', value: 'm' },+ { label: 'Week', value: 'W' },+ { label: 'Day', value: 'd' },+ { label: 'Hour', value: 'H' },+ ],+ },+ }),+ timezone: Property.ShortText({+ displayName: 'Timezone',+ description: 'e.g. "Europe/Berlin". Defaults to UTC.',+ required: false,+ }),+ limit: Property.Number({+ displayName: 'Limit',+ description: 'Maximum rows for table widgets.',+ required: false,+ }),+ },+ async run(context) {+ const { type, dateFrom, dateTo, timeUnit, timezone, limit } = context.propsValue;+ return await mauticApi.getDashboardData({+ auth: context.auth,+ type,+ query: {+ ...spreadIfDefined('dateFrom', dateFrom),+ ...spreadIfDefined('dateTo', dateTo),+ ...spreadIfDefined('timeUnit', timeUnit),+ ...spreadIfDefined('timezone', timezone),+ ...spreadIfDefined('limit', limit?.toString()),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/reports/get-report.ts b/packages/pieces/community/mautic/src/lib/actions/ai/reports/get-report.tsnew file mode 100644index 00000000000..3448751e969--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/reports/get-report.ts@@ -0,0 +1,60 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticGetReportOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticGetReportAction = createAction({+ auth: mauticAuth,+ name: 'mautic_get_report',+ outputSchema: mauticGetReportOutputSchema,+ displayName: 'Get Report',+ description: 'Runs a saved Mautic report and returns its rows.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description:+ "Runs a saved report and returns its rows for a date range, with the total count. Page with Page and Limit. Defaults to the report's own date range.",+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Report Id',+ description: 'Numeric report id, from List Reports or Create Report.',+ }),+ dateFrom: Property.ShortText({+ displayName: 'Date From',+ description: 'Date in UTC, e.g. "2026-01-31".',+ required: false,+ }),+ dateTo: Property.ShortText({+ displayName: 'Date To',+ description: 'Date in UTC, e.g. "2026-01-31".',+ required: false,+ }),+ page: Property.Number({+ displayName: 'Page',+ description: 'Page number, starting at 1.',+ required: false,+ }),+ limit: Property.Number({+ displayName: 'Limit',+ description: 'Rows per page.',+ required: false,+ }),+ },+ async run(context) {+ const { id, dateFrom, dateTo, page, limit } = context.propsValue;+ return await mauticApi.getReport({+ auth: context.auth,+ id,+ query: {+ ...spreadIfDefined('dateFrom', dateFrom),+ ...spreadIfDefined('dateTo', dateTo),+ ...spreadIfDefined('page', page?.toString()),+ ...spreadIfDefined('limit', limit?.toString()),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/reports/get-stats.ts b/packages/pieces/community/mautic/src/lib/actions/ai/reports/get-stats.tsnew file mode 100644index 00000000000..a8ae116587d--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/reports/get-stats.ts@@ -0,0 +1,38 @@+import { Property, createAction } from '@activepieces/pieces-framework';++import { mauticGetStatsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticGetStatsAction = createAction({+ auth: mauticAuth,+ name: 'mautic_get_stats',+ outputSchema: mauticGetStatsOutputSchema,+ displayName: 'Get Stats',+ description: 'Reads raw rows from a Mautic stats table.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Reads raw rows from a Mautic stats table, e.g. "email_stats", "page_hits", "form_submissions", "lead_points_change_log", "campaign_lead_event_log". Leave Table empty to list the available tables and their columns. Filter with Where; page with Start and Limit. Each table needs its own view permission.',+ idempotent: true,+ },+ props: {+ table: Property.ShortText({+ displayName: 'Table',+ description: 'Stats table name; leave empty to list the tables.',+ required: false,+ }),+ start: mauticAiProps.pageOptions.start,+ limit: mauticAiProps.pageOptions.limit,+ where: mauticAiProps.listOptions.where,+ },+ async run(context) {+ return await mauticApi.getStats({+ auth: context.auth,+ table: context.propsValue.table,+ query: context.propsValue,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/reports/list-dashboard-widget-types.ts b/packages/pieces/community/mautic/src/lib/actions/ai/reports/list-dashboard-widget-types.tsnew file mode 100644index 00000000000..b5dd356bb2d--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/reports/list-dashboard-widget-types.ts@@ -0,0 +1,24 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListDashboardWidgetTypesOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticApi } from '../../../common/api';++export const mauticListDashboardWidgetTypesAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_dashboard_widget_types',+ outputSchema: mauticListDashboardWidgetTypesOutputSchema,+ displayName: 'List Dashboard Widget Types',+ description: 'Lists the Mautic dashboard widget types.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists the dashboard widget types (e.g. "created.leads.in.time", "emails.in.time", "page.hits.in.time") whose data Get Dashboard Widget Data returns.',+ idempotent: true,+ },+ props: {},+ async run(context) {+ return await mauticApi.getDashboardData({ auth: context.auth });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/reports/list-reports.ts b/packages/pieces/community/mautic/src/lib/actions/ai/reports/list-reports.tsnew file mode 100644index 00000000000..9f516ddf0a3--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/reports/list-reports.ts@@ -0,0 +1,32 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListReportsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticListReportsAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_reports',+ outputSchema: mauticListReportsOutputSchema,+ displayName: 'List Reports',+ description: 'Lists Mautic reports.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists saved reports with their source, columns and filters. Page with Start and Limit; the response has the total count.',+ idempotent: true,+ },+ props: {+ ...mauticAiProps.listOptions,+ },+ async run(context) {+ return await mauticApi.listRecords({+ auth: context.auth,+ resource: 'reports',+ key: 'reports',+ query: context.propsValue,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/reports/output-schemas.ts b/packages/pieces/community/mautic/src/lib/actions/ai/reports/output-schemas.tsnew file mode 100644index 00000000000..d6edaf2df91--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/reports/output-schemas.ts@@ -0,0 +1,201 @@+import { OutputSchema } from '@activepieces/pieces-framework';++import { reportFiltersFields, reportsFields } from '../../../output-schemas';++export const mauticCreateReportOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'report',+ label: 'Report',+ children: [+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'name', label: 'Name' },+ { key: 'description', label: 'Description' },+ { key: 'system', label: 'System', format: 'boolean' },+ { key: 'isScheduled', label: 'Is Scheduled', format: 'boolean' },+ { key: 'source', label: 'Source' },+ { key: 'columns', label: 'Columns' },+ { key: 'filters', label: 'Filters', listItems: reportFiltersFields },+ { key: 'tableOrder', label: 'Table Order' },+ { key: 'graphs', label: 'Graphs' },+ { key: 'groupBy', label: 'Group By' },+ {+ key: 'settings',+ label: 'Settings',+ children: [+ { key: 'showGraphsAboveTable', label: 'Show Graphs Above Table' },+ { key: 'showDynamicFilters', label: 'Show Dynamic Filters' },+ { key: 'hideDateRangeFilter', label: 'Hide Date Range Filter' },+ ],+ },+ { key: 'aggregators', label: 'Aggregators' },+ { key: 'scheduleUnit', label: 'Schedule Unit' },+ { key: 'toAddress', label: 'To Address' },+ { key: 'scheduleDay', label: 'Schedule Day' },+ { key: 'scheduleMonthFrequency', label: 'Schedule Month Frequency' },+ ],+ },+ ],+};++export const mauticDeleteReportOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'report',+ label: 'Report',+ children: [+ { key: 'id', label: 'ID' },+ { key: 'name', label: 'Name' },+ { key: 'description', label: 'Description' },+ { key: 'system', label: 'System', format: 'boolean' },+ { key: 'isScheduled', label: 'Is Scheduled', format: 'boolean' },+ { key: 'source', label: 'Source' },+ { key: 'columns', label: 'Columns' },+ { key: 'filters', label: 'Filters', listItems: reportFiltersFields },+ { key: 'tableOrder', label: 'Table Order' },+ { key: 'graphs', label: 'Graphs' },+ { key: 'groupBy', label: 'Group By' },+ {+ key: 'settings',+ label: 'Settings',+ children: [+ { key: 'showDynamicFilters', label: 'Show Dynamic Filters' },+ { key: 'hideDateRangeFilter', label: 'Hide Date Range Filter' },+ { key: 'showGraphsAboveTable', label: 'Show Graphs Above Table' },+ ],+ },+ { key: 'aggregators', label: 'Aggregators' },+ { key: 'scheduleUnit', label: 'Schedule Unit' },+ { key: 'toAddress', label: 'To Address' },+ { key: 'scheduleDay', label: 'Schedule Day' },+ { key: 'scheduleMonthFrequency', label: 'Schedule Month Frequency' },+ ],+ },+ ],+};++export const mauticGetDashboardWidgetDataOutputSchema: OutputSchema = {+ fields: [+ { key: 'success', label: 'Success', format: 'number' },+ { key: 'cached', label: 'Cached', format: 'boolean' },+ { key: 'execution_time', label: 'Execution Time', format: 'number' },+ { key: 'data', label: 'Data' },+ ],+};++export const mauticGetReportOutputSchema: OutputSchema = {+ fields: [+ { key: 'totalResults', label: 'Total Results', format: 'number' },+ { key: 'data', label: 'Data' },+ { key: 'dataColumns', label: 'Data Columns', dynamicKey: true },+ { key: 'limit', label: 'Limit', format: 'number' },+ { key: 'page', label: 'Page', format: 'number' },+ { key: 'debug', label: 'Debug' },+ { key: 'aggregatorColumns', label: 'Aggregator Columns' },+ {+ key: 'report',+ label: 'Report',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'name', label: 'Name' },+ { key: 'description', label: 'Description' },+ { key: 'system', label: 'System', format: 'boolean' },+ { key: 'isScheduled', label: 'Is Scheduled', format: 'boolean' },+ { key: 'source', label: 'Source' },+ { key: 'columns', label: 'Columns' },+ {+ key: 'filters',+ label: 'Filters',+ listItems: [+ { key: 'column', label: 'Column' },+ { key: 'condition', label: 'Condition' },+ { key: 'value', label: 'Value' },+ ],+ },+ {+ key: 'tableOrder',+ label: 'Table Order',+ listItems: [+ { key: 'column', label: 'Column' },+ { key: 'direction', label: 'Direction' },+ ],+ },+ { key: 'graphs', label: 'Graphs' },+ { key: 'groupBy', label: 'Group By' },+ { key: 'settings', label: 'Settings' },+ { key: 'aggregators', label: 'Aggregators' },+ { key: 'dateModified', label: 'Date Modified', format: 'datetime' },+ ],+ },+ { key: 'dateFrom', label: 'Date From', format: 'datetime' },+ { key: 'dateTo', label: 'Date To', format: 'datetime' },+ ],+};++export const mauticGetStatsOutputSchema: OutputSchema = {+ fields: [+ { key: 'total', label: 'Total' },+ { key: 'stats', label: 'Stats' },+ { key: 'availableTables', label: 'Available Tables' },+ {+ key: 'tableColumns',+ label: 'Table Columns',+ children: [+ { key: 'asset_downloads', label: 'Asset Downloads' },+ { key: 'audit_log', label: 'Audit Log' },+ { key: 'campaign_lead_event_log', label: 'Campaign Lead Event Log' },+ { key: 'campaign_leads', label: 'Campaign Leads' },+ { key: 'channel_url_trackables', label: 'Channel URL Trackables' },+ { key: 'companies_leads', label: 'Companies Leads' },+ { key: 'dynamic_content_lead_data', label: 'Dynamic Content Lead Data' },+ { key: 'dynamic_content_stats', label: 'Dynamic Content Stats' },+ { key: 'email_stat_replies', label: 'Email Stat Replies' },+ { key: 'email_stats', label: 'Email Stats' },+ { key: 'email_stats_devices', label: 'Email Stats Devices' },+ { key: 'focus_stats', label: 'Focus Stats' },+ { key: 'form_submissions', label: 'Form Submissions' },+ { key: 'ip_addresses', label: 'IP Addresses' },+ { key: 'lead_categories', label: 'Lead Categories' },+ { key: 'lead_companies_change_log', label: 'Lead Companies Change Log' },+ { key: 'lead_devices', label: 'Lead Devices' },+ { key: 'lead_donotcontact', label: 'Lead Donotcontact' },+ { key: 'lead_event_log', label: 'Lead Event Log' },+ { key: 'lead_frequencyrules', label: 'Lead Frequencyrules' },+ { key: 'lead_lists_leads', label: 'Lead Lists Leads' },+ { key: 'lead_points_change_log', label: 'Lead Points Change Log' },+ { key: 'lead_stages_change_log', label: 'Lead Stages Change Log' },+ { key: 'lead_utmtags', label: 'Lead Utmtags' },+ { key: 'page_hits', label: 'Page Hits' },+ { key: 'page_redirects', label: 'Page Redirects' },+ { key: 'point_lead_action_log', label: 'Point Lead Action Log' },+ { key: 'point_lead_event_log', label: 'Point Lead Event Log' },+ { key: 'push_notification_stats', label: 'Push Notification Stats' },+ { key: 'sms_message_stats', label: 'Sms Message Stats' },+ { key: 'stage_lead_action_log', label: 'Stage Lead Action Log' },+ { key: 'tweet_stats', label: 'Tweet Stats' },+ { key: 'video_hits', label: 'Video Hits' },+ { key: 'webhook_logs', label: 'Webhook Logs' },+ ],+ },+ ],+};++export const mauticListDashboardWidgetTypesOutputSchema: OutputSchema = {+ fields: [+ { key: 'success', label: 'Success', format: 'number' },+ { key: 'types', label: 'Types', dynamicKey: true },+ ],+};++export const mauticListReportsOutputSchema: OutputSchema = {+ fields: [+ { key: 'total', label: 'Total', format: 'number' },+ { key: 'reports', label: 'Reports', labelKey: 'name', listItems: reportsFields },+ ],+};++export const mauticUpdateReportOutputSchema: OutputSchema = {+ fields: [{ key: 'report', label: 'Report', children: reportsFields }],+};diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/reports/update-report.ts b/packages/pieces/community/mautic/src/lib/actions/ai/reports/update-report.tsnew file mode 100644index 00000000000..a29d04aef8b--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/reports/update-report.ts@@ -0,0 +1,83 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticUpdateReportOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticUpdateReportAction = createAction({+ auth: mauticAuth,+ name: 'mautic_update_report',+ outputSchema: mauticUpdateReportOutputSchema,+ displayName: 'Update Report',+ description: 'Updates fields of a Mautic report.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description: 'Updates an existing report. Only the fields given are changed.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Report Id',+ description: 'Numeric report id, from List Reports or Create Report.',+ }),+ name: Property.ShortText({ displayName: 'Name', required: false }),+ source: Property.ShortText({+ displayName: 'Source',+ description:+ 'Data source, e.g. "leads", "companies", "email.stats", "page.hits", "form.submissions", "asset.downloads", "campaign_lead_event_log".',+ required: false,+ }),+ columns: Property.Array({+ displayName: 'Columns',+ description:+ 'Column keys to include, e.g. ["l.id", "l.email", "l.firstname"]. Get Report on an existing report shows valid keys.',+ required: false,+ }),+ filters: Property.Array({+ displayName: 'Filters',+ description:+ 'Filters, each like {"column": "l.email", "condition": "like", "value": "%@example.com", "glue": "and"}.',+ required: false,+ }),+ description: Property.LongText({ displayName: 'Description', required: false }),+ isPublished: mauticAiProps.yesNo({ displayName: 'Published' }),+ system: mauticAiProps.yesNo({+ displayName: 'Visible to Everyone',+ description: 'Whether all users can see the report.',+ }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other report properties, e.g. "tableOrder", "graphs", "groupBy", "aggregators", "isScheduled", "scheduleUnit", "toAddress". The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const {+ id,+ additionalFields,+ name,+ source,+ columns,+ filters,+ description,+ isPublished,+ system,+ } = context.propsValue;+ return await mauticApi.updateRecord({+ auth: context.auth,+ resource: 'reports',+ id,+ body: {+ ...additionalFields,+ ...spreadIfDefined('name', name),+ ...spreadIfDefined('source', source),+ ...spreadIfDefined('columns', columns),+ ...spreadIfDefined('filters', filters),+ ...spreadIfDefined('description', description),+ ...spreadIfDefined('isPublished', isPublished),+ ...spreadIfDefined('system', system),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/segments/add-contact-to-segment.ts b/packages/pieces/community/mautic/src/lib/actions/ai/segments/add-contact-to-segment.tsnew file mode 100644index 00000000000..9ad126bb579--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/segments/add-contact-to-segment.ts@@ -0,0 +1,40 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticAdjustContactPointsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticAddContactToSegmentAction = createAction({+ auth: mauticAuth,+ name: 'mautic_add_contact_to_segment',+ outputSchema: mauticAdjustContactPointsOutputSchema,+ displayName: 'Add Contact to Segment',+ description: 'Adds a contact to a Mautic segment.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Adds one contact to a segment manually. Repeating it leaves the contact in the segment. Use Add Contacts to Segment for many.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Segment Id',+ description: 'Numeric segment id, from List Segments or Create Segment.',+ }),+ contactId: mauticAiProps.recordId({+ displayName: 'Contact Id',+ description: 'Numeric contact id, from List Contacts.',+ }),+ },+ async run(context) {+ return await mauticApi.changeMembership({+ auth: context.auth,+ resource: 'segments',+ id: context.propsValue.id,+ contactId: context.propsValue.contactId,+ change: 'add',+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/segments/add-contacts-to-segment.ts b/packages/pieces/community/mautic/src/lib/actions/ai/segments/add-contacts-to-segment.tsnew file mode 100644index 00000000000..5a77c60ee37--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/segments/add-contacts-to-segment.ts@@ -0,0 +1,40 @@+import { Property, createAction } from '@activepieces/pieces-framework';++import { mauticAddContactsToSegmentOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';+import { mauticUtils } from '../../../common/utils';++export const mauticAddContactsToSegmentAction = createAction({+ auth: mauticAuth,+ name: 'mautic_add_contacts_to_segment',+ outputSchema: mauticAddContactsToSegmentOutputSchema,+ displayName: 'Add Contacts to Segment',+ description: 'Adds several contacts to a Mautic segment.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Adds many contacts to a segment in one request. The response reports success per contact id. Repeating it leaves the contacts in the segment.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Segment Id',+ description: 'Numeric segment id, from List Segments or Create Segment.',+ }),+ contactIds: Property.Array({+ displayName: 'Contact Ids',+ description: 'Numeric contact ids, from List Contacts.',+ required: true,+ }),+ },+ async run(context) {+ return await mauticApi.addContactsToSegment({+ auth: context.auth,+ id: context.propsValue.id,+ contactIds: mauticUtils.toBatchIds({ ids: context.propsValue.contactIds }),+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/segments/create-segment.ts b/packages/pieces/community/mautic/src/lib/actions/ai/segments/create-segment.tsnew file mode 100644index 00000000000..de03b647fae--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/segments/create-segment.ts@@ -0,0 +1,89 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticCreateSegmentOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticCreateSegmentAction = createAction({+ auth: mauticAuth,+ name: 'mautic_create_segment',+ outputSchema: mauticCreateSegmentOutputSchema,+ displayName: 'Create Segment',+ description: 'Creates a Mautic segment.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Creates a segment. Name is required. Add Filters to make it dynamic, or leave them out and add contacts with Add Contact to Segment.',+ idempotent: false,+ },+ props: {+ name: Property.ShortText({ displayName: 'Name', required: true }),+ alias: Property.ShortText({+ displayName: 'Alias',+ description: 'Unique alias; generated from the name when empty.',+ required: false,+ }),+ publicName: Property.ShortText({+ displayName: 'Public Name',+ description: 'Name shown to contacts in the preference center.',+ required: false,+ }),+ description: Property.LongText({ displayName: 'Description', required: false }),+ isPublished: mauticAiProps.yesNo({ displayName: 'Published' }),+ isGlobal: mauticAiProps.yesNo({+ displayName: 'Global',+ description: 'Whether other users can use the segment.',+ }),+ isPreferenceCenter: mauticAiProps.yesNo({+ displayName: 'Preference Center',+ description: 'Whether contacts can join or leave it in the preference center.',+ }),+ category: Property.Number({+ displayName: 'Category Id',+ description: 'Category id, from List Categories.',+ required: false,+ }),+ filters: Property.Array({+ displayName: 'Filters',+ description:+ 'Segment filters, each an object such as {"glue": "and", "field": "email", "object": "lead", "type": "email", "operator": "like", "properties": {"filter": "%@example.com"}}. Without filters the segment has only manually added contacts.',+ required: false,+ }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other segment properties from the Mautic segment API. The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const {+ additionalFields,+ name,+ alias,+ publicName,+ description,+ isPublished,+ isGlobal,+ isPreferenceCenter,+ category,+ filters,+ } = context.propsValue;+ return await mauticApi.createRecord({+ auth: context.auth,+ resource: 'segments',+ body: {+ ...additionalFields,+ ...spreadIfDefined('name', name),+ ...spreadIfDefined('alias', alias),+ ...spreadIfDefined('publicName', publicName),+ ...spreadIfDefined('description', description),+ ...spreadIfDefined('isPublished', isPublished),+ ...spreadIfDefined('isGlobal', isGlobal),+ ...spreadIfDefined('isPreferenceCenter', isPreferenceCenter),+ ...spreadIfDefined('category', category),+ ...spreadIfDefined('filters', filters),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/segments/delete-segment.ts b/packages/pieces/community/mautic/src/lib/actions/ai/segments/delete-segment.tsnew file mode 100644index 00000000000..75fe5fc7043--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/segments/delete-segment.ts@@ -0,0 +1,33 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticDeleteSegmentOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticDeleteSegmentAction = createAction({+ auth: mauticAuth,+ name: 'mautic_delete_segment',+ outputSchema: mauticDeleteSegmentOutputSchema,+ displayName: 'Delete Segment',+ description: 'Permanently deletes a Mautic segment.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description: 'Permanently deletes a segment. Its contacts are kept. Cannot be undone.',+ idempotent: false,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Segment Id',+ description: 'Numeric segment id, from List Segments or Create Segment.',+ }),+ },+ async run(context) {+ return await mauticApi.deleteRecord({+ auth: context.auth,+ resource: 'segments',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/segments/get-segment.ts b/packages/pieces/community/mautic/src/lib/actions/ai/segments/get-segment.tsnew file mode 100644index 00000000000..895f6825652--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/segments/get-segment.ts@@ -0,0 +1,33 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticGetSegmentOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticGetSegmentAction = createAction({+ auth: mauticAuth,+ name: 'mautic_get_segment',+ outputSchema: mauticGetSegmentOutputSchema,+ displayName: 'Get Segment',+ description: 'Gets one Mautic segment by id.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description: 'Gets a single segment by its numeric id, with its filters.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Segment Id',+ description: 'Numeric segment id, from List Segments or Create Segment.',+ }),+ },+ async run(context) {+ return await mauticApi.getRecord({+ auth: context.auth,+ resource: 'segments',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/segments/list-segments.ts b/packages/pieces/community/mautic/src/lib/actions/ai/segments/list-segments.tsnew file mode 100644index 00000000000..675dfa92d51--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/segments/list-segments.ts@@ -0,0 +1,32 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListSegmentsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticListSegmentsAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_segments',+ outputSchema: mauticListSegmentsOutputSchema,+ displayName: 'List Segments',+ description: 'Lists Mautic segments.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists segments (contact lists) with their filters. Use Search for free text or Where for exact column conditions. Page with Start and Limit; the response has the total count.',+ idempotent: true,+ },+ props: {+ ...mauticAiProps.listOptions,+ },+ async run(context) {+ return await mauticApi.listRecords({+ auth: context.auth,+ resource: 'segments',+ key: 'lists',+ query: context.propsValue,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/segments/output-schemas.ts b/packages/pieces/community/mautic/src/lib/actions/ai/segments/output-schemas.tsnew file mode 100644index 00000000000..b804a7c2841--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/segments/output-schemas.ts@@ -0,0 +1,99 @@+import { OutputSchema } from '@activepieces/pieces-framework';++import {+ categoryFields,+ listFields,+ listFilters2Fields,+ listFiltersFields,+} from '../../../output-schemas';++export const mauticAddContactsToSegmentOutputSchema: OutputSchema = {+ fields: [+ { key: 'success', label: 'Success', format: 'number' },+ { key: 'details', label: 'Details', dynamicKey: true },+ ],+};++export const mauticAdjustContactPointsOutputSchema: OutputSchema = {+ fields: [{ key: 'success', label: 'Success', format: 'number' }],+};++export const mauticCreateSegmentOutputSchema: OutputSchema = {+ fields: [{ key: 'list', label: 'List', children: listFields }],+};++export const mauticDeleteSegmentOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'list',+ label: 'List',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified', format: 'datetime' },+ { key: 'id', label: 'ID' },+ { key: 'name', label: 'Name' },+ { key: 'publicName', label: 'Public Name' },+ { key: 'alias', label: 'Alias' },+ { key: 'description', label: 'Description' },+ { key: 'category', label: 'Category', children: categoryFields },+ { key: 'filters', label: 'Filters', listItems: listFilters2Fields },+ { key: 'isGlobal', label: 'Is Global', format: 'boolean' },+ { key: 'isPreferenceCenter', label: 'Is Preference Center', format: 'boolean' },+ ],+ },+ ],+};++export const mauticGetSegmentOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'list',+ label: 'List',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified', format: 'datetime' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'name', label: 'Name' },+ { key: 'publicName', label: 'Public Name' },+ { key: 'alias', label: 'Alias' },+ { key: 'description', label: 'Description' },+ { key: 'category', label: 'Category', children: categoryFields },+ { key: 'filters', label: 'Filters', listItems: listFiltersFields },+ { key: 'isGlobal', label: 'Is Global', format: 'boolean' },+ { key: 'isPreferenceCenter', label: 'Is Preference Center', format: 'boolean' },+ ],+ },+ ],+};++export const mauticListSegmentsOutputSchema: OutputSchema = {+ fields: [+ { key: 'total', label: 'Total', format: 'number' },+ { key: 'lists', label: 'Lists', labelKey: 'name', listItems: listFields },+ ],+};++export const mauticUpdateSegmentOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'list',+ label: 'List',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified', format: 'datetime' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'name', label: 'Name' },+ { key: 'publicName', label: 'Public Name' },+ { key: 'alias', label: 'Alias' },+ { key: 'description', label: 'Description' },+ { key: 'category', label: 'Category', children: categoryFields },+ { key: 'filters', label: 'Filters', listItems: listFilters2Fields },+ { key: 'isGlobal', label: 'Is Global', format: 'boolean' },+ { key: 'isPreferenceCenter', label: 'Is Preference Center', format: 'boolean' },+ ],+ },+ ],+};diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/segments/remove-contact-from-segment.ts b/packages/pieces/community/mautic/src/lib/actions/ai/segments/remove-contact-from-segment.tsnew file mode 100644index 00000000000..22c5260bfc9--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/segments/remove-contact-from-segment.ts@@ -0,0 +1,40 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticAdjustContactPointsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticRemoveContactFromSegmentAction = createAction({+ auth: mauticAuth,+ name: 'mautic_remove_contact_from_segment',+ outputSchema: mauticAdjustContactPointsOutputSchema,+ displayName: 'Remove Contact from Segment',+ description: 'Removes a contact from a Mautic segment.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Removes a contact from a segment manually; a filter-based segment will not add it back. Repeating it leaves the contact out.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Segment Id',+ description: 'Numeric segment id, from List Segments or Create Segment.',+ }),+ contactId: mauticAiProps.recordId({+ displayName: 'Contact Id',+ description: 'Numeric contact id, from List Contacts.',+ }),+ },+ async run(context) {+ return await mauticApi.changeMembership({+ auth: context.auth,+ resource: 'segments',+ id: context.propsValue.id,+ contactId: context.propsValue.contactId,+ change: 'remove',+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/segments/update-segment.ts b/packages/pieces/community/mautic/src/lib/actions/ai/segments/update-segment.tsnew file mode 100644index 00000000000..2caf3297e46--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/segments/update-segment.ts@@ -0,0 +1,95 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticUpdateSegmentOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticUpdateSegmentAction = createAction({+ auth: mauticAuth,+ name: 'mautic_update_segment',+ outputSchema: mauticUpdateSegmentOutputSchema,+ displayName: 'Update Segment',+ description: 'Updates fields of a Mautic segment.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Updates an existing segment. Filters, when given, replace the existing filters. Only the fields given are changed.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Segment Id',+ description: 'Numeric segment id, from List Segments or Create Segment.',+ }),+ name: Property.ShortText({ displayName: 'Name', required: false }),+ alias: Property.ShortText({+ displayName: 'Alias',+ description: 'Unique alias; generated from the name when empty.',+ required: false,+ }),+ publicName: Property.ShortText({+ displayName: 'Public Name',+ description: 'Name shown to contacts in the preference center.',+ required: false,+ }),+ description: Property.LongText({ displayName: 'Description', required: false }),+ isPublished: mauticAiProps.yesNo({ displayName: 'Published' }),+ isGlobal: mauticAiProps.yesNo({+ displayName: 'Global',+ description: 'Whether other users can use the segment.',+ }),+ isPreferenceCenter: mauticAiProps.yesNo({+ displayName: 'Preference Center',+ description: 'Whether contacts can join or leave it in the preference center.',+ }),+ category: Property.Number({+ displayName: 'Category Id',+ description: 'Category id, from List Categories.',+ required: false,+ }),+ filters: Property.Array({+ displayName: 'Filters',+ description:+ 'Segment filters, each an object such as {"glue": "and", "field": "email", "object": "lead", "type": "email", "operator": "like", "properties": {"filter": "%@example.com"}}. Without filters the segment has only manually added contacts.',+ required: false,+ }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other segment properties from the Mautic segment API. The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const {+ id,+ additionalFields,+ name,+ alias,+ publicName,+ description,+ isPublished,+ isGlobal,+ isPreferenceCenter,+ category,+ filters,+ } = context.propsValue;+ return await mauticApi.updateRecord({+ auth: context.auth,+ resource: 'segments',+ id,+ body: {+ ...additionalFields,+ ...spreadIfDefined('name', name),+ ...spreadIfDefined('alias', alias),+ ...spreadIfDefined('publicName', publicName),+ ...spreadIfDefined('description', description),+ ...spreadIfDefined('isPublished', isPublished),+ ...spreadIfDefined('isGlobal', isGlobal),+ ...spreadIfDefined('isPreferenceCenter', isPreferenceCenter),+ ...spreadIfDefined('category', category),+ ...spreadIfDefined('filters', filters),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/stages/add-contact-to-stage.ts b/packages/pieces/community/mautic/src/lib/actions/ai/stages/add-contact-to-stage.tsnew file mode 100644index 00000000000..4732910ce29--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/stages/add-contact-to-stage.ts@@ -0,0 +1,40 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticAdjustContactPointsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticAddContactToStageAction = createAction({+ auth: mauticAuth,+ name: 'mautic_add_contact_to_stage',+ outputSchema: mauticAdjustContactPointsOutputSchema,+ displayName: 'Add Contact to Stage',+ description: 'Adds a contact to a Mautic stage.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Moves a contact into a stage, replacing its current stage. Repeating it leaves the contact in the stage.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Stage Id',+ description: 'Numeric stage id, from List Stages or Create Stage.',+ }),+ contactId: mauticAiProps.recordId({+ displayName: 'Contact Id',+ description: 'Numeric contact id, from List Contacts.',+ }),+ },+ async run(context) {+ return await mauticApi.changeMembership({+ auth: context.auth,+ resource: 'stages',+ id: context.propsValue.id,+ contactId: context.propsValue.contactId,+ change: 'add',+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/stages/create-stage.ts b/packages/pieces/community/mautic/src/lib/actions/ai/stages/create-stage.tsnew file mode 100644index 00000000000..ede7f111e40--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/stages/create-stage.ts@@ -0,0 +1,55 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticCreateStageOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticCreateStageAction = createAction({+ auth: mauticAuth,+ name: 'mautic_create_stage',+ outputSchema: mauticCreateStageOutputSchema,+ displayName: 'Create Stage',+ description: 'Creates a Mautic stage.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description: 'Creates a lifecycle stage. Name is required.',+ idempotent: false,+ },+ props: {+ name: Property.ShortText({ displayName: 'Name', required: true }),+ weight: Property.Number({+ displayName: 'Weight',+ description: 'Order of the stage in the lifecycle; higher is further along.',+ required: false,+ }),+ description: Property.LongText({ displayName: 'Description', required: false }),+ isPublished: mauticAiProps.yesNo({ displayName: 'Published' }),+ category: Property.Number({+ displayName: 'Category Id',+ description: 'Category id, from List Categories.',+ required: false,+ }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other stage properties, e.g. "publishUp", "publishDown". The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const { additionalFields, name, weight, description, isPublished, category } =+ context.propsValue;+ return await mauticApi.createRecord({+ auth: context.auth,+ resource: 'stages',+ body: {+ ...additionalFields,+ ...spreadIfDefined('name', name),+ ...spreadIfDefined('weight', weight),+ ...spreadIfDefined('description', description),+ ...spreadIfDefined('isPublished', isPublished),+ ...spreadIfDefined('category', category),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/stages/delete-stage.ts b/packages/pieces/community/mautic/src/lib/actions/ai/stages/delete-stage.tsnew file mode 100644index 00000000000..94f5789de9d--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/stages/delete-stage.ts@@ -0,0 +1,34 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticDeleteStageOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticDeleteStageAction = createAction({+ auth: mauticAuth,+ name: 'mautic_delete_stage',+ outputSchema: mauticDeleteStageOutputSchema,+ displayName: 'Delete Stage',+ description: 'Permanently deletes a Mautic stage.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description:+ 'Permanently deletes a stage; contacts in it are left without a stage. Cannot be undone.',+ idempotent: false,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Stage Id',+ description: 'Numeric stage id, from List Stages or Create Stage.',+ }),+ },+ async run(context) {+ return await mauticApi.deleteRecord({+ auth: context.auth,+ resource: 'stages',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/stages/get-stage.ts b/packages/pieces/community/mautic/src/lib/actions/ai/stages/get-stage.tsnew file mode 100644index 00000000000..23dac491d17--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/stages/get-stage.ts@@ -0,0 +1,33 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticGetStageOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticGetStageAction = createAction({+ auth: mauticAuth,+ name: 'mautic_get_stage',+ outputSchema: mauticGetStageOutputSchema,+ displayName: 'Get Stage',+ description: 'Gets one Mautic stage by id.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description: 'Gets a single stage by its numeric id.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Stage Id',+ description: 'Numeric stage id, from List Stages or Create Stage.',+ }),+ },+ async run(context) {+ return await mauticApi.getRecord({+ auth: context.auth,+ resource: 'stages',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/stages/list-stages.ts b/packages/pieces/community/mautic/src/lib/actions/ai/stages/list-stages.tsnew file mode 100644index 00000000000..4c5e3e9a5c9--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/stages/list-stages.ts@@ -0,0 +1,32 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListStagesOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticListStagesAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_stages',+ outputSchema: mauticListStagesOutputSchema,+ displayName: 'List Stages',+ description: 'Lists Mautic stages.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists contact lifecycle stages with their weight. Page with Start and Limit; the response has the total count.',+ idempotent: true,+ },+ props: {+ ...mauticAiProps.listOptions,+ },+ async run(context) {+ return await mauticApi.listRecords({+ auth: context.auth,+ resource: 'stages',+ key: 'stages',+ query: context.propsValue,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/stages/output-schemas.ts b/packages/pieces/community/mautic/src/lib/actions/ai/stages/output-schemas.tsnew file mode 100644index 00000000000..623c428888b--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/stages/output-schemas.ts@@ -0,0 +1,60 @@+import { OutputSchema } from '@activepieces/pieces-framework';++import { categoryFields, stageFields } from '../../../output-schemas';++export const mauticAdjustContactPointsOutputSchema: OutputSchema = {+ fields: [{ key: 'success', label: 'Success', format: 'number' }],+};++export const mauticCreateStageOutputSchema: OutputSchema = {+ fields: [{ key: 'stage', label: 'Stage', children: stageFields }],+};++export const mauticDeleteStageOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'stage',+ label: 'Stage',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified' },+ { key: 'id', label: 'ID' },+ { key: 'name', label: 'Name' },+ { key: 'category', label: 'Category', children: categoryFields },+ { key: 'weight', label: 'Weight', format: 'number' },+ { key: 'description', label: 'Description' },+ { key: 'publishUp', label: 'Publish Up' },+ { key: 'publishDown', label: 'Publish Down' },+ ],+ },+ ],+};++export const mauticGetStageOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'stage',+ label: 'Stage',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified', format: 'datetime' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'name', label: 'Name' },+ { key: 'category', label: 'Category', children: categoryFields },+ { key: 'weight', label: 'Weight', format: 'number' },+ { key: 'description', label: 'Description' },+ { key: 'publishUp', label: 'Publish Up' },+ { key: 'publishDown', label: 'Publish Down' },+ ],+ },+ ],+};++export const mauticListStagesOutputSchema: OutputSchema = {+ fields: [+ { key: 'total', label: 'Total', format: 'number' },+ { key: 'stages', label: 'Stages', labelKey: 'name', listItems: stageFields },+ ],+};diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/stages/remove-contact-from-stage.ts b/packages/pieces/community/mautic/src/lib/actions/ai/stages/remove-contact-from-stage.tsnew file mode 100644index 00000000000..5b418f1ebd0--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/stages/remove-contact-from-stage.ts@@ -0,0 +1,40 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticAdjustContactPointsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticRemoveContactFromStageAction = createAction({+ auth: mauticAuth,+ name: 'mautic_remove_contact_from_stage',+ outputSchema: mauticAdjustContactPointsOutputSchema,+ displayName: 'Remove Contact from Stage',+ description: 'Removes a contact from a Mautic stage.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Takes a contact out of a stage, leaving it without a stage. Repeating it changes nothing.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Stage Id',+ description: 'Numeric stage id, from List Stages or Create Stage.',+ }),+ contactId: mauticAiProps.recordId({+ displayName: 'Contact Id',+ description: 'Numeric contact id, from List Contacts.',+ }),+ },+ async run(context) {+ return await mauticApi.changeMembership({+ auth: context.auth,+ resource: 'stages',+ id: context.propsValue.id,+ contactId: context.propsValue.contactId,+ change: 'remove',+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/stages/update-stage.ts b/packages/pieces/community/mautic/src/lib/actions/ai/stages/update-stage.tsnew file mode 100644index 00000000000..7ac3094ec0f--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/stages/update-stage.ts@@ -0,0 +1,60 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticGetStageOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticUpdateStageAction = createAction({+ auth: mauticAuth,+ name: 'mautic_update_stage',+ outputSchema: mauticGetStageOutputSchema,+ displayName: 'Update Stage',+ description: 'Updates fields of a Mautic stage.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description: 'Updates an existing stage. Only the fields given are changed.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Stage Id',+ description: 'Numeric stage id, from List Stages or Create Stage.',+ }),+ name: Property.ShortText({ displayName: 'Name', required: false }),+ weight: Property.Number({+ displayName: 'Weight',+ description: 'Order of the stage in the lifecycle; higher is further along.',+ required: false,+ }),+ description: Property.LongText({ displayName: 'Description', required: false }),+ isPublished: mauticAiProps.yesNo({ displayName: 'Published' }),+ category: Property.Number({+ displayName: 'Category Id',+ description: 'Category id, from List Categories.',+ required: false,+ }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other stage properties, e.g. "publishUp", "publishDown". The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const { id, additionalFields, name, weight, description, isPublished, category } =+ context.propsValue;+ return await mauticApi.updateRecord({+ auth: context.auth,+ resource: 'stages',+ id,+ body: {+ ...additionalFields,+ ...spreadIfDefined('name', name),+ ...spreadIfDefined('weight', weight),+ ...spreadIfDefined('description', description),+ ...spreadIfDefined('isPublished', isPublished),+ ...spreadIfDefined('category', category),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/tags/create-tag.ts b/packages/pieces/community/mautic/src/lib/actions/ai/tags/create-tag.tsnew file mode 100644index 00000000000..36b8cdb0fe1--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/tags/create-tag.ts@@ -0,0 +1,33 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticCreateTagOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticApi } from '../../../common/api';++export const mauticCreateTagAction = createAction({+ auth: mauticAuth,+ name: 'mautic_create_tag',+ outputSchema: mauticCreateTagOutputSchema,+ displayName: 'Create Tag',+ description: 'Creates a Mautic tag.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Creates a tag. Tag is required; the Mautic tag API accepts only the name. To tag a contact, use Update Contact with Tags instead.',+ idempotent: false,+ },+ props: {+ tag: Property.ShortText({ displayName: 'Tag', description: 'Tag name.', required: true }),+ },+ async run(context) {+ const { tag } = context.propsValue;+ return await mauticApi.createRecord({+ auth: context.auth,+ resource: 'tags',+ body: {+ ...spreadIfDefined('tag', tag),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/tags/delete-tag.ts b/packages/pieces/community/mautic/src/lib/actions/ai/tags/delete-tag.tsnew file mode 100644index 00000000000..f6746d4ed99--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/tags/delete-tag.ts@@ -0,0 +1,33 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticDeleteTagOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticDeleteTagAction = createAction({+ auth: mauticAuth,+ name: 'mautic_delete_tag',+ outputSchema: mauticDeleteTagOutputSchema,+ displayName: 'Delete Tag',+ description: 'Permanently deletes a Mautic tag.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description: 'Permanently deletes a tag and removes it from every contact. Cannot be undone.',+ idempotent: false,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Tag Id',+ description: 'Numeric tag id, from List Tags or Create Tag.',+ }),+ },+ async run(context) {+ return await mauticApi.deleteRecord({+ auth: context.auth,+ resource: 'tags',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/tags/get-tag.ts b/packages/pieces/community/mautic/src/lib/actions/ai/tags/get-tag.tsnew file mode 100644index 00000000000..554bcc12e57--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/tags/get-tag.ts@@ -0,0 +1,33 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticCreateTagOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticGetTagAction = createAction({+ auth: mauticAuth,+ name: 'mautic_get_tag',+ outputSchema: mauticCreateTagOutputSchema,+ displayName: 'Get Tag',+ description: 'Gets one Mautic tag by id.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description: 'Gets a single tag by its numeric id.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Tag Id',+ description: 'Numeric tag id, from List Tags or Create Tag.',+ }),+ },+ async run(context) {+ return await mauticApi.getRecord({+ auth: context.auth,+ resource: 'tags',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/tags/list-tags.ts b/packages/pieces/community/mautic/src/lib/actions/ai/tags/list-tags.tsnew file mode 100644index 00000000000..b8a1f4c7bc0--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/tags/list-tags.ts@@ -0,0 +1,31 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListTagsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticListTagsAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_tags',+ outputSchema: mauticListTagsOutputSchema,+ displayName: 'List Tags',+ description: 'Lists Mautic tags.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description: 'Lists contact tags. Page with Start and Limit; the response has the total count.',+ idempotent: true,+ },+ props: {+ ...mauticAiProps.filterOptions,+ },+ async run(context) {+ return await mauticApi.listRecords({+ auth: context.auth,+ resource: 'tags',+ key: 'tags',+ query: context.propsValue,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/tags/output-schemas.ts b/packages/pieces/community/mautic/src/lib/actions/ai/tags/output-schemas.tsnew file mode 100644index 00000000000..4bf01389a33--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/tags/output-schemas.ts@@ -0,0 +1,45 @@+import { OutputSchema } from '@activepieces/pieces-framework';++export const mauticCreateTagOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'tag',+ label: 'Tag',+ children: [+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'tag', label: 'Tag' },+ { key: 'description', label: 'Description' },+ ],+ },+ ],+};++export const mauticDeleteTagOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'tag',+ label: 'Tag',+ children: [+ { key: 'id', label: 'ID' },+ { key: 'tag', label: 'Tag' },+ { key: 'description', label: 'Description' },+ ],+ },+ ],+};++export const mauticListTagsOutputSchema: OutputSchema = {+ fields: [+ { key: 'total', label: 'Total', format: 'number' },+ {+ key: 'tags',+ label: 'Tags',+ labelKey: 'id',+ listItems: [+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'tag', label: 'Tag' },+ { key: 'description', label: 'Description' },+ ],+ },+ ],+};diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/tags/update-tag.ts b/packages/pieces/community/mautic/src/lib/actions/ai/tags/update-tag.tsnew file mode 100644index 00000000000..8d884ab7317--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/tags/update-tag.ts@@ -0,0 +1,38 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticCreateTagOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticUpdateTagAction = createAction({+ auth: mauticAuth,+ name: 'mautic_update_tag',+ outputSchema: mauticCreateTagOutputSchema,+ displayName: 'Update Tag',+ description: 'Updates fields of a Mautic tag.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description: 'Updates an existing tag, e.g. to rename it. Only the fields given are changed.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Tag Id',+ description: 'Numeric tag id, from List Tags or Create Tag.',+ }),+ tag: Property.ShortText({ displayName: 'Tag', description: 'Tag name.', required: false }),+ },+ async run(context) {+ const { id, tag } = context.propsValue;+ return await mauticApi.updateRecord({+ auth: context.auth,+ resource: 'tags',+ id,+ body: {+ ...spreadIfDefined('tag', tag),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/text-messages/create-sms.ts b/packages/pieces/community/mautic/src/lib/actions/ai/text-messages/create-sms.tsnew file mode 100644index 00000000000..75d83fe5a5f--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/text-messages/create-sms.ts@@ -0,0 +1,63 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticCreateSmsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticCreateSmsAction = createAction({+ auth: mauticAuth,+ name: 'mautic_create_sms',+ outputSchema: mauticCreateSmsOutputSchema,+ displayName: 'Create Text Message',+ description: 'Creates a Mautic text message.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Creates a text message template. Name and Message are required. Mautic sends it from campaigns.',+ idempotent: false,+ },+ props: {+ name: Property.ShortText({+ displayName: 'Name',+ description: 'Internal name of the text message.',+ required: true,+ }),+ message: Property.LongText({+ displayName: 'Message',+ description: 'Text to send. Tokens like {contactfield=firstname} are replaced per contact.',+ required: true,+ }),+ isPublished: mauticAiProps.yesNo({ displayName: 'Published' }),+ category: Property.Number({+ displayName: 'Category Id',+ description: 'Category id, from List Categories.',+ required: false,+ }),+ language: Property.ShortText({+ displayName: 'Language',+ description: 'Locale code, e.g. "en".',+ required: false,+ }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other text message properties, e.g. "publishUp", "publishDown", "smsType". The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const { additionalFields, name, message, isPublished, category, language } = context.propsValue;+ return await mauticApi.createRecord({+ auth: context.auth,+ resource: 'smses',+ body: {+ ...additionalFields,+ ...spreadIfDefined('name', name),+ ...spreadIfDefined('message', message),+ ...spreadIfDefined('isPublished', isPublished),+ ...spreadIfDefined('category', category),+ ...spreadIfDefined('language', language),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/text-messages/delete-sms.ts b/packages/pieces/community/mautic/src/lib/actions/ai/text-messages/delete-sms.tsnew file mode 100644index 00000000000..bd7acc8fada--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/text-messages/delete-sms.ts@@ -0,0 +1,33 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticDeleteSmsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticDeleteSmsAction = createAction({+ auth: mauticAuth,+ name: 'mautic_delete_sms',+ outputSchema: mauticDeleteSmsOutputSchema,+ displayName: 'Delete Text Message',+ description: 'Permanently deletes a Mautic text message.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description: 'Permanently deletes a text message and its stats. Cannot be undone.',+ idempotent: false,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Text Message Id',+ description: 'Numeric text message id, from List Text Messages or Create Text Message.',+ }),+ },+ async run(context) {+ return await mauticApi.deleteRecord({+ auth: context.auth,+ resource: 'smses',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/text-messages/get-sms.ts b/packages/pieces/community/mautic/src/lib/actions/ai/text-messages/get-sms.tsnew file mode 100644index 00000000000..5f0d2c43d69--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/text-messages/get-sms.ts@@ -0,0 +1,33 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticGetSmsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticGetSmsAction = createAction({+ auth: mauticAuth,+ name: 'mautic_get_sms',+ outputSchema: mauticGetSmsOutputSchema,+ displayName: 'Get Text Message',+ description: 'Gets one Mautic text message by id.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description: 'Gets a single text message by its numeric id.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Text Message Id',+ description: 'Numeric text message id, from List Text Messages or Create Text Message.',+ }),+ },+ async run(context) {+ return await mauticApi.getRecord({+ auth: context.auth,+ resource: 'smses',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/text-messages/list-smses.ts b/packages/pieces/community/mautic/src/lib/actions/ai/text-messages/list-smses.tsnew file mode 100644index 00000000000..703260eebbf--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/text-messages/list-smses.ts@@ -0,0 +1,32 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListSmsesOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticListSmsesAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_smses',+ outputSchema: mauticListSmsesOutputSchema,+ displayName: 'List Text Messages',+ description: 'Lists Mautic text messages.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists text messages (SMS templates) with their sent counts. Page with Start and Limit; the response has the total count.',+ idempotent: true,+ },+ props: {+ ...mauticAiProps.listOptions,+ },+ async run(context) {+ return await mauticApi.listRecords({+ auth: context.auth,+ resource: 'smses',+ key: 'smses',+ query: context.propsValue,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/text-messages/output-schemas.ts b/packages/pieces/community/mautic/src/lib/actions/ai/text-messages/output-schemas.tsnew file mode 100644index 00000000000..35f72b04368--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/text-messages/output-schemas.ts@@ -0,0 +1,93 @@+import { OutputSchema } from '@activepieces/pieces-framework';++import { categoryFields } from '../../../output-schemas';++export const mauticCreateSmsOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'sms',+ label: 'Sms',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'name', label: 'Name' },+ { key: 'message', label: 'Message' },+ { key: 'language', label: 'Language' },+ { key: 'category', label: 'Category', children: categoryFields },+ { key: 'publishUp', label: 'Publish Up', format: 'datetime' },+ { key: 'publishDown', label: 'Publish Down' },+ { key: 'sentCount', label: 'Sent Count', format: 'number' },+ ],+ },+ ],+};++export const mauticDeleteSmsOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'sms',+ label: 'Sms',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified' },+ { key: 'id', label: 'ID' },+ { key: 'name', label: 'Name' },+ { key: 'message', label: 'Message' },+ { key: 'language', label: 'Language' },+ { key: 'category', label: 'Category', children: categoryFields },+ { key: 'publishUp', label: 'Publish Up', format: 'datetime' },+ { key: 'publishDown', label: 'Publish Down' },+ { key: 'sentCount', label: 'Sent Count', format: 'number' },+ ],+ },+ ],+};++export const mauticGetSmsOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'sms',+ label: 'Sms',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified', format: 'datetime' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'name', label: 'Name' },+ { key: 'message', label: 'Message' },+ { key: 'language', label: 'Language' },+ { key: 'category', label: 'Category', children: categoryFields },+ { key: 'publishUp', label: 'Publish Up', format: 'datetime' },+ { key: 'publishDown', label: 'Publish Down' },+ { key: 'sentCount', label: 'Sent Count', format: 'number' },+ ],+ },+ ],+};++export const mauticListSmsesOutputSchema: OutputSchema = {+ fields: [+ { key: 'total', label: 'Total', format: 'number' },+ {+ key: 'smses',+ label: 'Smses',+ labelKey: 'name',+ listItems: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'name', label: 'Name' },+ { key: 'message', label: 'Message' },+ { key: 'language', label: 'Language' },+ { key: 'category', label: 'Category', children: categoryFields },+ { key: 'publishUp', label: 'Publish Up' },+ { key: 'publishDown', label: 'Publish Down' },+ { key: 'sentCount', label: 'Sent Count', format: 'number' },+ ],+ },+ ],+};diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/text-messages/update-sms.ts b/packages/pieces/community/mautic/src/lib/actions/ai/text-messages/update-sms.tsnew file mode 100644index 00000000000..4c6b878871e--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/text-messages/update-sms.ts@@ -0,0 +1,68 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticGetSmsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticUpdateSmsAction = createAction({+ auth: mauticAuth,+ name: 'mautic_update_sms',+ outputSchema: mauticGetSmsOutputSchema,+ displayName: 'Update Text Message',+ description: 'Updates fields of a Mautic text message.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description: 'Updates an existing text message. Only the fields given are changed.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Text Message Id',+ description: 'Numeric text message id, from List Text Messages or Create Text Message.',+ }),+ name: Property.ShortText({+ displayName: 'Name',+ description: 'Internal name of the text message.',+ required: false,+ }),+ message: Property.LongText({+ displayName: 'Message',+ description: 'Text to send. Tokens like {contactfield=firstname} are replaced per contact.',+ required: false,+ }),+ isPublished: mauticAiProps.yesNo({ displayName: 'Published' }),+ category: Property.Number({+ displayName: 'Category Id',+ description: 'Category id, from List Categories.',+ required: false,+ }),+ language: Property.ShortText({+ displayName: 'Language',+ description: 'Locale code, e.g. "en".',+ required: false,+ }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other text message properties, e.g. "publishUp", "publishDown", "smsType". The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const { id, additionalFields, name, message, isPublished, category, language } =+ context.propsValue;+ return await mauticApi.updateRecord({+ auth: context.auth,+ resource: 'smses',+ id,+ body: {+ ...additionalFields,+ ...spreadIfDefined('name', name),+ ...spreadIfDefined('message', message),+ ...spreadIfDefined('isPublished', isPublished),+ ...spreadIfDefined('category', category),+ ...spreadIfDefined('language', language),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/tweets/create-tweet.ts b/packages/pieces/community/mautic/src/lib/actions/ai/tweets/create-tweet.tsnew file mode 100644index 00000000000..e566414fd27--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/tweets/create-tweet.ts@@ -0,0 +1,83 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticCreateTweetOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticCreateTweetAction = createAction({+ auth: mauticAuth,+ name: 'mautic_create_tweet',+ outputSchema: mauticCreateTweetOutputSchema,+ displayName: 'Create Tweet',+ description: 'Creates a Mautic tweet.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Creates a tweet template that campaigns can post. Name and Text are required. Needs the Social plugin.',+ idempotent: false,+ },+ props: {+ name: Property.ShortText({ displayName: 'Name', required: true }),+ text: Property.LongText({+ displayName: 'Text',+ description: 'Tweet text, up to 280 characters.',+ required: true,+ }),+ description: Property.LongText({ displayName: 'Description', required: false }),+ asset: Property.Number({+ displayName: 'Asset Id',+ description: 'Asset to link, from List Assets.',+ required: false,+ }),+ page: Property.Number({+ displayName: 'Landing Page Id',+ description: 'Landing page to link, from List Landing Pages.',+ required: false,+ }),+ isPublished: mauticAiProps.yesNo({ displayName: 'Published' }),+ category: Property.Number({+ displayName: 'Category Id',+ description: 'Category id, from List Categories.',+ required: false,+ }),+ language: Property.ShortText({+ displayName: 'Language',+ description: 'Locale code, e.g. "en".',+ required: false,+ }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other tweet properties, e.g. "publishUp", "publishDown". The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const {+ additionalFields,+ name,+ text,+ description,+ asset,+ page,+ isPublished,+ category,+ language,+ } = context.propsValue;+ return await mauticApi.createRecord({+ auth: context.auth,+ resource: 'tweets',+ body: {+ ...additionalFields,+ ...spreadIfDefined('name', name),+ ...spreadIfDefined('text', text),+ ...spreadIfDefined('description', description),+ ...spreadIfDefined('asset', asset),+ ...spreadIfDefined('page', page),+ ...spreadIfDefined('isPublished', isPublished),+ ...spreadIfDefined('category', category),+ ...spreadIfDefined('language', language),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/tweets/delete-tweet.ts b/packages/pieces/community/mautic/src/lib/actions/ai/tweets/delete-tweet.tsnew file mode 100644index 00000000000..9a9d5cc062b--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/tweets/delete-tweet.ts@@ -0,0 +1,33 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticDeleteTweetOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticDeleteTweetAction = createAction({+ auth: mauticAuth,+ name: 'mautic_delete_tweet',+ outputSchema: mauticDeleteTweetOutputSchema,+ displayName: 'Delete Tweet',+ description: 'Permanently deletes a Mautic tweet.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description: 'Permanently deletes a tweet template. Needs the Social plugin. Cannot be undone.',+ idempotent: false,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Tweet Id',+ description: 'Numeric tweet id, from List Tweets or Create Tweet.',+ }),+ },+ async run(context) {+ return await mauticApi.deleteRecord({+ auth: context.auth,+ resource: 'tweets',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/tweets/get-tweet.ts b/packages/pieces/community/mautic/src/lib/actions/ai/tweets/get-tweet.tsnew file mode 100644index 00000000000..4113349fa84--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/tweets/get-tweet.ts@@ -0,0 +1,33 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticGetTweetOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticGetTweetAction = createAction({+ auth: mauticAuth,+ name: 'mautic_get_tweet',+ outputSchema: mauticGetTweetOutputSchema,+ displayName: 'Get Tweet',+ description: 'Gets one Mautic tweet by id.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description: 'Gets a single tweet template by its numeric id. Needs the Social plugin.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Tweet Id',+ description: 'Numeric tweet id, from List Tweets or Create Tweet.',+ }),+ },+ async run(context) {+ return await mauticApi.getRecord({+ auth: context.auth,+ resource: 'tweets',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/tweets/list-tweets.ts b/packages/pieces/community/mautic/src/lib/actions/ai/tweets/list-tweets.tsnew file mode 100644index 00000000000..408bfe85897--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/tweets/list-tweets.ts@@ -0,0 +1,32 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListTweetsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticListTweetsAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_tweets',+ outputSchema: mauticListTweetsOutputSchema,+ displayName: 'List Tweets',+ description: 'Lists Mautic tweets.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists tweet templates used by campaigns. Needs the Social plugin with Twitter configured. Page with Start and Limit; the response has the total count.',+ idempotent: true,+ },+ props: {+ ...mauticAiProps.listOptions,+ },+ async run(context) {+ return await mauticApi.listRecords({+ auth: context.auth,+ resource: 'tweets',+ key: 'tweets',+ query: context.propsValue,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/tweets/output-schemas.ts b/packages/pieces/community/mautic/src/lib/actions/ai/tweets/output-schemas.tsnew file mode 100644index 00000000000..742ebeb3cab--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/tweets/output-schemas.ts@@ -0,0 +1,64 @@+import { OutputSchema } from '@activepieces/pieces-framework';++import { categoryFields, tweetFields } from '../../../output-schemas';++export const mauticCreateTweetOutputSchema: OutputSchema = {+ fields: [{ key: 'tweet', label: 'Tweet', children: tweetFields }],+};++export const mauticDeleteTweetOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'tweet',+ label: 'Tweet',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified' },+ { key: 'id', label: 'ID' },+ { key: 'name', label: 'Name' },+ { key: 'text', label: 'Text' },+ { key: 'language', label: 'Language' },+ { key: 'category', label: 'Category', children: categoryFields },+ { key: 'mediaId', label: 'Media ID' },+ { key: 'mediaPath', label: 'Media Path' },+ { key: 'sentCount', label: 'Sent Count', format: 'number' },+ { key: 'favoriteCount', label: 'Favorite Count', format: 'number' },+ { key: 'retweetCount', label: 'Retweet Count', format: 'number' },+ { key: 'description', label: 'Description' },+ ],+ },+ ],+};++export const mauticGetTweetOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'tweet',+ label: 'Tweet',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified', format: 'datetime' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'name', label: 'Name' },+ { key: 'text', label: 'Text' },+ { key: 'language', label: 'Language' },+ { key: 'category', label: 'Category', children: categoryFields },+ { key: 'mediaId', label: 'Media ID' },+ { key: 'mediaPath', label: 'Media Path' },+ { key: 'sentCount', label: 'Sent Count', format: 'number' },+ { key: 'favoriteCount', label: 'Favorite Count', format: 'number' },+ { key: 'retweetCount', label: 'Retweet Count', format: 'number' },+ { key: 'description', label: 'Description' },+ ],+ },+ ],+};++export const mauticListTweetsOutputSchema: OutputSchema = {+ fields: [+ { key: 'total', label: 'Total', format: 'number' },+ { key: 'tweets', label: 'Tweets', labelKey: 'name', listItems: tweetFields },+ ],+};diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/tweets/update-tweet.ts b/packages/pieces/community/mautic/src/lib/actions/ai/tweets/update-tweet.tsnew file mode 100644index 00000000000..f2869d2da5d--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/tweets/update-tweet.ts@@ -0,0 +1,89 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticGetTweetOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticUpdateTweetAction = createAction({+ auth: mauticAuth,+ name: 'mautic_update_tweet',+ outputSchema: mauticGetTweetOutputSchema,+ displayName: 'Update Tweet',+ description: 'Updates fields of a Mautic tweet.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Updates an existing tweet template. Needs the Social plugin. Only the fields given are changed.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Tweet Id',+ description: 'Numeric tweet id, from List Tweets or Create Tweet.',+ }),+ name: Property.ShortText({ displayName: 'Name', required: false }),+ text: Property.LongText({+ displayName: 'Text',+ description: 'Tweet text, up to 280 characters.',+ required: false,+ }),+ description: Property.LongText({ displayName: 'Description', required: false }),+ asset: Property.Number({+ displayName: 'Asset Id',+ description: 'Asset to link, from List Assets.',+ required: false,+ }),+ page: Property.Number({+ displayName: 'Landing Page Id',+ description: 'Landing page to link, from List Landing Pages.',+ required: false,+ }),+ isPublished: mauticAiProps.yesNo({ displayName: 'Published' }),+ category: Property.Number({+ displayName: 'Category Id',+ description: 'Category id, from List Categories.',+ required: false,+ }),+ language: Property.ShortText({+ displayName: 'Language',+ description: 'Locale code, e.g. "en".',+ required: false,+ }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other tweet properties, e.g. "publishUp", "publishDown". The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const {+ id,+ additionalFields,+ name,+ text,+ description,+ asset,+ page,+ isPublished,+ category,+ language,+ } = context.propsValue;+ return await mauticApi.updateRecord({+ auth: context.auth,+ resource: 'tweets',+ id,+ body: {+ ...additionalFields,+ ...spreadIfDefined('name', name),+ ...spreadIfDefined('text', text),+ ...spreadIfDefined('description', description),+ ...spreadIfDefined('asset', asset),+ ...spreadIfDefined('page', page),+ ...spreadIfDefined('isPublished', isPublished),+ ...spreadIfDefined('category', category),+ ...spreadIfDefined('language', language),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/users/check-user-permissions.ts b/packages/pieces/community/mautic/src/lib/actions/ai/users/check-user-permissions.tsnew file mode 100644index 00000000000..27d301abed9--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/users/check-user-permissions.ts@@ -0,0 +1,40 @@+import { Property, createAction } from '@activepieces/pieces-framework';++import { mauticCheckUserPermissionsOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';+import { mauticUtils } from '../../../common/utils';++export const mauticCheckUserPermissionsAction = createAction({+ auth: mauticAuth,+ name: 'mautic_check_user_permissions',+ outputSchema: mauticCheckUserPermissionsOutputSchema,+ displayName: 'Check User Permissions',+ description: 'Checks whether a Mautic user has given permissions.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description:+ 'Checks permission strings for a user and returns true or false for each, e.g. "email:emails:send". Read-only.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'User Id',+ description: 'Numeric user id, from List Users or Get Current User.',+ }),+ permissions: Property.Array({+ displayName: 'Permissions',+ description: 'Permission strings, e.g. "lead:leads:viewother", "email:emails:send".',+ required: true,+ }),+ },+ async run(context) {+ return await mauticApi.checkUserPermissions({+ auth: context.auth,+ id: context.propsValue.id,+ permissions: mauticUtils.toBatchIds({ ids: context.propsValue.permissions }),+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/users/create-role.ts b/packages/pieces/community/mautic/src/lib/actions/ai/users/create-role.tsnew file mode 100644index 00000000000..a08f90f4251--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/users/create-role.ts@@ -0,0 +1,52 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticCreateRoleOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticCreateRoleAction = createAction({+ auth: mauticAuth,+ name: 'mautic_create_role',+ outputSchema: mauticCreateRoleOutputSchema,+ displayName: 'Create Role',+ description: 'Creates a Mautic role.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Creates a role. Name is required; give Administrator or Permissions. Needs an administrator account.',+ idempotent: false,+ },+ props: {+ name: Property.ShortText({ displayName: 'Name', required: true }),+ description: Property.LongText({ displayName: 'Description', required: false }),+ isAdmin: mauticAiProps.yesNo({+ displayName: 'Administrator',+ description: 'Full access to everything; permissions are ignored.',+ }),+ rawPermissions: Property.Json({+ displayName: 'Permissions',+ description:+ 'Permissions by bundle, e.g. {"email:emails": ["viewown", "editown", "create"], "lead:leads": ["full"]}.',+ required: false,+ }),+ additionalFields: mauticAiProps.additionalFields({+ description: 'Other role properties. The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const { additionalFields, name, description, isAdmin, rawPermissions } = context.propsValue;+ return await mauticApi.createRecord({+ auth: context.auth,+ resource: 'roles',+ body: {+ ...additionalFields,+ ...spreadIfDefined('name', name),+ ...spreadIfDefined('description', description),+ ...spreadIfDefined('isAdmin', isAdmin),+ ...spreadIfDefined('rawPermissions', rawPermissions),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/users/create-user.ts b/packages/pieces/community/mautic/src/lib/actions/ai/users/create-user.tsnew file mode 100644index 00000000000..275cc0980eb--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/users/create-user.ts@@ -0,0 +1,85 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticCreateUserOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticCreateUserAction = createAction({+ auth: mauticAuth,+ name: 'mautic_create_user',+ outputSchema: mauticCreateUserOutputSchema,+ displayName: 'Create User',+ description: 'Creates a Mautic user.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Creates a Mautic user. Username, Email, First Name, Last Name, Role Id and Password are required. Needs an administrator account.',+ idempotent: false,+ },+ props: {+ username: Property.ShortText({ displayName: 'Username', required: true }),+ email: Property.ShortText({ displayName: 'Email', required: true }),+ firstName: Property.ShortText({ displayName: 'First Name', required: true }),+ lastName: Property.ShortText({ displayName: 'Last Name', required: true }),+ role: Property.Number({+ displayName: 'Role Id',+ description: 'Role id, from List Assignable Roles.',+ required: true,+ }),+ position: Property.ShortText({ displayName: 'Position', required: false }),+ timezone: Property.ShortText({+ displayName: 'Timezone',+ description: 'e.g. "Europe/Berlin".',+ required: false,+ }),+ locale: Property.ShortText({+ displayName: 'Locale',+ description: 'e.g. "en_US".',+ required: false,+ }),+ isPublished: mauticAiProps.yesNo({ displayName: 'Published' }),+ password: Property.ShortText({+ displayName: 'Password',+ description: 'Password for the user to sign in with.',+ required: true,+ }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other user properties, e.g. "signature". The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const {+ additionalFields,+ password,+ username,+ email,+ firstName,+ lastName,+ role,+ position,+ timezone,+ locale,+ isPublished,+ } = context.propsValue;+ return await mauticApi.createRecord({+ auth: context.auth,+ resource: 'users',+ body: {+ ...additionalFields,+ ...spreadIfDefined('username', username),+ ...spreadIfDefined('email', email),+ ...spreadIfDefined('firstName', firstName),+ ...spreadIfDefined('lastName', lastName),+ ...spreadIfDefined('role', role),+ ...spreadIfDefined('position', position),+ ...spreadIfDefined('timezone', timezone),+ ...spreadIfDefined('locale', locale),+ ...spreadIfDefined('isPublished', isPublished),+ ...(password ? { plainPassword: { password, confirm: password } } : {}),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/users/delete-role.ts b/packages/pieces/community/mautic/src/lib/actions/ai/users/delete-role.tsnew file mode 100644index 00000000000..35f6bc0232a--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/users/delete-role.ts@@ -0,0 +1,34 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticDeleteRoleOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticDeleteRoleAction = createAction({+ auth: mauticAuth,+ name: 'mautic_delete_role',+ outputSchema: mauticDeleteRoleOutputSchema,+ displayName: 'Delete Role',+ description: 'Permanently deletes a Mautic role.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description:+ 'Permanently deletes a role; it must have no users. Needs an administrator account. Cannot be undone.',+ idempotent: false,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Role Id',+ description: 'Numeric role id, from List Roles or Create Role.',+ }),+ },+ async run(context) {+ return await mauticApi.deleteRecord({+ auth: context.auth,+ resource: 'roles',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/users/delete-user.ts b/packages/pieces/community/mautic/src/lib/actions/ai/users/delete-user.tsnew file mode 100644index 00000000000..dbab6f5043f--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/users/delete-user.ts@@ -0,0 +1,33 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticDeleteUserOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticDeleteUserAction = createAction({+ auth: mauticAuth,+ name: 'mautic_delete_user',+ outputSchema: mauticDeleteUserOutputSchema,+ displayName: 'Delete User',+ description: 'Permanently deletes a Mautic user.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description: 'Permanently deletes a user. Needs an administrator account. Cannot be undone.',+ idempotent: false,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'User Id',+ description: 'Numeric user id, from List Users or Create User.',+ }),+ },+ async run(context) {+ return await mauticApi.deleteRecord({+ auth: context.auth,+ resource: 'users',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/users/get-current-user.ts b/packages/pieces/community/mautic/src/lib/actions/ai/users/get-current-user.tsnew file mode 100644index 00000000000..13375b4d3c8--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/users/get-current-user.ts@@ -0,0 +1,24 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticGetCurrentUserOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticApi } from '../../../common/api';++export const mauticGetCurrentUserAction = createAction({+ auth: mauticAuth,+ name: 'mautic_get_current_user',+ outputSchema: mauticGetCurrentUserOutputSchema,+ displayName: 'Get Current User',+ description: 'Gets the Mautic user the connection signs in as.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description:+ 'Gets the user this connection signs in as, with role and permissions. Use it to find your own user id.',+ idempotent: true,+ },+ props: {},+ async run(context) {+ return await mauticApi.getCurrentUser({ auth: context.auth });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/users/get-role.ts b/packages/pieces/community/mautic/src/lib/actions/ai/users/get-role.tsnew file mode 100644index 00000000000..3f03f763d9a--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/users/get-role.ts@@ -0,0 +1,33 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticGetRoleOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticGetRoleAction = createAction({+ auth: mauticAuth,+ name: 'mautic_get_role',+ outputSchema: mauticGetRoleOutputSchema,+ displayName: 'Get Role',+ description: 'Gets one Mautic role by id.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description: 'Gets a single role by its numeric id, with its permissions.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Role Id',+ description: 'Numeric role id, from List Roles or Create Role.',+ }),+ },+ async run(context) {+ return await mauticApi.getRecord({+ auth: context.auth,+ resource: 'roles',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/users/get-user.ts b/packages/pieces/community/mautic/src/lib/actions/ai/users/get-user.tsnew file mode 100644index 00000000000..70545f2fd2e--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/users/get-user.ts@@ -0,0 +1,33 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticGetUserOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticGetUserAction = createAction({+ auth: mauticAuth,+ name: 'mautic_get_user',+ outputSchema: mauticGetUserOutputSchema,+ displayName: 'Get User',+ description: 'Gets one Mautic user by id.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description: 'Gets a single user by its numeric id, with role and permissions.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'User Id',+ description: 'Numeric user id, from List Users or Create User.',+ }),+ },+ async run(context) {+ return await mauticApi.getRecord({+ auth: context.auth,+ resource: 'users',+ id: context.propsValue.id,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/users/list-assignable-roles.ts b/packages/pieces/community/mautic/src/lib/actions/ai/users/list-assignable-roles.tsnew file mode 100644index 00000000000..9c00c8036af--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/users/list-assignable-roles.ts@@ -0,0 +1,23 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListAssignableRolesOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticApi } from '../../../common/api';++export const mauticListAssignableRolesAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_assignable_roles',+ outputSchema: mauticListAssignableRolesOutputSchema,+ displayName: 'List Assignable Roles',+ description: 'Lists the roles a Mautic user can be given.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description: 'Lists role ids and names to use as Role Id in Create User or Update User.',+ idempotent: true,+ },+ props: {},+ async run(context) {+ return await mauticApi.listAssignableRoles({ auth: context.auth });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/users/list-roles.ts b/packages/pieces/community/mautic/src/lib/actions/ai/users/list-roles.tsnew file mode 100644index 00000000000..733461cd535--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/users/list-roles.ts@@ -0,0 +1,32 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListRolesOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticListRolesAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_roles',+ outputSchema: mauticListRolesOutputSchema,+ displayName: 'List Roles',+ description: 'Lists Mautic roles.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists user roles with their permissions. Page with Start and Limit; the response has the total count.',+ idempotent: true,+ },+ props: {+ ...mauticAiProps.listOptions,+ },+ async run(context) {+ return await mauticApi.listRecords({+ auth: context.auth,+ resource: 'roles',+ key: 'roles',+ query: context.propsValue,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/users/list-users.ts b/packages/pieces/community/mautic/src/lib/actions/ai/users/list-users.tsnew file mode 100644index 00000000000..6c131fd3d36--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/users/list-users.ts@@ -0,0 +1,32 @@+import { createAction } from '@activepieces/pieces-framework';++import { mauticListUsersOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticListUsersAction = createAction({+ auth: mauticAuth,+ name: 'mautic_list_users',+ outputSchema: mauticListUsersOutputSchema,+ displayName: 'List Users',+ description: 'Lists Mautic users.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists Mautic users with their role. Page with Start and Limit; the response has the total count.',+ idempotent: true,+ },+ props: {+ ...mauticAiProps.listOptions,+ },+ async run(context) {+ return await mauticApi.listRecords({+ auth: context.auth,+ resource: 'users',+ key: 'users',+ query: context.propsValue,+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/users/output-schemas.ts b/packages/pieces/community/mautic/src/lib/actions/ai/users/output-schemas.tsnew file mode 100644index 00000000000..4f88929b588--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/users/output-schemas.ts@@ -0,0 +1,229 @@+import { OutputSchema } from '@activepieces/pieces-framework';++import { role2Fields, roleFields, userRole2Fields, userRoleFields } from '../../../output-schemas';++export const mauticCheckUserPermissionsOutputSchema: OutputSchema = {+ fields: [{ key: 'permissions', label: 'Permissions', value: '', dynamicKey: true }],+};++export const mauticCreateRoleOutputSchema: OutputSchema = {+ fields: [{ key: 'role', label: 'Role', children: role2Fields }],+};++export const mauticCreateUserOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'user',+ label: 'User',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'username', label: 'Username' },+ { key: 'firstName', label: 'First Name' },+ { key: 'lastName', label: 'Last Name' },+ { key: 'email', label: 'Email', format: 'email' },+ { key: 'position', label: 'Position' },+ { key: 'role', label: 'Role', children: userRoleFields },+ { key: 'timezone', label: 'Timezone' },+ { key: 'locale', label: 'Locale' },+ { key: 'lastLogin', label: 'Last Login' },+ { key: 'lastActive', label: 'Last Active' },+ { key: 'signature', label: 'Signature' },+ ],+ },+ ],+};++export const mauticDeleteRoleOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'role',+ label: 'Role',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified' },+ { key: 'id', label: 'ID' },+ { key: 'name', label: 'Name' },+ { key: 'description', label: 'Description' },+ { key: 'isAdmin', label: 'Is Admin', format: 'boolean' },+ {+ key: 'rawPermissions',+ label: 'Raw Permissions',+ children: [+ { key: 'lead:leads', label: 'Lead Leads' },+ { key: 'email:emails', label: 'Email Emails' },+ ],+ },+ ],+ },+ ],+};++export const mauticDeleteUserOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'user',+ label: 'User',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified' },+ { key: 'id', label: 'ID' },+ { key: 'username', label: 'Username' },+ { key: 'firstName', label: 'First Name' },+ { key: 'lastName', label: 'Last Name' },+ { key: 'email', label: 'Email', format: 'email' },+ { key: 'position', label: 'Position' },+ { key: 'role', label: 'Role', children: userRoleFields },+ { key: 'timezone', label: 'Timezone' },+ { key: 'locale', label: 'Locale' },+ { key: 'lastLogin', label: 'Last Login' },+ { key: 'lastActive', label: 'Last Active' },+ { key: 'signature', label: 'Signature' },+ ],+ },+ ],+};++export const mauticGetCurrentUserOutputSchema: OutputSchema = {+ fields: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'username', label: 'Username' },+ { key: 'firstName', label: 'First Name' },+ { key: 'lastName', label: 'Last Name' },+ { key: 'email', label: 'Email', format: 'email' },+ { key: 'role', label: 'Role', children: roleFields },+ { key: 'timezone', label: 'Timezone' },+ { key: 'locale', label: 'Locale' },+ { key: 'lastLogin', label: 'Last Login', format: 'datetime' },+ { key: 'lastActive', label: 'Last Active', format: 'datetime' },+ ],+};++export const mauticGetRoleOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'role',+ label: 'Role',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified', format: 'datetime' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'name', label: 'Name' },+ { key: 'description', label: 'Description' },+ { key: 'isAdmin', label: 'Is Admin', format: 'boolean' },+ {+ key: 'rawPermissions',+ label: 'Raw Permissions',+ children: [+ { key: 'lead:leads', label: 'Lead Leads' },+ { key: 'email:emails', label: 'Email Emails' },+ ],+ },+ ],+ },+ ],+};++export const mauticGetUserOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'user',+ label: 'User',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified', format: 'datetime' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'username', label: 'Username' },+ { key: 'firstName', label: 'First Name' },+ { key: 'lastName', label: 'Last Name' },+ { key: 'email', label: 'Email', format: 'email' },+ { key: 'position', label: 'Position' },+ { key: 'role', label: 'Role', children: userRole2Fields },+ { key: 'timezone', label: 'Timezone' },+ { key: 'locale', label: 'Locale' },+ { key: 'lastLogin', label: 'Last Login' },+ { key: 'lastActive', label: 'Last Active' },+ { key: 'signature', label: 'Signature' },+ ],+ },+ ],+};++export const mauticListAssignableRolesOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'roles',+ label: 'Roles',+ labelKey: 'name',+ listItems: [+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'name', label: 'Name' },+ ],+ },+ ],+};++export const mauticListRolesOutputSchema: OutputSchema = {+ fields: [+ { key: 'total', label: 'Total', format: 'number' },+ { key: 'roles', label: 'Roles', labelKey: 'name', listItems: role2Fields },+ ],+};++export const mauticListUsersOutputSchema: OutputSchema = {+ fields: [+ { key: 'total', label: 'Total', format: 'number' },+ {+ key: 'users',+ label: 'Users',+ labelKey: 'email',+ listItems: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'username', label: 'Username' },+ { key: 'firstName', label: 'First Name' },+ { key: 'lastName', label: 'Last Name' },+ { key: 'email', label: 'Email', format: 'email' },+ { key: 'position', label: 'Position' },+ { key: 'role', label: 'Role', children: userRole2Fields },+ { key: 'timezone', label: 'Timezone' },+ { key: 'locale', label: 'Locale' },+ { key: 'lastLogin', label: 'Last Login' },+ { key: 'lastActive', label: 'Last Active' },+ { key: 'signature', label: 'Signature' },+ ],+ },+ ],+};++export const mauticUpdateRoleOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'role',+ label: 'Role',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified', format: 'datetime' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'name', label: 'Name' },+ { key: 'description', label: 'Description' },+ { key: 'isAdmin', label: 'Is Admin', format: 'boolean' },+ {+ key: 'rawPermissions',+ label: 'Raw Permissions',+ children: [{ key: 'lead:leads', label: 'Lead Leads' }],+ },+ ],+ },+ ],+};diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/users/update-role.ts b/packages/pieces/community/mautic/src/lib/actions/ai/users/update-role.tsnew file mode 100644index 00000000000..89f5497f2bc--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/users/update-role.ts@@ -0,0 +1,57 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticUpdateRoleOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticUpdateRoleAction = createAction({+ auth: mauticAuth,+ name: 'mautic_update_role',+ outputSchema: mauticUpdateRoleOutputSchema,+ displayName: 'Update Role',+ description: 'Updates fields of a Mautic role.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Updates an existing role; Permissions, when given, replace the existing ones. Needs an administrator account. Only the fields given are changed.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'Role Id',+ description: 'Numeric role id, from List Roles or Create Role.',+ }),+ name: Property.ShortText({ displayName: 'Name', required: false }),+ description: Property.LongText({ displayName: 'Description', required: false }),+ isAdmin: mauticAiProps.yesNo({+ displayName: 'Administrator',+ description: 'Full access to everything; permissions are ignored.',+ }),+ rawPermissions: Property.Json({+ displayName: 'Permissions',+ description:+ 'Permissions by bundle, e.g. {"email:emails": ["viewown", "editown", "create"], "lead:leads": ["full"]}.',+ required: false,+ }),+ additionalFields: mauticAiProps.additionalFields({+ description: 'Other role properties. The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const { id, additionalFields, name, description, isAdmin, rawPermissions } = context.propsValue;+ return await mauticApi.updateRecord({+ auth: context.auth,+ resource: 'roles',+ id,+ body: {+ ...additionalFields,+ ...spreadIfDefined('name', name),+ ...spreadIfDefined('description', description),+ ...spreadIfDefined('isAdmin', isAdmin),+ ...spreadIfDefined('rawPermissions', rawPermissions),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/ai/users/update-user.ts b/packages/pieces/community/mautic/src/lib/actions/ai/users/update-user.tsnew file mode 100644index 00000000000..31ed44fe092--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/actions/ai/users/update-user.ts@@ -0,0 +1,91 @@+import { Property, createAction, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticGetUserOutputSchema } from './output-schemas';+import { mauticAuth } from '../../../auth';+import { mauticAiProps } from '../../../common/ai-props';+import { mauticApi } from '../../../common/api';++export const mauticUpdateUserAction = createAction({+ auth: mauticAuth,+ name: 'mautic_update_user',+ outputSchema: mauticGetUserOutputSchema,+ displayName: 'Update User',+ description: 'Updates fields of a Mautic user.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Updates an existing user; give Password only to change it. Needs an administrator account. Only the fields given are changed.',+ idempotent: true,+ },+ props: {+ id: mauticAiProps.recordId({+ displayName: 'User Id',+ description: 'Numeric user id, from List Users or Create User.',+ }),+ username: Property.ShortText({ displayName: 'Username', required: false }),+ email: Property.ShortText({ displayName: 'Email', required: false }),+ firstName: Property.ShortText({ displayName: 'First Name', required: false }),+ lastName: Property.ShortText({ displayName: 'Last Name', required: false }),+ role: Property.Number({+ displayName: 'Role Id',+ description: 'Role id, from List Assignable Roles.',+ required: false,+ }),+ position: Property.ShortText({ displayName: 'Position', required: false }),+ timezone: Property.ShortText({+ displayName: 'Timezone',+ description: 'e.g. "Europe/Berlin".',+ required: false,+ }),+ locale: Property.ShortText({+ displayName: 'Locale',+ description: 'e.g. "en_US".',+ required: false,+ }),+ isPublished: mauticAiProps.yesNo({ displayName: 'Published' }),+ password: Property.ShortText({+ displayName: 'Password',+ description: 'Password for the user to sign in with.',+ required: false,+ }),+ additionalFields: mauticAiProps.additionalFields({+ description:+ 'Other user properties, e.g. "signature". The dedicated props above win over the same keys here.',+ }),+ },+ async run(context) {+ const {+ id,+ additionalFields,+ password,+ username,+ email,+ firstName,+ lastName,+ role,+ position,+ timezone,+ locale,+ isPublished,+ } = context.propsValue;+ return await mauticApi.updateRecord({+ auth: context.auth,+ resource: 'users',+ id,+ body: {+ ...additionalFields,+ ...spreadIfDefined('username', username),+ ...spreadIfDefined('email', email),+ ...spreadIfDefined('firstName', firstName),+ ...spreadIfDefined('lastName', lastName),+ ...spreadIfDefined('role', role),+ ...spreadIfDefined('position', position),+ ...spreadIfDefined('timezone', timezone),+ ...spreadIfDefined('locale', locale),+ ...spreadIfDefined('isPublished', isPublished),+ ...(password ? { plainPassword: { password, confirm: password } } : {}),+ },+ });+ },+});diff --git a/packages/pieces/community/mautic/src/lib/actions/create-company.ts b/packages/pieces/community/mautic/src/lib/actions/create-company.tsindex 4c50fc94cab..bffb4943c19 100644--- a/packages/pieces/community/mautic/src/lib/actions/create-company.ts+++ b/packages/pieces/community/mautic/src/lib/actions/create-company.ts@@ -1,16 +1,13 @@import { createAction } from '@activepieces/pieces-framework';-import {- httpClient,- HttpMethod,- HttpRequest,-} from '@activepieces/pieces-common';-import { mauticCommon } from '../common';import { mauticAuth } from '../auth';+import { mauticApi } from '../common/api';+import { mauticProps } from '../common/props';+import { createMauticCompanyOutputSchema } from '../output-schemas';-export const createCompany = createAction({+export const createCompanyAction = createAction({auth: mauticAuth,- description: 'Creates a new company in Mautic CRM', // Must be a unique across the piece, this shouldn't be changed.- audience: 'both',+ description: 'Creates a new company in Mautic CRM',+ audience: 'human',aiMetadata: {description:'Create a new company in Mautic from the provided field values (company name, address, custom fields, etc.). Use when adding an organization to Mautic; to modify an existing company use Update Company, and check Search Company first to avoid duplicates. Not idempotent: each call inserts a new company record.',@@ -18,24 +15,12 @@ export const createCompany = createAction({},displayName: 'Create Company',name: 'create_mautic_company',+ outputSchema: createMauticCompanyOutputSchema,classification: 'WRITE',props: {- fields: mauticCommon.companyFields,+ fields: mauticProps.companyFields({ required: true }),},run: async function (context) {- const { base_url, username, password } = context.auth.props;- const request: HttpRequest = {- method: HttpMethod.POST,- url:- (base_url.endsWith('/') ? base_url : base_url + '/') +- 'api/companies/new',- body: JSON.stringify(context.propsValue.fields),- headers: {- Authorization:- 'Basic ' + Buffer.from(`${username}:${password}`).toString('base64'),- 'Content-Type': 'application/json',- },- };- return await httpClient.sendRequest(request);+ return await mauticApi.createCompany({ auth: context.auth, fields: context.propsValue.fields });},});diff --git a/packages/pieces/community/mautic/src/lib/actions/create-contact.ts b/packages/pieces/community/mautic/src/lib/actions/create-contact.tsindex 01aaed0dd3f..8ee536b4249 100644--- a/packages/pieces/community/mautic/src/lib/actions/create-contact.ts+++ b/packages/pieces/community/mautic/src/lib/actions/create-contact.ts@@ -1,16 +1,13 @@import { createAction } from '@activepieces/pieces-framework';-import {- httpClient,- HttpMethod,- HttpRequest,-} from '@activepieces/pieces-common';-import { mauticCommon } from '../common';import { mauticAuth } from '../auth';+import { mauticApi } from '../common/api';+import { mauticProps } from '../common/props';+import { createMauticContactOutputSchema } from '../output-schemas';-export const createContact = createAction({+export const createContactAction = createAction({auth: mauticAuth,- description: 'Creates a new contact in Mautic CRM', // Must be a unique across the piece, this shouldn't be changed.- audience: 'both',+ description: 'Creates a new contact in Mautic CRM',+ audience: 'human',aiMetadata: {description:'Create a new contact (lead) in Mautic from the provided field values (name, email, phone, custom fields, etc.). Use when adding a person to Mautic; to modify an existing contact use Update Contact instead, and to avoid duplicates check first with Search Contact. Not idempotent: each call inserts a new contact, so repeating it produces duplicates.',@@ -18,24 +15,12 @@ export const createContact = createAction({},displayName: 'Create Contact',name: 'create_mautic_contact',+ outputSchema: createMauticContactOutputSchema,classification: 'WRITE',props: {- fields: mauticCommon.contactFields,+ fields: mauticProps.contactFields({ required: true }),},run: async function (context) {- const { base_url, username, password } = context.auth.props;- const request: HttpRequest = {- method: HttpMethod.POST,- url:- (base_url.endsWith('/') ? base_url : base_url + '/') +- 'api/contacts/new',- body: JSON.stringify(context.propsValue.fields),- headers: {- Authorization:- 'Basic ' + Buffer.from(`${username}:${password}`).toString('base64'),- 'Content-Type': 'application/json',- },- };- return await httpClient.sendRequest(request);+ return await mauticApi.createContact({ auth: context.auth, fields: context.propsValue.fields });},});diff --git a/packages/pieces/community/mautic/src/lib/actions/index.ts b/packages/pieces/community/mautic/src/lib/actions/index.tsdeleted file mode 100644index d915524ba25..00000000000--- a/packages/pieces/community/mautic/src/lib/actions/index.ts+++ /dev/null@@ -1,6 +0,0 @@-export { createContact } from './create-contact';-export { searchContact } from './search-contact';-export { updateContact } from './update-contact';-export { createCompany } from './create-company';-export { searchCompany } from './search-company';-export { updateCompany } from './update-company';diff --git a/packages/pieces/community/mautic/src/lib/actions/search-company.ts b/packages/pieces/community/mautic/src/lib/actions/search-company.tsindex e719c6db33a..bc6fd368834 100644--- a/packages/pieces/community/mautic/src/lib/actions/search-company.ts+++ b/packages/pieces/community/mautic/src/lib/actions/search-company.ts@@ -1,11 +1,13 @@import { createAction } from '@activepieces/pieces-framework';-import { mauticCommon, searchEntity } from '../common';import { mauticAuth } from '../auth';+import { mauticApi } from '../common/api';+import { mauticProps } from '../common/props';+import { searchMauticCompanyOutputSchema } from '../output-schemas';-export const searchCompany = createAction({+export const searchCompanyAction = createAction({auth: mauticAuth,- description: 'Search for a company in Mautic CRM', // Must be a unique across the piece, this shouldn't be changed.- audience: 'both',+ description: 'Search for a company in Mautic CRM',+ audience: 'human',aiMetadata: {description:'Look up a company in Mautic by matching the supplied field values (combined into a search query), returning the first matching company. Use to find a company or resolve its id before updating, or to verify whether an organization already exists before creating one. Read-only and idempotent.',@@ -13,23 +15,13 @@ export const searchCompany = createAction({},displayName: 'Search Company',name: 'search_mautic_company',+ outputSchema: searchMauticCompanyOutputSchema,classification: 'SEARCH',props: {- fields: mauticCommon.companyFields,+ fields: mauticProps.companyFields({ required: true }),},run: async function (context) {- const { base_url, username, password } = context.auth.props;- const url =- (base_url.endsWith('/') ? base_url : base_url + '/') + 'api/companies';- const fields = context.propsValue.fields;- const keys = Object.keys(fields);- let searchParams = '?';- for (const key of keys) {- if (fields[key]) {- searchParams += `search=${key}:${fields[key]}&`;- }- }- const response = await searchEntity(url, searchParams, username, password);- return Object.values(response.body.companies)[0];+ const response = await mauticApi.searchCompanies({ auth: context.auth, fields: context.propsValue.fields });+ return Object.values(response.companies)[0];},});diff --git a/packages/pieces/community/mautic/src/lib/actions/search-contact.ts b/packages/pieces/community/mautic/src/lib/actions/search-contact.tsindex 92440bc1470..00d37dd33bb 100644--- a/packages/pieces/community/mautic/src/lib/actions/search-contact.ts+++ b/packages/pieces/community/mautic/src/lib/actions/search-contact.ts@@ -1,11 +1,13 @@import { createAction } from '@activepieces/pieces-framework';-import { mauticCommon, searchEntity } from '../common';import { mauticAuth } from '../auth';+import { mauticApi } from '../common/api';+import { mauticProps } from '../common/props';+import { searchMauticContactOutputSchema } from '../output-schemas';-export const searchContact = createAction({+export const searchContactAction = createAction({auth: mauticAuth,- description: 'Search for a contact in Mautic CRM', // Must be a unique across the piece, this shouldn't be changed.- audience: 'both',+ description: 'Search for a contact in Mautic CRM',+ audience: 'human',aiMetadata: {description:'Look up a contact in Mautic by matching the supplied field values (each provided field becomes an exact-equality filter), returning the first matching contact. Use to find a contact or resolve its id before updating, or to verify whether someone already exists before creating one. Read-only and idempotent.',@@ -13,25 +15,13 @@ export const searchContact = createAction({},displayName: 'Search Contact',name: 'search_mautic_contact',+ outputSchema: searchMauticContactOutputSchema,classification: 'SEARCH',props: {- fields: mauticCommon.contactFields,+ fields: mauticProps.contactFields({ required: true }),},run: async function (context) {- const { base_url, username, password } = context.auth.props;- const url =- (base_url.endsWith('/') ? base_url : base_url + '/') + 'api/contacts';- const fields = context.propsValue.fields;- const keys = Object.keys(fields);- let count = 0;- let searchParams = '?';- for (const key of keys) {- if (fields[key]) {- searchParams += `where[${count}][col]=${key}&where[${count}][expr]=eq&where[${count}][val]=${fields[key]}&`;- ++count;- }- }- const response = await searchEntity(url, searchParams, username, password);- return Object.values(response.body.contacts)[0];+ const response = await mauticApi.searchContacts({ auth: context.auth, fields: context.propsValue.fields });+ return Object.values(response.contacts)[0];},});diff --git a/packages/pieces/community/mautic/src/lib/actions/update-company.ts b/packages/pieces/community/mautic/src/lib/actions/update-company.tsindex 19cf63befe9..0f6108d4ec6 100644--- a/packages/pieces/community/mautic/src/lib/actions/update-company.ts+++ b/packages/pieces/community/mautic/src/lib/actions/update-company.ts@@ -1,16 +1,13 @@import { createAction } from '@activepieces/pieces-framework';-import {- httpClient,- HttpMethod,- HttpRequest,-} from '@activepieces/pieces-common';-import { mauticCommon } from '../common';import { mauticAuth } from '../auth';+import { mauticApi } from '../common/api';+import { mauticProps } from '../common/props';+import { updateMauticCompanyOutputSchema } from '../output-schemas';-export const updateCompany = createAction({+export const updateCompanyAction = createAction({auth: mauticAuth,- description: 'Update a company in Mautic CRM', // Must be a unique across the piece, this shouldn't be changed.- audience: 'both',+ description: 'Update a company in Mautic CRM',+ audience: 'human',aiMetadata: {description:'Update an existing Mautic company, identified by its numeric company id, with the provided field values (empty fields are dropped so they are left unchanged). Use when you already know the company id (resolve it first with Search Company if you only have a name). Idempotent: applying the same field values to the same id repeatedly leaves the company in the same state.',@@ -18,34 +15,17 @@ export const updateCompany = createAction({},displayName: 'Update Company With Contact Id',name: 'update_mautic_company',+ outputSchema: updateMauticCompanyOutputSchema,classification: 'WRITE',props: {- id: mauticCommon.id,- fields: mauticCommon.companyFields,+ id: mauticProps.entityId({ required: true }),+ fields: mauticProps.companyFields({ required: true }),},run: async function (context) {- const { base_url, username, password } = context.auth.props;- // This is intentionally done because for `null` data Mautic doesn't change data for contacts but- // for the same it changes data for companies. This step is taken to ensure both behave the same.- const fields = context.propsValue.fields;- const keys = Object.keys(fields);- for (const key of keys) {- if (!fields[key]) {- delete fields[key];- }- }- const request: HttpRequest = {- method: HttpMethod.PATCH,- url: `${- base_url.endsWith('/') ? base_url : base_url + '/'- }api/companies/${context.propsValue.id}/edit`,- body: JSON.stringify(fields),- headers: {- Authorization:- 'Basic ' + Buffer.from(`${username}:${password}`).toString('base64'),- 'Content-Type': 'application/json',- },- };- return await httpClient.sendRequest(request);+ return await mauticApi.updateCompany({+ auth: context.auth,+ id: context.propsValue.id,+ fields: context.propsValue.fields,+ });},});diff --git a/packages/pieces/community/mautic/src/lib/actions/update-contact.ts b/packages/pieces/community/mautic/src/lib/actions/update-contact.tsindex 142c9c2401c..81da14cfa60 100644--- a/packages/pieces/community/mautic/src/lib/actions/update-contact.ts+++ b/packages/pieces/community/mautic/src/lib/actions/update-contact.ts@@ -1,16 +1,13 @@import { createAction } from '@activepieces/pieces-framework';-import {- httpClient,- HttpMethod,- HttpRequest,-} from '@activepieces/pieces-common';-import { mauticCommon } from '../common';import { mauticAuth } from '../auth';+import { mauticApi } from '../common/api';+import { mauticProps } from '../common/props';+import { updateMauticContactOutputSchema } from '../output-schemas';-export const updateContact = createAction({+export const updateContactAction = createAction({auth: mauticAuth,- description: 'Update a contact in Mautic CRM', // Must be a unique across the piece, this shouldn't be changed.- audience: 'both',+ description: 'Update a contact in Mautic CRM',+ audience: 'human',aiMetadata: {description:"Update an existing Mautic contact, identified by its numeric contact id, with the provided field values. Use when you already know the contact id (resolve it first with Search Contact if you only have an email or name). Idempotent: applying the same field values to the same id repeatedly leaves the contact in the same state.",@@ -18,25 +15,17 @@ export const updateContact = createAction({},displayName: 'Update Contact With Contact Id',name: 'update_mautic_contact',+ outputSchema: updateMauticContactOutputSchema,classification: 'WRITE',props: {- id: mauticCommon.id,- fields: mauticCommon.contactFields,+ id: mauticProps.entityId({ required: true }),+ fields: mauticProps.contactFields({ required: true }),},run: async function (context) {- const { base_url, username, password } = context.auth.props;- const request: HttpRequest = {- method: HttpMethod.PATCH,- url: `${base_url.endsWith('/') ? base_url : base_url + '/'}api/contacts/${- context.propsValue.id- }/edit`,- body: JSON.stringify(context.propsValue.fields),- headers: {- Authorization:- 'Basic ' + Buffer.from(`${username}:${password}`).toString('base64'),- 'Content-Type': 'application/json',- },- };- return await httpClient.sendRequest(request);+ return await mauticApi.updateContact({+ auth: context.auth,+ id: context.propsValue.id,+ fields: context.propsValue.fields,+ });},});diff --git a/packages/pieces/community/mautic/src/lib/auth.ts b/packages/pieces/community/mautic/src/lib/auth.tsindex b7dde3abf98..fcee12933b6 100644--- a/packages/pieces/community/mautic/src/lib/auth.ts+++ b/packages/pieces/community/mautic/src/lib/auth.ts@@ -1,4 +1,6 @@-import { PieceAuth, Property } from '@activepieces/pieces-framework';+import { AppConnectionType, isNil, PieceAuth, Property, tryCatch } from '@activepieces/pieces-framework';++import { mauticApi } from './common/api';const markdownDescription = `Follow these steps:@@ -25,5 +27,17 @@ export const mauticAuth = PieceAuth.CustomAuth({required: true,}),},+ validate: async ({ auth }) => {+ const { data, error } = await tryCatch(() =>+ mauticApi.getCurrentUser({ auth: { type: AppConnectionType.CUSTOM_AUTH, props: auth } }),+ );+ if (error || isNil(data?.['username'])) {+ return {+ valid: false,+ error: 'Could not sign in to Mautic. Check the base URL, username and password, and that Basic Authentication is enabled in API Settings.',+ };+ }+ return { valid: true };+ },required: true,});diff --git a/packages/pieces/community/mautic/src/lib/common/ai-props.ts b/packages/pieces/community/mautic/src/lib/common/ai-props.tsnew file mode 100644index 00000000000..6f978b0892b--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/common/ai-props.ts@@ -0,0 +1,162 @@+import { Property } from '@activepieces/pieces-framework';++function recordId({ displayName, description }: { displayName: string; description: string }) {+ return Property.ShortText({ displayName, description, required: true });+}++function additionalFields({ description }: { description: string }) {+ return Property.Json({ displayName: 'Additional Fields', description, required: false });+}++function records({ description }: { description: string }) {+ return Property.Array({ displayName: 'Records', description, required: true });+}++function yesNo({ displayName, description }: { displayName: string; description?: string }) {+ return Property.StaticDropdown({+ displayName,+ description,+ required: false,+ options: {+ options: [+ { label: 'Yes', value: true },+ { label: 'No', value: false },+ ],+ },+ });+}++const pageOptions = {+ search: Property.ShortText({+ displayName: 'Search',+ description: 'Search string or Mautic search command, e.g. "jane" or "email:[email protected]".',+ required: false,+ }),+ start: Property.Number({+ displayName: 'Start',+ description:+ 'Zero-based offset of the first record. Add the limit to it to fetch the next page.',+ required: false,+ }),+ limit: Property.Number({+ displayName: 'Limit',+ description: 'Maximum number of records to return.',+ required: false,+ defaultValue: 30,+ }),+ orderBy: Property.ShortText({+ displayName: 'Order By',+ description: 'Column to sort by, in snake_case, e.g. "date_added" or "id".',+ required: false,+ }),+ orderByDir: Property.StaticDropdown({+ displayName: 'Order Direction',+ required: false,+ options: {+ options: [+ { label: 'Ascending', value: 'ASC' },+ { label: 'Descending', value: 'DESC' },+ ],+ },+ }),+};++const filterOptions = {+ ...pageOptions,+ where: Property.Array({+ displayName: 'Where',+ description:+ 'Conditions that must all match. "col" is a column name such as "email" or "id", "expr" a Doctrine expression, "val" the value (comma-separated for in/notIn).',+ required: false,+ properties: {+ col: Property.ShortText({ displayName: 'Column', required: true }),+ expr: Property.StaticDropdown({+ displayName: 'Expression',+ required: true,+ options: {+ options: [+ 'eq',+ 'neq',+ 'lt',+ 'lte',+ 'gt',+ 'gte',+ 'like',+ 'notLike',+ 'in',+ 'notIn',+ 'isNull',+ 'isNotNull',+ ].map((expr) => ({ label: expr, value: expr })),+ },+ }),+ val: Property.ShortText({ displayName: 'Value', required: false }),+ },+ }),+};++const listOptions = {+ ...filterOptions,+ publishedOnly: Property.Checkbox({+ displayName: 'Published Only',+ description: 'Return only published records.',+ required: false,+ }),+};++const activityOptions = {+ search: Property.ShortText({+ displayName: 'Search',+ description: 'Text to filter events by.',+ required: false,+ }),+ includeEvents: Property.Array({+ displayName: 'Include Event Types',+ description:+ 'Event type ids to include, e.g. "page.hit", "email.read", "form.submitted". Taken from the "types" field of a previous response.',+ required: false,+ }),+ excludeEvents: Property.Array({+ displayName: 'Exclude Event Types',+ description: 'Event type ids to exclude.',+ required: false,+ }),+ dateFrom: Property.ShortText({+ displayName: 'Date From',+ description: 'Earliest event time, format "YYYY-MM-DD HH:MM:SS".',+ required: false,+ }),+ dateTo: Property.ShortText({+ displayName: 'Date To',+ description: 'Latest event time, format "YYYY-MM-DD HH:MM:SS".',+ required: false,+ }),+ orderBy: Property.ShortText({+ displayName: 'Order By',+ description: 'Column to sort by, e.g. "timestamp".',+ required: false,+ }),+ orderByDir: pageOptions.orderByDir,+ page: Property.Number({+ displayName: 'Page',+ description: 'Page number, starting at 1.',+ required: false,+ }),+ limit: Property.Number({+ displayName: 'Limit',+ description: 'Events per page.',+ required: false,+ defaultValue: 25,+ }),+};++export const mauticAiProps = {+ recordId,+ yesNo,+ additionalFields,+ records,+ pageOptions,+ filterOptions,+ listOptions,+ activityOptions,+};diff --git a/packages/pieces/community/mautic/src/lib/common/api.ts b/packages/pieces/community/mautic/src/lib/common/api.tsnew file mode 100644index 00000000000..80c1a9fb8ad--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/common/api.ts@@ -0,0 +1,1061 @@+import FormData from 'form-data';++import { HttpMethod, HttpResponse } from '@activepieces/pieces-common';+import { isNil, spreadIfDefined } from '@activepieces/pieces-framework';++import { mauticClient } from './client';++import type {+ MauticActivityQuery,+ MauticAuthValue,+ MauticCompanySearchResult,+ MauticContactSearchResult,+ MauticEntityFieldType,+ MauticEntityInput,+ MauticField,+ MauticFieldList,+ MauticListQuery,+ MauticRecord,+ MauticWebhookInformation,+} from './types';++async function listFields({+ auth,+ type,+}: {+ auth: MauticAuthValue;+ type: MauticEntityFieldType;+}): Promise<MauticField[]> {+ const response = await mauticClient.request<MauticFieldList>({+ auth,+ method: HttpMethod.GET,+ path: `fields/${type}?limit=1000`,+ });+ if (response.status !== 200) {+ throw Error(`Unable to fetch ${type} metadata`);+ }+ return Object.values(response.body.fields);+}++async function createContact({+ auth,+ fields,+}: {+ auth: MauticAuthValue;+ fields: MauticEntityInput;+}): Promise<HttpResponse> {+ return await mauticClient.request({+ auth,+ method: HttpMethod.POST,+ path: 'contacts/new',+ body: JSON.stringify(fields),+ });+}++async function updateContact({+ auth,+ id,+ fields,+}: {+ auth: MauticAuthValue;+ id: string;+ fields: MauticEntityInput;+}): Promise<HttpResponse> {+ return await mauticClient.request({+ auth,+ method: HttpMethod.PATCH,+ path: `contacts/${id}/edit`,+ body: JSON.stringify(fields),+ });+}++async function searchContacts({+ auth,+ fields,+}: {+ auth: MauticAuthValue;+ fields: MauticEntityInput;+}): Promise<MauticContactSearchResult> {+ let count = 0;+ let searchParams = '?';+ for (const key of Object.keys(fields)) {+ if (fields[key]) {+ searchParams += `where[${count}][col]=${key}&where[${count}][expr]=eq&where[${count}][val]=${fields[key]}&`;+ ++count;+ }+ }+ return await searchEntity<MauticContactSearchResult>({ auth, path: `contacts${searchParams}` });+}++async function createCompany({+ auth,+ fields,+}: {+ auth: MauticAuthValue;+ fields: MauticEntityInput;+}): Promise<HttpResponse> {+ return await mauticClient.request({+ auth,+ method: HttpMethod.POST,+ path: 'companies/new',+ body: JSON.stringify(fields),+ });+}++async function updateCompany({+ auth,+ id,+ fields,+}: {+ auth: MauticAuthValue;+ id: string;+ fields: MauticEntityInput;+}): Promise<HttpResponse> {+ const nonEmptyFields = Object.fromEntries(Object.entries(fields).filter(([, value]) => value));+ return await mauticClient.request({+ auth,+ method: HttpMethod.PATCH,+ path: `companies/${id}/edit`,+ body: JSON.stringify(nonEmptyFields),+ });+}++async function searchCompanies({+ auth,+ fields,+}: {+ auth: MauticAuthValue;+ fields: MauticEntityInput;+}): Promise<MauticCompanySearchResult> {+ let searchParams = '?';+ for (const key of Object.keys(fields)) {+ if (fields[key]) {+ searchParams += `search=${key}:${fields[key]}&`;+ }+ }+ return await searchEntity<MauticCompanySearchResult>({ auth, path: `companies${searchParams}` });+}++async function createWebhook({+ auth,+ name,+ description,+ webhookUrl,+ eventType,+}: CreateWebhookParams): Promise<MauticWebhookInformation> {+ const response = await mauticClient.request<MauticWebhookInformation>({+ auth,+ method: HttpMethod.POST,+ path: 'hooks/new',+ body: {+ name,+ description,+ webhookUrl,+ eventsOrderbyDir: 'ASC',+ triggers: [eventType],+ },+ });+ return response.body;+}++async function deleteWebhook({+ auth,+ webhookId,+}: {+ auth: MauticAuthValue;+ webhookId: number;+}): Promise<void> {+ await mauticClient.request({+ auth,+ method: HttpMethod.DELETE,+ path: `hooks/${webhookId}/delete`,+ });+}++async function searchEntity<T extends { total?: number | string }>({+ auth,+ path,+}: {+ auth: MauticAuthValue;+ path: string;+}): Promise<T> {+ const response = await mauticClient.request<T>({ auth, method: HttpMethod.GET, path });+ const length = response.body.total;+ if (!length || length != 1) {+ throw Error('The query is not perfect enough to get single result. Please refine');+ }+ return response.body;+}++async function getCurrentUser({ auth }: { auth: MauticAuthValue }): Promise<MauticRecord> {+ const response = await mauticClient.request<MauticRecord>({+ auth,+ method: HttpMethod.GET,+ path: 'users/self',+ });+ return response.body;+}++async function listRecords({+ auth,+ resource,+ key,+ query,+}: {+ auth: MauticAuthValue;+ resource: string;+ key: string;+ query: MauticListQuery;+}): Promise<MauticRecord> {+ const response = await mauticClient.request<MauticRecord>({+ auth,+ method: HttpMethod.GET,+ path: resource,+ queryParams: listQuery(query),+ });+ return { ...response.body, [key]: valuesOf({ value: response.body[key] }) };+}++async function getRecord({ auth, resource, id }: RecordParams): Promise<MauticRecord> {+ const response = await mauticClient.request<MauticRecord>({+ auth,+ method: HttpMethod.GET,+ path: `${resource}/${id}`,+ });+ return response.body;+}++async function createRecord({+ auth,+ resource,+ body,+}: {+ auth: MauticAuthValue;+ resource: string;+ body: MauticRecord;+}): Promise<MauticRecord> {+ const response = await mauticClient.request<MauticRecord>({+ auth,+ method: HttpMethod.POST,+ path: `${resource}/new`,+ body,+ });+ return response.body;+}++async function updateRecord({+ auth,+ resource,+ id,+ body,+}: RecordParams & { body: MauticRecord }): Promise<MauticRecord> {+ const response = await mauticClient.request<MauticRecord>({+ auth,+ method: HttpMethod.PATCH,+ path: `${resource}/${id}/edit`,+ body,+ });+ return response.body;+}++async function deleteRecord({ auth, resource, id }: RecordParams): Promise<MauticRecord> {+ const response = await mauticClient.request<MauticRecord>({+ auth,+ method: HttpMethod.DELETE,+ path: `${resource}/${id}/delete`,+ });+ return response.body;+}++async function batchCreateRecords({+ auth,+ resource,+ records,+}: {+ auth: MauticAuthValue;+ resource: string;+ records: MauticRecord[];+}): Promise<MauticRecord> {+ const response = await mauticClient.request<MauticRecord>({+ auth,+ method: HttpMethod.POST,+ path: `${resource}/batch/new`,+ body: records,+ });+ return response.body;+}++async function batchUpdateRecords({+ auth,+ resource,+ records,+}: {+ auth: MauticAuthValue;+ resource: string;+ records: MauticRecord[];+}): Promise<MauticRecord> {+ const response = await mauticClient.request<MauticRecord>({+ auth,+ method: HttpMethod.PATCH,+ path: `${resource}/batch/edit`,+ body: records,+ });+ return response.body;+}++async function batchDeleteRecords({+ auth,+ resource,+ ids,+}: {+ auth: MauticAuthValue;+ resource: string;+ ids: string[];+}): Promise<MauticRecord> {+ const response = await mauticClient.request<MauticRecord>({+ auth,+ method: HttpMethod.DELETE,+ path: `${resource}/batch/delete`,+ queryParams: { ids: ids.join(',') },+ });+ return response.body;+}++async function listActivity({+ auth,+ contactId,+ query,+}: {+ auth: MauticAuthValue;+ contactId?: string;+ query: MauticActivityQuery;+}): Promise<MauticRecord> {+ const response = await mauticClient.request<MauticRecord>({+ auth,+ method: HttpMethod.GET,+ path: contactId ? `contacts/${contactId}/activity` : 'contacts/activity',+ queryParams: activityQuery(query),+ });+ return response.body;+}++async function listContactOptions({+ auth,+ list,+ query,+}: {+ auth: MauticAuthValue;+ list: 'fields' | 'owners' | 'segments';+ query?: Record<string, string>;+}): Promise<MauticRecord> {+ const response = await mauticClient.request<unknown>({+ auth,+ method: HttpMethod.GET,+ path: `contacts/list/${list}`,+ queryParams: query,+ });+ return { [list]: response.body };+}++async function listContactRelation({+ auth,+ id,+ relation,+ query,+}: {+ auth: MauticAuthValue;+ id: string;+ relation: 'campaigns' | 'companies' | 'notes' | 'segments' | 'devices';+ query?: MauticListQuery;+}): Promise<MauticRecord> {+ const response = await mauticClient.request<MauticRecord>({+ auth,+ method: HttpMethod.GET,+ path: `contacts/${id}/${relation}`,+ queryParams: query ? listQuery(query) : undefined,+ });+ const key = relation === 'segments' ? 'lists' : relation;+ return { ...response.body, [key]: valuesOf({ value: response.body[key] }) };+}++async function setDoNotContact({+ auth,+ id,+ channel,+ change,+ body,+}: {+ auth: MauticAuthValue;+ id: string;+ channel: string;+ change: 'add' | 'remove';+ body?: MauticRecord;+}): Promise<MauticRecord> {+ const response = await mauticClient.request<MauticRecord>({+ auth,+ method: HttpMethod.POST,+ path: `contacts/${id}/dnc/${channel}/${change}`,+ body,+ });+ return response.body;+}++async function addContactUtmTags({+ auth,+ id,+ body,+}: {+ auth: MauticAuthValue;+ id: string;+ body: MauticRecord;+}): Promise<MauticRecord> {+ const response = await mauticClient.request<MauticRecord>({+ auth,+ method: HttpMethod.POST,+ path: `contacts/${id}/utm/add`,+ body,+ });+ return response.body;+}++async function removeContactUtmTags({+ auth,+ id,+ utmId,+}: {+ auth: MauticAuthValue;+ id: string;+ utmId: string;+}): Promise<MauticRecord> {+ const response = await mauticClient.request<MauticRecord>({+ auth,+ method: HttpMethod.POST,+ path: `contacts/${id}/utm/${utmId}/remove`,+ });+ return response.body;+}++async function adjustContactPoints({+ auth,+ id,+ operator,+ delta,+ body,+}: {+ auth: MauticAuthValue;+ id: string;+ operator: string;+ delta: number;+ body: MauticRecord;+}): Promise<MauticRecord> {+ const response = await mauticClient.request<MauticRecord>({+ auth,+ method: HttpMethod.POST,+ path: `contacts/${id}/points/${operator}/${delta}`,+ body,+ });+ return response.body;+}++async function listContactPointGroups({+ auth,+ id,+}: {+ auth: MauticAuthValue;+ id: string;+}): Promise<MauticRecord> {+ const response = await mauticClient.request<MauticRecord>({+ auth,+ method: HttpMethod.GET,+ path: `contacts/${id}/points/groups`,+ });+ return response.body;+}++async function getContactPointGroup({+ auth,+ id,+ groupId,+}: {+ auth: MauticAuthValue;+ id: string;+ groupId: string;+}): Promise<MauticRecord> {+ const response = await mauticClient.request<MauticRecord>({+ auth,+ method: HttpMethod.GET,+ path: `contacts/${id}/points/groups/${groupId}`,+ });+ return response.body;+}++async function adjustContactGroupPoints({+ auth,+ id,+ groupId,+ operator,+ value,+ body,+}: {+ auth: MauticAuthValue;+ id: string;+ groupId: string;+ operator: string;+ value: number;+ body: MauticRecord;+}): Promise<MauticRecord> {+ const response = await mauticClient.request<MauticRecord>({+ auth,+ method: HttpMethod.POST,+ path: `contacts/${id}/points/groups/${groupId}/${operator}/${value}`,+ body,+ });+ return response.body;+}++async function changeMembership({+ auth,+ resource,+ id,+ contactId,+ change,+}: RecordParams & { contactId: string; change: 'add' | 'remove' }): Promise<MauticRecord> {+ const response = await mauticClient.request<MauticRecord>({+ auth,+ method: HttpMethod.POST,+ path: `${resource}/${id}/contact/${contactId}/${change}`,+ });+ return response.body;+}++async function addContactsToSegment({+ auth,+ id,+ contactIds,+}: {+ auth: MauticAuthValue;+ id: string;+ contactIds: string[];+}): Promise<MauticRecord> {+ const response = await mauticClient.request<MauticRecord>({+ auth,+ method: HttpMethod.POST,+ path: `segments/${id}/contacts/add`,+ body: { ids: contactIds },+ });+ return response.body;+}++async function cloneCampaign({+ auth,+ id,+}: {+ auth: MauticAuthValue;+ id: string;+}): Promise<MauticRecord> {+ const response = await mauticClient.request<MauticRecord>({+ auth,+ method: HttpMethod.POST,+ path: `campaigns/clone/${id}`,+ });+ return response.body;+}++async function listCampaignContacts({+ auth,+ id,+ query,+}: {+ auth: MauticAuthValue;+ id: string;+ query: MauticListQuery;+}): Promise<MauticRecord> {+ const response = await mauticClient.request<MauticRecord>({+ auth,+ method: HttpMethod.GET,+ path: `campaigns/${id}/contacts`,+ queryParams: listQuery(query),+ });+ return response.body;+}++async function listContactCampaignEvents({+ auth,+ contactId,+ campaignId,+ query,+}: {+ auth: MauticAuthValue;+ contactId: string;+ campaignId?: string;+ query: MauticListQuery;+}): Promise<MauticRecord> {+ const response = await mauticClient.request<MauticRecord>({+ auth,+ method: HttpMethod.GET,+ path: campaignId+ ? `campaigns/${campaignId}/events/contact/${contactId}`+ : `campaigns/events/contact/${contactId}`,+ queryParams: listQuery(query),+ });+ return { ...response.body, events: valuesOf({ value: response.body['events'] }) };+}++async function rescheduleContactCampaignEvent({+ auth,+ eventId,+ contactId,+ body,+}: {+ auth: MauticAuthValue;+ eventId: string;+ contactId: string;+ body: MauticRecord;+}): Promise<MauticRecord> {+ const response = await mauticClient.request<MauticRecord>({+ auth,+ method: HttpMethod.PUT,+ path: `campaigns/events/${eventId}/contact/${contactId}/edit`,+ body,+ });+ return response.body;+}++async function batchRescheduleContactCampaignEvents({+ auth,+ records,+}: {+ auth: MauticAuthValue;+ records: MauticRecord[];+}): Promise<MauticRecord> {+ const response = await mauticClient.request<MauticRecord>({+ auth,+ method: HttpMethod.PUT,+ path: 'campaigns/events/batch/edit',+ body: records,+ });+ return response.body;+}++async function listFormSubmissions({+ auth,+ formId,+ contactId,+ query,+}: {+ auth: MauticAuthValue;+ formId: string;+ contactId?: string;+ query: MauticListQuery;+}): Promise<MauticRecord> {+ const response = await mauticClient.request<MauticRecord>({+ auth,+ method: HttpMethod.GET,+ path: contactId+ ? `forms/${formId}/submissions/contact/${contactId}`+ : `forms/${formId}/submissions`,+ queryParams: listQuery(query),+ });+ return { ...response.body, submissions: valuesOf({ value: response.body['submissions'] }) };+}++async function getFormSubmission({+ auth,+ formId,+ submissionId,+}: {+ auth: MauticAuthValue;+ formId: string;+ submissionId: string;+}): Promise<MauticRecord> {+ const response = await mauticClient.request<MauticRecord>({+ auth,+ method: HttpMethod.GET,+ path: `forms/${formId}/submissions/${submissionId}`,+ });+ return response.body;+}++async function deleteFormItems({+ auth,+ formId,+ kind,+ ids,+}: {+ auth: MauticAuthValue;+ formId: string;+ kind: 'fields' | 'actions';+ ids: string[];+}): Promise<MauticRecord> {+ const response = await mauticClient.request<MauticRecord>({+ auth,+ method: HttpMethod.DELETE,+ path: `forms/${formId}/${kind}/delete`,+ queryParams: Object.fromEntries(ids.map((id, index) => [`${kind}[${index}]`, id])),+ });+ return response.body;+}++async function listAssignableRoles({ auth }: { auth: MauticAuthValue }): Promise<MauticRecord> {+ const response = await mauticClient.request<unknown>({+ auth,+ method: HttpMethod.GET,+ path: 'users/list/roles',+ });+ return { roles: response.body };+}++async function checkUserPermissions({+ auth,+ id,+ permissions,+}: {+ auth: MauticAuthValue;+ id: string;+ permissions: string[];+}): Promise<MauticRecord> {+ const response = await mauticClient.request<MauticRecord>({+ auth,+ method: HttpMethod.POST,+ path: `users/${id}/permissioncheck`,+ body: { permissions },+ });+ return response.body;+}++async function getReport({+ auth,+ id,+ query,+}: {+ auth: MauticAuthValue;+ id: string;+ query: Record<string, string>;+}): Promise<MauticRecord> {+ const response = await mauticClient.request<MauticRecord>({+ auth,+ method: HttpMethod.GET,+ path: `reports/${id}`,+ queryParams: query,+ });+ return response.body;+}++async function getStats({+ auth,+ table,+ query,+}: {+ auth: MauticAuthValue;+ table?: string;+ query: MauticListQuery;+}): Promise<MauticRecord> {+ const response = await mauticClient.request<MauticRecord>({+ auth,+ method: HttpMethod.GET,+ path: table ? `stats/${table}` : 'stats',+ queryParams: listQuery(query),+ });+ return response.body;+}++async function getDashboardData({+ auth,+ type,+ query,+}: {+ auth: MauticAuthValue;+ type?: string;+ query?: Record<string, string>;+}): Promise<MauticRecord> {+ const response = await mauticClient.request<MauticRecord>({+ auth,+ method: HttpMethod.GET,+ path: type ? `data/${type}` : 'data',+ queryParams: query,+ });+ return response.body;+}++async function generateFocusItemJs({+ auth,+ id,+}: {+ auth: MauticAuthValue;+ id: string;+}): Promise<MauticRecord> {+ const response = await mauticClient.request<MauticRecord>({+ auth,+ method: HttpMethod.POST,+ path: `focus/${id}/js`,+ });+ return response.body;+}++async function listPointTypes({+ auth,+ kind,+}: {+ auth: MauticAuthValue;+ kind: 'actions' | 'triggers/events';+}): Promise<MauticRecord> {+ const response = await mauticClient.request<MauticRecord>({+ auth,+ method: HttpMethod.GET,+ path: `points/${kind}/types`,+ });+ return response.body;+}++async function deletePointTriggerEvents({+ auth,+ triggerId,+ eventIds,+}: {+ auth: MauticAuthValue;+ triggerId: string;+ eventIds: string[];+}): Promise<MauticRecord> {+ const response = await mauticClient.request<MauticRecord>({+ auth,+ method: HttpMethod.DELETE,+ path: `points/triggers/${triggerId}/events/delete`,+ queryParams: Object.fromEntries(eventIds.map((id, index) => [`events[${index}]`, id])),+ });+ return response.body;+}++async function listFiles({+ auth,+ dir,+ subdir,+}: {+ auth: MauticAuthValue;+ dir: string;+ subdir?: string;+}): Promise<MauticRecord> {+ const response = await mauticClient.request<MauticRecord>({+ auth,+ method: HttpMethod.GET,+ path: `files/${dir}`,+ queryParams: subdir ? { subdir } : undefined,+ });+ return response.body;+}++async function uploadFile({+ auth,+ path,+ file,+ subdir,+}: {+ auth: MauticAuthValue;+ path: string;+ file: { filename: string; data: Buffer };+ subdir?: string;+}): Promise<MauticRecord> {+ const form = new FormData();+ form.append('file', file.data, file.filename);+ const response = await mauticClient.request<MauticRecord>({+ auth,+ method: HttpMethod.POST,+ path,+ body: form,+ headers: form.getHeaders(),+ queryParams: subdir ? { subdir } : undefined,+ });+ return response.body;+}++async function deleteFile({+ auth,+ dir,+ file,+ subdir,+}: {+ auth: MauticAuthValue;+ dir: string;+ file: string;+ subdir?: string;+}): Promise<MauticRecord> {+ const response = await mauticClient.request<MauticRecord>({+ auth,+ method: HttpMethod.DELETE,+ path: `files/${dir}/${file}/delete`,+ queryParams: subdir ? { subdir } : undefined,+ });+ return response.body;+}++async function listThemes({ auth }: { auth: MauticAuthValue }): Promise<MauticRecord> {+ const response = await mauticClient.request<MauticRecord>({+ auth,+ method: HttpMethod.GET,+ path: 'themes',+ });+ return response.body;+}++async function getTheme({+ auth,+ theme,+}: {+ auth: MauticAuthValue;+ theme: string;+}): Promise<Buffer> {+ const response = await mauticClient.request<Buffer>({+ auth,+ method: HttpMethod.GET,+ path: `themes/${theme}`,+ responseType: 'arraybuffer',+ });+ return response.body;+}++async function deleteTheme({+ auth,+ theme,+}: {+ auth: MauticAuthValue;+ theme: string;+}): Promise<MauticRecord> {+ const response = await mauticClient.request<MauticRecord>({+ auth,+ method: HttpMethod.DELETE,+ path: `themes/${theme}/delete`,+ });+ return response.body;+}++function listQuery({+ search,+ start,+ limit,+ orderBy,+ orderByDir,+ publishedOnly,+ where,+}: MauticListQuery): Record<string, string> {+ return {+ ...spreadIfDefined('search', search),+ ...spreadIfDefined('start', start?.toString()),+ ...spreadIfDefined('limit', limit?.toString()),+ ...spreadIfDefined('orderBy', orderBy),+ ...spreadIfDefined('orderByDir', orderByDir),+ ...(publishedOnly ? { published: '1' } : {}),+ ...Object.fromEntries(+ (where ?? []).flatMap((condition, index) =>+ Object.entries(recordOf({ value: condition }))+ .filter(([, value]) => !isNil(value) && value !== '')+ .map(([field, value]) => [`where[${index}][${field}]`, String(value)]),+ ),+ ),+ };+}++function activityQuery({+ search,+ includeEvents,+ excludeEvents,+ dateFrom,+ dateTo,+ orderBy,+ orderByDir,+ page,+ limit,+}: MauticActivityQuery): Record<string, string> {+ return {+ ...spreadIfDefined('filters[search]', search),+ ...Object.fromEntries(+ (includeEvents ?? []).map((event, index) => [+ `filters[includeEvents][${index}]`,+ String(event),+ ]),+ ),+ ...Object.fromEntries(+ (excludeEvents ?? []).map((event, index) => [+ `filters[excludeEvents][${index}]`,+ String(event),+ ]),+ ),+ ...spreadIfDefined('filters[dateFrom]', dateFrom),+ ...spreadIfDefined('filters[dateTo]', dateTo),+ ...spreadIfDefined('order[0]', orderBy),+ ...spreadIfDefined('order[1]', orderBy ? orderByDir : undefined),+ ...spreadIfDefined('page', page?.toString()),+ ...spreadIfDefined('limit', limit?.toString()),+ };+}++function valuesOf({ value }: { value: unknown }): unknown {+ return typeof value === 'object' && value !== null ? Object.values(value) : value;+}++function recordOf({ value }: { value: unknown }): object {+ return typeof value === 'object' && value !== null ? value : {};+}++export const mauticApi = {+ listFields,+ createContact,+ updateContact,+ searchContacts,+ createCompany,+ updateCompany,+ searchCompanies,+ createWebhook,+ deleteWebhook,+ getCurrentUser,+ listRecords,+ getRecord,+ createRecord,+ updateRecord,+ deleteRecord,+ batchCreateRecords,+ batchUpdateRecords,+ batchDeleteRecords,+ listActivity,+ listContactOptions,+ listContactRelation,+ setDoNotContact,+ addContactUtmTags,+ removeContactUtmTags,+ adjustContactPoints,+ listContactPointGroups,+ getContactPointGroup,+ adjustContactGroupPoints,+ changeMembership,+ addContactsToSegment,+ cloneCampaign,+ listCampaignContacts,+ listContactCampaignEvents,+ rescheduleContactCampaignEvent,+ batchRescheduleContactCampaignEvents,+ listFormSubmissions,+ getFormSubmission,+ deleteFormItems,+ listAssignableRoles,+ checkUserPermissions,+ getReport,+ getStats,+ getDashboardData,+ generateFocusItemJs,+ listPointTypes,+ deletePointTriggerEvents,+ listFiles,+ uploadFile,+ deleteFile,+ listThemes,+ getTheme,+ deleteTheme,+};++type RecordParams = { auth: MauticAuthValue; resource: string; id: string };++type CreateWebhookParams = {+ auth: MauticAuthValue;+ name: string;+ description: string;+ webhookUrl: string;+ eventType: string;+};diff --git a/packages/pieces/community/mautic/src/lib/common/client.ts b/packages/pieces/community/mautic/src/lib/common/client.tsnew file mode 100644index 00000000000..5a09c6a7409--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/common/client.ts@@ -0,0 +1,43 @@+import { HttpMethod, HttpResponse, httpClient } from '@activepieces/pieces-common';++import type { MauticAuthValue } from './types';++function baseUrl({ auth }: { auth: MauticAuthValue }): string {+ const { base_url } = auth.props;+ return `${base_url.endsWith('/') ? base_url : base_url + '/'}api/`;+}++async function request<T>({+ auth,+ method,+ path,+ body,+ queryParams,+ headers,+ responseType,+}: RequestParams): Promise<HttpResponse<T>> {+ const { username, password } = auth.props;+ return await httpClient.sendRequest<T>({+ method,+ url: `${baseUrl({ auth })}${path}`,+ body,+ queryParams,+ responseType,+ headers: {+ Authorization: 'Basic ' + Buffer.from(`${username}:${password}`).toString('base64'),+ ...(headers ?? { 'Content-Type': 'application/json' }),+ },+ });+}++export const mauticClient = { baseUrl, request };++type RequestParams = {+ auth: MauticAuthValue;+ method: HttpMethod;+ path: string;+ body?: unknown;+ queryParams?: Record<string, string>;+ headers?: Record<string, string>;+ responseType?: 'arraybuffer';+};diff --git a/packages/pieces/community/mautic/src/lib/common/helper.ts b/packages/pieces/community/mautic/src/lib/common/helper.tsdeleted file mode 100644index 0c2c0245d07..00000000000--- a/packages/pieces/community/mautic/src/lib/common/helper.ts+++ /dev/null@@ -1,126 +0,0 @@-import { DynamicPropsValue, Property } from '@activepieces/pieces-framework';-import {- httpClient,- HttpMethod,- HttpRequest,-} from '@activepieces/pieces-common';-import { mauticAuth } from '../auth';--// Function Section-export const mapMauticToActivepiecesProperty = (- type: string,- fieldMetadata: {- displayName: string;- required: boolean;- },- properties: object-) => {- switch (type) {- case 'lookup':- case 'text':- case 'email':- case 'tel':- case 'region':- case 'country':- case 'locale':- case 'timezone':- case 'url':- return Property.ShortText(fieldMetadata);- case 'date':- case 'datetime':- return Property.DateTime(fieldMetadata);- case 'number':- return Property.Number(fieldMetadata);- case 'boolean':- return Property.StaticDropdown({- ...fieldMetadata,- options: {- options: [- { value: 'no', label: 'No' },- { value: 'yes', label: 'Yes' },- ],- },- });- case 'multiselect':- return Property.StaticMultiSelectDropdown({- ...fieldMetadata,- options: {- options: Object.values(properties)[0],- },- });- case 'select':- return Property.StaticDropdown({- ...fieldMetadata,- options: {- options: Object.values(properties)[0],- },- });- default:- console.error(`No support of type ${type}`);- return null;- }-};--export const fetchDynamicFieldsFromMetadata = async (- baseUrl: string,- username: string,- password: string,- type: 'contact' | 'company' | 'lead'-) => {- const request: HttpRequest = {- method: HttpMethod.GET,- url: `${- baseUrl.endsWith('/') ? baseUrl : baseUrl + '/'- }api/fields/${type}?limit=1000`,- headers: {- Authorization: `Basic ${Buffer.from(`${username}:${password}`).toString(- 'base64'- )}`,- 'Content-Type': 'application/json',- },- };-- const result = await httpClient.sendRequest(request);- if (result.status == 200) {- return Object.values(result.body.fields).reduce(- (fields: DynamicPropsValue, field) => {- const {- label: displayName,- alias,- type,- properties,- } = field as Record<string, any>;- const fieldMetadata = {- displayName,- required: false,- };- if (!type) return {};- const f = mapMauticToActivepiecesProperty(- type,- fieldMetadata,- properties- );- if (f) {- fields[alias] = f;- }- return fields;- },- {}- );- }- throw Error(`Unable to fetch ${type} metadata`);-};--export const getFields = (type: 'contact' | 'company' | 'lead') =>- Property.DynamicProperties({- auth: mauticAuth,- displayName: 'All Fields',- description: 'List of all possible fields present',- required: true,- refreshers: [],- props: async ({ auth }) => {- if (!auth) return {};- const { base_url, username, password } = auth.props;- return fetchDynamicFieldsFromMetadata(base_url, username, password, type);- },- });diff --git a/packages/pieces/community/mautic/src/lib/common/index.ts b/packages/pieces/community/mautic/src/lib/common/index.tsdeleted file mode 100644index 066a6014fd9..00000000000--- a/packages/pieces/community/mautic/src/lib/common/index.ts+++ /dev/null@@ -1,41 +0,0 @@-import { Property } from '@activepieces/pieces-framework';-import { getFields } from './helper';-import {- httpClient,- HttpMethod,- HttpRequest,-} from '@activepieces/pieces-common';--export const mauticCommon = {- contactFields: { ...getFields('contact'), ...getFields('lead') },- companyFields: getFields('company'),- id: Property.ShortText({- displayName: 'Id of the entity',- required: true,- }),-};--export const searchEntity = async (- url: string,- searchParams: string,- username: string,- password: string-) => {- const request: HttpRequest = {- method: HttpMethod.GET,- url: `${url}${searchParams}`,- headers: {- Authorization: `Basic ${Buffer.from(`${username}:${password}`).toString(- 'base64'- )}`,- 'Content-Type': 'application/json',- },- };- const response: Record<string, any> = await httpClient.sendRequest(request);- const length = response.body.total;- if (!length || length != 1)- throw Error(- 'The query is not perfect enough to get single result. Please refine'- );- return response;-};diff --git a/packages/pieces/community/mautic/src/lib/common/props.ts b/packages/pieces/community/mautic/src/lib/common/props.tsnew file mode 100644index 00000000000..84d24b182bf--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/common/props.ts@@ -0,0 +1,138 @@+import { DynamicPropsValue, Property } from '@activepieces/pieces-framework';++import { mauticAuth } from '../auth';+import { mauticApi } from './api';++import type { MauticEntityFieldType, MauticFieldOption } from './types';++function contactFields<R extends boolean>(params: PropParams<R>) {+ return entityFields({ ...params, type: 'lead' });+}++function companyFields<R extends boolean>(params: PropParams<R>) {+ return entityFields({ ...params, type: 'company' });+}++function entityId<R extends boolean>({+ required,+ displayName = 'Id of the entity',+ description,+}: PropParams<R>) {+ return Property.ShortText({ displayName, description, required });+}++function webhookName<R extends boolean>({+ required,+ displayName = 'Webhook Name',+ description = 'The name the webhook will be searchable by in mautic the webhooks page.',+}: PropParams<R>) {+ return Property.ShortText({ displayName, description, required });+}++function webhookDescription<R extends boolean>({+ required,+ displayName = 'Description',+ description = 'A short description of the webhook',+}: PropParams<R>) {+ return Property.LongText({ displayName, description, required });+}++function entityFields<R extends boolean>({+ required,+ type,+ displayName = 'All Fields',+ description = 'List of all possible fields present',+}: PropParams<R> & { type: MauticEntityFieldType }) {+ return Property.DynamicProperties({+ auth: mauticAuth,+ displayName,+ description,+ required,+ refreshers: [],+ props: async ({ auth }) => {+ if (!auth) return {};+ const fieldList = await mauticApi.listFields({ auth, type });+ return fieldList.reduce((fields: DynamicPropsValue, field) => {+ const { label: displayName, alias, type, properties } = field;+ const fieldMetadata = {+ displayName,+ required: false,+ };+ if (!type) return {};+ const f = mapMauticToActivepiecesProperty({ type, fieldMetadata, properties });+ if (f) {+ fields[alias] = f;+ }+ return fields;+ }, {});+ },+ });+}++function mapMauticToActivepiecesProperty({+ type,+ fieldMetadata,+ properties,+}: {+ type: string;+ fieldMetadata: { displayName: string; required: boolean };+ properties: Record<string, MauticFieldOption[]>;+}) {+ switch (type) {+ case 'lookup':+ case 'text':+ case 'email':+ case 'tel':+ case 'region':+ case 'country':+ case 'locale':+ case 'timezone':+ case 'url':+ return Property.ShortText(fieldMetadata);+ case 'date':+ case 'datetime':+ return Property.DateTime(fieldMetadata);+ case 'number':+ return Property.Number(fieldMetadata);+ case 'boolean':+ return Property.StaticDropdown({+ ...fieldMetadata,+ options: {+ options: [+ { value: 'no', label: 'No' },+ { value: 'yes', label: 'Yes' },+ ],+ },+ });+ case 'multiselect':+ return Property.StaticMultiSelectDropdown({+ ...fieldMetadata,+ options: {+ options: Object.values(properties)[0],+ },+ });+ case 'select':+ return Property.StaticDropdown({+ ...fieldMetadata,+ options: {+ options: Object.values(properties)[0],+ },+ });+ default:+ return null;+ }+}++export const mauticProps = {+ contactFields,+ companyFields,+ entityId,+ webhookName,+ webhookDescription,+};++export type PropParams<R extends boolean> = {+ required: R;+ displayName?: string;+ description?: string;+};diff --git a/packages/pieces/community/mautic/src/lib/common/types.ts b/packages/pieces/community/mautic/src/lib/common/types.tsnew file mode 100644index 00000000000..f4dd339598e--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/common/types.ts@@ -0,0 +1,88 @@+import type { AppConnectionType } from '@activepieces/pieces-framework';++export type MauticAuthValue = {+ type: AppConnectionType.CUSTOM_AUTH;+ props: { base_url: string; username: string; password: string };+};++export type MauticEntityFieldType = 'contact' | 'company' | 'lead';++export type MauticFieldOption = { label: string; value: string };++export type MauticField = {+ label: string;+ alias: string;+ type?: string;+ properties: Record<string, MauticFieldOption[]>;+};++export type MauticFieldList = { fields: Record<string, MauticField> };++export type MauticEntityInput = Record<string, unknown>;++export type MauticContact = { id: number; fields?: Record<string, unknown> };++export type MauticCompany = { id: number; fields?: Record<string, unknown> };++export type MauticContactSearchResult = {+ total?: number | string;+ contacts: Record<string, MauticContact>;+};++export type MauticCompanySearchResult = {+ total?: number | string;+ companies: Record<string, MauticCompany>;+};++export type MauticWebhookInformation = {+ hook: {+ isPublished: boolean;+ dateAdded: string;+ dateModified: string;+ createdBy: number;+ createdByUser: string;+ modifiedBy: unknown | null;+ modifiedByUser: string;+ id: number;+ name: string;+ description: string;+ webhookUrl: string;+ secret: string;+ eventsOrderbyDir: string;+ category: {+ id: number;+ createdByUser: string;+ modifiedByUser: string;+ title: string;+ alias: string;+ description: string | null;+ color: string | null;+ bundle: string;+ };+ triggers: string[];+ };+};++export type MauticRecord = Record<string, unknown>;++export type MauticListQuery = {+ search?: string;+ start?: number;+ limit?: number;+ orderBy?: string;+ orderByDir?: string;+ publishedOnly?: boolean;+ where?: unknown[];+};++export type MauticActivityQuery = {+ search?: string;+ includeEvents?: unknown[];+ excludeEvents?: unknown[];+ dateFrom?: string;+ dateTo?: string;+ orderBy?: string;+ orderByDir?: string;+ page?: number;+ limit?: number;+};diff --git a/packages/pieces/community/mautic/src/lib/common/utils.ts b/packages/pieces/community/mautic/src/lib/common/utils.tsnew file mode 100644index 00000000000..fcb29b46f9c--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/common/utils.ts@@ -0,0 +1,326 @@+import type { MauticRecord } from './types';++function contactSampleData({ eventType }: { eventType: string }): Record<string, unknown> {+ return { [eventType]: [CONTACT_SAMPLE] };+}++function toBatchRecords({ records }: { records: unknown[] }): MauticRecord[] {+ if (records.length === 0) {+ throw new Error('Records must contain at least one record.');+ }+ return records.map((record, index) => {+ if (typeof record !== 'object' || record === null || Array.isArray(record)) {+ throw new Error(`Records item ${index + 1} must be an object of field values.`);+ }+ return Object.fromEntries(Object.entries(record));+ });+}++function toBatchIds({ ids }: { ids: unknown[] }): string[] {+ if (ids.length === 0) {+ throw new Error('Give at least one id.');+ }+ return ids.map(String);+}++export const mauticUtils = { contactSampleData, toBatchRecords, toBatchIds };++const CONTACT_SAMPLE = {+ contact: {+ id: 38186,+ points: 0,+ color: null,+ fields: {+ core: {+ points: {+ id: '9',+ label: 'Points',+ alias: 'points',+ type: 'number',+ group: 'core',+ object: 'lead',+ is_fixed: '1',+ value: '0',+ },+ title: {+ id: '1',+ label: 'Title',+ alias: 'title',+ type: 'lookup',+ group: 'core',+ object: 'lead',+ is_fixed: '1',+ value: '',+ },+ firstname: {+ id: '2',+ label: 'First Name',+ alias: 'firstname',+ type: 'text',+ group: 'core',+ object: 'lead',+ is_fixed: '1',+ value: 'Test',+ },+ lastname: {+ id: '3',+ label: 'Last Name',+ alias: 'lastname',+ type: 'text',+ group: 'core',+ object: 'lead',+ is_fixed: '1',+ value: 'Contact',+ },+ company: {+ id: '4',+ label: 'Company',+ alias: 'company',+ type: 'text',+ group: 'core',+ object: 'lead',+ is_fixed: '1',+ value: '',+ },+ position: {+ id: '5',+ label: 'Position',+ alias: 'position',+ type: 'text',+ group: 'core',+ object: 'lead',+ is_fixed: '1',+ value: '',+ },+ email: {+ id: '6',+ label: 'Email',+ alias: 'email',+ type: 'email',+ group: 'core',+ object: 'lead',+ is_fixed: '1',+ value: '[email protected]',+ },+ phone: {+ id: '8',+ label: 'Phone',+ alias: 'phone',+ type: 'tel',+ group: 'core',+ object: 'lead',+ is_fixed: '1',+ value: '',+ },+ mobile: {+ id: '7',+ label: 'Mobile',+ alias: 'mobile',+ type: 'tel',+ group: 'core',+ object: 'lead',+ is_fixed: '1',+ value: '',+ },+ address1: {+ id: '11',+ label: 'Address Line 1',+ alias: 'address1',+ type: 'text',+ group: 'core',+ object: 'lead',+ is_fixed: '1',+ value: '',+ },+ address2: {+ id: '12',+ label: 'Address Line 2',+ alias: 'address2',+ type: 'text',+ group: 'core',+ object: 'lead',+ is_fixed: '1',+ value: '',+ },+ city: {+ id: '13',+ label: 'City',+ alias: 'city',+ type: 'text',+ group: 'core',+ object: 'lead',+ is_fixed: '1',+ value: '',+ },+ state: {+ id: '14',+ label: 'State',+ alias: 'state',+ type: 'region',+ group: 'core',+ object: 'lead',+ is_fixed: '1',+ value: '',+ },+ zipcode: {+ id: '15',+ label: 'Zip Code',+ alias: 'zipcode',+ type: 'text',+ group: 'core',+ object: 'lead',+ is_fixed: '1',+ value: '',+ },+ country: {+ id: '16',+ label: 'Country',+ alias: 'country',+ type: 'country',+ group: 'core',+ object: 'lead',+ is_fixed: '1',+ value: '',+ },+ fax: {+ id: '10',+ label: 'Fax',+ alias: 'fax',+ type: 'tel',+ group: 'core',+ object: 'lead',+ is_fixed: '0',+ value: null,+ },+ preferred_locale: {+ id: '17',+ label: 'Preferred Locale',+ alias: 'preferred_locale',+ type: 'locale',+ group: 'core',+ object: 'lead',+ is_fixed: '1',+ value: null,+ },+ attribution_date: {+ id: '18',+ label: 'Attribution Date',+ alias: 'attribution_date',+ type: 'datetime',+ group: 'core',+ object: 'lead',+ is_fixed: '1',+ value: null,+ },+ attribution: {+ id: '19',+ label: 'Attribution',+ alias: 'attribution',+ type: 'number',+ group: 'core',+ object: 'lead',+ is_fixed: '1',+ value: null,+ },+ website: {+ id: '20',+ label: 'Website',+ alias: 'website',+ type: 'url',+ group: 'core',+ object: 'lead',+ is_fixed: '0',+ value: null,+ },+ boolean: {+ id: '43',+ label: 'Boolean',+ alias: 'boolean',+ type: 'boolean',+ group: 'core',+ object: 'lead',+ is_fixed: '0',+ value: null,+ },+ multiple_contact: {+ id: '44',+ label: 'Multiple Contact',+ alias: 'multiple_contact',+ type: 'multiselect',+ group: 'core',+ object: 'lead',+ is_fixed: '0',+ value: null,+ },+ },+ social: {+ facebook: {+ id: '21',+ label: 'Facebook',+ alias: 'facebook',+ type: 'text',+ group: 'social',+ object: 'lead',+ is_fixed: '0',+ value: null,+ },+ foursquare: {+ id: '22',+ label: 'Foursquare',+ alias: 'foursquare',+ type: 'text',+ group: 'social',+ object: 'lead',+ is_fixed: '0',+ value: null,+ },+ instagram: {+ id: '24',+ label: 'Instagram',+ alias: 'instagram',+ type: 'text',+ group: 'social',+ object: 'lead',+ is_fixed: '0',+ value: null,+ },+ linkedin: {+ id: '25',+ label: 'LinkedIn',+ alias: 'linkedin',+ type: 'text',+ group: 'social',+ object: 'lead',+ is_fixed: '0',+ value: null,+ },+ skype: {+ id: '26',+ label: 'Skype',+ alias: 'skype',+ type: 'text',+ group: 'social',+ object: 'lead',+ is_fixed: '0',+ value: null,+ },+ twitter: {+ id: '27',+ label: 'Twitter',+ alias: 'twitter',+ type: 'text',+ group: 'social',+ object: 'lead',+ is_fixed: '0',+ value: null,+ },+ },+ personal: [],+ professional: [],+ },+ },+ channel: 'email',+ old_status: 'contactable',+ new_status: 'manual',+ timestamp: '2017-12-01T00:05:18-06:00',+};diff --git a/packages/pieces/community/mautic/src/lib/output-schemas.ts b/packages/pieces/community/mautic/src/lib/output-schemas.tsnew file mode 100644index 00000000000..c12bbfb4341--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/output-schemas.ts@@ -0,0 +1,1345 @@+import { OutputSchema } from '@activepieces/pieces-framework';++export const categoryFields: OutputSchema['fields'] = [+ { format: 'number', key: 'id', label: 'ID' },+ { key: 'title', label: 'Title' },+ { key: 'alias', label: 'Alias' },+ { key: 'description', label: 'Description' },+ { key: 'color', label: 'Color' },+ { key: 'bundle', label: 'Bundle' },+];++export const assetFields: OutputSchema['fields'] = [+ { format: 'boolean', key: 'isPublished', label: 'Published' },+ { format: 'datetime', key: 'dateAdded', label: 'Date Added' },+ { key: 'dateModified', label: 'Date Modified' },+ { format: 'number', key: 'id', label: 'ID' },+ { key: 'title', label: 'Title' },+ { key: 'alias', label: 'Alias' },+ { children: categoryFields, key: 'category', label: 'Category' },+ { key: 'description', label: 'Description' },+ { key: 'language', label: 'Language' },+ { key: 'publishUp', label: 'Publish Up' },+ { key: 'publishDown', label: 'Publish Down' },+ { format: 'number', key: 'downloadCount', label: 'Download Count' },+ { format: 'number', key: 'uniqueDownloadCount', label: 'Unique Download Count' },+ { format: 'number', key: 'revision', label: 'Revision' },+ { key: 'extension', label: 'Extension' },+ { key: 'mime', label: 'Mime' },+ { format: 'filesize', key: 'size', label: 'Size' },+ { format: 'url', key: 'downloadUrl', label: 'Download URL' },+ { key: 'storageLocation', label: 'Storage Location' },+ { format: 'boolean', key: 'disallow', label: 'Disallow' },+];++export const campaign2Fields: OutputSchema['fields'] = [+ { format: 'number', key: 'id', label: 'ID' },+ { key: 'name', label: 'Name' },+ { key: 'category', label: 'Category' },+ { key: 'description', label: 'Description' },+];++export const campaignEventsFields: OutputSchema['fields'] = [+ { format: 'number', key: 'id', label: 'ID' },+ { key: 'name', label: 'Name' },+ { key: 'description', label: 'Description' },+ { key: 'type', label: 'Type' },+ { key: 'eventType', label: 'Event Type' },+ { key: 'channel', label: 'Channel' },+ { key: 'channelId', label: 'Channel ID' },+ { format: 'number', key: 'order', label: 'Order' },+ {+ children: [{ format: 'number', key: 'points', label: 'Points' }],+ key: 'properties',+ label: 'Properties',+ },+ { key: 'triggerDate', label: 'Trigger Date' },+ { format: 'number', key: 'triggerInterval', label: 'Trigger Interval' },+ { key: 'triggerIntervalUnit', label: 'Trigger Interval Unit' },+ { key: 'triggerHour', label: 'Trigger Hour' },+ { key: 'triggerRestrictedStartHour', label: 'Trigger Restricted Start Hour' },+ { key: 'triggerRestrictedStopHour', label: 'Trigger Restricted Stop Hour' },+ { key: 'triggerRestrictedDaysOfWeek', label: 'Trigger Restricted Days Of Week' },+ { key: 'triggerMode', label: 'Trigger Mode' },+ { key: 'decisionPath', label: 'Decision Path' },+ { key: 'parent', label: 'Parent' },+ { key: 'children', label: 'Children' },+];++export const campaignListsFields: OutputSchema['fields'] = [+ { format: 'number', key: 'id', label: 'ID' },+ { key: 'name', label: 'Name' },+ { key: 'publicName', label: 'Public Name' },+ { key: 'alias', label: 'Alias' },+ { key: 'description', label: 'Description' },+ { children: categoryFields, key: 'category', label: 'Category' },+];++export const campaignFields: OutputSchema['fields'] = [+ { format: 'boolean', key: 'isPublished', label: 'Published' },+ { format: 'datetime', key: 'dateAdded', label: 'Date Added' },+ { key: 'dateModified', label: 'Date Modified' },+ { format: 'number', key: 'id', label: 'ID' },+ { key: 'name', label: 'Name' },+ { children: categoryFields, key: 'category', label: 'Category' },+ { key: 'description', label: 'Description' },+ { format: 'boolean', key: 'allowRestart', label: 'Allow Restart' },+ { format: 'datetime', key: 'publishUp', label: 'Publish Up' },+ { format: 'datetime', key: 'publishDown', label: 'Publish Down' },+ { key: 'events', label: 'Events', labelKey: 'name', listItems: campaignEventsFields },+ { key: 'forms', label: 'Forms' },+ { key: 'lists', label: 'Lists', labelKey: 'name', listItems: campaignListsFields },+ {+ children: [+ {+ key: 'nodes',+ label: 'Nodes',+ labelKey: 'id',+ listItems: [+ { key: 'id', label: 'ID' },+ { key: 'positionX', label: 'Position X' },+ { key: 'positionY', label: 'Position Y' },+ ],+ },+ {+ key: 'connections',+ label: 'Connections',+ listItems: [+ {+ children: [+ { key: 'source', label: 'Source' },+ { key: 'target', label: 'Target' },+ ],+ key: 'anchors',+ label: 'Anchors',+ },+ { key: 'sourceId', label: 'Source ID' },+ { key: 'targetId', label: 'Target ID' },+ ],+ },+ ],+ key: 'canvasSettings',+ label: 'Canvas Settings',+ },+];++export const contactDoNotContactFields: OutputSchema['fields'] = [+ { format: 'number', key: 'id', label: 'ID' },+ { format: 'datetime', key: 'dateAdded', label: 'Date Added' },+ { format: 'number', key: 'reason', label: 'Reason' },+ { key: 'comments', label: 'Comments' },+ { key: 'channel', label: 'Channel' },+];++export const contactOwner2Fields: OutputSchema['fields'] = [+ { format: 'number', key: 'id', label: 'ID' },+ { key: 'username', label: 'Username' },+ { key: 'firstName', label: 'First Name' },+ { key: 'lastName', label: 'Last Name' },+];++export const roleFields: OutputSchema['fields'] = [+ { format: 'boolean', key: 'isPublished', label: 'Published' },+ { format: 'number', key: 'id', label: 'ID' },+ { key: 'name', label: 'Name' },+ { key: 'description', label: 'Description' },+ { format: 'boolean', key: 'isAdmin', label: 'Is Admin' },+];++export const contactOwnerFields: OutputSchema['fields'] = [+ { format: 'boolean', key: 'isPublished', label: 'Published' },+ { format: 'number', key: 'id', label: 'ID' },+ { key: 'username', label: 'Username' },+ { key: 'firstName', label: 'First Name' },+ { key: 'lastName', label: 'Last Name' },+ { format: 'email', key: 'email', label: 'Email' },+ { children: roleFields, key: 'role', label: 'Role' },+ { key: 'timezone', label: 'Timezone' },+ { key: 'locale', label: 'Locale' },+ { format: 'datetime', key: 'lastLogin', label: 'Last Login' },+ { format: 'datetime', key: 'lastActive', label: 'Last Active' },+];++export const fieldsAll4Fields: OutputSchema['fields'] = [+ { key: 'id', label: 'ID' },+ { format: 'number', key: 'points', label: 'Points' },+ { key: 'last_active', label: 'Last Active' },+ { key: 'title', label: 'Title' },+ { key: 'firstname', label: 'First Name' },+ { key: 'lastname', label: 'Last Name' },+ { key: 'company', label: 'Company' },+ { key: 'position', label: 'Position' },+ { format: 'email', key: 'email', label: 'Email' },+ { key: 'phone', label: 'Phone' },+ { key: 'mobile', label: 'Mobile' },+ { key: 'address1', label: 'Address 1' },+ { key: 'address2', label: 'Address 2' },+ { key: 'city', label: 'City' },+ { key: 'state', label: 'State' },+ { key: 'zipcode', label: 'Zip Code' },+ { key: 'timezone', label: 'Timezone' },+ { key: 'country', label: 'Country' },+ { key: 'fax', label: 'Fax' },+ { key: 'preferred_locale', label: 'Preferred Locale' },+ { key: 'attribution_date', label: 'Attribution Date' },+ { key: 'attribution', label: 'Attribution' },+ { key: 'website', label: 'Website' },+ { key: 'facebook', label: 'Facebook' },+ { key: 'foursquare', label: 'Foursquare' },+ { key: 'instagram', label: 'Instagram' },+ { key: 'linkedin', label: 'LinkedIn' },+ { key: 'skype', label: 'Skype' },+ { key: 'twitter', label: 'Twitter' },+];++export const contacts2Fields: OutputSchema['fields'] = [+ { format: 'boolean', key: 'isPublished', label: 'Published' },+ { format: 'datetime', key: 'dateAdded', label: 'Date Added' },+ { format: 'datetime', key: 'dateModified', label: 'Date Modified' },+ { format: 'number', key: 'id', label: 'ID' },+ { format: 'number', key: 'points', label: 'Points' },+ { key: 'color', label: 'Color' },+ {+ children: [{ children: fieldsAll4Fields, key: 'all', label: 'All' }],+ key: 'fields',+ label: 'Fields',+ },+ { key: 'lastActive', label: 'Last Active' },+ { key: 'owner', label: 'Owner' },+ { key: 'ipAddresses', label: 'IP Addresses' },+ { key: 'tags', label: 'Tags' },+ { key: 'utmtags', label: 'UTM Tags' },+ { key: 'stage', label: 'Stage' },+ { format: 'datetime', key: 'dateIdentified', label: 'Date Identified' },+ { key: 'preferredProfileImage', label: 'Preferred Profile Image' },+ { key: 'doNotContact', label: 'Do Not Contact' },+ { key: 'frequencyRules', label: 'Frequency Rules' },+];++export const fieldsAll2Fields: OutputSchema['fields'] = [+ { key: 'id', label: 'ID' },+ { key: 'title', label: 'Title' },+ { key: 'firstname', label: 'First Name' },+ { key: 'lastname', label: 'Last Name' },+ { key: 'company', label: 'Company' },+ { key: 'position', label: 'Position' },+ { format: 'email', key: 'email', label: 'Email' },+ { key: 'mobile', label: 'Mobile' },+ { key: 'phone', label: 'Phone' },+ { format: 'number', key: 'points', label: 'Points' },+ { key: 'fax', label: 'Fax' },+ { key: 'address1', label: 'Address 1' },+ { key: 'address2', label: 'Address 2' },+ { key: 'city', label: 'City' },+ { key: 'state', label: 'State' },+ { key: 'zipcode', label: 'Zip Code' },+ { key: 'country', label: 'Country' },+ { key: 'preferred_locale', label: 'Preferred Locale' },+ { key: 'timezone', label: 'Timezone' },+ { key: 'last_active', label: 'Last Active' },+ { key: 'attribution_date', label: 'Attribution Date' },+ { key: 'attribution', label: 'Attribution' },+ { key: 'website', label: 'Website' },+ { key: 'facebook', label: 'Facebook' },+ { key: 'foursquare', label: 'Foursquare' },+ { key: 'instagram', label: 'Instagram' },+ { key: 'linkedin', label: 'LinkedIn' },+ { key: 'skype', label: 'Skype' },+ { key: 'twitter', label: 'Twitter' },+];++export const contactsFields: OutputSchema['fields'] = [+ { format: 'boolean', key: 'isPublished', label: 'Published' },+ { format: 'datetime', key: 'dateAdded', label: 'Date Added' },+ { key: 'dateModified', label: 'Date Modified' },+ { format: 'number', key: 'id', label: 'ID' },+ { format: 'number', key: 'points', label: 'Points' },+ { key: 'color', label: 'Color' },+ {+ children: [{ children: fieldsAll2Fields, key: 'all', label: 'All' }],+ key: 'fields',+ label: 'Fields',+ },+ { key: 'lastActive', label: 'Last Active' },+ { key: 'owner', label: 'Owner' },+ { key: 'ipAddresses', label: 'IP Addresses' },+ { key: 'tags', label: 'Tags' },+ { key: 'utmtags', label: 'UTM Tags' },+ { key: 'stage', label: 'Stage' },+ { format: 'datetime', key: 'dateIdentified', label: 'Date Identified' },+ { key: 'preferredProfileImage', label: 'Preferred Profile Image' },+ { key: 'doNotContact', label: 'Do Not Contact' },+ { key: 'frequencyRules', label: 'Frequency Rules' },+];++export const ownerRoleFields: OutputSchema['fields'] = [+ { format: 'number', key: 'id', label: 'ID' },+ { key: 'name', label: 'Name' },+ { key: 'description', label: 'Description' },+ { format: 'boolean', key: 'isAdmin', label: 'Is Admin' },+ { key: 'rawPermissions', label: 'Raw Permissions' },+];++export const leadOwnerFields: OutputSchema['fields'] = [+ { format: 'number', key: 'id', label: 'ID' },+ { key: 'username', label: 'Username' },+ { key: 'firstName', label: 'First Name' },+ { key: 'lastName', label: 'Last Name' },+ { format: 'email', key: 'email', label: 'Email' },+ { key: 'position', label: 'Position' },+ { children: ownerRoleFields, key: 'role', label: 'Role' },+ { key: 'timezone', label: 'Timezone' },+ { key: 'locale', label: 'Locale' },+ { format: 'datetime', key: 'lastLogin', label: 'Last Login' },+ { format: 'datetime', key: 'lastActive', label: 'Last Active' },+ { key: 'signature', label: 'Signature' },+];++export const deviceLeadFields: OutputSchema['fields'] = [+ { format: 'number', key: 'id', label: 'ID' },+ { format: 'number', key: 'points', label: 'Points' },+ { key: 'color', label: 'Color' },+ { key: 'title', label: 'Title' },+ { key: 'firstname', label: 'First Name' },+ { key: 'lastname', label: 'Last Name' },+ { key: 'company', label: 'Company' },+ { key: 'position', label: 'Position' },+ { format: 'email', key: 'email', label: 'Email' },+ { key: 'phone', label: 'Phone' },+ { key: 'mobile', label: 'Mobile' },+ { key: 'address1', label: 'Address 1' },+ { key: 'address2', label: 'Address 2' },+ { key: 'city', label: 'City' },+ { key: 'state', label: 'State' },+ { key: 'zipcode', label: 'Zip Code' },+ { key: 'timezone', label: 'Timezone' },+ { key: 'country', label: 'Country' },+ { key: 'fields', label: 'Fields' },+ { key: 'lastActive', label: 'Last Active' },+ { children: leadOwnerFields, key: 'owner', label: 'Owner' },+ { key: 'ipAddresses', label: 'IP Addresses' },+ {+ key: 'tags',+ label: 'Tags',+ labelKey: 'id',+ listItems: [+ { format: 'number', key: 'id', label: 'ID' },+ { key: 'tag', label: 'Tag' },+ { key: 'description', label: 'Description' },+ ],+ },+ { key: 'utmtags', label: 'UTM Tags' },+ { key: 'stage', label: 'Stage' },+ { format: 'datetime', key: 'dateIdentified', label: 'Date Identified' },+ { key: 'preferredProfileImage', label: 'Preferred Profile Image' },+ { key: 'doNotContact', label: 'Do Not Contact' },+ { key: 'frequencyRules', label: 'Frequency Rules' },+];++export const deviceFields: OutputSchema['fields'] = [+ { format: 'number', key: 'id', label: 'ID' },+ { children: deviceLeadFields, key: 'lead', label: 'Lead' },+ { key: 'clientInfo', label: 'Client Info' },+ { key: 'device', label: 'Device' },+ { key: 'deviceBrand', label: 'Device Brand' },+ { key: 'deviceModel', label: 'Device Model' },+ { key: 'deviceOsName', label: 'Device Os Name' },+ { key: 'deviceOsShortName', label: 'Device Os Short Name' },+ { key: 'deviceOsVersion', label: 'Device Os Version' },+ { key: 'deviceOsPlatform', label: 'Device Os Platform' },+];++export const dynamicContentFiltersFields: OutputSchema['fields'] = [+ { key: 'glue', label: 'Glue' },+ { key: 'field', label: 'Field' },+ { key: 'object', label: 'Object' },+ { key: 'type', label: 'Type' },+ { key: 'filter', label: 'Filter' },+ { key: 'display', label: 'Display' },+ { key: 'operator', label: 'Operator' },+];++export const dynamicContentUtmTags2Fields: OutputSchema['fields'] = [+ { key: 'utmMedium', label: 'Utm Medium' },+ { key: 'utmSource', label: 'Utm Source' },+ { key: 'utmContent', label: 'Utm Content' },+ { key: 'utmCampaign', label: 'Utm Campaign' },+];++export const dynamicContentUtmTagsFields: OutputSchema['fields'] = [+ { key: 'utmSource', label: 'Utm Source' },+ { key: 'utmMedium', label: 'Utm Medium' },+ { key: 'utmCampaign', label: 'Utm Campaign' },+ { key: 'utmContent', label: 'Utm Content' },+];++export const filtersFiltersFields: OutputSchema['fields'] = [+ { key: 'glue', label: 'Glue' },+ { key: 'field', label: 'Field' },+ { key: 'object', label: 'Object' },+ { key: 'type', label: 'Type' },+ { key: 'operator', label: 'Operator' },+ { key: 'display', label: 'Display' },+ { key: 'filter', label: 'Filter' },+];++export const emailFields: OutputSchema['fields'] = [+ { format: 'boolean', key: 'isPublished', label: 'Published' },+ { format: 'datetime', key: 'dateAdded', label: 'Date Added' },+ { format: 'datetime', key: 'dateModified', label: 'Date Modified' },+ { format: 'number', key: 'id', label: 'ID' },+ { key: 'name', label: 'Name' },+ { key: 'subject', label: 'Subject' },+ { key: 'language', label: 'Language' },+ { children: categoryFields, key: 'category', label: 'Category' },+ { format: 'email', key: 'fromAddress', label: 'From Address' },+ { key: 'fromName', label: 'From Name' },+ { format: 'email', key: 'replyToAddress', label: 'Reply To Address' },+ { key: 'bccAddress', label: 'Bcc Address' },+ { key: 'useOwnerAsMailer', label: 'Use Owner As Mailer' },+ { children: dynamicContentUtmTagsFields, key: 'utmTags', label: 'Utm Tags' },+ { key: 'preheaderText', label: 'Preheader Text' },+ { key: 'customHtml', label: 'Custom HTML' },+ { key: 'plainText', label: 'Plain Text' },+ { key: 'template', label: 'Template' },+ { key: 'emailType', label: 'Email Type' },+ { key: 'publishUp', label: 'Publish Up' },+ { key: 'publishDown', label: 'Publish Down' },+ { format: 'boolean', key: 'publicPreview', label: 'Public Preview' },+ { format: 'number', key: 'readCount', label: 'Read Count' },+ { format: 'number', key: 'sentCount', label: 'Sent Count' },+ { format: 'number', key: 'revision', label: 'Revision' },+ { key: 'assetAttachments', label: 'Asset Attachments' },+ { key: 'variantStartDate', label: 'Variant Start Date' },+ { format: 'number', key: 'variantSentCount', label: 'Variant Sent Count' },+ { format: 'number', key: 'variantReadCount', label: 'Variant Read Count' },+ { key: 'variantParent', label: 'Variant Parent' },+ { key: 'variantChildren', label: 'Variant Children' },+ { key: 'translationParent', label: 'Translation Parent' },+ { key: 'translationChildren', label: 'Translation Children' },+ { key: 'unsubscribeForm', label: 'Unsubscribe Form' },+ {+ key: 'dynamicContent',+ label: 'Dynamic Content',+ listItems: [+ { key: 'tokenName', label: 'Token Name' },+ { key: 'content', label: 'Content' },+ {+ key: 'filters',+ label: 'Filters',+ listItems: [+ { key: 'content', label: 'Content' },+ { key: 'filters', label: 'Filters', listItems: filtersFiltersFields },+ ],+ },+ ],+ },+ { key: 'lists', label: 'Lists' },+];++export const eventFields: OutputSchema['fields'] = [+ { format: 'number', key: 'id', label: 'ID' },+ { key: 'name', label: 'Name' },+ { key: 'description', label: 'Description' },+ { key: 'type', label: 'Type' },+ { key: 'eventType', label: 'Event Type' },+ { key: 'channel', label: 'Channel' },+ { key: 'channelId', label: 'Channel ID' },+ { format: 'number', key: 'order', label: 'Order' },+ {+ children: [{ format: 'number', key: 'points', label: 'Points' }],+ key: 'properties',+ label: 'Properties',+ },+ { key: 'triggerDate', label: 'Trigger Date' },+ { format: 'number', key: 'triggerInterval', label: 'Trigger Interval' },+ { key: 'triggerIntervalUnit', label: 'Trigger Interval Unit' },+ { key: 'triggerHour', label: 'Trigger Hour' },+ { key: 'triggerRestrictedStartHour', label: 'Trigger Restricted Start Hour' },+ { key: 'triggerRestrictedStopHour', label: 'Trigger Restricted Stop Hour' },+ { key: 'triggerRestrictedDaysOfWeek', label: 'Trigger Restricted Days Of Week' },+ { key: 'triggerMode', label: 'Trigger Mode' },+ { key: 'decisionPath', label: 'Decision Path' },+ { key: 'parent', label: 'Parent' },+ { key: 'children', label: 'Children' },+ { children: campaign2Fields, key: 'campaign', label: 'Campaign' },+];++export const fieldFields: OutputSchema['fields'] = [+ { format: 'boolean', key: 'isPublished', label: 'Published' },+ { format: 'datetime', key: 'dateAdded', label: 'Date Added' },+ { key: 'dateModified', label: 'Date Modified' },+ { format: 'number', key: 'id', label: 'ID' },+ { key: 'label', label: 'Label' },+ { key: 'alias', label: 'Alias' },+ { key: 'type', label: 'Type' },+ { key: 'group', label: 'Group' },+ { format: 'number', key: 'order', label: 'Order' },+ { key: 'object', label: 'Object' },+ { key: 'defaultValue', label: 'Default Value' },+ { format: 'boolean', key: 'isRequired', label: 'Is Required' },+ { format: 'boolean', key: 'isFixed', label: 'Is Fixed' },+ { format: 'boolean', key: 'isListable', label: 'Is Listable' },+ { format: 'boolean', key: 'isVisible', label: 'Is Visible' },+ { format: 'boolean', key: 'isShortVisible', label: 'Is Short Visible' },+ { format: 'boolean', key: 'isUniqueIdentifier', label: 'Is Unique Identifier' },+ { format: 'boolean', key: 'isPubliclyUpdatable', label: 'Is Publicly Updatable' },+ {+ children: [+ {+ key: 'list',+ label: 'List',+ labelKey: 'label',+ listItems: [+ { key: 'label', label: 'Label' },+ { key: 'value', label: 'Value' },+ ],+ },+ ],+ key: 'properties',+ label: 'Properties',+ },+ { format: 'boolean', key: 'isIndex', label: 'Is Index' },+ { format: 'number', key: 'charLengthLimit', label: 'Char Length Limit' },+];++export const fieldsAll3Fields: OutputSchema['fields'] = [+ { format: 'number', key: 'id', label: 'ID' },+ { key: 'companyemail', label: 'Company Email' },+ { key: 'companyaddress1', label: 'Company Address 1' },+ { key: 'companyaddress2', label: 'Company Address 2' },+ { key: 'companyphone', label: 'Company Phone' },+ { key: 'companycity', label: 'Company City' },+ { key: 'companystate', label: 'Company State' },+ { key: 'companyzipcode', label: 'Company Zip Code' },+ { key: 'companycountry', label: 'Company Country' },+ { key: 'companyname', label: 'Company Name' },+ { key: 'companywebsite', label: 'Company Website' },+ { key: 'companyindustry', label: 'Company Industry' },+ { key: 'companydescription', label: 'Company Description' },+ { key: 'companynumber_of_employees', label: 'Company Number of Employees' },+ { key: 'companyfax', label: 'Company Fax' },+ { key: 'companyannual_revenue', label: 'Company Annual Revenue' },+];++export const fieldsAllFields: OutputSchema['fields'] = [+ { format: 'number', key: 'id', label: 'ID' },+ { key: 'companyaddress1', label: 'Company Address 1' },+ { key: 'companyaddress2', label: 'Company Address 2' },+ { key: 'companyemail', label: 'Company Email' },+ { key: 'companyphone', label: 'Company Phone' },+ { key: 'companycity', label: 'Company City' },+ { key: 'companystate', label: 'Company State' },+ { key: 'companyzipcode', label: 'Company Zip Code' },+ { key: 'companycountry', label: 'Company Country' },+ { key: 'companyname', label: 'Company Name' },+ { key: 'companywebsite', label: 'Company Website' },+ { key: 'companynumber_of_employees', label: 'Company Number of Employees' },+ { key: 'companyfax', label: 'Company Fax' },+ { key: 'companyannual_revenue', label: 'Company Annual Revenue' },+ { key: 'companyindustry', label: 'Company Industry' },+ { key: 'companydescription', label: 'Company Description' },+];++export const filtersFields: OutputSchema['fields'] = [+ { key: 'search', label: 'Search' },+ { key: 'includeEvents', label: 'Include Events' },+ { key: 'excludeEvents', label: 'Exclude Events' },+ { format: 'datetime', key: 'dateFrom', label: 'Date From' },+ { format: 'datetime', key: 'dateTo', label: 'Date To' },+];++export const propertiesBarFields: OutputSchema['fields'] = [+ { format: 'number', key: 'allow_hide', label: 'Allow Hide' },+ { format: 'number', key: 'push_page', label: 'Push Page' },+ { format: 'number', key: 'sticky', label: 'Sticky' },+ { key: 'size', label: 'Size' },+ { key: 'placement', label: 'Placement' },+];++export const propertiesColorsFields: OutputSchema['fields'] = [+ { key: 'primary', label: 'Primary' },+ { key: 'text', label: 'Text' },+ { key: 'button', label: 'Button' },+ { key: 'button_text', label: 'Button Text' },+];++export const propertiesContentFields: OutputSchema['fields'] = [+ { key: 'headline', label: 'Headline' },+ { key: 'tagline', label: 'Tagline' },+ { key: 'link_text', label: 'Link Text' },+ { format: 'url', key: 'link_url', label: 'Link URL' },+ { key: 'link_new_window', label: 'Link New Window' },+ { key: 'font', label: 'Font' },+ { key: 'css', label: 'Css' },+];++export const focusPropertiesFields: OutputSchema['fields'] = [+ { children: propertiesBarFields, key: 'bar', label: 'Bar' },+ {+ children: [{ key: 'placement', label: 'Placement' }],+ key: 'modal',+ label: 'Modal',+ },+ {+ children: [{ key: 'placement', label: 'Placement' }],+ key: 'notification',+ label: 'Notification',+ },+ { key: 'page', label: 'Page' },+ { format: 'number', key: 'animate', label: 'Animate' },+ { key: 'link_activation', label: 'Link Activation' },+ { children: propertiesColorsFields, key: 'colors', label: 'Colors' },+ { children: propertiesContentFields, key: 'content', label: 'Content' },+ { key: 'when', label: 'When' },+ { key: 'timeout', label: 'Timeout' },+ { key: 'frequency', label: 'Frequency' },+ { key: 'stop_after_conversion', label: 'Stop After Conversion' },+ { key: 'stop_after_close', label: 'Stop After Close' },+];++export const formActionsFields: OutputSchema['fields'] = [+ { format: 'number', key: 'id', label: 'ID' },+ { key: 'name', label: 'Name' },+ { key: 'description', label: 'Description' },+ { key: 'type', label: 'Type' },+ { format: 'number', key: 'order', label: 'Order' },+ {+ children: [+ { key: 'operator', label: 'Operator' },+ { format: 'number', key: 'points', label: 'Points' },+ { key: 'group', label: 'Group' },+ ],+ key: 'properties',+ label: 'Properties',+ },+];++export const formFieldsFields: OutputSchema['fields'] = [+ { format: 'number', key: 'id', label: 'ID' },+ { key: 'label', label: 'Label' },+ { format: 'boolean', key: 'showLabel', label: 'Show Label' },+ { key: 'alias', label: 'Alias' },+ { key: 'type', label: 'Type' },+ { key: 'defaultValue', label: 'Default Value' },+ { format: 'boolean', key: 'isRequired', label: 'Is Required' },+ { key: 'validationMessage', label: 'Validation Message' },+ { key: 'helpMessage', label: 'Help Message' },+ { format: 'number', key: 'order', label: 'Order' },+ { key: 'properties', label: 'Properties' },+ { key: 'validation', label: 'Validation' },+ { key: 'parent', label: 'Parent' },+ { key: 'conditions', label: 'Conditions' },+ { key: 'labelAttributes', label: 'Label Attributes' },+ { key: 'inputAttributes', label: 'Input Attributes' },+ { key: 'containerAttributes', label: 'Container Attributes' },+ { key: 'leadField', label: 'Lead Field' },+ { format: 'boolean', key: 'saveResult', label: 'Save Result' },+ { format: 'boolean', key: 'isAutoFill', label: 'Is Auto Fill' },+ { key: 'mappedObject', label: 'Mapped Object' },+ { key: 'mappedField', label: 'Mapped Field' },+];++export const listFiltersFields: OutputSchema['fields'] = [+ { key: 'glue', label: 'Glue' },+ { key: 'field', label: 'Field' },+ { key: 'object', label: 'Object' },+ { key: 'type', label: 'Type' },+ { key: 'operator', label: 'Operator' },+ {+ children: [{ key: 'filter', label: 'Filter' }],+ key: 'properties',+ label: 'Properties',+ },+];++export const listFields: OutputSchema['fields'] = [+ { format: 'boolean', key: 'isPublished', label: 'Published' },+ { format: 'datetime', key: 'dateAdded', label: 'Date Added' },+ { key: 'dateModified', label: 'Date Modified' },+ { format: 'number', key: 'id', label: 'ID' },+ { key: 'name', label: 'Name' },+ { key: 'publicName', label: 'Public Name' },+ { key: 'alias', label: 'Alias' },+ { key: 'description', label: 'Description' },+ { children: categoryFields, key: 'category', label: 'Category' },+ { key: 'filters', label: 'Filters', listItems: listFiltersFields },+ { format: 'boolean', key: 'isGlobal', label: 'Is Global' },+ { format: 'boolean', key: 'isPreferenceCenter', label: 'Is Preference Center' },+];++export const listFilters2Fields: OutputSchema['fields'] = [+ { key: 'object', label: 'Object' },+ { key: 'glue', label: 'Glue' },+ { key: 'field', label: 'Field' },+ { key: 'type', label: 'Type' },+ { key: 'operator', label: 'Operator' },+ {+ children: [{ key: 'filter', label: 'Filter' }],+ key: 'properties',+ label: 'Properties',+ },+ { key: 'filter', label: 'Filter' },+ { key: 'display', label: 'Display' },+];++export const messageChannelsFields: OutputSchema['fields'] = [+ { format: 'number', key: 'id', label: 'ID' },+ { key: 'channel', label: 'Channel' },+ { format: 'number', key: 'channelId', label: 'Channel ID' },+ { key: 'channelName', label: 'Channel Name' },+ { format: 'boolean', key: 'isEnabled', label: 'Is Enabled' },+];++export const noteLeadFields: OutputSchema['fields'] = [+ { format: 'number', key: 'id', label: 'ID' },+ { format: 'number', key: 'points', label: 'Points' },+ { key: 'color', label: 'Color' },+ { key: 'fields', label: 'Fields' },+];++export const noteFields: OutputSchema['fields'] = [+ { format: 'number', key: 'id', label: 'ID' },+ { key: 'text', label: 'Text' },+ { key: 'type', label: 'Type' },+ { format: 'datetime', key: 'dateTime', label: 'Date Time' },+ { children: noteLeadFields, key: 'lead', label: 'Lead' },+];++export const notificationFields: OutputSchema['fields'] = [+ { format: 'boolean', key: 'isPublished', label: 'Published' },+ { format: 'datetime', key: 'dateAdded', label: 'Date Added' },+ { key: 'dateModified', label: 'Date Modified' },+ { format: 'number', key: 'id', label: 'ID' },+ { key: 'name', label: 'Name' },+ { key: 'heading', label: 'Heading' },+ { key: 'message', label: 'Message' },+ { format: 'url', key: 'url', label: 'URL' },+ { key: 'language', label: 'Language' },+ { children: categoryFields, key: 'category', label: 'Category' },+ { key: 'button', label: 'Button' },+ { children: dynamicContentUtmTagsFields, key: 'utmTags', label: 'Utm Tags' },+ { key: 'publishUp', label: 'Publish Up' },+ { key: 'publishDown', label: 'Publish Down' },+ { format: 'number', key: 'readCount', label: 'Read Count' },+ { format: 'number', key: 'sentCount', label: 'Sent Count' },+];++export const pageFields: OutputSchema['fields'] = [+ { format: 'boolean', key: 'isPublished', label: 'Published' },+ { format: 'datetime', key: 'dateAdded', label: 'Date Added' },+ { key: 'dateModified', label: 'Date Modified' },+ { format: 'number', key: 'id', label: 'ID' },+ { key: 'title', label: 'Title' },+ { key: 'alias', label: 'Alias' },+ { children: categoryFields, key: 'category', label: 'Category' },+ { key: 'language', label: 'Language' },+ { key: 'publishUp', label: 'Publish Up' },+ { key: 'publishDown', label: 'Publish Down' },+ { format: 'number', key: 'hits', label: 'Hits' },+ { format: 'number', key: 'uniqueHits', label: 'Unique Hits' },+ { format: 'number', key: 'variantHits', label: 'Variant Hits' },+ { format: 'number', key: 'revision', label: 'Revision' },+ { key: 'metaDescription', label: 'Meta Description' },+ { key: 'redirectType', label: 'Redirect Type' },+ { format: 'url', key: 'redirectUrl', label: 'Redirect URL' },+ { key: 'isPreferenceCenter', label: 'Is Preference Center' },+ { key: 'noIndex', label: 'No Index' },+ { key: 'variantSettings', label: 'Variant Settings' },+ { key: 'variantStartDate', label: 'Variant Start Date' },+ { key: 'variantParent', label: 'Variant Parent' },+ { key: 'variantChildren', label: 'Variant Children' },+ { key: 'translationParent', label: 'Translation Parent' },+ { key: 'translationChildren', label: 'Translation Children' },+ { key: 'template', label: 'Template' },+ { key: 'customHtml', label: 'Custom HTML' },+];++export const pointFields: OutputSchema['fields'] = [+ { format: 'boolean', key: 'isPublished', label: 'Published' },+ { format: 'datetime', key: 'dateAdded', label: 'Date Added' },+ { key: 'dateModified', label: 'Date Modified' },+ { format: 'number', key: 'id', label: 'ID' },+ { key: 'name', label: 'Name' },+ { children: categoryFields, key: 'category', label: 'Category' },+ { key: 'type', label: 'Type' },+ { key: 'description', label: 'Description' },+ { key: 'publishUp', label: 'Publish Up' },+ { key: 'publishDown', label: 'Publish Down' },+ { format: 'number', key: 'delta', label: 'Delta' },+ { key: 'properties', label: 'Properties' },+ { format: 'boolean', key: 'repeatable', label: 'Repeatable' },+];++export const pointGroupFields: OutputSchema['fields'] = [+ { format: 'boolean', key: 'isPublished', label: 'Published' },+ { format: 'datetime', key: 'dateAdded', label: 'Date Added' },+ { key: 'dateModified', label: 'Date Modified' },+ { format: 'number', key: 'id', label: 'ID' },+ { key: 'name', label: 'Name' },+ { key: 'description', label: 'Description' },+];++export const reportFiltersFields: OutputSchema['fields'] = [+ { key: 'column', label: 'Column' },+ { key: 'glue', label: 'Glue' },+ { key: 'dynamic', label: 'Dynamic' },+ { key: 'condition', label: 'Condition' },+ { key: 'value', label: 'Value' },+];++export const reportsFields: OutputSchema['fields'] = [+ { format: 'number', key: 'id', label: 'ID' },+ { key: 'name', label: 'Name' },+ { key: 'description', label: 'Description' },+ { format: 'boolean', key: 'system', label: 'System' },+ { format: 'boolean', key: 'isScheduled', label: 'Is Scheduled' },+ { key: 'source', label: 'Source' },+ { key: 'columns', label: 'Columns' },+ { key: 'filters', label: 'Filters', listItems: reportFiltersFields },+ { key: 'tableOrder', label: 'Table Order' },+ { key: 'graphs', label: 'Graphs' },+ { key: 'groupBy', label: 'Group By' },+ {+ children: [+ { key: 'showDynamicFilters', label: 'Show Dynamic Filters' },+ { key: 'hideDateRangeFilter', label: 'Hide Date Range Filter' },+ { key: 'showGraphsAboveTable', label: 'Show Graphs Above Table' },+ ],+ key: 'settings',+ label: 'Settings',+ },+ { key: 'aggregators', label: 'Aggregators' },+ { key: 'scheduleUnit', label: 'Schedule Unit' },+ { key: 'toAddress', label: 'To Address' },+ { key: 'scheduleDay', label: 'Schedule Day' },+ { key: 'scheduleMonthFrequency', label: 'Schedule Month Frequency' },+];++export const role2Fields: OutputSchema['fields'] = [+ { format: 'boolean', key: 'isPublished', label: 'Published' },+ { format: 'datetime', key: 'dateAdded', label: 'Date Added' },+ { key: 'dateModified', label: 'Date Modified' },+ { format: 'number', key: 'id', label: 'ID' },+ { key: 'name', label: 'Name' },+ { key: 'description', label: 'Description' },+ { format: 'boolean', key: 'isAdmin', label: 'Is Admin' },+ {+ children: [+ { key: 'lead:leads', label: 'Lead Leads' },+ { key: 'email:emails', label: 'Email Emails' },+ ],+ key: 'rawPermissions',+ label: 'Raw Permissions',+ },+];++export const stageFields: OutputSchema['fields'] = [+ { format: 'boolean', key: 'isPublished', label: 'Published' },+ { format: 'datetime', key: 'dateAdded', label: 'Date Added' },+ { key: 'dateModified', label: 'Date Modified' },+ { format: 'number', key: 'id', label: 'ID' },+ { key: 'name', label: 'Name' },+ { children: categoryFields, key: 'category', label: 'Category' },+ { format: 'number', key: 'weight', label: 'Weight' },+ { key: 'description', label: 'Description' },+ { key: 'publishUp', label: 'Publish Up' },+ { key: 'publishDown', label: 'Publish Down' },+];++export const submissionFormFields: OutputSchema['fields'] = [+ { format: 'number', key: 'id', label: 'ID' },+ { key: 'name', label: 'Name' },+ { key: 'alias', label: 'Alias' },+ { key: 'category', label: 'Category' },+];++export const submissionLeadFields: OutputSchema['fields'] = [+ { format: 'number', key: 'id', label: 'ID' },+ { format: 'number', key: 'points', label: 'Points' },+ { key: 'color', label: 'Color' },+ { key: 'title', label: 'Title' },+ { key: 'firstname', label: 'First Name' },+ { key: 'lastname', label: 'Last Name' },+ { key: 'company', label: 'Company' },+ { key: 'position', label: 'Position' },+ { format: 'email', key: 'email', label: 'Email' },+ { key: 'phone', label: 'Phone' },+ { key: 'mobile', label: 'Mobile' },+ { key: 'address1', label: 'Address 1' },+ { key: 'address2', label: 'Address 2' },+ { key: 'city', label: 'City' },+ { key: 'state', label: 'State' },+ { key: 'zipcode', label: 'Zip Code' },+ { key: 'timezone', label: 'Timezone' },+ { key: 'country', label: 'Country' },+];++export const triggerEventsFields: OutputSchema['fields'] = [+ { format: 'number', key: 'id', label: 'ID' },+ { key: 'name', label: 'Name' },+ { key: 'description', label: 'Description' },+ { key: 'type', label: 'Type' },+ { format: 'number', key: 'order', label: 'Order' },+ {+ children: [+ { key: 'add_tags', label: 'Add Tags' },+ { key: 'remove_tags', label: 'Remove Tags' },+ ],+ key: 'properties',+ label: 'Properties',+ },+];++export const triggerFields: OutputSchema['fields'] = [+ { format: 'boolean', key: 'isPublished', label: 'Published' },+ { format: 'datetime', key: 'dateAdded', label: 'Date Added' },+ { format: 'datetime', key: 'dateModified', label: 'Date Modified' },+ { format: 'number', key: 'id', label: 'ID' },+ { key: 'name', label: 'Name' },+ { children: categoryFields, key: 'category', label: 'Category' },+ { key: 'description', label: 'Description' },+ { key: 'publishUp', label: 'Publish Up' },+ { key: 'publishDown', label: 'Publish Down' },+ { format: 'number', key: 'points', label: 'Points' },+ { key: 'color', label: 'Color' },+ { key: 'events', label: 'Events', labelKey: 'name', listItems: triggerEventsFields },+ { format: 'boolean', key: 'triggerExistingLeads', label: 'Trigger Existing Leads' },+];++export const tweetFields: OutputSchema['fields'] = [+ { format: 'boolean', key: 'isPublished', label: 'Published' },+ { format: 'datetime', key: 'dateAdded', label: 'Date Added' },+ { key: 'dateModified', label: 'Date Modified' },+ { format: 'number', key: 'id', label: 'ID' },+ { key: 'name', label: 'Name' },+ { key: 'text', label: 'Text' },+ { key: 'language', label: 'Language' },+ { children: categoryFields, key: 'category', label: 'Category' },+ { key: 'mediaId', label: 'Media ID' },+ { key: 'mediaPath', label: 'Media Path' },+ { format: 'number', key: 'sentCount', label: 'Sent Count' },+ { format: 'number', key: 'favoriteCount', label: 'Favorite Count' },+ { format: 'number', key: 'retweetCount', label: 'Retweet Count' },+ { key: 'description', label: 'Description' },+];++export const typesFields: OutputSchema['fields'] = [+ { key: 'asset.download', label: 'Asset Download', value: "['asset.download']" },+ { key: 'campaign.event', label: 'Campaign Event', value: "['campaign.event']" },+ {+ key: 'campaign.event.scheduled',+ label: 'Campaign Event Scheduled',+ value: "['campaign.event.scheduled']",+ },+ { key: 'campaign_membership', label: 'Campaign Membership' },+ { key: 'lead.source.created', label: 'Lead Source Created', value: "['lead.source.created']" },+ {+ key: 'lead.source.identified',+ label: 'Lead Source Identified',+ value: "['lead.source.identified']",+ },+ { key: 'lead.donotcontact', label: 'Lead Donotcontact', value: "['lead.donotcontact']" },+ { key: 'dynamic.content.sent', label: 'Dynamic Content Sent', value: "['dynamic.content.sent']" },+ { key: 'email.failed', label: 'Email Failed', value: "['email.failed']" },+ { key: 'email.read', label: 'Email Read', value: "['email.read']" },+ { key: 'email.replied', label: 'Email Replied', value: "['email.replied']" },+ { key: 'email.sent', label: 'Email Sent', value: "['email.sent']" },+ { key: 'sms.failed', label: 'Sms Failed', value: "['sms.failed']" },+ { key: 'focus.on_click', label: 'Focus On Click', value: "['focus.on_click']" },+ { key: 'focus.on_view', label: 'Focus On View', value: "['focus.on_view']" },+ { key: 'form.submitted', label: 'Form Submitted', value: "['form.submitted']" },+ { key: 'lead.imported', label: 'Lead Imported', value: "['lead.imported']" },+ { key: 'integration_sync_issues', label: 'Integration Sync Issues' },+ { key: 'message.queue', label: 'Message Queue', value: "['message.queue']" },+ { key: 'page.hit', label: 'Page Hit', value: "['page.hit']" },+ { key: 'point.gained', label: 'Point Gained', value: "['point.gained']" },+ { key: 'segment_membership', label: 'Segment Membership' },+ { key: 'sms.sent', label: 'Sms Sent', value: "['sms.sent']" },+ { key: 'stage.changed', label: 'Stage Changed', value: "['stage.changed']" },+ { key: 'sms_reply', label: 'Sms Reply' },+ { key: 'lead.utmtagsadded', label: 'Lead Utmtagsadded', value: "['lead.utmtagsadded']" },+ { key: 'page.videohit', label: 'Page Videohit', value: "['page.videohit']" },+];++export const userRole2Fields: OutputSchema['fields'] = [+ { format: 'number', key: 'id', label: 'ID' },+ { key: 'name', label: 'Name' },+ { key: 'description', label: 'Description' },+ { format: 'boolean', key: 'isAdmin', label: 'Is Admin' },+ {+ children: [{ key: 'lead:leads', label: 'Lead Leads' }],+ key: 'rawPermissions',+ label: 'Raw Permissions',+ },+];++export const userRoleFields: OutputSchema['fields'] = [+ { format: 'number', key: 'id', label: 'ID' },+ { key: 'name', label: 'Name' },+ { key: 'description', label: 'Description' },+ { format: 'boolean', key: 'isAdmin', label: 'Is Admin' },+ {+ children: [+ { key: 'lead:leads', label: 'Lead Leads' },+ { key: 'email:emails', label: 'Email Emails' },+ ],+ key: 'rawPermissions',+ label: 'Raw Permissions',+ },+];++export const createMauticCompanyOutputSchema: OutputSchema = {+ fields: [+ { key: 'status', label: 'Status', format: 'number' },+ {+ key: 'body',+ label: 'Body',+ children: [+ {+ key: 'company',+ label: 'Company',+ children: [+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'score', label: 'Score', format: 'number' },+ {+ key: 'fields',+ label: 'Fields',+ children: [{ key: 'all', label: 'All', children: fieldsAllFields }],+ },+ ],+ },+ ],+ },+ ],+};++export const createMauticContactOutputSchema: OutputSchema = {+ fields: [+ { key: 'status', label: 'Status', format: 'number' },+ {+ key: 'body',+ label: 'Body',+ children: [{ key: 'contact', label: 'Contact', children: contactsFields }],+ },+ ],+};++export const mauticLeadChannelSubscriptionChangedTriggerOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'mautic.lead_channel_subscription_changed',+ label: 'Events',+ value: "['mautic.lead_channel_subscription_changed']",+ listItems: [+ {+ key: 'contact',+ label: 'Contact',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified', format: 'datetime' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'points', label: 'Points', format: 'number' },+ { key: 'color', label: 'Color' },+ { key: 'fields', label: 'Fields' },+ { key: 'lastActive', label: 'Last Active' },+ { key: 'owner', label: 'Owner' },+ { key: 'ipAddresses', label: 'IP Addresses' },+ { key: 'tags', label: 'Tags' },+ { key: 'utmtags', label: 'UTM Tags' },+ { key: 'stage', label: 'Stage' },+ { key: 'dateIdentified', label: 'Date Identified', format: 'datetime' },+ { key: 'preferredProfileImage', label: 'Preferred Profile Image' },+ {+ key: 'doNotContact',+ label: 'Do Not Contact',+ labelKey: 'id',+ listItems: [+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'reason', label: 'Reason', format: 'number' },+ { key: 'comments', label: 'Comments' },+ { key: 'channel', label: 'Channel' },+ { key: 'channelId', label: 'Channel ID' },+ ],+ },+ { key: 'frequencyRules', label: 'Frequency Rules' },+ ],+ },+ { key: 'channel', label: 'Channel' },+ { key: 'old_status', label: 'Old Status' },+ { key: 'new_status', label: 'New Status' },+ { key: 'timestamp', label: 'Timestamp', format: 'datetime' },+ ],+ },+ ],+};++export const mauticLeadCompanyChangeTriggerOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'mautic.lead_company_change',+ label: 'Events',+ value: "['mautic.lead_company_change']",+ listItems: [+ { key: 'added', label: 'Added', format: 'boolean' },+ {+ key: 'contact',+ label: 'Contact',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified', format: 'datetime' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'points', label: 'Points', format: 'number' },+ { key: 'color', label: 'Color' },+ { key: 'title', label: 'Title' },+ { key: 'firstname', label: 'First Name' },+ { key: 'lastname', label: 'Last Name' },+ { key: 'company', label: 'Company' },+ { key: 'position', label: 'Position' },+ { key: 'email', label: 'Email' },+ { key: 'phone', label: 'Phone' },+ { key: 'mobile', label: 'Mobile' },+ { key: 'address1', label: 'Address 1' },+ { key: 'address2', label: 'Address 2' },+ { key: 'city', label: 'City' },+ { key: 'state', label: 'State' },+ { key: 'zipcode', label: 'Zip Code' },+ { key: 'timezone', label: 'Timezone' },+ { key: 'country', label: 'Country' },+ { key: 'fields', label: 'Fields' },+ { key: 'lastActive', label: 'Last Active' },+ { key: 'owner', label: 'Owner' },+ { key: 'ipAddresses', label: 'IP Addresses' },+ { key: 'tags', label: 'Tags' },+ { key: 'utmtags', label: 'UTM Tags' },+ { key: 'stage', label: 'Stage' },+ { key: 'dateIdentified', label: 'Date Identified', format: 'datetime' },+ { key: 'preferredProfileImage', label: 'Preferred Profile Image' },+ { key: 'doNotContact', label: 'Do Not Contact' },+ { key: 'frequencyRules', label: 'Frequency Rules' },+ ],+ },+ {+ key: 'company',+ label: 'Company',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified', format: 'datetime' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'name', label: 'Name' },+ { key: 'email', label: 'Email', format: 'email' },+ { key: 'address1', label: 'Address 1' },+ { key: 'address2', label: 'Address 2' },+ { key: 'phone', label: 'Phone' },+ { key: 'city', label: 'City' },+ { key: 'state', label: 'State' },+ { key: 'zipcode', label: 'Zip Code' },+ { key: 'country', label: 'Country' },+ { key: 'website', label: 'Website', format: 'url' },+ { key: 'industry', label: 'Industry' },+ { key: 'description', label: 'Description' },+ { key: 'score', label: 'Score', format: 'number' },+ {+ key: 'fields',+ label: 'Fields',+ children: [{ key: 'other', label: 'Other' }],+ },+ ],+ },+ { key: 'timestamp', label: 'Timestamp', format: 'datetime' },+ ],+ },+ ],+};++export const mauticLeadPostSaveNewTriggerOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'mautic.lead_post_save_new',+ label: 'Events',+ value: "['mautic.lead_post_save_new']",+ listItems: [+ {+ key: 'contact',+ label: 'Contact',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'points', label: 'Points', format: 'number' },+ { key: 'color', label: 'Color' },+ { key: 'fields', label: 'Fields' },+ { key: 'lastActive', label: 'Last Active' },+ { key: 'owner', label: 'Owner' },+ { key: 'ipAddresses', label: 'IP Addresses' },+ { key: 'tags', label: 'Tags' },+ { key: 'utmtags', label: 'UTM Tags' },+ { key: 'stage', label: 'Stage' },+ { key: 'dateIdentified', label: 'Date Identified', format: 'datetime' },+ { key: 'preferredProfileImage', label: 'Preferred Profile Image' },+ { key: 'doNotContact', label: 'Do Not Contact' },+ { key: 'frequencyRules', label: 'Frequency Rules' },+ ],+ },+ { key: 'timestamp', label: 'Timestamp', format: 'datetime' },+ ],+ },+ ],+};++export const mauticLeadPostSaveUpdateTriggerOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'mautic.lead_post_save_update',+ label: 'Events',+ value: "['mautic.lead_post_save_update']",+ listItems: [+ {+ key: 'contact',+ label: 'Contact',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified', format: 'datetime' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'points', label: 'Points', format: 'number' },+ { key: 'color', label: 'Color' },+ { key: 'fields', label: 'Fields' },+ { key: 'lastActive', label: 'Last Active' },+ { key: 'owner', label: 'Owner', children: contactOwner2Fields },+ { key: 'ipAddresses', label: 'IP Addresses' },+ {+ key: 'tags',+ label: 'Tags',+ labelKey: 'id',+ listItems: [+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'tag', label: 'Tag' },+ { key: 'description', label: 'Description' },+ ],+ },+ { key: 'utmtags', label: 'UTM Tags' },+ { key: 'stage', label: 'Stage' },+ { key: 'dateIdentified', label: 'Date Identified', format: 'datetime' },+ { key: 'preferredProfileImage', label: 'Preferred Profile Image' },+ { key: 'doNotContact', label: 'Do Not Contact' },+ { key: 'frequencyRules', label: 'Frequency Rules' },+ ],+ },+ { key: 'timestamp', label: 'Timestamp', format: 'datetime' },+ ],+ },+ ],+};++export const searchMauticCompanyOutputSchema: OutputSchema = {+ fields: [+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'score', label: 'Score', format: 'number' },+ {+ key: 'fields',+ label: 'Fields',+ children: [+ { key: 'other', label: 'Other' },+ { key: 'all', label: 'All', children: fieldsAll3Fields },+ ],+ },+ ],+};++export const searchMauticContactOutputSchema: OutputSchema = {+ fields: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'points', label: 'Points', format: 'number' },+ { key: 'color', label: 'Color' },+ {+ key: 'fields',+ label: 'Fields',+ children: [{ key: 'all', label: 'All', children: fieldsAll4Fields }],+ },+ { key: 'lastActive', label: 'Last Active' },+ { key: 'owner', label: 'Owner' },+ { key: 'ipAddresses', label: 'IP Addresses' },+ { key: 'tags', label: 'Tags' },+ { key: 'utmtags', label: 'UTM Tags' },+ { key: 'stage', label: 'Stage' },+ { key: 'dateIdentified', label: 'Date Identified', format: 'datetime' },+ { key: 'preferredProfileImage', label: 'Preferred Profile Image' },+ { key: 'doNotContact', label: 'Do Not Contact' },+ { key: 'frequencyRules', label: 'Frequency Rules' },+ ],+};++export const updateMauticCompanyOutputSchema: OutputSchema = {+ fields: [+ { key: 'status', label: 'Status', format: 'number' },+ {+ key: 'body',+ label: 'Body',+ children: [+ {+ key: 'company',+ label: 'Company',+ children: [+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'score', label: 'Score', format: 'number' },+ {+ key: 'fields',+ label: 'Fields',+ children: [+ { key: 'other', label: 'Other' },+ { key: 'all', label: 'All', children: fieldsAllFields },+ ],+ },+ ],+ },+ ],+ },+ ],+};++export const updateMauticContactOutputSchema: OutputSchema = {+ fields: [+ { key: 'status', label: 'Status', format: 'number' },+ {+ key: 'body',+ label: 'Body',+ children: [+ {+ key: 'contact',+ label: 'Contact',+ children: [+ { key: 'isPublished', label: 'Published', format: 'boolean' },+ { key: 'dateAdded', label: 'Date Added', format: 'datetime' },+ { key: 'dateModified', label: 'Date Modified', format: 'datetime' },+ { key: 'id', label: 'ID', format: 'number' },+ { key: 'points', label: 'Points', format: 'number' },+ { key: 'color', label: 'Color' },+ {+ key: 'fields',+ label: 'Fields',+ children: [{ key: 'all', label: 'All', children: fieldsAll2Fields }],+ },+ { key: 'lastActive', label: 'Last Active' },+ { key: 'owner', label: 'Owner' },+ { key: 'ipAddresses', label: 'IP Addresses' },+ { key: 'tags', label: 'Tags' },+ { key: 'utmtags', label: 'UTM Tags' },+ { key: 'stage', label: 'Stage' },+ { key: 'dateIdentified', label: 'Date Identified', format: 'datetime' },+ { key: 'preferredProfileImage', label: 'Preferred Profile Image' },+ { key: 'doNotContact', label: 'Do Not Contact' },+ { key: 'frequencyRules', label: 'Frequency Rules' },+ ],+ },+ ],+ },+ ],+};diff --git a/packages/pieces/community/mautic/src/lib/triggers/contact-channel-subscription-changed.ts b/packages/pieces/community/mautic/src/lib/triggers/contact-channel-subscription-changed.tsnew file mode 100644index 00000000000..80a4945093a--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/triggers/contact-channel-subscription-changed.ts@@ -0,0 +1,50 @@+import { TriggerStrategy, createTrigger } from '@activepieces/pieces-framework';++import { mauticAuth } from '../auth';+import { mauticApi } from '../common/api';+import { mauticProps } from '../common/props';+import { mauticUtils } from '../common/utils';+import { mauticLeadChannelSubscriptionChangedTriggerOutputSchema } from '../output-schemas';++import type { MauticWebhookInformation } from '../common/types';++const EVENT_TYPE = 'mautic.lead_channel_subscription_changed';+const STORE_KEY = 'mautic_lead_channel_subscription_changed_trigger';++export const contactChannelSubscriptionChangedTrigger = createTrigger({+ auth: mauticAuth,+ name: 'mautic_lead_channel_subscription_changed_trigger',+ outputSchema: mauticLeadChannelSubscriptionChangedTriggerOutputSchema,+ classification: 'READ',+ displayName: 'Contact Channel Subscription Change',+ description: "Triggers when a contact's channel subscription status changes.",+ aiMetadata: {+ description:+ "Fires when a contact's subscription status for a communication channel (such as email) changes in Mautic — for example when they opt in or out of receiving messages. Use to react to contactability/consent changes for a channel.",+ },+ props: {+ name: mauticProps.webhookName({ required: true }),+ description: mauticProps.webhookDescription({ required: true }),+ },+ sampleData: mauticUtils.contactSampleData({ eventType: EVENT_TYPE }),+ type: TriggerStrategy.WEBHOOK,+ async onEnable(context) {+ const webhook = await mauticApi.createWebhook({+ auth: context.auth,+ name: context.propsValue.name,+ description: context.propsValue.description,+ webhookUrl: context.webhookUrl,+ eventType: EVENT_TYPE,+ });+ await context.store.put<MauticWebhookInformation>(STORE_KEY, webhook);+ },+ async onDisable(context) {+ const webhook = await context.store.get<MauticWebhookInformation>(STORE_KEY);+ if (webhook != null) {+ await mauticApi.deleteWebhook({ auth: context.auth, webhookId: webhook.hook.id });+ }+ },+ async run(context) {+ return [context.payload.body];+ },+});diff --git a/packages/pieces/community/mautic/src/lib/triggers/contact-company-changed.ts b/packages/pieces/community/mautic/src/lib/triggers/contact-company-changed.tsnew file mode 100644index 00000000000..cdcdbdd81c2--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/triggers/contact-company-changed.ts@@ -0,0 +1,50 @@+import { TriggerStrategy, createTrigger } from '@activepieces/pieces-framework';++import { mauticAuth } from '../auth';+import { mauticApi } from '../common/api';+import { mauticProps } from '../common/props';+import { mauticUtils } from '../common/utils';+import { mauticLeadCompanyChangeTriggerOutputSchema } from '../output-schemas';++import type { MauticWebhookInformation } from '../common/types';++const EVENT_TYPE = 'mautic.lead_company_change';+const STORE_KEY = 'mautic_lead_company_change_trigger';++export const contactCompanyChangedTrigger = createTrigger({+ auth: mauticAuth,+ name: 'mautic_lead_company_change_trigger',+ outputSchema: mauticLeadCompanyChangeTriggerOutputSchema,+ classification: 'READ',+ displayName: 'Contact Company Subscription Change',+ description: 'Triggers when a commpany is added or removed to/from contact.',+ aiMetadata: {+ description:+ "Fires when a contact's company association changes in Mautic — that is, when the contact is added to or removed from a company. Use to react to a contact's organization membership changing.",+ },+ props: {+ name: mauticProps.webhookName({ required: true }),+ description: mauticProps.webhookDescription({ required: true }),+ },+ sampleData: mauticUtils.contactSampleData({ eventType: EVENT_TYPE }),+ type: TriggerStrategy.WEBHOOK,+ async onEnable(context) {+ const webhook = await mauticApi.createWebhook({+ auth: context.auth,+ name: context.propsValue.name,+ description: context.propsValue.description,+ webhookUrl: context.webhookUrl,+ eventType: EVENT_TYPE,+ });+ await context.store.put<MauticWebhookInformation>(STORE_KEY, webhook);+ },+ async onDisable(context) {+ const webhook = await context.store.get<MauticWebhookInformation>(STORE_KEY);+ if (webhook != null) {+ await mauticApi.deleteWebhook({ auth: context.auth, webhookId: webhook.hook.id });+ }+ },+ async run(context) {+ return [context.payload.body];+ },+});diff --git a/packages/pieces/community/mautic/src/lib/triggers/contact-updated.ts b/packages/pieces/community/mautic/src/lib/triggers/contact-updated.tsnew file mode 100644index 00000000000..4d8186463b8--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/triggers/contact-updated.ts@@ -0,0 +1,50 @@+import { TriggerStrategy, createTrigger } from '@activepieces/pieces-framework';++import { mauticAuth } from '../auth';+import { mauticApi } from '../common/api';+import { mauticProps } from '../common/props';+import { mauticUtils } from '../common/utils';+import { mauticLeadPostSaveUpdateTriggerOutputSchema } from '../output-schemas';++import type { MauticWebhookInformation } from '../common/types';++const EVENT_TYPE = 'mautic.lead_post_save_update';+const STORE_KEY = 'mautic_lead_post_save_update_trigger';++export const contactUpdatedTrigger = createTrigger({+ auth: mauticAuth,+ name: 'mautic_lead_post_save_update_trigger',+ outputSchema: mauticLeadPostSaveUpdateTriggerOutputSchema,+ classification: 'READ',+ displayName: 'Contact Updated',+ description: 'Triggers when a contact is updated.',+ aiMetadata: {+ description:+ "Fires when an existing contact (lead) in Mautic is saved after being modified, representing a change to that contact's field values. Use to react to edits on already-existing contacts; for newly created contacts use the New Contact trigger.",+ },+ props: {+ name: mauticProps.webhookName({ required: true }),+ description: mauticProps.webhookDescription({ required: true }),+ },+ sampleData: mauticUtils.contactSampleData({ eventType: EVENT_TYPE }),+ type: TriggerStrategy.WEBHOOK,+ async onEnable(context) {+ const webhook = await mauticApi.createWebhook({+ auth: context.auth,+ name: context.propsValue.name,+ description: context.propsValue.description,+ webhookUrl: context.webhookUrl,+ eventType: EVENT_TYPE,+ });+ await context.store.put<MauticWebhookInformation>(STORE_KEY, webhook);+ },+ async onDisable(context) {+ const webhook = await context.store.get<MauticWebhookInformation>(STORE_KEY);+ if (webhook != null) {+ await mauticApi.deleteWebhook({ auth: context.auth, webhookId: webhook.hook.id });+ }+ },+ async run(context) {+ return [context.payload.body];+ },+});diff --git a/packages/pieces/community/mautic/src/lib/triggers/index.ts b/packages/pieces/community/mautic/src/lib/triggers/index.tsdeleted file mode 100644index 0ae7bd43f06..00000000000--- a/packages/pieces/community/mautic/src/lib/triggers/index.ts+++ /dev/null@@ -1,473 +0,0 @@-import { HttpMethod, HttpRequest, httpClient } from '@activepieces/pieces-common';-import { mauticAuth } from '../auth';-import { Property, TriggerStrategy, createTrigger } from "@activepieces/pieces-framework";--const contactTestData = {- "contact": {- "id": 38186,- "points": 0,- "color": null,- "fields": {- "core": {- "points": {- "id": "9",- "label": "Points",- "alias": "points",- "type": "number",- "group": "core",- "object": "lead",- "is_fixed": "1",- "value": "0"- },- "title": {- "id": "1",- "label": "Title",- "alias": "title",- "type": "lookup",- "group": "core",- "object": "lead",- "is_fixed": "1",- "value": ""- },- "firstname": {- "id": "2",- "label": "First Name",- "alias": "firstname",- "type": "text",- "group": "core",- "object": "lead",- "is_fixed": "1",- "value": "Test"- },- "lastname": {- "id": "3",- "label": "Last Name",- "alias": "lastname",- "type": "text",- "group": "core",- "object": "lead",- "is_fixed": "1",- "value": "Contact"- },- "company": {- "id": "4",- "label": "Company",- "alias": "company",- "type": "text",- "group": "core",- "object": "lead",- "is_fixed": "1",- "value": ""- },- "position": {- "id": "5",- "label": "Position",- "alias": "position",- "type": "text",- "group": "core",- "object": "lead",- "is_fixed": "1",- "value": ""- },- "email": {- "id": "6",- "label": "Email",- "alias": "email",- "type": "email",- "group": "core",- "object": "lead",- "is_fixed": "1",- "value": "[email protected]"- },- "phone": {- "id": "8",- "label": "Phone",- "alias": "phone",- "type": "tel",- "group": "core",- "object": "lead",- "is_fixed": "1",- "value": ""- },- "mobile": {- "id": "7",- "label": "Mobile",- "alias": "mobile",- "type": "tel",- "group": "core",- "object": "lead",- "is_fixed": "1",- "value": ""- },- "address1": {- "id": "11",- "label": "Address Line 1",- "alias": "address1",- "type": "text",- "group": "core",- "object": "lead",- "is_fixed": "1",- "value": ""- },- "address2": {- "id": "12",- "label": "Address Line 2",- "alias": "address2",- "type": "text",- "group": "core",- "object": "lead",- "is_fixed": "1",- "value": ""- },- "city": {- "id": "13",- "label": "City",- "alias": "city",- "type": "text",- "group": "core",- "object": "lead",- "is_fixed": "1",- "value": ""- },- "state": {- "id": "14",- "label": "State",- "alias": "state",- "type": "region",- "group": "core",- "object": "lead",- "is_fixed": "1",- "value": ""- },- "zipcode": {- "id": "15",- "label": "Zip Code",- "alias": "zipcode",- "type": "text",- "group": "core",- "object": "lead",- "is_fixed": "1",- "value": ""- },- "country": {- "id": "16",- "label": "Country",- "alias": "country",- "type": "country",- "group": "core",- "object": "lead",- "is_fixed": "1",- "value": ""- },- "fax": {- "id": "10",- "label": "Fax",- "alias": "fax",- "type": "tel",- "group": "core",- "object": "lead",- "is_fixed": "0",- "value": null- },- "preferred_locale": {- "id": "17",- "label": "Preferred Locale",- "alias": "preferred_locale",- "type": "locale",- "group": "core",- "object": "lead",- "is_fixed": "1",- "value": null- },- "attribution_date": {- "id": "18",- "label": "Attribution Date",- "alias": "attribution_date",- "type": "datetime",- "group": "core",- "object": "lead",- "is_fixed": "1",- "value": null- },- "attribution": {- "id": "19",- "label": "Attribution",- "alias": "attribution",- "type": "number",- "group": "core",- "object": "lead",- "is_fixed": "1",- "value": null- },- "website": {- "id": "20",- "label": "Website",- "alias": "website",- "type": "url",- "group": "core",- "object": "lead",- "is_fixed": "0",- "value": null- },- "boolean": {- "id": "43",- "label": "Boolean",- "alias": "boolean",- "type": "boolean",- "group": "core",- "object": "lead",- "is_fixed": "0",- "value": null- },- "multiple_contact": {- "id": "44",- "label": "Multiple Contact",- "alias": "multiple_contact",- "type": "multiselect",- "group": "core",- "object": "lead",- "is_fixed": "0",- "value": null- }- },- "social": {- "facebook": {- "id": "21",- "label": "Facebook",- "alias": "facebook",- "type": "text",- "group": "social",- "object": "lead",- "is_fixed": "0",- "value": null- },- "foursquare": {- "id": "22",- "label": "Foursquare",- "alias": "foursquare",- "type": "text",- "group": "social",- "object": "lead",- "is_fixed": "0",- "value": null- },- "instagram": {- "id": "24",- "label": "Instagram",- "alias": "instagram",- "type": "text",- "group": "social",- "object": "lead",- "is_fixed": "0",- "value": null- },- "linkedin": {- "id": "25",- "label": "LinkedIn",- "alias": "linkedin",- "type": "text",- "group": "social",- "object": "lead",- "is_fixed": "0",- "value": null- },- "skype": {- "id": "26",- "label": "Skype",- "alias": "skype",- "type": "text",- "group": "social",- "object": "lead",- "is_fixed": "0",- "value": null- },- "twitter": {- "id": "27",- "label": "Twitter",- "alias": "twitter",- "type": "text",- "group": "social",- "object": "lead",- "is_fixed": "0",- "value": null- }- },- "personal": [],- "professional": []- }- },- "channel": "email",- "old_status": "contactable",- "new_status": "manual",- "timestamp": "2017-12-01T00:05:18-06:00"-}--export const triggers = [- {- name: "lead_post_save_update",- displayName: "Contact Updated",- description: "Triggers when a contact is updated.",- aiMetadata: {- description:- "Fires when an existing contact (lead) in Mautic is saved after being modified, representing a change to that contact's field values. Use to react to edits on already-existing contacts; for newly created contacts use the New Contact trigger.",- },- sampleData: {- "mautic.lead_post_save_update": [contactTestData]- },- eventType: "mautic.lead_post_save_update",- },- {- name: "lead_company_change",- displayName: "Contact Company Subscription Change",- description: "Triggers when a commpany is added or removed to/from contact.",- aiMetadata: {- description:- "Fires when a contact's company association changes in Mautic — that is, when the contact is added to or removed from a company. Use to react to a contact's organization membership changing.",- },- sampleData: {- "mautic.lead_company_change": [contactTestData]- },- eventType: "mautic.lead_company_change",- },- {- name: "lead_channel_subscription_changed",- displayName: "Contact Channel Subscription Change",- description: "Triggers when a contact's channel subscription status changes.",- aiMetadata: {- description:- "Fires when a contact's subscription status for a communication channel (such as email) changes in Mautic — for example when they opt in or out of receiving messages. Use to react to contactability/consent changes for a channel.",- },- sampleData: {- "mautic.lead_channel_subscription_changed": [contactTestData]- },- eventType: "mautic.lead_channel_subscription_changed",- },- {- name: "lead_post_save_new",- displayName: "New Contact",- description: "Triggers when a new contact is created.",- aiMetadata: {- description:- "Fires when a new contact (lead) is created in Mautic, representing a freshly added person. Use to react to contact creation; for changes to existing contacts use the Contact Updated trigger.",- },- sampleData: {- "mautic.lead_post_save_new": [contactTestData]- },- eventType: "mautic.lead_post_save_new",- },-]- .map((props) => registerTrigger(props));--function registerTrigger({- name,- displayName,- eventType,- description,- aiMetadata,- sampleData-}: {- name: string;- displayName: string;- eventType: string;- description: string;- aiMetadata: { description: string };- sampleData: unknown;-}) {- return createTrigger({- auth: mauticAuth,- name: `mautic_${name}_trigger`,- classification: 'READ',- displayName,- description,- aiMetadata,- props: {- name: Property.ShortText({- displayName: "Webhook Name",- description: "The name the webhook will be searchable by in mautic the webhooks page.",- required: true- }),- description: Property.LongText({- displayName: "Description",- description: "A short description of the webhook",- required: true- })- },- sampleData,- type: TriggerStrategy.WEBHOOK,- async onEnable(context) {- const { base_url, username, password } = context.auth.props-- const request: HttpRequest = {- method: HttpMethod.POST,- url: `${(base_url.endsWith('/') ? base_url : base_url + '/')}api/hooks/new`,- body: {- name: context.propsValue.name,- description: context.propsValue.description,- webhookUrl: context.webhookUrl,- eventsOrderbyDir: "ASC",- triggers: [eventType]- },- headers: {- 'Content-Type': 'application/json',- 'Authorization':- 'Basic ' + Buffer.from(`${username}:${password}`).toString('base64'),- },- queryParams: {},- }-- const response = await httpClient.sendRequest<WebhookInformation>(request);- await context.store.put<WebhookInformation>(`mautic_${name}_trigger`, response.body);- },- async onDisable(context) {- const { base_url, username, password } = context.auth.props-- const webhook = await context.store.get<WebhookInformation>(`mautic_${name}_trigger`);- if (webhook != null) {- const request: HttpRequest = {- method: HttpMethod.DELETE,- url: `${(base_url.endsWith('/') ? base_url : base_url + '/')}api/hooks/${webhook.hook.id}/delete`,- headers: {- 'Content-Type': 'application/json',- 'Authorization':- 'Basic ' + Buffer.from(`${username}:${password}`).toString('base64'),- },- };- const response = await httpClient.sendRequest(request);- console.debug(`mautic.trigger.onDisable`, response);- }- },- async run(context) {- return [context.payload.body];- },- });-}---interface WebhookInformation {- hook: {- isPublished: boolean- dateAdded: string- dateModified: string- createdBy: number- createdByUser: string- modifiedBy: unknown | null- modifiedByUser: string- id: number- name: string- description: string- webhookUrl: string- secret: string- eventsOrderbyDir: string- category: {- id: number- createdByUser: string- modifiedByUser: string- title: string- alias: string- description: string | null- color: string | null- bundle: string- }- triggers: string[]- }-}diff --git a/packages/pieces/community/mautic/src/lib/triggers/new-contact.ts b/packages/pieces/community/mautic/src/lib/triggers/new-contact.tsnew file mode 100644index 00000000000..4d3c80e1533--- /dev/null+++ b/packages/pieces/community/mautic/src/lib/triggers/new-contact.ts@@ -0,0 +1,50 @@+import { TriggerStrategy, createTrigger } from '@activepieces/pieces-framework';++import { mauticAuth } from '../auth';+import { mauticApi } from '../common/api';+import { mauticProps } from '../common/props';+import { mauticUtils } from '../common/utils';+import { mauticLeadPostSaveNewTriggerOutputSchema } from '../output-schemas';++import type { MauticWebhookInformation } from '../common/types';++const EVENT_TYPE = 'mautic.lead_post_save_new';+const STORE_KEY = 'mautic_lead_post_save_new_trigger';++export const newContactTrigger = createTrigger({+ auth: mauticAuth,+ name: 'mautic_lead_post_save_new_trigger',+ outputSchema: mauticLeadPostSaveNewTriggerOutputSchema,+ classification: 'READ',+ displayName: 'New Contact',+ description: 'Triggers when a new contact is created.',+ aiMetadata: {+ description:+ 'Fires when a new contact (lead) is created in Mautic, representing a freshly added person. Use to react to contact creation; for changes to existing contacts use the Contact Updated trigger.',+ },+ props: {+ name: mauticProps.webhookName({ required: true }),+ description: mauticProps.webhookDescription({ required: true }),+ },+ sampleData: mauticUtils.contactSampleData({ eventType: EVENT_TYPE }),+ type: TriggerStrategy.WEBHOOK,+ async onEnable(context) {+ const webhook = await mauticApi.createWebhook({+ auth: context.auth,+ name: context.propsValue.name,+ description: context.propsValue.description,+ webhookUrl: context.webhookUrl,+ eventType: EVENT_TYPE,+ });+ await context.store.put<MauticWebhookInformation>(STORE_KEY, webhook);+ },+ async onDisable(context) {+ const webhook = await context.store.get<MauticWebhookInformation>(STORE_KEY);+ if (webhook != null) {+ await mauticApi.deleteWebhook({ auth: context.auth, webhookId: webhook.hook.id });+ }+ },+ async run(context) {+ return [context.payload.body];+ },+});