Skip to content

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

feat(pinterest,trello): expand board, pin, card and custom field actions for agents (#15539)

Odai Ahmadcec0d8399616
diff --git a/docs/install/reference/breaking-changes.mdx b/docs/install/reference/breaking-changes.mdx
index 599c198639f..45d3f11b44b 100644
--- a/docs/install/reference/breaking-changes.mdx
+++ b/docs/install/reference/breaking-changes.mdx
@@ -67,6 +67,28 @@ Connection secrets still never cross instances. Only the reference travels, and
Nothing on upgrade if your source project is the source of truth for connections, which is the intended model. If instead you deliberately re-point a step in the destination project at a different connection than the source uses, that re-point is now overwritten on the next apply. Either point the source at the connection you want, or clear the connection on the source step so the destination wiring is preserved.
+#### Seven actions are no longer offered to agents
+
+The Pinterest piece advertised its six original actions to AI agents as `audience: 'both'`, but they identify boards and Pins through dynamic dropdowns that an agent has no way to drive. They are now `human`, alongside the Trello `add_card_attachment` action, whose only input is a file an agent cannot produce.
+
+An agent that currently holds one of these tools stops seeing it. Every one has a replacement among the new agent actions that takes plain IDs instead: Create Pin from Media, Create New Board, Update Board Details, Delete Pin by ID, Search Boards, Search Pins, and Add Card Attachment from URL.
+
+The flow builder is unaffected. All seven actions keep working exactly as before for human users, and no saved step changes.
+
+#### What you need to do
+
+Nothing for flows. If you have an agent configured with one of the seven actions above, point it at the corresponding agent action listed there. MCP clients should refresh their tool list.
+
+#### Pinterest Update Board can no longer clear a description
+
+Update Board and its agent twin Update Board Details treat a blank or whitespace-only description as "keep the current one", matching the help text the field always carried. Previously a blank description was sent to Pinterest and wiped the board's description on every run.
+
+Clearing a description from this action is therefore no longer possible; that is the intended reading. A call that supplies only a blank description now fails with "At least one field (name, description, or privacy) must be provided to update the board." instead of silently doing nothing.
+
+#### What you need to do
+
+Nothing unless a flow or an agent relied on a blank description to clear a board's description, which previously happened on every run whether or not it was intended. Clear it from Pinterest directly.
+
## 0.91.0
### What has changed?
diff --git a/packages/pieces/community/pinterest/package.json b/packages/pieces/community/pinterest/package.json
index edd9e8c6ccb..ab04db64da0 100644
--- a/packages/pieces/community/pinterest/package.json
+++ b/packages/pieces/community/pinterest/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-pinterest",
- "version": "0.1.9",
+ "version": "0.2.0",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"scripts": {
diff --git a/packages/pieces/community/pinterest/src/index.ts b/packages/pieces/community/pinterest/src/index.ts
index 73b0601ea5f..a261bf54e30 100644
--- a/packages/pieces/community/pinterest/src/index.ts
+++ b/packages/pieces/community/pinterest/src/index.ts
@@ -6,6 +6,35 @@ import { deletePin } from './lib/actions/delete-pin';
import { findBoardByName } from './lib/actions/find-board-by-name';
import { findPin } from './lib/actions/find-pin';
import { updateBoard } from './lib/actions/update-board';
+import { listBoards } from './lib/actions/list-boards';
+import { getBoard } from './lib/actions/get-board';
+import { deleteBoard } from './lib/actions/delete-board';
+import { listPinsOnBoard } from './lib/actions/list-pins-on-board';
+import { listBoardSections } from './lib/actions/list-board-sections';
+import { createBoardSection } from './lib/actions/create-board-section';
+import { renameBoardSection } from './lib/actions/rename-board-section';
+import { deleteBoardSection } from './lib/actions/delete-board-section';
+import { listPinsOnBoardSection } from './lib/actions/list-pins-on-board-section';
+import { listPins } from './lib/actions/list-pins';
+import { getPin } from './lib/actions/get-pin';
+import { savePin } from './lib/actions/save-pin';
+import { getPinAnalytics } from './lib/actions/get-pin-analytics';
+import { listPinProductTags } from './lib/actions/list-pin-product-tags';
+import { getUserAccount } from './lib/actions/get-user-account';
+import { getUserAccountAnalytics } from './lib/actions/get-user-account-analytics';
+import { getTopPinsAnalytics } from './lib/actions/get-top-pins-analytics';
+import { getTopVideoPinsAnalytics } from './lib/actions/get-top-video-pins-analytics';
+import { listFollowers } from './lib/actions/list-followers';
+import { listFollowing } from './lib/actions/list-following';
+import { listFollowedBoards } from './lib/actions/list-followed-boards';
+import { listLinkedBusinesses } from './lib/actions/list-linked-businesses';
+import { listVerifiedWebsites } from './lib/actions/list-verified-websites';
+import { createPinFromMedia } from './lib/actions/create-pin-from-media';
+import { createNewBoard } from './lib/actions/create-new-board';
+import { deletePinById } from './lib/actions/delete-pin-by-id';
+import { updateBoardDetails } from './lib/actions/update-board-details';
+import { searchBoards } from './lib/actions/search-boards';
+import { searchPins } from './lib/actions/search-pins';
import { newBoard } from './lib/triggers/new-board';
import { newFollower } from './lib/triggers/new-follower';
import { newPinOnBoard } from './lib/triggers/new-pin-on-board';
@@ -16,7 +45,7 @@ export const pinterest = createPiece({
minimumSupportedRelease: '0.88.2',
logoUrl: 'https://cdn.activepieces.com/pieces/pinterest.png',
categories: [PieceCategory.MARKETING],
- authors: ['Sanket6652', 'Talaljaber'],
+ authors: ['Sanket6652', 'Talaljaber', 'OdaiAhmed99'],
actions: [
createPin,
createBoard,
@@ -24,6 +53,35 @@ export const pinterest = createPiece({
findBoardByName,
findPin,
updateBoard,
+ listBoards,
+ getBoard,
+ createNewBoard,
+ updateBoardDetails,
+ deleteBoard,
+ searchBoards,
+ listBoardSections,
+ createBoardSection,
+ renameBoardSection,
+ deleteBoardSection,
+ listPinsOnBoard,
+ listPinsOnBoardSection,
+ listPins,
+ getPin,
+ searchPins,
+ createPinFromMedia,
+ savePin,
+ deletePinById,
+ listPinProductTags,
+ getPinAnalytics,
+ getUserAccount,
+ getUserAccountAnalytics,
+ getTopPinsAnalytics,
+ getTopVideoPinsAnalytics,
+ listFollowers,
+ listFollowing,
+ listFollowedBoards,
+ listLinkedBusinesses,
+ listVerifiedWebsites,
],
triggers: [newBoard, newFollower, newPinOnBoard],
});
diff --git a/packages/pieces/community/pinterest/src/lib/actions/create-board-section.ts b/packages/pieces/community/pinterest/src/lib/actions/create-board-section.ts
new file mode 100644
index 00000000000..259575c7007
--- /dev/null
+++ b/packages/pieces/community/pinterest/src/lib/actions/create-board-section.ts
@@ -0,0 +1,42 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { makeRequest } from '../common';
+import { pinterestAuth } from '../common/auth';
+import { HttpMethod, getAccessTokenOrThrow } from '@activepieces/pieces-common';
+import { boardSectionActionOutputSchema } from '../output-schemas';
+
+export const createBoardSection = createAction({
+ auth: pinterestAuth,
+ name: 'createBoardSection',
+ classification: 'WRITE',
+ outputSchema: boardSectionActionOutputSchema,
+ displayName: 'Create Board Section',
+ description: 'Add a section to a board.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Creates a named section inside an existing board and returns the new section id. Use it to group Pins within a board before creating Pins into that section. Check List Board Sections first: Pinterest allows two sections with the same name, so each call adds another section rather than reusing one, which makes this not idempotent.',
+ idempotent: false,
+ },
+ props: {
+ board_id: Property.ShortText({
+ displayName: 'Board ID',
+ required: true,
+ description: 'Numeric board id, as returned by List Boards.',
+ }),
+ name: Property.ShortText({
+ displayName: 'Section Name',
+ required: true,
+ description: 'The name of the new section.',
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const { board_id, name } = propsValue;
+
+ return await makeRequest(
+ getAccessTokenOrThrow(auth),
+ HttpMethod.POST,
+ `/boards/${board_id}/sections`,
+ { name }
+ );
+ },
+});
diff --git a/packages/pieces/community/pinterest/src/lib/actions/create-board.ts b/packages/pieces/community/pinterest/src/lib/actions/create-board.ts
index 624d4ee9914..273aa9b0a04 100644
--- a/packages/pieces/community/pinterest/src/lib/actions/create-board.ts
+++ b/packages/pieces/community/pinterest/src/lib/actions/create-board.ts
@@ -1,10 +1,7 @@
-import {
- createAction,
- Property,
-} from '@activepieces/pieces-framework';
-import { makeRequest } from '../common';
+import { createAction, Property } from '@activepieces/pieces-framework';
import { pinterestAuth } from '../common/auth';
-import { HttpMethod, getAccessTokenOrThrow } from '@activepieces/pieces-common';
+import { getAccessTokenOrThrow } from '@activepieces/pieces-common';
+import { pinterestOperations } from '../common/operations';
import { adAccountIdDropdown } from '../common/props';
import { createBoardActionOutputSchema } from '../output-schemas';
@@ -15,7 +12,7 @@ export const createBoard = createAction({
outputSchema: createBoardActionOutputSchema,
displayName: 'Create Board',
description: 'Create a new Pinterest board for organizing Pins.',
- audience: 'both',
+ audience: 'human',
aiMetadata: {
description:
'Creates a new Pinterest board to organize Pins, with a name and optional description and privacy level. Use before adding Pins when no suitable board exists. Each call creates a separate board even with identical input, so it is not idempotent.',
@@ -69,32 +66,9 @@ export const createBoard = createAction({
}),
},
async run({ auth, propsValue }) {
- const { ad_account_id, name, description, privacy, is_ads_only } =
- propsValue;
- if (name && name.length > 180) {
- throw new Error('Board name must be 180 characters or less');
- }
-
- if (description && description.length > 500) {
- throw new Error('Board description must be 500 characters or less');
- }
- const body: any = {
- name,
- is_ads_only,
- };
- if (description) body.description = description;
- if (privacy) body.privacy = privacy;
-
- let path = '/boards';
- if (ad_account_id) {
- path = `/boards?ad_account_id=${encodeURIComponent(ad_account_id)}`;
- }
-
- return await makeRequest(
- getAccessTokenOrThrow(auth),
- HttpMethod.POST,
- path,
- body
- );
+ return await pinterestOperations.createBoard({
+ accessToken: getAccessTokenOrThrow(auth),
+ ...propsValue,
+ });
},
});
diff --git a/packages/pieces/community/pinterest/src/lib/actions/create-new-board.ts b/packages/pieces/community/pinterest/src/lib/actions/create-new-board.ts
new file mode 100644
index 00000000000..983086f7db7
--- /dev/null
+++ b/packages/pieces/community/pinterest/src/lib/actions/create-new-board.ts
@@ -0,0 +1,51 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { pinterestAuth } from '../common/auth';
+import { getAccessTokenOrThrow } from '@activepieces/pieces-common';
+import { pinterestOperations } from '../common/operations';
+import { createBoardActionOutputSchema } from '../output-schemas';
+
+export const createNewBoard = createAction({
+ auth: pinterestAuth,
+ name: 'createNewBoard',
+ classification: 'WRITE',
+ outputSchema: createBoardActionOutputSchema,
+ displayName: 'Create New Board',
+ description: 'Create a board to organise Pins.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Creates a board and returns its new board id, optionally with a description and a privacy level of public or protected. Use it when no suitable board exists yet; check List Boards or Search Boards first, because Pinterest allows two boards with the same name and each call creates another one, which makes this not idempotent. Secret boards are not offered because this connection does not hold the scope Pinterest requires to write them.',
+ idempotent: false,
+ },
+ props: {
+ name: Property.ShortText({
+ displayName: 'Board Name',
+ required: true,
+ description: 'Name of the board (max 180 characters).',
+ }),
+ description: Property.LongText({
+ displayName: 'Description',
+ required: false,
+ description: 'Description of the board (max 500 characters).',
+ }),
+ privacy: Property.StaticDropdown({
+ displayName: 'Privacy',
+ required: false,
+ defaultValue: 'PUBLIC',
+ description:
+ 'Who can see the board. Defaults to public. Secret boards cannot be created through this connection.',
+ options: {
+ options: [
+ { label: 'Public', value: 'PUBLIC' },
+ { label: 'Protected', value: 'PROTECTED' },
+ ],
+ },
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await pinterestOperations.createBoard({
+ accessToken: getAccessTokenOrThrow(auth),
+ ...propsValue,
+ });
+ },
+});
diff --git a/packages/pieces/community/pinterest/src/lib/actions/create-pin-from-media.ts b/packages/pieces/community/pinterest/src/lib/actions/create-pin-from-media.ts
new file mode 100644
index 00000000000..a2306a909da
--- /dev/null
+++ b/packages/pieces/community/pinterest/src/lib/actions/create-pin-from-media.ts
@@ -0,0 +1,71 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { pinterestAuth } from '../common/auth';
+import { getAccessTokenOrThrow } from '@activepieces/pieces-common';
+import { pinterestOperations } from '../common/operations';
+import { createPinActionOutputSchema } from '../output-schemas';
+
+export const createPinFromMedia = createAction({
+ auth: pinterestAuth,
+ name: 'createPinFromMedia',
+ classification: 'WRITE',
+ outputSchema: createPinActionOutputSchema,
+ displayName: 'Create Pin from Media',
+ description: 'Publish a new Pin from a hosted image URL.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Publishes a new Pin to a board from a hosted image URL and returns the new pin id. Use it to put new content on Pinterest, and Save Pin to repin content that already exists. The image must be a URL Pinterest can fetch without authentication; this action cannot publish video, and raw image data is not accepted here. Requires a board id from List Boards and a title, and each call publishes another Pin, so it is not idempotent.',
+ idempotent: false,
+ },
+ props: {
+ board_id: Property.ShortText({
+ displayName: 'Board ID',
+ required: true,
+ description: 'Numeric board id, as returned by List Boards.',
+ }),
+ title: Property.ShortText({
+ displayName: 'Title',
+ required: true,
+ description: 'Title of the Pin (max 100 characters).',
+ }),
+ media_url: Property.ShortText({
+ displayName: 'Image URL',
+ required: true,
+ description:
+ 'Publicly reachable URL of the image. Pinterest fetches it, so it must be reachable without authentication.',
+ }),
+ board_section_id: Property.ShortText({
+ displayName: 'Board Section ID',
+ required: false,
+ description:
+ 'Optional section on that board, as returned by List Board Sections.',
+ }),
+ description: Property.LongText({
+ displayName: 'Description',
+ required: false,
+ description: 'Description of the Pin (max 800 characters).',
+ }),
+ link: Property.ShortText({
+ displayName: 'Destination Link',
+ required: false,
+ description: 'URL the Pin opens when clicked.',
+ }),
+ alt_text: Property.ShortText({
+ displayName: 'Alt Text',
+ required: false,
+ description: 'Accessibility text for the media (max 500 characters).',
+ }),
+ dominant_color: Property.ShortText({
+ displayName: 'Dominant Color',
+ required: false,
+ description: 'Hex color code such as #6E7874.',
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await pinterestOperations.createPin({
+ accessToken: getAccessTokenOrThrow(auth),
+ media_source_type: 'image_url',
+ ...propsValue,
+ });
+ },
+});
diff --git a/packages/pieces/community/pinterest/src/lib/actions/create-pin.ts b/packages/pieces/community/pinterest/src/lib/actions/create-pin.ts
index 00d1666c341..14230a48dd2 100644
--- a/packages/pieces/community/pinterest/src/lib/actions/create-pin.ts
+++ b/packages/pieces/community/pinterest/src/lib/actions/create-pin.ts
@@ -1,10 +1,7 @@
-import {
- createAction,
- Property,
-} from '@activepieces/pieces-framework';
-import { makeRequest } from '../common';
+import { createAction, Property } from '@activepieces/pieces-framework';
import { pinterestAuth } from '../common/auth';
-import { HttpMethod, getAccessTokenOrThrow } from '@activepieces/pieces-common';
+import { getAccessTokenOrThrow } from '@activepieces/pieces-common';
+import { pinterestOperations } from '../common/operations';
import {
adAccountIdDropdown,
boardIdDropdown,
@@ -20,7 +17,7 @@ export const createPin = createAction({
outputSchema: createPinActionOutputSchema,
displayName: 'Create Pin',
description: 'Create a Pin on a board from an image URL or base64 image.',
- audience: 'both',
+ audience: 'human',
aiMetadata: {
description:
'Creates a Pin on a Pinterest board by uploading media from a hosted image/video URL (or base64 image). Use to publish visual content to a board the user owns. Requires a valid board_id and a media source; each call creates a new Pin, so it is not idempotent.',
@@ -141,165 +138,9 @@ export const createPin = createAction({
}),
},
async run({ auth, propsValue }) {
- const {
- board_id,
- board_section_id,
- title,
- description,
- media_source_type,
- media_url,
- link,
- dominant_color,
- alt_text,
- parent_pin_id,
- is_removable,
- product_tags,
- ad_account_id,
- note,
- sponsor_id,
- } = propsValue;
-
- if (
- media_source_type !== 'image_url' &&
- media_source_type !== 'image_base64'
- ) {
- throw new Error(
- 'Video Pins are not supported by this action. Choose Image URL or Base64 Image.'
- );
- }
-
- if (title && title.length > 100) {
- throw new Error('Title must be 100 characters or less');
- }
-
- if (description && description.length > 800) {
- throw new Error('Description must be 800 characters or less');
- }
-
- if (alt_text && alt_text.length > 500) {
- throw new Error('Alt text must be 500 characters or less');
- }
-
- if (media_source_type !== 'image_base64') {
- try {
- new URL(media_url);
- } catch {
- throw new Error('Please enter a valid URL in the Media field');
- }
- }
-
- if (link) {
- try {
- new URL(link);
- } catch {
- throw new Error('Please enter a valid URL for Destination Link');
- }
- }
-
- if (dominant_color) {
- const hexColorRegex = /^#[0-9A-Fa-f]{6}$/;
- if (!hexColorRegex.test(dominant_color)) {
- throw new Error(
- 'Pin Color must be a valid hex color format (e.g., #6E7874)'
- );
- }
- }
-
- const body: any = {
- board_id,
- title,
- media_source: buildMediaSource({
- mediaSourceType: media_source_type,
- mediaUrl: media_url,
- }),
- };
-
- if (board_section_id) body.board_section_id = board_section_id;
- if (description) body.description = description;
- if (link) body.link = link;
- if (dominant_color) body.dominant_color = dominant_color;
- if (alt_text) body.alt_text = alt_text;
- if (parent_pin_id) body.parent_pin_id = parent_pin_id;
- if (note) body.note = note;
- if (sponsor_id) body.sponsor_id = sponsor_id;
- if (typeof is_removable === 'boolean') body.is_removable = is_removable;
-
- if (
- product_tags &&
- Array.isArray(product_tags) &&
- product_tags.length > 0
- ) {
- body.product_tags = product_tags;
- }
-
- let path = '/pins';
- if (ad_account_id) {
- path = `/pins?ad_account_id=${encodeURIComponent(ad_account_id)}`;
- }
-
- return await makeRequest(
- getAccessTokenOrThrow(auth),
- HttpMethod.POST,
- path,
- body
- );
+ return await pinterestOperations.createPin({
+ accessToken: getAccessTokenOrThrow(auth),
+ ...propsValue,
+ });
},
});
-
-function buildMediaSource({
- mediaSourceType,
- mediaUrl,
-}: {
- mediaSourceType: string;
- mediaUrl: string;
-}): Record<string, string> {
- if (mediaSourceType !== 'image_base64') {
- return { source_type: mediaSourceType, url: mediaUrl };
- }
-
- const trimmed = mediaUrl.trim();
- const dataUri = /^data:([^;,]*)((?:;[^;,]*)*),/.exec(trimmed);
- const isBase64Uri =
- dataUri !== null &&
- dataUri[2].split(';').some((param) => param.toLowerCase() === 'base64');
-
- if (dataUri && !isBase64Uri) {
- throw new Error(
- 'Media data URI must be base64 encoded (data:image/png;base64,...)'
- );
- }
-
- const data = (dataUri ? trimmed.slice(dataUri[0].length) : trimmed)
- .replace(/\s+/g, '')
- .replace(/-/g, '+')
- .replace(/_/g, '/');
- if (!BASE64_PATTERN.test(data)) {
- throw new Error('Media must be valid base64 when the type is Base64 Image');
- }
-
- const declaredType =
- dataUri && dataUri[1].length > 0 ? dataUri[1].toLowerCase() : undefined;
- const contentType = declaredType ?? detectImageContentType(data);
-
- if (!contentType || !SUPPORTED_IMAGE_TYPES.has(contentType)) {
- throw new Error(
- 'Media must be a JPEG or PNG image, as a data URI or raw base64'
- );
- }
-
- return {
- source_type: 'image_base64',
- content_type: contentType,
- data,
- };
-}
-
-function detectImageContentType(base64: string): string | undefined {
- const signature = base64.slice(0, 8);
- if (signature.startsWith('/9j/')) return 'image/jpeg';
- if (signature.startsWith('iVBORw0K')) return 'image/png';
- return undefined;
-}
-
-const SUPPORTED_IMAGE_TYPES = new Set(['image/jpeg', 'image/png']);
-const BASE64_PATTERN = /^[A-Za-z0-9+/]+={0,2}$/;
diff --git a/packages/pieces/community/pinterest/src/lib/actions/delete-board-section.ts b/packages/pieces/community/pinterest/src/lib/actions/delete-board-section.ts
new file mode 100644
index 00000000000..d803d4493d5
--- /dev/null
+++ b/packages/pieces/community/pinterest/src/lib/actions/delete-board-section.ts
@@ -0,0 +1,49 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { makeRequest } from '../common';
+import { pinterestAuth } from '../common/auth';
+import { HttpMethod, getAccessTokenOrThrow } from '@activepieces/pieces-common';
+import { deleteBoardSectionActionOutputSchema } from '../output-schemas';
+
+export const deleteBoardSection = createAction({
+ auth: pinterestAuth,
+ name: 'deleteBoardSection',
+ classification: 'DESTRUCTIVE',
+ outputSchema: deleteBoardSectionActionOutputSchema,
+ displayName: 'Delete Board Section',
+ description: 'Delete a section from a board.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Deletes a section from a board. The Pins that were in the section stay on the board and become unsectioned, so this removes the grouping rather than the content; use Delete Board to remove the Pins as well. Requires both the board id and the section id, and deleting an already-deleted section errors rather than succeeding, so it is not idempotent.',
+ idempotent: false,
+ },
+ props: {
+ board_id: Property.ShortText({
+ displayName: 'Board ID',
+ required: true,
+ description: 'Numeric board id, as returned by List Boards.',
+ }),
+ section_id: Property.ShortText({
+ displayName: 'Section ID',
+ required: true,
+ description:
+ 'Numeric section id, as returned by List Board Sections for this board.',
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const { board_id, section_id } = propsValue;
+
+ await makeRequest(
+ getAccessTokenOrThrow(auth),
+ HttpMethod.DELETE,
+ `/boards/${board_id}/sections/${section_id}`
+ );
+
+ return {
+ success: true,
+ board_id,
+ section_id,
+ message: `Section ${section_id} was deleted from board ${board_id}.`,
+ };
+ },
+});
diff --git a/packages/pieces/community/pinterest/src/lib/actions/delete-board.ts b/packages/pieces/community/pinterest/src/lib/actions/delete-board.ts
new file mode 100644
index 00000000000..f8c3da6af54
--- /dev/null
+++ b/packages/pieces/community/pinterest/src/lib/actions/delete-board.ts
@@ -0,0 +1,42 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { makeRequest } from '../common';
+import { pinterestAuth } from '../common/auth';
+import { HttpMethod, getAccessTokenOrThrow } from '@activepieces/pieces-common';
+import { deleteBoardActionOutputSchema } from '../output-schemas';
+
+export const deleteBoard = createAction({
+ auth: pinterestAuth,
+ name: 'deleteBoard',
+ classification: 'DESTRUCTIVE',
+ outputSchema: deleteBoardActionOutputSchema,
+ displayName: 'Delete Board',
+ description: 'Permanently delete a board and every Pin saved on it.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Permanently deletes a board together with every Pin saved on it. This cannot be undone and destroys content, so confirm the board id with Get Board first and delete individual Pins instead when only some content should go. Deleting an already-deleted board returns an error rather than succeeding, so it is not idempotent.',
+ idempotent: false,
+ },
+ props: {
+ board_id: Property.ShortText({
+ displayName: 'Board ID',
+ required: true,
+ description: 'Numeric board id, as returned by List Boards.',
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const { board_id } = propsValue;
+
+ await makeRequest(
+ getAccessTokenOrThrow(auth),
+ HttpMethod.DELETE,
+ `/boards/${board_id}`
+ );
+
+ return {
+ success: true,
+ board_id,
+ message: `Board ${board_id} and all of its Pins were deleted.`,
+ };
+ },
+});
diff --git a/packages/pieces/community/pinterest/src/lib/actions/delete-pin-by-id.ts b/packages/pieces/community/pinterest/src/lib/actions/delete-pin-by-id.ts
new file mode 100644
index 00000000000..77b131a7548
--- /dev/null
+++ b/packages/pieces/community/pinterest/src/lib/actions/delete-pin-by-id.ts
@@ -0,0 +1,33 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { pinterestAuth } from '../common/auth';
+import { getAccessTokenOrThrow } from '@activepieces/pieces-common';
+import { pinterestOperations } from '../common/operations';
+import { deletePinActionOutputSchema } from '../output-schemas';
+
+export const deletePinById = createAction({
+ auth: pinterestAuth,
+ name: 'deletePinById',
+ classification: 'DESTRUCTIVE',
+ outputSchema: deletePinActionOutputSchema,
+ displayName: 'Delete Pin by ID',
+ description: 'Permanently delete a Pin.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Permanently deletes one Pin by id. Pinterest has no trash for Pins, so this cannot be undone; confirm the Pin with Get Pin first, and use Update Pin to move a Pin to another board when the goal is to tidy up rather than destroy. Deleting an already-deleted Pin returns an error rather than succeeding, so it is not idempotent.',
+ idempotent: false,
+ },
+ props: {
+ pin_id: Property.ShortText({
+ displayName: 'Pin ID',
+ required: true,
+ description: 'Numeric pin id, as returned by List Pins or Search Pins.',
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await pinterestOperations.deletePin({
+ accessToken: getAccessTokenOrThrow(auth),
+ pin_id: propsValue.pin_id,
+ });
+ },
+});
diff --git a/packages/pieces/community/pinterest/src/lib/actions/delete-pin.ts b/packages/pieces/community/pinterest/src/lib/actions/delete-pin.ts
index cc379f2c5f8..cf263a58157 100644
--- a/packages/pieces/community/pinterest/src/lib/actions/delete-pin.ts
+++ b/packages/pieces/community/pinterest/src/lib/actions/delete-pin.ts
@@ -1,9 +1,7 @@
-import {
- createAction,
-} from '@activepieces/pieces-framework';
-import { makeRequest } from '../common';
+import { createAction } from '@activepieces/pieces-framework';
import { pinterestAuth } from '../common/auth';
-import { HttpMethod, getAccessTokenOrThrow } from '@activepieces/pieces-common';
+import { getAccessTokenOrThrow } from '@activepieces/pieces-common';
+import { pinterestOperations } from '../common/operations';
import { adAccountIdDropdown, pinIdDropdown } from '../common/props';
import { deletePinActionOutputSchema } from '../output-schemas';
@@ -14,7 +12,7 @@ export const deletePin = createAction({
outputSchema: deletePinActionOutputSchema,
displayName: 'Delete Pin',
description: 'Permanently delete a specific Pin.',
- audience: 'both',
+ audience: 'human',
aiMetadata: {
description:
'Permanently deletes a single Pin identified by its pin_id. Use to remove published content from Pinterest; this is destructive and cannot be undone. Repeating the call after the Pin is gone returns an error rather than re-deleting, so treat it as not idempotent.',
@@ -25,21 +23,10 @@ export const deletePin = createAction({
ad_account_id: adAccountIdDropdown,
},
async run({ auth, propsValue }) {
- const { pin_id, ad_account_id } = propsValue;
-
- let path = `/pins/${pin_id}`;
- if (ad_account_id) {
- path = `/pins/${pin_id}?ad_account_id=${encodeURIComponent(
- ad_account_id
- )}`;
- }
-
- await makeRequest(getAccessTokenOrThrow(auth), HttpMethod.DELETE, path);
-
- return {
- success: true,
- message: `Pin ${pin_id} has been successfully deleted.`,
- pin_id: pin_id,
- };
+ return await pinterestOperations.deletePin({
+ accessToken: getAccessTokenOrThrow(auth),
+ pin_id: propsValue.pin_id,
+ ad_account_id: propsValue.ad_account_id,
+ });
},
});
diff --git a/packages/pieces/community/pinterest/src/lib/actions/find-board-by-name.ts b/packages/pieces/community/pinterest/src/lib/actions/find-board-by-name.ts
index b85eec12afd..be654baa2bc 100644
--- a/packages/pieces/community/pinterest/src/lib/actions/find-board-by-name.ts
+++ b/packages/pieces/community/pinterest/src/lib/actions/find-board-by-name.ts
@@ -1,10 +1,7 @@
-import {
- createAction,
- Property,
-} from '@activepieces/pieces-framework';
-import { makeRequest } from '../common';
+import { createAction, Property } from '@activepieces/pieces-framework';
import { pinterestAuth } from '../common/auth';
-import { HttpMethod, getAccessTokenOrThrow } from '@activepieces/pieces-common';
+import { getAccessTokenOrThrow } from '@activepieces/pieces-common';
+import { pinterestOperations } from '../common/operations';
import { adAccountIdDropdown } from '../common/props';
import { findBoardByNameActionOutputSchema } from '../output-schemas';
@@ -15,7 +12,7 @@ export const findBoardByName = createAction({
outputSchema: findBoardByNameActionOutputSchema,
displayName: 'Find Board by Name',
description: "Search for boards by name using Pinterest's search API.",
- audience: 'both',
+ audience: 'human',
aiMetadata: {
description:
"Searches the authenticated account's boards by a text query and returns matching boards. Use to resolve a board name into a board_id before creating Pins or updating a board. Read-only and idempotent; supports pagination via a bookmark token.",
@@ -37,35 +34,9 @@ export const findBoardByName = createAction({
}),
},
async run({ auth, propsValue }) {
- const { query, ad_account_id, bookmark } = propsValue;
-
- const searchParams = new URLSearchParams();
- searchParams.append('query', query);
-
- if (ad_account_id) {
- searchParams.append('ad_account_id', ad_account_id);
- }
-
- if (bookmark) {
- searchParams.append('bookmark', bookmark);
- }
-
- const path = `/search/boards/?${searchParams.toString()}`;
-
- try {
- const response = await makeRequest(
- getAccessTokenOrThrow(auth),
- HttpMethod.GET,
- path
- );
-
- return response;
- } catch (error) {
- throw new Error(
- `Failed to search boards: ${
- error instanceof Error ? error.message : 'Unknown error'
- }`
- );
- }
+ return await pinterestOperations.searchBoards({
+ accessToken: getAccessTokenOrThrow(auth),
+ ...propsValue,
+ });
},
});
diff --git a/packages/pieces/community/pinterest/src/lib/actions/find-pin.ts b/packages/pieces/community/pinterest/src/lib/actions/find-pin.ts
index 4555d7c590e..a5d8c872759 100644
--- a/packages/pieces/community/pinterest/src/lib/actions/find-pin.ts
+++ b/packages/pieces/community/pinterest/src/lib/actions/find-pin.ts
@@ -1,7 +1,7 @@
import { createAction, Property } from '@activepieces/pieces-framework';
-import { isRecord, makeRequest } from '../common';
import { pinterestAuth } from '../common/auth';
-import { HttpMethod, getAccessTokenOrThrow } from '@activepieces/pieces-common';
+import { getAccessTokenOrThrow } from '@activepieces/pieces-common';
+import { pinterestOperations } from '../common/operations';
import { adAccountIdDropdown } from '../common/props';
import { findPinActionOutputSchema } from '../output-schemas';
@@ -12,7 +12,7 @@ export const findPin = createAction({
outputSchema: findPinActionOutputSchema,
displayName: 'Find Pin by Keyword',
description: 'Search for Pins using title, description, or keywords.',
- audience: 'both',
+ audience: 'human',
aiMetadata: {
description:
"Searches the authenticated account's Pins by keywords matched against title, description, or tags (comma-separated pin IDs also work). Use to locate existing Pins or resolve a pin_id before deleting or referencing one. Read-only and idempotent; it returns at most max_results Pins, and the next batch is fetched by passing the returned bookmark back as bookmark.",
@@ -45,143 +45,9 @@ export const findPin = createAction({
}),
},
async run({ auth, propsValue }) {
- const { query, bookmark, ad_account_id, max_results } = propsValue;
- const limit = Math.min(
- 250,
- Math.max(1, Math.floor(max_results ?? DEFAULT_MAX_RESULTS))
- );
- const cursor = decodeCursor(bookmark);
- const accessToken = getAccessTokenOrThrow(auth);
-
- let items: unknown[] = [];
- let pageBookmark: string | null = cursor.bookmark;
- let requestedBookmark: string | null = cursor.bookmark;
- let nextBookmark: string | undefined = undefined;
- let lastPageStart = 0;
- let lastPageSkipped = 0;
-
- for (let page = 0; page < MAX_SEARCH_PAGES; page++) {
- const params = new URLSearchParams();
- params.append('query', query);
- if (pageBookmark !== null) {
- params.append('bookmark', pageBookmark);
- }
- if (ad_account_id) {
- params.append('ad_account_id', ad_account_id);
- }
-
- const response: unknown = await makeRequest(
- accessToken,
- HttpMethod.GET,
- `/search/pins?${params.toString()}`
- );
-
- if (!isRecord(response) || !Array.isArray(response['items'])) {
- throw new Error(
- 'Pinterest returned an unexpected response for the Pin search'
- );
- }
-
- const rawItems: unknown[] = response['items'];
-
- if (page === 0 && cursor.skip > rawItems.length) {
- throw new Error(
- 'Bookmark does not match this search. Start again without a bookmark.'
- );
- }
-
- const skipped = page === 0 ? cursor.skip : 0;
- const responseBookmark = response['bookmark'];
-
- requestedBookmark = pageBookmark;
- lastPageStart = items.length;
- lastPageSkipped = skipped;
- items = [...items, ...rawItems.slice(skipped)];
- nextBookmark =
- typeof responseBookmark === 'string' && responseBookmark.length > 0
- ? responseBookmark
- : undefined;
-
- if (!nextBookmark || items.length >= limit || rawItems.length === 0) {
- break;
- }
- pageBookmark = nextBookmark;
- }
-
- const cutInsidePage = items.length > limit;
- const limitedItems = cutInsidePage ? items.slice(0, limit) : items;
-
- return {
- items: limitedItems,
- bookmark: cutInsidePage
- ? encodeCursor({
- bookmark: requestedBookmark,
- skip: lastPageSkipped + (limit - lastPageStart),
- })
- : nextBookmark,
- total_results: limitedItems.length,
- query_used: query,
- has_more: cutInsidePage || !!nextBookmark,
- };
+ return await pinterestOperations.searchPins({
+ accessToken: getAccessTokenOrThrow(auth),
+ ...propsValue,
+ });
},
});
-
-function encodeCursor({
- bookmark,
- skip,
-}: {
- bookmark: string | null;
- skip: number;
-}): string {
- const payload = JSON.stringify({ b: bookmark, s: skip });
- return `${CURSOR_PREFIX}${Buffer.from(payload, 'utf8').toString('base64url')}`;
-}
-
-function decodeCursor(value: string | undefined): {
- bookmark: string | null;
- skip: number;
-} {
- if (!value) {
- return { bookmark: null, skip: 0 };
- }
-
- if (!value.startsWith(CURSOR_PREFIX)) {
- return { bookmark: value, skip: 0 };
- }
-
- const decoded = parseCursorPayload(value.slice(CURSOR_PREFIX.length));
-
- if (!isRecord(decoded)) {
- throw new Error(INVALID_CURSOR_MESSAGE);
- }
-
- const cursorBookmark = decoded['b'];
- const cursorSkip = decoded['s'];
-
- if (cursorBookmark !== null && typeof cursorBookmark !== 'string') {
- throw new Error(INVALID_CURSOR_MESSAGE);
- }
-
- if (
- typeof cursorSkip !== 'number' ||
- !Number.isInteger(cursorSkip) ||
- cursorSkip < 0
- ) {
- throw new Error(INVALID_CURSOR_MESSAGE);
- }
-
- return { bookmark: cursorBookmark, skip: cursorSkip };
-}
-
-function parseCursorPayload(encoded: string): unknown {
- try {
- return JSON.parse(Buffer.from(encoded, 'base64url').toString('utf8'));
- } catch {
- throw new Error(INVALID_CURSOR_MESSAGE);
- }
-}
-
-const DEFAULT_MAX_RESULTS = 25;
-const MAX_SEARCH_PAGES = 10;
-const CURSOR_PREFIX = 'apc1.';
-const INVALID_CURSOR_MESSAGE = 'Bookmark is not a valid Find Pin bookmark';
diff --git a/packages/pieces/community/pinterest/src/lib/actions/get-board.ts b/packages/pieces/community/pinterest/src/lib/actions/get-board.ts
new file mode 100644
index 00000000000..7b2ee084fee
--- /dev/null
+++ b/packages/pieces/community/pinterest/src/lib/actions/get-board.ts
@@ -0,0 +1,36 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { makeRequest } from '../common';
+import { pinterestAuth } from '../common/auth';
+import { HttpMethod, getAccessTokenOrThrow } from '@activepieces/pieces-common';
+import { getBoardActionOutputSchema } from '../output-schemas';
+
+export const getBoard = createAction({
+ auth: pinterestAuth,
+ name: 'getBoard',
+ classification: 'READ',
+ outputSchema: getBoardActionOutputSchema,
+ displayName: 'Get Board',
+ description: 'Read a single board by its id.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Reads one board by id and returns its name, description, privacy, owner and pin and follower counts. Use it to confirm a board exists and check its privacy before pinning to it; use List Boards or Search Boards when only the name is known. The board id is a numeric string taken from List Boards, Search Boards or a pin record; read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ board_id: Property.ShortText({
+ displayName: 'Board ID',
+ required: true,
+ description: 'Numeric board id, as returned by List Boards.',
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const { board_id } = propsValue;
+
+ return await makeRequest(
+ getAccessTokenOrThrow(auth),
+ HttpMethod.GET,
+ `/boards/${board_id}`
+ );
+ },
+});
diff --git a/packages/pieces/community/pinterest/src/lib/actions/get-pin-analytics.ts b/packages/pieces/community/pinterest/src/lib/actions/get-pin-analytics.ts
new file mode 100644
index 00000000000..fe0fd9f3db9
--- /dev/null
+++ b/packages/pieces/community/pinterest/src/lib/actions/get-pin-analytics.ts
@@ -0,0 +1,74 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { buildPath, makeRequest } from '../common';
+import { pinterestAuth } from '../common/auth';
+import { HttpMethod, getAccessTokenOrThrow } from '@activepieces/pieces-common';
+import { pinAnalyticsActionOutputSchema } from '../output-schemas';
+
+const PIN_METRIC_OPTIONS = [
+ { label: 'Impressions', value: 'IMPRESSION' },
+ { label: 'Outbound Clicks', value: 'OUTBOUND_CLICK' },
+ { label: 'Pin Clicks', value: 'PIN_CLICK' },
+ { label: 'Saves', value: 'SAVE' },
+ { label: 'Save Rate', value: 'SAVE_RATE' },
+ { label: 'Total Comments', value: 'TOTAL_COMMENTS' },
+ { label: 'Total Reactions', value: 'TOTAL_REACTIONS' },
+ { label: 'User Follows', value: 'USER_FOLLOW' },
+ { label: 'Profile Visits', value: 'PROFILE_VISIT' },
+ { label: 'Video Views (MRC)', value: 'VIDEO_MRC_VIEW' },
+ { label: 'Video 10s Views', value: 'VIDEO_10S_VIEW' },
+ { label: '95% Quartile Views', value: 'QUARTILE_95_PERCENT_VIEW' },
+ { label: 'Total Play Time', value: 'VIDEO_V50_WATCH_TIME' },
+ { label: 'Video Starts', value: 'VIDEO_START' },
+ { label: 'Average Watch Time', value: 'VIDEO_AVG_WATCH_TIME' },
+];
+
+export const getPinAnalytics = createAction({
+ auth: pinterestAuth,
+ name: 'getPinAnalytics',
+ classification: 'READ',
+ outputSchema: pinAnalyticsActionOutputSchema,
+ displayName: 'Get Pin Analytics',
+ description: 'Read performance metrics for a single Pin.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Reads performance metrics for one Pin over a date range, such as impressions, saves, outbound clicks and video views. Use it to judge how a specific Pin performed; use Get Account Analytics for the whole profile and Get Top Pins for a ranked comparison. Start date, end date and at least one metric are all required, dates use YYYY-MM-DD, the range cannot start more than 90 days ago or span more than 90 days, and video metrics return zero on image Pins. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ pin_id: Property.ShortText({
+ displayName: 'Pin ID',
+ required: true,
+ description: 'Numeric pin id, as returned by List Pins.',
+ }),
+ start_date: Property.ShortText({
+ displayName: 'Start Date',
+ required: true,
+ description: 'YYYY-MM-DD, at most 90 days ago.',
+ }),
+ end_date: Property.ShortText({
+ displayName: 'End Date',
+ required: true,
+ description: 'YYYY-MM-DD, at most 90 days after the start date.',
+ }),
+ metric_types: Property.StaticMultiSelectDropdown({
+ displayName: 'Metrics',
+ required: true,
+ description: 'One or more metrics to return.',
+ options: { options: PIN_METRIC_OPTIONS },
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const { pin_id, start_date, end_date, metric_types } = propsValue;
+
+ return await makeRequest(
+ getAccessTokenOrThrow(auth),
+ HttpMethod.GET,
+ buildPath(`/pins/${pin_id}/analytics`, {
+ start_date,
+ end_date,
+ metric_types: metric_types.join(','),
+ })
+ );
+ },
+});
diff --git a/packages/pieces/community/pinterest/src/lib/actions/get-pin.ts b/packages/pieces/community/pinterest/src/lib/actions/get-pin.ts
new file mode 100644
index 00000000000..8ac788dbeb5
--- /dev/null
+++ b/packages/pieces/community/pinterest/src/lib/actions/get-pin.ts
@@ -0,0 +1,45 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { buildPath, makeRequest } from '../common';
+import { pinterestAuth } from '../common/auth';
+import { HttpMethod, getAccessTokenOrThrow } from '@activepieces/pieces-common';
+import { getPinActionOutputSchema } from '../output-schemas';
+
+export const getPin = createAction({
+ auth: pinterestAuth,
+ name: 'getPin',
+ classification: 'READ',
+ outputSchema: getPinActionOutputSchema,
+ displayName: 'Get Pin',
+ description: 'Read a single Pin by its id.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Reads one Pin by id and returns its title, description, destination link, alt text, media and the board it lives on. Use it to inspect a Pin before updating or deleting it; use Search Pins or List Pins when only the text or board is known. Enable Include Metrics to add 90-day and lifetime counts, which Pinterest omits by default. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ pin_id: Property.ShortText({
+ displayName: 'Pin ID',
+ required: true,
+ description: 'Numeric pin id, as returned by List Pins or Search Pins.',
+ }),
+ pin_metrics: Property.Checkbox({
+ displayName: 'Include Metrics',
+ required: false,
+ defaultValue: false,
+ description:
+ 'Return 90-day and lifetime metrics alongside the Pin. Total comments and reactions are lifetime-only.',
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const { pin_id, pin_metrics } = propsValue;
+
+ return await makeRequest(
+ getAccessTokenOrThrow(auth),
+ HttpMethod.GET,
+ buildPath(`/pins/${pin_id}`, {
+ pin_metrics: pin_metrics === true ? 'true' : undefined,
+ })
+ );
+ },
+});
diff --git a/packages/pieces/community/pinterest/src/lib/actions/get-top-pins-analytics.ts b/packages/pieces/community/pinterest/src/lib/actions/get-top-pins-analytics.ts
new file mode 100644
index 00000000000..1b7d66ec421
--- /dev/null
+++ b/packages/pieces/community/pinterest/src/lib/actions/get-top-pins-analytics.ts
@@ -0,0 +1,65 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { buildPath, makeRequest } from '../common';
+import { pinterestAuth } from '../common/auth';
+import { HttpMethod, getAccessTokenOrThrow } from '@activepieces/pieces-common';
+import { topPinsAnalyticsActionOutputSchema } from '../output-schemas';
+
+export const getTopPinsAnalytics = createAction({
+ auth: pinterestAuth,
+ name: 'getTopPinsAnalytics',
+ classification: 'READ',
+ outputSchema: topPinsAnalyticsActionOutputSchema,
+ displayName: 'Get Top Pins',
+ description: 'Rank the account Pins by a performance metric.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns the account best-performing Pins over a date range, ranked by the chosen metric. Use it to find what worked without pulling analytics for each Pin one by one; use Get Top Video Pins for video-specific rankings. Start date, end date and the sort metric are all required, dates are YYYY-MM-DD and the range cannot start more than 90 days ago. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ start_date: Property.ShortText({
+ displayName: 'Start Date',
+ required: true,
+ description: 'YYYY-MM-DD, at most 90 days ago.',
+ }),
+ end_date: Property.ShortText({
+ displayName: 'End Date',
+ required: true,
+ description: 'YYYY-MM-DD, at most 90 days after the start date.',
+ }),
+ sort_by: Property.StaticDropdown({
+ displayName: 'Sort By',
+ required: true,
+ description: 'The metric the ranking is based on.',
+ options: {
+ options: [
+ { label: 'Engagement', value: 'ENGAGEMENT' },
+ { label: 'Saves', value: 'SAVE' },
+ { label: 'Impressions', value: 'IMPRESSION' },
+ { label: 'Outbound Clicks', value: 'OUTBOUND_CLICK' },
+ { label: 'Pin Clicks', value: 'PIN_CLICK' },
+ ],
+ },
+ }),
+ num_of_pins: Property.Number({
+ displayName: 'Number of Pins',
+ required: false,
+ description: 'How many Pins to return (1-50, Pinterest defaults to 10).',
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const { start_date, end_date, sort_by, num_of_pins } = propsValue;
+
+ return await makeRequest(
+ getAccessTokenOrThrow(auth),
+ HttpMethod.GET,
+ buildPath('/user_account/analytics/top_pins', {
+ start_date,
+ end_date,
+ sort_by,
+ num_of_pins,
+ })
+ );
+ },
+});
diff --git a/packages/pieces/community/pinterest/src/lib/actions/get-top-video-pins-analytics.ts b/packages/pieces/community/pinterest/src/lib/actions/get-top-video-pins-analytics.ts
new file mode 100644
index 00000000000..6f510db8482
--- /dev/null
+++ b/packages/pieces/community/pinterest/src/lib/actions/get-top-video-pins-analytics.ts
@@ -0,0 +1,69 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { buildPath, makeRequest } from '../common';
+import { pinterestAuth } from '../common/auth';
+import { HttpMethod, getAccessTokenOrThrow } from '@activepieces/pieces-common';
+import { topPinsAnalyticsActionOutputSchema } from '../output-schemas';
+
+export const getTopVideoPinsAnalytics = createAction({
+ auth: pinterestAuth,
+ name: 'getTopVideoPinsAnalytics',
+ classification: 'READ',
+ outputSchema: topPinsAnalyticsActionOutputSchema,
+ displayName: 'Get Top Video Pins',
+ description: 'Rank the account video Pins by a video metric.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns the account best-performing video Pins over a date range, ranked by a video metric such as watch time or 10-second views. Use it for video content specifically; use Get Top Pins for all Pin formats ranked by engagement. Start date, end date and the sort metric are all required, dates are YYYY-MM-DD and the range cannot start more than 90 days ago. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ start_date: Property.ShortText({
+ displayName: 'Start Date',
+ required: true,
+ description: 'YYYY-MM-DD, at most 90 days ago.',
+ }),
+ end_date: Property.ShortText({
+ displayName: 'End Date',
+ required: true,
+ description: 'YYYY-MM-DD, at most 90 days after the start date.',
+ }),
+ sort_by: Property.StaticDropdown({
+ displayName: 'Sort By',
+ required: true,
+ description: 'The video metric the ranking is based on.',
+ options: {
+ options: [
+ { label: 'Saves', value: 'SAVE' },
+ { label: 'Impressions', value: 'IMPRESSION' },
+ { label: 'Outbound Clicks', value: 'OUTBOUND_CLICK' },
+ { label: 'Video Views (MRC)', value: 'VIDEO_MRC_VIEW' },
+ { label: 'Average Watch Time', value: 'VIDEO_AVG_WATCH_TIME' },
+ { label: 'Total Play Time', value: 'VIDEO_V50_WATCH_TIME' },
+ { label: '95% Quartile Views', value: 'QUARTILE_95_PERCENT_VIEW' },
+ { label: 'Video 10s Views', value: 'VIDEO_10S_VIEW' },
+ { label: 'Video Starts', value: 'VIDEO_START' },
+ ],
+ },
+ }),
+ num_of_pins: Property.Number({
+ displayName: 'Number of Pins',
+ required: false,
+ description: 'How many Pins to return (1-50, Pinterest defaults to 10).',
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const { start_date, end_date, sort_by, num_of_pins } = propsValue;
+
+ return await makeRequest(
+ getAccessTokenOrThrow(auth),
+ HttpMethod.GET,
+ buildPath('/user_account/analytics/top_video_pins', {
+ start_date,
+ end_date,
+ sort_by,
+ num_of_pins,
+ })
+ );
+ },
+});
diff --git a/packages/pieces/community/pinterest/src/lib/actions/get-user-account-analytics.ts b/packages/pieces/community/pinterest/src/lib/actions/get-user-account-analytics.ts
new file mode 100644
index 00000000000..12c5da2af11
--- /dev/null
+++ b/packages/pieces/community/pinterest/src/lib/actions/get-user-account-analytics.ts
@@ -0,0 +1,66 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { buildPath, makeRequest } from '../common';
+import { pinterestAuth } from '../common/auth';
+import { HttpMethod, getAccessTokenOrThrow } from '@activepieces/pieces-common';
+import { accountAnalyticsActionOutputSchema } from '../output-schemas';
+
+export const getUserAccountAnalytics = createAction({
+ auth: pinterestAuth,
+ name: 'getUserAccountAnalytics',
+ classification: 'READ',
+ outputSchema: accountAnalyticsActionOutputSchema,
+ displayName: 'Get Account Analytics',
+ description: 'Read performance metrics for the whole account.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Reads profile-wide performance metrics over a date range, such as impressions, engagements, saves and outbound clicks. Use it for an account-level summary; use Get Pin Analytics for one Pin and Get Top Pins for a ranked list. Start and end date are required as YYYY-MM-DD and the range cannot start more than 90 days ago; unlike the Pin endpoint, metrics are optional here and Pinterest returns all of them when none are given. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ start_date: Property.ShortText({
+ displayName: 'Start Date',
+ required: true,
+ description: 'YYYY-MM-DD, at most 90 days ago.',
+ }),
+ end_date: Property.ShortText({
+ displayName: 'End Date',
+ required: true,
+ description: 'YYYY-MM-DD, at most 90 days after the start date.',
+ }),
+ metric_types: Property.StaticMultiSelectDropdown({
+ displayName: 'Metrics',
+ required: false,
+ description: 'Leave empty to return every available metric.',
+ options: {
+ options: [
+ { label: 'Engagement', value: 'ENGAGEMENT' },
+ { label: 'Engagement Rate', value: 'ENGAGEMENT_RATE' },
+ { label: 'Impressions', value: 'IMPRESSION' },
+ { label: 'Outbound Clicks', value: 'OUTBOUND_CLICK' },
+ { label: 'Outbound Click Rate', value: 'OUTBOUND_CLICK_RATE' },
+ { label: 'Pin Clicks', value: 'PIN_CLICK' },
+ { label: 'Pin Click Rate', value: 'PIN_CLICK_RATE' },
+ { label: 'Saves', value: 'SAVE' },
+ { label: 'Save Rate', value: 'SAVE_RATE' },
+ ],
+ },
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const { start_date, end_date, metric_types } = propsValue;
+
+ return await makeRequest(
+ getAccessTokenOrThrow(auth),
+ HttpMethod.GET,
+ buildPath('/user_account/analytics', {
+ start_date,
+ end_date,
+ metric_types:
+ metric_types === undefined || metric_types.length === 0
+ ? undefined
+ : metric_types.join(','),
+ })
+ );
+ },
+});
diff --git a/packages/pieces/community/pinterest/src/lib/actions/get-user-account.ts b/packages/pieces/community/pinterest/src/lib/actions/get-user-account.ts
new file mode 100644
index 00000000000..915118933d3
--- /dev/null
+++ b/packages/pieces/community/pinterest/src/lib/actions/get-user-account.ts
@@ -0,0 +1,28 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { makeRequest } from '../common';
+import { pinterestAuth } from '../common/auth';
+import { HttpMethod, getAccessTokenOrThrow } from '@activepieces/pieces-common';
+import { userAccountActionOutputSchema } from '../output-schemas';
+
+export const getUserAccount = createAction({
+ auth: pinterestAuth,
+ name: 'getUserAccount',
+ classification: 'READ',
+ outputSchema: userAccountActionOutputSchema,
+ displayName: 'Get User Account',
+ description: 'Read the profile of the connected Pinterest account.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Reads the connected account profile: username, account type, display name, website, and pin, board and follower counts. Use it to confirm which account a connection belongs to before writing content, or to report follower totals. Takes no input and never changes anything; read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {},
+ async run({ auth }) {
+ return await makeRequest(
+ getAccessTokenOrThrow(auth),
+ HttpMethod.GET,
+ '/user_account'
+ );
+ },
+});
diff --git a/packages/pieces/community/pinterest/src/lib/actions/list-board-sections.ts b/packages/pieces/community/pinterest/src/lib/actions/list-board-sections.ts
new file mode 100644
index 00000000000..ba4ca02062c
--- /dev/null
+++ b/packages/pieces/community/pinterest/src/lib/actions/list-board-sections.ts
@@ -0,0 +1,49 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { buildPath, makeRequest, paginatedResult } from '../common';
+import { pinterestAuth } from '../common/auth';
+import { HttpMethod, getAccessTokenOrThrow } from '@activepieces/pieces-common';
+import { listBoardSectionsActionOutputSchema } from '../output-schemas';
+
+export const listBoardSections = createAction({
+ auth: pinterestAuth,
+ name: 'listBoardSections',
+ classification: 'READ',
+ outputSchema: listBoardSectionsActionOutputSchema,
+ displayName: 'List Board Sections',
+ description: 'List the sections of a board.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Lists the sections of one board, returning each section id and name. Use it to resolve a section name into the board_section_id that Create Pin and List Pins on Board Section take. A section id is only meaningful together with its board id, so always carry both; results page through an opaque bookmark cursor. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ board_id: Property.ShortText({
+ displayName: 'Board ID',
+ required: true,
+ description: 'Numeric board id, as returned by List Boards.',
+ }),
+ page_size: Property.Number({
+ displayName: 'Page Size',
+ required: false,
+ description: 'Sections per page (1-250, Pinterest defaults to 25).',
+ }),
+ bookmark: Property.ShortText({
+ displayName: 'Bookmark',
+ required: false,
+ description:
+ 'Opaque cursor returned by a previous call; omit to read the first page.',
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const { board_id, page_size, bookmark } = propsValue;
+
+ const response = await makeRequest(
+ getAccessTokenOrThrow(auth),
+ HttpMethod.GET,
+ buildPath(`/boards/${board_id}/sections`, { page_size, bookmark })
+ );
+
+ return paginatedResult(response);
+ },
+});
diff --git a/packages/pieces/community/pinterest/src/lib/actions/list-boards.ts b/packages/pieces/community/pinterest/src/lib/actions/list-boards.ts
new file mode 100644
index 00000000000..f1aa80b218e
--- /dev/null
+++ b/packages/pieces/community/pinterest/src/lib/actions/list-boards.ts
@@ -0,0 +1,63 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { buildPath, makeRequest, paginatedResult } from '../common';
+import { pinterestAuth } from '../common/auth';
+import { HttpMethod, getAccessTokenOrThrow } from '@activepieces/pieces-common';
+import { listBoardsActionOutputSchema } from '../output-schemas';
+
+export const listBoards = createAction({
+ auth: pinterestAuth,
+ name: 'listBoards',
+ classification: 'READ',
+ outputSchema: listBoardsActionOutputSchema,
+ displayName: 'List Boards',
+ description: 'List the boards owned by the connected Pinterest account.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Lists the boards the connected account owns or collaborates on, returning each board id alongside its name, privacy and pin count. Use this to resolve a board name into the board_id that every pin and section action needs; prefer Search Boards when the account has many boards and part of the name is known. Results page through an opaque bookmark cursor, so pass the returned bookmark back in for the next page; read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ privacy: Property.StaticDropdown({
+ displayName: 'Privacy',
+ required: false,
+ description:
+ 'Return only boards with this privacy setting. Omit to return all of them.',
+ options: {
+ options: [
+ { label: 'All', value: 'ALL' },
+ { label: 'Public', value: 'PUBLIC' },
+ { label: 'Protected', value: 'PROTECTED' },
+ { label: 'Secret', value: 'SECRET' },
+ { label: 'Public and Secret', value: 'PUBLIC_AND_SECRET' },
+ ],
+ },
+ }),
+ page_size: Property.Number({
+ displayName: 'Page Size',
+ required: false,
+ description: 'Boards per page (1-250, Pinterest defaults to 25).',
+ }),
+ bookmark: Property.ShortText({
+ displayName: 'Bookmark',
+ required: false,
+ description:
+ 'Opaque cursor returned by a previous call; omit to read the first page.',
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const { privacy, page_size, bookmark } = propsValue;
+
+ const response = await makeRequest(
+ getAccessTokenOrThrow(auth),
+ HttpMethod.GET,
+ buildPath('/boards', {
+ privacy: privacy === 'ALL' ? undefined : privacy,
+ page_size,
+ bookmark,
+ })
+ );
+
+ return paginatedResult(response);
+ },
+});
diff --git a/packages/pieces/community/pinterest/src/lib/actions/list-followed-boards.ts b/packages/pieces/community/pinterest/src/lib/actions/list-followed-boards.ts
new file mode 100644
index 00000000000..123f314b7c6
--- /dev/null
+++ b/packages/pieces/community/pinterest/src/lib/actions/list-followed-boards.ts
@@ -0,0 +1,44 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { buildPath, makeRequest, paginatedResult } from '../common';
+import { pinterestAuth } from '../common/auth';
+import { HttpMethod, getAccessTokenOrThrow } from '@activepieces/pieces-common';
+import { listBoardsActionOutputSchema } from '../output-schemas';
+
+export const listFollowedBoards = createAction({
+ auth: pinterestAuth,
+ name: 'listFollowedBoards',
+ classification: 'READ',
+ outputSchema: listBoardsActionOutputSchema,
+ displayName: 'List Followed Boards',
+ description: 'List the boards the connected account follows.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Lists boards owned by other accounts that the connected account follows. Use it to see which boards feed this account; use List Boards for the boards the account itself owns, which is what pin actions need. Pages through an opaque bookmark cursor. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ page_size: Property.Number({
+ displayName: 'Page Size',
+ required: false,
+ description: 'Boards per page (1-250, Pinterest defaults to 25).',
+ }),
+ bookmark: Property.ShortText({
+ displayName: 'Bookmark',
+ required: false,
+ description:
+ 'Opaque cursor returned by a previous call; omit to read the first page.',
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const { page_size, bookmark } = propsValue;
+
+ const response = await makeRequest(
+ getAccessTokenOrThrow(auth),
+ HttpMethod.GET,
+ buildPath('/user_account/following/boards', { page_size, bookmark })
+ );
+
+ return paginatedResult(response);
+ },
+});
diff --git a/packages/pieces/community/pinterest/src/lib/actions/list-followers.ts b/packages/pieces/community/pinterest/src/lib/actions/list-followers.ts
new file mode 100644
index 00000000000..b6bbddd4f89
--- /dev/null
+++ b/packages/pieces/community/pinterest/src/lib/actions/list-followers.ts
@@ -0,0 +1,44 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { buildPath, makeRequest, paginatedResult } from '../common';
+import { pinterestAuth } from '../common/auth';
+import { HttpMethod, getAccessTokenOrThrow } from '@activepieces/pieces-common';
+import { listUserSummariesActionOutputSchema } from '../output-schemas';
+
+export const listFollowers = createAction({
+ auth: pinterestAuth,
+ name: 'listFollowers',
+ classification: 'READ',
+ outputSchema: listUserSummariesActionOutputSchema,
+ displayName: 'List Followers',
+ description: 'List the accounts following the connected account.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Lists the accounts that follow the connected account, newest first. Pinterest returns only a username and account type per follower, so use Get User Account for richer profile data. Use List Following for the accounts this account follows instead. Pages through an opaque bookmark cursor, so a large audience needs several calls. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ page_size: Property.Number({
+ displayName: 'Page Size',
+ required: false,
+ description: 'Followers per page (1-250, Pinterest defaults to 25).',
+ }),
+ bookmark: Property.ShortText({
+ displayName: 'Bookmark',
+ required: false,
+ description:
+ 'Opaque cursor returned by a previous call; omit to read the first page.',
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const { page_size, bookmark } = propsValue;
+
+ const response = await makeRequest(
+ getAccessTokenOrThrow(auth),
+ HttpMethod.GET,
+ buildPath('/user_account/followers', { page_size, bookmark })
+ );
+
+ return paginatedResult(response);
+ },
+});
diff --git a/packages/pieces/community/pinterest/src/lib/actions/list-following.ts b/packages/pieces/community/pinterest/src/lib/actions/list-following.ts
new file mode 100644
index 00000000000..e39638a6ee6
--- /dev/null
+++ b/packages/pieces/community/pinterest/src/lib/actions/list-following.ts
@@ -0,0 +1,58 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { buildPath, makeRequest, paginatedResult } from '../common';
+import { pinterestAuth } from '../common/auth';
+import { HttpMethod, getAccessTokenOrThrow } from '@activepieces/pieces-common';
+import { listUserSummariesActionOutputSchema } from '../output-schemas';
+
+export const listFollowing = createAction({
+ auth: pinterestAuth,
+ name: 'listFollowing',
+ classification: 'READ',
+ outputSchema: listUserSummariesActionOutputSchema,
+ displayName: 'List Following',
+ description: 'List the accounts the connected account follows.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Lists the accounts the connected account follows, returning each username with its follower count. Use it to check whether the account already follows someone; use List Followers for the other direction and List Followed Boards for boards rather than people. Pages through an opaque bookmark cursor. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ feed_type: Property.StaticDropdown({
+ displayName: 'Feed Type',
+ required: false,
+ description:
+ 'Which followees to keep. Pinterest defaults to all of them.',
+ options: {
+ options: [
+ { label: 'All', value: 'ALL' },
+ { label: 'Ranked', value: 'RANKED' },
+ { label: 'Creators Only', value: 'CREATOR_ONLY' },
+ { label: 'Ranked Creators Only', value: 'RANKED_CREATOR_ONLY' },
+ ],
+ },
+ }),
+ page_size: Property.Number({
+ displayName: 'Page Size',
+ required: false,
+ description: 'Accounts per page (1-250, Pinterest defaults to 25).',
+ }),
+ bookmark: Property.ShortText({
+ displayName: 'Bookmark',
+ required: false,
+ description:
+ 'Opaque cursor returned by a previous call; omit to read the first page.',
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const { feed_type, page_size, bookmark } = propsValue;
+
+ const response = await makeRequest(
+ getAccessTokenOrThrow(auth),
+ HttpMethod.GET,
+ buildPath('/user_account/following', { feed_type, page_size, bookmark })
+ );
+
+ return paginatedResult(response);
+ },
+});
diff --git a/packages/pieces/community/pinterest/src/lib/actions/list-linked-businesses.ts b/packages/pieces/community/pinterest/src/lib/actions/list-linked-businesses.ts
new file mode 100644
index 00000000000..5fad9bfb453
--- /dev/null
+++ b/packages/pieces/community/pinterest/src/lib/actions/list-linked-businesses.ts
@@ -0,0 +1,31 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { makeRequest } from '../common';
+import { pinterestAuth } from '../common/auth';
+import { HttpMethod, getAccessTokenOrThrow } from '@activepieces/pieces-common';
+import { listLinkedBusinessesActionOutputSchema } from '../output-schemas';
+
+export const listLinkedBusinesses = createAction({
+ auth: pinterestAuth,
+ name: 'listLinkedBusinesses',
+ classification: 'READ',
+ outputSchema: listLinkedBusinessesActionOutputSchema,
+ displayName: 'List Linked Businesses',
+ description: 'List the business accounts linked to the connected account.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Lists the business accounts linked to the connected account, returning each business id and username. Use it when an action needs to operate on behalf of a linked business rather than the personal account. Takes no input; read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {},
+ async run({ auth }) {
+ const response = await makeRequest(
+ getAccessTokenOrThrow(auth),
+ HttpMethod.GET,
+ '/user_account/businesses'
+ );
+
+ const items = Array.isArray(response) ? response : [];
+ return { items, count: items.length };
+ },
+});
diff --git a/packages/pieces/community/pinterest/src/lib/actions/list-pin-product-tags.ts b/packages/pieces/community/pinterest/src/lib/actions/list-pin-product-tags.ts
new file mode 100644
index 00000000000..9657f2f9588
--- /dev/null
+++ b/packages/pieces/community/pinterest/src/lib/actions/list-pin-product-tags.ts
@@ -0,0 +1,39 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { makeRequest } from '../common';
+import { pinterestAuth } from '../common/auth';
+import { HttpMethod, getAccessTokenOrThrow } from '@activepieces/pieces-common';
+import { listPinProductTagsActionOutputSchema } from '../output-schemas';
+
+export const listPinProductTags = createAction({
+ auth: pinterestAuth,
+ name: 'listPinProductTags',
+ classification: 'READ',
+ outputSchema: listPinProductTagsActionOutputSchema,
+ displayName: 'List Pin Product Tags',
+ description: 'List the product tags attached to a Pin.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Lists the product tags attached to one Pin, returning each tagged product with its id and position on the image. Use it to check what a shoppable Pin currently links to before editing it. Requires a numeric pin id from List Pins, and returns an empty list for Pins with no tags rather than failing. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ pin_id: Property.ShortText({
+ displayName: 'Pin ID',
+ required: true,
+ description: 'Numeric pin id, as returned by List Pins.',
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const { pin_id } = propsValue;
+
+ const response = await makeRequest(
+ getAccessTokenOrThrow(auth),
+ HttpMethod.GET,
+ `/pins/${pin_id}/product_tags`
+ );
+
+ const items = response.product_tags ?? [];
+ return { items, count: items.length };
+ },
+});
diff --git a/packages/pieces/community/pinterest/src/lib/actions/list-pins-on-board-section.ts b/packages/pieces/community/pinterest/src/lib/actions/list-pins-on-board-section.ts
new file mode 100644
index 00000000000..3b4aad05d9e
--- /dev/null
+++ b/packages/pieces/community/pinterest/src/lib/actions/list-pins-on-board-section.ts
@@ -0,0 +1,58 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { buildPath, makeRequest, paginatedResult } from '../common';
+import { pinterestAuth } from '../common/auth';
+import { HttpMethod, getAccessTokenOrThrow } from '@activepieces/pieces-common';
+import { listPinsOnBoardActionOutputSchema } from '../output-schemas';
+
+export const listPinsOnBoardSection = createAction({
+ auth: pinterestAuth,
+ name: 'listPinsOnBoardSection',
+ classification: 'READ',
+ outputSchema: listPinsOnBoardActionOutputSchema,
+ displayName: 'List Pins on Board Section',
+ description: 'List the Pins saved in one section of a board.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Lists the Pins inside a single section of a board. Use it when Pins are grouped into sections and only one group is wanted; use List Pins on Board for the whole board, including Pins that sit in no section. Requires both the board id and the section id from List Board Sections and pages through an opaque bookmark cursor; read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ board_id: Property.ShortText({
+ displayName: 'Board ID',
+ required: true,
+ description: 'Numeric board id, as returned by List Boards.',
+ }),
+ section_id: Property.ShortText({
+ displayName: 'Section ID',
+ required: true,
+ description:
+ 'Numeric section id, as returned by List Board Sections for this board.',
+ }),
+ page_size: Property.Number({
+ displayName: 'Page Size',
+ required: false,
+ description: 'Pins per page (1-250, Pinterest defaults to 25).',
+ }),
+ bookmark: Property.ShortText({
+ displayName: 'Bookmark',
+ required: false,
+ description:
+ 'Opaque cursor returned by a previous call; omit to read the first page.',
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const { board_id, section_id, page_size, bookmark } = propsValue;
+
+ const response = await makeRequest(
+ getAccessTokenOrThrow(auth),
+ HttpMethod.GET,
+ buildPath(`/boards/${board_id}/sections/${section_id}/pins`, {
+ page_size,
+ bookmark,
+ })
+ );
+
+ return paginatedResult(response);
+ },
+});
diff --git a/packages/pieces/community/pinterest/src/lib/actions/list-pins-on-board.ts b/packages/pieces/community/pinterest/src/lib/actions/list-pins-on-board.ts
new file mode 100644
index 00000000000..7963a38669b
--- /dev/null
+++ b/packages/pieces/community/pinterest/src/lib/actions/list-pins-on-board.ts
@@ -0,0 +1,49 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { buildPath, makeRequest, paginatedResult } from '../common';
+import { pinterestAuth } from '../common/auth';
+import { HttpMethod, getAccessTokenOrThrow } from '@activepieces/pieces-common';
+import { listPinsOnBoardActionOutputSchema } from '../output-schemas';
+
+export const listPinsOnBoard = createAction({
+ auth: pinterestAuth,
+ name: 'listPinsOnBoard',
+ classification: 'READ',
+ outputSchema: listPinsOnBoardActionOutputSchema,
+ displayName: 'List Pins on Board',
+ description: 'List the Pins saved on a board.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Lists the Pins saved on one board, returning each pin id with its title, description, link and media. Use it to audit or pick a Pin from a known board; use List Pins for every Pin on the account regardless of board, and List Pins on Board Section to narrow to a single section. Requires a numeric board id from List Boards and pages through an opaque bookmark cursor; read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ board_id: Property.ShortText({
+ displayName: 'Board ID',
+ required: true,
+ description: 'Numeric board id, as returned by List Boards.',
+ }),
+ page_size: Property.Number({
+ displayName: 'Page Size',
+ required: false,
+ description: 'Pins per page (1-250, Pinterest defaults to 25).',
+ }),
+ bookmark: Property.ShortText({
+ displayName: 'Bookmark',
+ required: false,
+ description:
+ 'Opaque cursor returned by a previous call; omit to read the first page.',
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const { board_id, page_size, bookmark } = propsValue;
+
+ const response = await makeRequest(
+ getAccessTokenOrThrow(auth),
+ HttpMethod.GET,
+ buildPath(`/boards/${board_id}/pins`, { page_size, bookmark })
+ );
+
+ return paginatedResult(response);
+ },
+});
diff --git a/packages/pieces/community/pinterest/src/lib/actions/list-pins.ts b/packages/pieces/community/pinterest/src/lib/actions/list-pins.ts
new file mode 100644
index 00000000000..e0754178540
--- /dev/null
+++ b/packages/pieces/community/pinterest/src/lib/actions/list-pins.ts
@@ -0,0 +1,56 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { buildPath, makeRequest, paginatedResult } from '../common';
+import { pinterestAuth } from '../common/auth';
+import { HttpMethod, getAccessTokenOrThrow } from '@activepieces/pieces-common';
+import { listPinsActionOutputSchema } from '../output-schemas';
+
+export const listPins = createAction({
+ auth: pinterestAuth,
+ name: 'listPins',
+ classification: 'READ',
+ outputSchema: listPinsActionOutputSchema,
+ displayName: 'List Pins',
+ description: 'List the Pins owned by the connected Pinterest account.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Lists the Pins the connected account owns across every board, newest first, returning each pin id with its title, link, board and media. Use it to survey recent content or find a pin id; use List Pins on Board when the board is already known, and Search Pins to match on text. Pages through an opaque bookmark cursor; read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ pin_filter: Property.StaticDropdown({
+ displayName: 'Pin Filter',
+ required: false,
+ description: 'Restrict the results to a subset of the account Pins.',
+ options: {
+ options: [
+ { label: 'Exclude Native Pins', value: 'exclude_native' },
+ { label: 'Exclude Repins', value: 'exclude_repins' },
+ { label: 'Has Been Promoted', value: 'has_been_promoted' },
+ ],
+ },
+ }),
+ page_size: Property.Number({
+ displayName: 'Page Size',
+ required: false,
+ description: 'Pins per page (1-250, Pinterest defaults to 25).',
+ }),
+ bookmark: Property.ShortText({
+ displayName: 'Bookmark',
+ required: false,
+ description:
+ 'Opaque cursor returned by a previous call; omit to read the first page.',
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const { pin_filter, page_size, bookmark } = propsValue;
+
+ const response = await makeRequest(
+ getAccessTokenOrThrow(auth),
+ HttpMethod.GET,
+ buildPath('/pins', { pin_filter, page_size, bookmark })
+ );
+
+ return paginatedResult(response);
+ },
+});
diff --git a/packages/pieces/community/pinterest/src/lib/actions/list-verified-websites.ts b/packages/pieces/community/pinterest/src/lib/actions/list-verified-websites.ts
new file mode 100644
index 00000000000..ab0ca770fd4
--- /dev/null
+++ b/packages/pieces/community/pinterest/src/lib/actions/list-verified-websites.ts
@@ -0,0 +1,44 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { buildPath, makeRequest, paginatedResult } from '../common';
+import { pinterestAuth } from '../common/auth';
+import { HttpMethod, getAccessTokenOrThrow } from '@activepieces/pieces-common';
+import { listVerifiedWebsitesActionOutputSchema } from '../output-schemas';
+
+export const listVerifiedWebsites = createAction({
+ auth: pinterestAuth,
+ name: 'listVerifiedWebsites',
+ classification: 'READ',
+ outputSchema: listVerifiedWebsitesActionOutputSchema,
+ displayName: 'List Verified Websites',
+ description: 'List the websites claimed by the connected account.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Lists the websites the connected account has claimed, with the verification status and method for each. Use it to check whether a domain is claimed before publishing Pins that link to it, since claimed domains attribute traffic back to the account. Read-only and idempotent; claiming a new website needs a scope this connection does not hold.',
+ idempotent: true,
+ },
+ props: {
+ page_size: Property.Number({
+ displayName: 'Page Size',
+ required: false,
+ description: 'Websites per page (1-250, Pinterest defaults to 25).',
+ }),
+ bookmark: Property.ShortText({
+ displayName: 'Bookmark',
+ required: false,
+ description:
+ 'Opaque cursor returned by a previous call; omit to read the first page.',
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const { page_size, bookmark } = propsValue;
+
+ const response = await makeRequest(
+ getAccessTokenOrThrow(auth),
+ HttpMethod.GET,
+ buildPath('/user_account/websites', { page_size, bookmark })
+ );
+
+ return paginatedResult(response);
+ },
+});
diff --git a/packages/pieces/community/pinterest/src/lib/actions/rename-board-section.ts b/packages/pieces/community/pinterest/src/lib/actions/rename-board-section.ts
new file mode 100644
index 00000000000..6803966f45e
--- /dev/null
+++ b/packages/pieces/community/pinterest/src/lib/actions/rename-board-section.ts
@@ -0,0 +1,48 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { makeRequest } from '../common';
+import { pinterestAuth } from '../common/auth';
+import { HttpMethod, getAccessTokenOrThrow } from '@activepieces/pieces-common';
+import { boardSectionActionOutputSchema } from '../output-schemas';
+
+export const renameBoardSection = createAction({
+ auth: pinterestAuth,
+ name: 'renameBoardSection',
+ classification: 'WRITE',
+ outputSchema: boardSectionActionOutputSchema,
+ displayName: 'Rename Board Section',
+ description: 'Change the name of a board section.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Renames an existing board section. The name is the only field Pinterest allows to be changed on a section, so this is a rename rather than a general update, and it moves no Pins. Requires both the board id and the section id from List Board Sections; sending the same name again converges on the same state, so it is idempotent.',
+ idempotent: true,
+ },
+ props: {
+ board_id: Property.ShortText({
+ displayName: 'Board ID',
+ required: true,
+ description: 'Numeric board id, as returned by List Boards.',
+ }),
+ section_id: Property.ShortText({
+ displayName: 'Section ID',
+ required: true,
+ description:
+ 'Numeric section id, as returned by List Board Sections for this board.',
+ }),
+ name: Property.ShortText({
+ displayName: 'Section Name',
+ required: true,
+ description: 'The new name for the section.',
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const { board_id, section_id, name } = propsValue;
+
+ return await makeRequest(
+ getAccessTokenOrThrow(auth),
+ HttpMethod.PATCH,
+ `/boards/${board_id}/sections/${section_id}`,
+ { name }
+ );
+ },
+});
diff --git a/packages/pieces/community/pinterest/src/lib/actions/save-pin.ts b/packages/pieces/community/pinterest/src/lib/actions/save-pin.ts
new file mode 100644
index 00000000000..1f1a107c047
--- /dev/null
+++ b/packages/pieces/community/pinterest/src/lib/actions/save-pin.ts
@@ -0,0 +1,52 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { makeRequest } from '../common';
+import { pinterestAuth } from '../common/auth';
+import { HttpMethod, getAccessTokenOrThrow } from '@activepieces/pieces-common';
+import { getPinActionOutputSchema } from '../output-schemas';
+
+export const savePin = createAction({
+ auth: pinterestAuth,
+ name: 'savePin',
+ classification: 'WRITE',
+ outputSchema: getPinActionOutputSchema,
+ displayName: 'Save Pin',
+ description: 'Save an existing Pin onto a board owned by the account.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Saves an existing Pin, including any public Pin created by someone else, onto a board the connected account owns. Use this to repin curated content; use Create Pin instead to publish new media the account owns. Requires the source pin id and the destination board id, and optionally a section on that board. Saving the same Pin again creates another copy, so it is not idempotent.',
+ idempotent: false,
+ },
+ props: {
+ pin_id: Property.ShortText({
+ displayName: 'Pin ID',
+ required: true,
+ description: 'Numeric id of the Pin to save.',
+ }),
+ board_id: Property.ShortText({
+ displayName: 'Destination Board ID',
+ required: true,
+ description:
+ 'Numeric board id to save the Pin onto, as returned by List Boards.',
+ }),
+ board_section_id: Property.ShortText({
+ displayName: 'Destination Section ID',
+ required: false,
+ description:
+ 'Optional section on that board, as returned by List Board Sections.',
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const { pin_id, board_id, board_section_id } = propsValue;
+
+ return await makeRequest(
+ getAccessTokenOrThrow(auth),
+ HttpMethod.POST,
+ `/pins/${pin_id}/save`,
+ {
+ board_id,
+ ...(board_section_id === undefined ? {} : { board_section_id }),
+ }
+ );
+ },
+});
diff --git a/packages/pieces/community/pinterest/src/lib/actions/search-boards.ts b/packages/pieces/community/pinterest/src/lib/actions/search-boards.ts
new file mode 100644
index 00000000000..23f91848a9f
--- /dev/null
+++ b/packages/pieces/community/pinterest/src/lib/actions/search-boards.ts
@@ -0,0 +1,40 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { pinterestAuth } from '../common/auth';
+import { getAccessTokenOrThrow } from '@activepieces/pieces-common';
+import { pinterestOperations } from '../common/operations';
+import { findBoardByNameActionOutputSchema } from '../output-schemas';
+
+export const searchBoards = createAction({
+ auth: pinterestAuth,
+ name: 'searchBoards',
+ classification: 'SEARCH',
+ outputSchema: findBoardByNameActionOutputSchema,
+ displayName: 'Search Boards',
+ description: "Search the account's boards by text.",
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ "Searches the connected account's own boards by a text query and returns the matches with their board ids. Use it to resolve a board name into the board_id that pin and section actions need; use List Boards when the account has few boards and the whole set is wanted. The query matches board names and descriptions, only searches boards this account can see, and pages through an opaque bookmark cursor. Read-only and idempotent.",
+ idempotent: true,
+ },
+ props: {
+ query: Property.ShortText({
+ displayName: 'Search Query',
+ required: true,
+ description: 'Text to match against board names and descriptions.',
+ }),
+ bookmark: Property.ShortText({
+ displayName: 'Bookmark',
+ required: false,
+ description:
+ 'Opaque cursor returned by a previous call; omit to read the first page.',
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await pinterestOperations.searchBoards({
+ accessToken: getAccessTokenOrThrow(auth),
+ query: propsValue.query,
+ bookmark: propsValue.bookmark,
+ });
+ },
+});
diff --git a/packages/pieces/community/pinterest/src/lib/actions/search-pins.ts b/packages/pieces/community/pinterest/src/lib/actions/search-pins.ts
new file mode 100644
index 00000000000..2fbcc170aec
--- /dev/null
+++ b/packages/pieces/community/pinterest/src/lib/actions/search-pins.ts
@@ -0,0 +1,48 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { pinterestAuth } from '../common/auth';
+import { getAccessTokenOrThrow } from '@activepieces/pieces-common';
+import { pinterestOperations } from '../common/operations';
+import { findPinActionOutputSchema } from '../output-schemas';
+
+export const searchPins = createAction({
+ auth: pinterestAuth,
+ name: 'searchPins',
+ classification: 'SEARCH',
+ outputSchema: findPinActionOutputSchema,
+ displayName: 'Search Pins',
+ description: "Search the account's Pins by text.",
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ "Searches the connected account's own Pins by text matched against titles, descriptions and tags, and returns the matches with their pin ids. Use it to resolve a Pin before reading, updating or deleting it; use List Pins on Board when the board is known. Only this account's Pins are searched, and paging uses an opaque bookmark cursor rather than a page size. Read-only and idempotent.",
+ idempotent: true,
+ },
+ props: {
+ query: Property.ShortText({
+ displayName: 'Search Query',
+ required: true,
+ description:
+ 'Text to match against Pin titles, descriptions and tags. Comma-separated pin ids also work.',
+ }),
+ bookmark: Property.ShortText({
+ displayName: 'Bookmark',
+ required: false,
+ description:
+ 'Opaque cursor returned by a previous call; omit to read the first page.',
+ }),
+ max_results: Property.Number({
+ displayName: 'Maximum Results',
+ required: false,
+ description:
+ 'Return at most this many Pins, 1 to 250. Pinterest has no page-size parameter for Pin search, so further pages are followed until the count is reached.',
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await pinterestOperations.searchPins({
+ accessToken: getAccessTokenOrThrow(auth),
+ query: propsValue.query,
+ bookmark: propsValue.bookmark,
+ max_results: propsValue.max_results,
+ });
+ },
+});
diff --git a/packages/pieces/community/pinterest/src/lib/actions/update-board-details.ts b/packages/pieces/community/pinterest/src/lib/actions/update-board-details.ts
new file mode 100644
index 00000000000..6ff9e841bab
--- /dev/null
+++ b/packages/pieces/community/pinterest/src/lib/actions/update-board-details.ts
@@ -0,0 +1,56 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { pinterestAuth } from '../common/auth';
+import { getAccessTokenOrThrow } from '@activepieces/pieces-common';
+import { pinterestOperations } from '../common/operations';
+import { updateBoardActionOutputSchema } from '../output-schemas';
+
+export const updateBoardDetails = createAction({
+ auth: pinterestAuth,
+ name: 'updateBoardDetails',
+ classification: 'WRITE',
+ outputSchema: updateBoardActionOutputSchema,
+ displayName: 'Update Board Details',
+ description: 'Change the name, description or privacy of a board.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Updates a board in place: its name, description or privacy setting. Anything left unset keeps its current value, so one field can be corrected without resending the rest, and at least one field must be supplied. Use Rename Board Section for a section rather than a board. Re-sending the same values converges on the same state, so it is idempotent.',
+ idempotent: true,
+ },
+ props: {
+ board_id: Property.ShortText({
+ displayName: 'Board ID',
+ required: true,
+ description: 'Numeric board id, as returned by List Boards.',
+ }),
+ name: Property.ShortText({
+ displayName: 'Board Name',
+ required: false,
+ description: 'New name (max 180 characters). Leave empty to keep it.',
+ }),
+ description: Property.LongText({
+ displayName: 'Description',
+ required: false,
+ description:
+ 'New description (max 500 characters). Leave empty to keep it.',
+ }),
+ privacy: Property.StaticDropdown({
+ displayName: 'Privacy',
+ required: false,
+ description:
+ 'New privacy setting. Leave empty to keep it. A board cannot be switched to secret through this connection.',
+ options: {
+ options: [
+ { label: 'Public', value: 'PUBLIC' },
+ { label: 'Protected', value: 'PROTECTED' },
+ ],
+ },
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await pinterestOperations.updateBoard({
+ accessToken: getAccessTokenOrThrow(auth),
+ ...propsValue,
+ });
+ },
+});
diff --git a/packages/pieces/community/pinterest/src/lib/actions/update-board.ts b/packages/pieces/community/pinterest/src/lib/actions/update-board.ts
index e11285bcf85..d2f3b428474 100644
--- a/packages/pieces/community/pinterest/src/lib/actions/update-board.ts
+++ b/packages/pieces/community/pinterest/src/lib/actions/update-board.ts
@@ -1,7 +1,7 @@
import { createAction, Property } from '@activepieces/pieces-framework';
-import { makeRequest } from '../common';
import { pinterestAuth } from '../common/auth';
-import { HttpMethod, getAccessTokenOrThrow } from '@activepieces/pieces-common';
+import { getAccessTokenOrThrow } from '@activepieces/pieces-common';
+import { pinterestOperations } from '../common/operations';
import { adAccountIdDropdown, boardIdDropdown } from '../common/props';
import { updateBoardActionOutputSchema } from '../output-schemas';
@@ -12,7 +12,7 @@ export const updateBoard = createAction({
outputSchema: updateBoardActionOutputSchema,
displayName: 'Update Board',
description: "Update a board's name, description, or privacy settings.",
- audience: 'both',
+ audience: 'human',
aiMetadata: {
description:
"Updates an existing board's name, description, and/or privacy setting, identified by board_id. Use to rename or reconfigure a board the user owns; at least one field must be supplied. Mutates the board on each call, so it is not idempotent.",
@@ -54,56 +54,9 @@ export const updateBoard = createAction({
}),
},
async run({ auth, propsValue }) {
- const { board_id, name, description, privacy, ad_account_id } = propsValue;
-
- const trimmedName = name?.trim();
- const trimmedDescription = description?.trim();
-
- if (!trimmedName && !trimmedDescription && !privacy) {
- throw new Error(
- 'At least one field (name, description, or privacy) must be provided to update the board.'
- );
- }
-
- if (name && name.length > 180) {
- throw new Error('Board name must be 180 characters or less');
- }
-
- if (description && description.length > 500) {
- throw new Error('Board description must be 500 characters or less');
- }
-
- const body: any = {};
- if (trimmedName) {
- body.name = trimmedName;
- }
- if (trimmedDescription) {
- body.description = trimmedDescription;
- }
- if (privacy) {
- body.privacy = privacy;
- }
-
- let path = `/boards/${board_id}`;
- if (ad_account_id) {
- path = `/boards/${board_id}?ad_account_id=${encodeURIComponent(
- ad_account_id
- )}`;
- }
-
- try {
- return await makeRequest(
- getAccessTokenOrThrow(auth),
- HttpMethod.PATCH,
- path,
- body
- );
- } catch (error) {
- throw new Error(
- `Failed to update board: ${
- error instanceof Error ? error.message : 'Unknown error'
- }`
- );
- }
+ return await pinterestOperations.updateBoard({
+ accessToken: getAccessTokenOrThrow(auth),
+ ...propsValue,
+ });
},
});
diff --git a/packages/pieces/community/pinterest/src/lib/common/index.ts b/packages/pieces/community/pinterest/src/lib/common/index.ts
index 7db185cdd31..f2e91948f02 100644
--- a/packages/pieces/community/pinterest/src/lib/common/index.ts
+++ b/packages/pieces/community/pinterest/src/lib/common/index.ts
@@ -103,6 +103,32 @@ export async function makeRequest(
}
}
+export function buildPath(
+ basePath: string,
+ params: Record<string, string | number | undefined>
+) {
+ const search = new URLSearchParams();
+ for (const [key, value] of Object.entries(params)) {
+ if (value !== undefined && value !== '') {
+ search.append(key, String(value));
+ }
+ }
+ const query = search.toString();
+ return query === '' ? basePath : `${basePath}?${query}`;
+}
+
+export function paginatedResult(response: {
+ items?: unknown[];
+ bookmark?: string | null;
+}) {
+ const items = response.items ?? [];
+ return {
+ items,
+ count: items.length,
+ bookmark: response.bookmark ?? null,
+ };
+}
+
export async function fetchAllPages({
accessToken,
path,
diff --git a/packages/pieces/community/pinterest/src/lib/common/operations.ts b/packages/pieces/community/pinterest/src/lib/common/operations.ts
new file mode 100644
index 00000000000..5b3b223b499
--- /dev/null
+++ b/packages/pieces/community/pinterest/src/lib/common/operations.ts
@@ -0,0 +1,454 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { buildPath, isRecord, makeRequest } from '.';
+
+type CreatePinParams = {
+ accessToken: string;
+ board_id: string;
+ title: string;
+ media_source_type: string;
+ media_url: string;
+ board_section_id?: string;
+ description?: string;
+ link?: string;
+ dominant_color?: string;
+ alt_text?: string;
+ parent_pin_id?: string;
+ note?: string;
+ sponsor_id?: string;
+ is_removable?: boolean;
+ product_tags?: string[];
+ ad_account_id?: string;
+};
+
+type CreateBoardParams = {
+ accessToken: string;
+ name: string;
+ description?: string;
+ privacy?: string;
+ is_ads_only?: boolean;
+ ad_account_id?: string;
+};
+
+type UpdateBoardParams = {
+ accessToken: string;
+ board_id: string;
+ name?: string;
+ description?: string;
+ privacy?: string;
+ ad_account_id?: string;
+};
+
+type DeletePinParams = {
+ accessToken: string;
+ pin_id: string;
+ ad_account_id?: string;
+};
+
+type SearchPinsResult = {
+ items: unknown[];
+ bookmark: string | undefined | null;
+ total_results: number;
+ query_used: string;
+ has_more: boolean;
+};
+
+type SearchParams = {
+ accessToken: string;
+ query: string;
+ bookmark?: string;
+ ad_account_id?: string;
+};
+
+function assertMaxLength({
+ value,
+ max,
+ label,
+}: {
+ value: string | undefined;
+ max: number;
+ label: string;
+}) {
+ if (value !== undefined && value.length > max) {
+ throw new Error(`${label} must be ${max} characters or less`);
+ }
+}
+
+function assertUrl({
+ value,
+ label,
+}: {
+ value: string | undefined;
+ label: string;
+}) {
+ if (value === undefined) {
+ return;
+ }
+ try {
+ new URL(value);
+ } catch {
+ throw new Error(`Please enter a valid URL for ${label}`);
+ }
+}
+
+async function createPinOperation(params: CreatePinParams) {
+ assertMaxLength({ value: params.title, max: 100, label: 'Title' });
+ assertMaxLength({ value: params.description, max: 800, label: 'Description' });
+ assertMaxLength({ value: params.alt_text, max: 500, label: 'Alt text' });
+ if (params.link) {
+ assertUrl({ value: params.link, label: 'Destination Link' });
+ }
+
+ if (params.dominant_color !== undefined && params.dominant_color !== '') {
+ if (!/^#[0-9A-Fa-f]{6}$/.test(params.dominant_color)) {
+ throw new Error(
+ 'Pin Color must be a valid hex color format (e.g., #6E7874)'
+ );
+ }
+ }
+
+ const body: Record<string, unknown> = {
+ board_id: params.board_id,
+ title: params.title,
+ media_source: buildMediaSource({
+ mediaSourceType: params.media_source_type,
+ mediaUrl: params.media_url,
+ }),
+ };
+
+ if (params.board_section_id) body['board_section_id'] = params.board_section_id;
+ if (params.description) body['description'] = params.description;
+ if (params.link) body['link'] = params.link;
+ if (params.dominant_color) body['dominant_color'] = params.dominant_color;
+ if (params.alt_text) body['alt_text'] = params.alt_text;
+ if (params.parent_pin_id) body['parent_pin_id'] = params.parent_pin_id;
+ if (params.note) body['note'] = params.note;
+ if (params.sponsor_id) body['sponsor_id'] = params.sponsor_id;
+ if (typeof params.is_removable === 'boolean') {
+ body['is_removable'] = params.is_removable;
+ }
+ if (params.product_tags !== undefined && params.product_tags.length > 0) {
+ body['product_tags'] = params.product_tags;
+ }
+
+ return await makeRequest(
+ params.accessToken,
+ HttpMethod.POST,
+ buildPath('/pins', { ad_account_id: params.ad_account_id }),
+ body
+ );
+}
+
+async function createBoardOperation(params: CreateBoardParams) {
+ assertMaxLength({ value: params.name, max: 180, label: 'Board name' });
+ assertMaxLength({
+ value: params.description,
+ max: 500,
+ label: 'Board description',
+ });
+
+ const body: Record<string, unknown> = {
+ name: params.name,
+ is_ads_only: params.is_ads_only,
+ };
+ if (params.description) body['description'] = params.description;
+ if (params.privacy) body['privacy'] = params.privacy;
+
+ return await makeRequest(
+ params.accessToken,
+ HttpMethod.POST,
+ buildPath('/boards', { ad_account_id: params.ad_account_id }),
+ body
+ );
+}
+
+async function updateBoardOperation(params: UpdateBoardParams) {
+ const trimmedName = params.name?.trim();
+ const trimmedDescription = params.description?.trim();
+
+ if (!trimmedName && !trimmedDescription && !params.privacy) {
+ throw new Error(
+ 'At least one field (name, description, or privacy) must be provided to update the board.'
+ );
+ }
+
+ assertMaxLength({ value: params.name, max: 180, label: 'Board name' });
+ assertMaxLength({
+ value: params.description,
+ max: 500,
+ label: 'Board description',
+ });
+
+ const body: Record<string, unknown> = {};
+ if (trimmedName) {
+ body['name'] = trimmedName;
+ }
+ if (trimmedDescription) {
+ body['description'] = trimmedDescription;
+ }
+ if (params.privacy) {
+ body['privacy'] = params.privacy;
+ }
+
+ try {
+ return await makeRequest(
+ params.accessToken,
+ HttpMethod.PATCH,
+ buildPath(`/boards/${params.board_id}`, {
+ ad_account_id: params.ad_account_id,
+ }),
+ body
+ );
+ } catch (error) {
+ throw new Error(
+ `Failed to update board: ${
+ error instanceof Error ? error.message : 'Unknown error'
+ }`
+ );
+ }
+}
+
+async function deletePinOperation(params: DeletePinParams) {
+ await makeRequest(
+ params.accessToken,
+ HttpMethod.DELETE,
+ buildPath(`/pins/${params.pin_id}`, {
+ ad_account_id: params.ad_account_id,
+ })
+ );
+
+ return {
+ success: true,
+ message: `Pin ${params.pin_id} has been successfully deleted.`,
+ pin_id: params.pin_id,
+ };
+}
+
+async function searchBoardsOperation(params: SearchParams) {
+ try {
+ return await makeRequest(
+ params.accessToken,
+ HttpMethod.GET,
+ buildPath('/search/boards/', {
+ query: params.query,
+ ad_account_id: params.ad_account_id,
+ bookmark: params.bookmark,
+ })
+ );
+ } catch (error) {
+ throw new Error(
+ `Failed to search boards: ${
+ error instanceof Error ? error.message : 'Unknown error'
+ }`
+ );
+ }
+}
+
+async function searchPinsOperation(
+ params: SearchParams & { max_results?: number }
+): Promise<SearchPinsResult> {
+ const limit = Math.min(
+ 250,
+ Math.max(1, Math.floor(params.max_results ?? DEFAULT_MAX_RESULTS))
+ );
+ const cursor = decodeCursor(params.bookmark);
+
+ let items: unknown[] = [];
+ let pageBookmark: string | null = cursor.bookmark;
+ let requestedBookmark: string | null = cursor.bookmark;
+ let nextBookmark: string | undefined = undefined;
+ let lastPageStart = 0;
+ let lastPageSkipped = 0;
+
+ for (let page = 0; page < MAX_SEARCH_PAGES; page++) {
+ const response: unknown = await makeRequest(
+ params.accessToken,
+ HttpMethod.GET,
+ buildPath('/search/pins', {
+ query: params.query,
+ bookmark: pageBookmark ?? undefined,
+ ad_account_id: params.ad_account_id,
+ })
+ );
+
+ if (!isRecord(response) || !Array.isArray(response['items'])) {
+ throw new Error(
+ 'Pinterest returned an unexpected response for the Pin search'
+ );
+ }
+
+ const rawItems: unknown[] = response['items'];
+
+ if (page === 0 && cursor.skip > rawItems.length) {
+ throw new Error(
+ 'Bookmark does not match this search. Start again without a bookmark.'
+ );
+ }
+
+ const skipped = page === 0 ? cursor.skip : 0;
+ const responseBookmark = response['bookmark'];
+
+ requestedBookmark = pageBookmark;
+ lastPageStart = items.length;
+ lastPageSkipped = skipped;
+ items = [...items, ...rawItems.slice(skipped)];
+ nextBookmark =
+ typeof responseBookmark === 'string' && responseBookmark.length > 0
+ ? responseBookmark
+ : undefined;
+
+ if (!nextBookmark || items.length >= limit || rawItems.length === 0) {
+ break;
+ }
+ pageBookmark = nextBookmark;
+ }
+
+ const cutInsidePage = items.length > limit;
+ const limitedItems = cutInsidePage ? items.slice(0, limit) : items;
+
+ return {
+ items: limitedItems,
+ bookmark: cutInsidePage
+ ? encodeCursor({
+ bookmark: requestedBookmark,
+ skip: lastPageSkipped + (limit - lastPageStart),
+ })
+ : nextBookmark,
+ total_results: limitedItems.length,
+ query_used: params.query,
+ has_more: cutInsidePage || !!nextBookmark,
+ };
+}
+
+function buildMediaSource({
+ mediaSourceType,
+ mediaUrl,
+}: {
+ mediaSourceType: string;
+ mediaUrl: string;
+}): Record<string, string> {
+ if (mediaSourceType !== 'image_url' && mediaSourceType !== 'image_base64') {
+ throw new Error(
+ 'Video Pins are not supported by this action. Choose Image URL or Base64 Image.'
+ );
+ }
+
+ if (mediaSourceType !== 'image_base64') {
+ assertUrl({ value: mediaUrl, label: 'Image URL' });
+ return { source_type: mediaSourceType, url: mediaUrl };
+ }
+
+ const trimmed = mediaUrl.trim();
+ const dataUri = /^data:([^;,]*)((?:;[^;,]*)*),/.exec(trimmed);
+ const isBase64Uri =
+ dataUri !== null &&
+ dataUri[2].split(';').some((param) => param.toLowerCase() === 'base64');
+
+ if (dataUri && !isBase64Uri) {
+ throw new Error(
+ 'Media data URI must be base64 encoded (data:image/png;base64,...)'
+ );
+ }
+
+ const data = (dataUri ? trimmed.slice(dataUri[0].length) : trimmed)
+ .replace(/\s+/g, '')
+ .replace(/-/g, '+')
+ .replace(/_/g, '/');
+ if (!BASE64_PATTERN.test(data)) {
+ throw new Error('Media must be valid base64 when the type is Base64 Image');
+ }
+
+ const declaredType =
+ dataUri && dataUri[1].length > 0 ? dataUri[1].toLowerCase() : undefined;
+ const contentType = declaredType ?? detectImageContentType(data);
+
+ if (!contentType || !SUPPORTED_IMAGE_TYPES.has(contentType)) {
+ throw new Error(
+ 'Media must be a JPEG or PNG image, as a data URI or raw base64'
+ );
+ }
+
+ return {
+ source_type: 'image_base64',
+ content_type: contentType,
+ data,
+ };
+}
+
+function detectImageContentType(base64: string): string | undefined {
+ const signature = base64.slice(0, 8);
+ if (signature.startsWith('/9j/')) return 'image/jpeg';
+ if (signature.startsWith('iVBORw0K')) return 'image/png';
+ return undefined;
+}
+
+function encodeCursor({
+ bookmark,
+ skip,
+}: {
+ bookmark: string | null;
+ skip: number;
+}): string {
+ const payload = JSON.stringify({ b: bookmark, s: skip });
+ const encoded = Buffer.from(payload, "utf8").toString("base64url");
+ return `${CURSOR_PREFIX}${encoded}`;
+}
+
+function decodeCursor(value: string | undefined): {
+ bookmark: string | null;
+ skip: number;
+} {
+ if (!value) {
+ return { bookmark: null, skip: 0 };
+ }
+
+ if (!value.startsWith(CURSOR_PREFIX)) {
+ return { bookmark: value, skip: 0 };
+ }
+
+ const decoded = parseCursorPayload(value.slice(CURSOR_PREFIX.length));
+
+ if (!isRecord(decoded)) {
+ throw new Error(INVALID_CURSOR_MESSAGE);
+ }
+
+ const cursorBookmark = decoded['b'];
+ const cursorSkip = decoded['s'];
+
+ if (cursorBookmark !== null && typeof cursorBookmark !== 'string') {
+ throw new Error(INVALID_CURSOR_MESSAGE);
+ }
+
+ if (
+ typeof cursorSkip !== 'number' ||
+ !Number.isInteger(cursorSkip) ||
+ cursorSkip < 0
+ ) {
+ throw new Error(INVALID_CURSOR_MESSAGE);
+ }
+
+ return { bookmark: cursorBookmark, skip: cursorSkip };
+}
+
+function parseCursorPayload(encoded: string): unknown {
+ try {
+ return JSON.parse(Buffer.from(encoded, 'base64url').toString('utf8'));
+ } catch {
+ throw new Error(INVALID_CURSOR_MESSAGE);
+ }
+}
+
+export const pinterestOperations = {
+ createPin: createPinOperation,
+ createBoard: createBoardOperation,
+ updateBoard: updateBoardOperation,
+ deletePin: deletePinOperation,
+ searchBoards: searchBoardsOperation,
+ searchPins: searchPinsOperation,
+};
+
+const DEFAULT_MAX_RESULTS = 25;
+const MAX_SEARCH_PAGES = 10;
+const CURSOR_PREFIX = 'apc1.';
+const INVALID_CURSOR_MESSAGE = 'Bookmark is not a valid Find Pin bookmark';
+const SUPPORTED_IMAGE_TYPES = new Set(['image/jpeg', 'image/png']);
+const BASE64_PATTERN = /^[A-Za-z0-9+/]+={0,2}$/;
diff --git a/packages/pieces/community/pinterest/src/lib/output-schemas.ts b/packages/pieces/community/pinterest/src/lib/output-schemas.ts
index 2ec3edbf2ea..59d39284a33 100644
--- a/packages/pieces/community/pinterest/src/lib/output-schemas.ts
+++ b/packages/pieces/community/pinterest/src/lib/output-schemas.ts
@@ -67,7 +67,42 @@ const pinFields: OutputSchema['fields'] = [
{ key: 'creative_type', label: 'Creative Type' },
{ key: 'parent_pin_id', label: 'Parent Pin ID' },
{ key: 'product_tags', label: 'Product Tags' },
- { key: 'pin_metrics', label: 'Pin Metrics' },
+ {
+ key: 'pin_metrics',
+ label: 'Pin Metrics',
+ description:
+ 'Only returned when the action asks for metrics; reactions and comments are lifetime-only.',
+ children: [
+ {
+ key: '90d',
+ label: 'Last 90 Days',
+ children: [
+ { key: 'impression', label: 'Impressions', format: 'number' },
+ { key: 'save', label: 'Saves', format: 'number' },
+ { key: 'pin_click', label: 'Pin Clicks', format: 'number' },
+ { key: 'outbound_click', label: 'Outbound Clicks', format: 'number' },
+ { key: 'user_follow', label: 'User Follows', format: 'number' },
+ { key: 'profile_visit', label: 'Profile Visits', format: 'number' },
+ { key: 'last_updated', label: 'Last Updated' },
+ ],
+ },
+ {
+ key: 'lifetime_metrics',
+ label: 'Lifetime',
+ children: [
+ { key: 'impression', label: 'Impressions', format: 'number' },
+ { key: 'save', label: 'Saves', format: 'number' },
+ { key: 'pin_click', label: 'Pin Clicks', format: 'number' },
+ { key: 'outbound_click', label: 'Outbound Clicks', format: 'number' },
+ { key: 'user_follow', label: 'User Follows', format: 'number' },
+ { key: 'profile_visit', label: 'Profile Visits', format: 'number' },
+ { key: 'reaction', label: 'Reactions', format: 'number' },
+ { key: 'comment', label: 'Comments', format: 'number' },
+ { key: 'last_updated', label: 'Last Updated' },
+ ],
+ },
+ ],
+ },
{ key: 'is_owner', label: 'Is Owner', format: 'boolean' },
{ key: 'is_standard', label: 'Is Standard', format: 'boolean' },
{ key: 'is_product', label: 'Is Product', format: 'boolean' },
@@ -134,3 +169,246 @@ export const newFollowerTriggerOutputSchema: OutputSchema = {
{ key: 'type', label: 'Account Type' },
],
};
+
+const userSummaryFields: OutputSchema['fields'] = [
+ { key: 'username', label: 'Username' },
+ { key: 'type', label: 'Account Type' },
+];
+
+const boardSectionFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Section ID' },
+ { key: 'name', label: 'Name' },
+];
+
+function paginatedSchema(
+ label: string,
+ listItems: OutputSchema['fields'],
+ labelKey: string
+): OutputSchema {
+ return {
+ fields: [
+ { key: 'items', label, labelKey, listItems },
+ { key: 'count', label: 'Count on This Page', format: 'number' },
+ {
+ key: 'bookmark',
+ label: 'Next Page Bookmark',
+ description:
+ 'Pass back as "Bookmark" to fetch the next page; null on the last page.',
+ },
+ ],
+ };
+}
+
+export const getBoardActionOutputSchema: OutputSchema = { fields: boardFields };
+export const getPinActionOutputSchema: OutputSchema = { fields: pinFields };
+export const boardSectionActionOutputSchema: OutputSchema = {
+ fields: boardSectionFields,
+};
+
+export const listBoardsActionOutputSchema = paginatedSchema(
+ 'Boards',
+ boardFields,
+ 'name'
+);
+export const listPinsActionOutputSchema = paginatedSchema(
+ 'Pins',
+ pinFields,
+ 'title'
+);
+export const listPinsOnBoardActionOutputSchema = paginatedSchema(
+ 'Pins',
+ pinFields,
+ 'title'
+);
+export const listBoardSectionsActionOutputSchema = paginatedSchema(
+ 'Sections',
+ boardSectionFields,
+ 'name'
+);
+export const listUserSummariesActionOutputSchema = paginatedSchema(
+ 'Accounts',
+ userSummaryFields,
+ 'username'
+);
+
+export const deleteBoardActionOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'success', label: 'Success', format: 'boolean' },
+ { key: 'board_id', label: 'Board ID' },
+ { key: 'message', label: 'Message' },
+ ],
+};
+
+export const deleteBoardSectionActionOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'success', label: 'Success', format: 'boolean' },
+ { key: 'board_id', label: 'Board ID' },
+ { key: 'section_id', label: 'Section ID' },
+ { key: 'message', label: 'Message' },
+ ],
+};
+
+export const userAccountActionOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'id', label: 'Account ID' },
+ { key: 'username', label: 'Username' },
+ { key: 'account_type', label: 'Account Type' },
+ { key: 'business_name', label: 'Business Name' },
+ { key: 'website_url', label: 'Website', format: 'url' },
+ { key: 'about', label: 'About' },
+ { key: 'profile_image', label: 'Profile Image', format: 'image' },
+ { key: 'board_count', label: 'Board Count', format: 'number' },
+ { key: 'pin_count', label: 'Pin Count', format: 'number' },
+ { key: 'follower_count', label: 'Follower Count', format: 'number' },
+ { key: 'following_count', label: 'Following Count', format: 'number' },
+ { key: 'monthly_views', label: 'Monthly Views', format: 'number' },
+ ],
+};
+
+export const listLinkedBusinessesActionOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'items',
+ label: 'Linked Businesses',
+ labelKey: 'username',
+ listItems: [
+ { key: 'username', label: 'Username' },
+ { key: 'image_small_url', label: 'Small Image', format: 'image' },
+ { key: 'image_medium_url', label: 'Medium Image', format: 'image' },
+ { key: 'image_large_url', label: 'Large Image', format: 'image' },
+ { key: 'image_xlarge_url', label: 'Extra Large Image', format: 'image' },
+ ],
+ },
+ { key: 'count', label: 'Count', format: 'number' },
+ ],
+};
+
+export const listVerifiedWebsitesActionOutputSchema = paginatedSchema(
+ 'Websites',
+ [
+ { key: 'website', label: 'Website', format: 'url' },
+ { key: 'status', label: 'Verification Status' },
+ { key: 'verified_at', label: 'Verified At', format: 'datetime' },
+ ],
+ 'website'
+);
+
+export const listPinProductTagsActionOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'items',
+ label: 'Product Tags',
+ labelKey: 'pin_id',
+ listItems: [
+ { key: 'pin_id', label: 'Tagged Product Pin ID' },
+ ],
+ },
+ { key: 'count', label: 'Count', format: 'number' },
+ ],
+};
+
+export const pinAnalyticsActionOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'all',
+ label: 'All App Types',
+ description:
+ 'Metrics for every app type combined; sibling keys such as WEB or MOBILE appear when the data is split.',
+ children: [
+ {
+ key: 'summary_metrics',
+ label: 'Summary Metrics',
+ description:
+ 'Totals for the requested range, keyed by the metric names that were asked for.',
+ dynamicKey: true,
+ },
+ {
+ key: 'daily_metrics',
+ label: 'Daily Metrics',
+ labelKey: 'date',
+ listItems: [
+ { key: 'date', label: 'Date', format: 'date' },
+ { key: 'data_status', label: 'Data Status' },
+ {
+ key: 'metrics',
+ label: 'Metrics',
+ description: 'Values keyed by the requested metric names.',
+ dynamicKey: true,
+ },
+ ],
+ },
+ ],
+ },
+ ],
+};
+
+export const accountAnalyticsActionOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'all',
+ label: 'All Pin Formats',
+ description:
+ 'Metrics for every Pin format combined; sibling keys appear when the data is split.',
+ children: [
+ {
+ key: 'summary_metrics',
+ label: 'Summary Metrics',
+ dynamicKey: true,
+ },
+ {
+ key: 'daily_metrics',
+ label: 'Daily Metrics',
+ labelKey: 'date',
+ listItems: [
+ { key: 'date', label: 'Date', format: 'date' },
+ { key: 'data_status', label: 'Data Status' },
+ {
+ key: 'metrics',
+ label: 'Metrics',
+ dynamicKey: true,
+ },
+ ],
+ },
+ ],
+ },
+ ],
+};
+
+export const topPinsAnalyticsActionOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'sort_by', label: 'Sorted By' },
+ {
+ key: 'pins',
+ label: 'Top Pins',
+ labelKey: 'pin_id',
+ listItems: [
+ { key: 'pin_id', label: 'Pin ID' },
+ {
+ key: 'metrics',
+ label: 'Metrics',
+ description:
+ 'Values keyed by metric name. Pinterest returns every metric it has, not only the one sorted on.',
+ dynamicKey: true,
+ },
+ {
+ key: 'data_status',
+ label: 'Data Status',
+ description: 'READY or PROCESSING, keyed by the same metric names.',
+ dynamicKey: true,
+ },
+ ],
+ },
+ {
+ key: 'date_availability',
+ label: 'Date Availability',
+ children: [
+ {
+ key: 'latest_available_timestamp',
+ label: 'Latest Available',
+ format: 'datetime',
+ },
+ { key: 'is_realtime', label: 'Is Realtime', format: 'boolean' },
+ ],
+ },
+ ],
+};
diff --git a/packages/pieces/community/trello/package.json b/packages/pieces/community/trello/package.json
index 9190f5bdcce..fde6599007a 100644
--- a/packages/pieces/community/trello/package.json
+++ b/packages/pieces/community/trello/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-trello",
- "version": "0.6.0",
+ "version": "0.7.0",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"scripts": {
diff --git a/packages/pieces/community/trello/src/index.ts b/packages/pieces/community/trello/src/index.ts
index 82336ddabb8..ff699cb5f18 100644
--- a/packages/pieces/community/trello/src/index.ts
+++ b/packages/pieces/community/trello/src/index.ts
@@ -61,6 +61,26 @@ import { getMyMember } from './lib/actions/ai/get-my-member';
import { getMember } from './lib/actions/ai/get-member';
import { listOrganizationBoards } from './lib/actions/ai/list-organization-boards';
import { addReactionToComment } from './lib/actions/ai/add-reaction-to-comment';
+import { listBoardCustomFields } from './lib/actions/ai/list-board-custom-fields';
+import { getCustomField } from './lib/actions/ai/get-custom-field';
+import { listCustomFieldOptions } from './lib/actions/ai/list-custom-field-options';
+import { listCardCustomFieldValues } from './lib/actions/ai/list-card-custom-field-values';
+import { setCardCustomFieldValue } from './lib/actions/ai/set-card-custom-field-value';
+import { createBoardCustomField } from './lib/actions/ai/create-board-custom-field';
+import { createCustomFieldOption } from './lib/actions/ai/create-custom-field-option';
+import { deleteCustomField } from './lib/actions/ai/delete-custom-field';
+import { copyCard } from './lib/actions/ai/copy-card';
+import { listCardActivity } from './lib/actions/ai/list-card-activity';
+import { voteOnCard } from './lib/actions/ai/vote-on-card';
+import { removeCardVote } from './lib/actions/ai/remove-card-vote';
+import { listCardVotes } from './lib/actions/ai/list-card-votes';
+import { deleteBoard } from './lib/actions/ai/delete-board';
+import { deleteLabel } from './lib/actions/ai/delete-label';
+import { moveListToBoard } from './lib/actions/ai/move-list-to-board';
+import { updateChecklist } from './lib/actions/ai/update-checklist';
+import { updateChecklistItem } from './lib/actions/ai/update-checklist-item';
+import { listBoardMemberships } from './lib/actions/ai/list-board-memberships';
+import { addCardAttachmentFromUrl } from './lib/actions/ai/add-card-attachment-from-url';
import { cardMovedTrigger } from './lib/triggers/cardMoved';
import { newCardTrigger } from './lib/triggers/newCard';
import { deadlineTrigger } from './lib/triggers/deadline';
@@ -122,9 +142,9 @@ export const trelloAuth = PieceAuth.BasicAuth({
export const trello = createPiece({
displayName: 'Trello',
description: 'Project management tool for teams',
- minimumSupportedRelease: '0.86.4',
+ minimumSupportedRelease: '0.87.0',
logoUrl: 'https://cdn.activepieces.com/pieces/trello.png',
- authors: ["Salem-Alaa", "kishanprmr", "MoShizzle", "khaledmashaly", "abuaboud", "AshotZaqoyan"],
+ authors: ["Salem-Alaa", "kishanprmr", "MoShizzle", "khaledmashaly", "abuaboud", "AshotZaqoyan", "OdaiAhmed99"],
categories: [PieceCategory.PRODUCTIVITY],
auth: trelloAuth,
actions: [createCard, getCard, updateCard, deleteCard, getCardAttachments, addCardAttachment, getCardAttachment, deleteCardAttachment,
@@ -137,7 +157,13 @@ export const trello = createPiece({
createList, listLists, getList, renameList, archiveList, moveAllCardsInList, archiveAllCardsInList,
createBoard, getBoard, listBoards, updateBoard, archiveBoard, listBoardMembers,
addChecklistToCard, listCardChecklists, deleteChecklist, setChecklistItemState, deleteChecklistItem, addChecklistItem,
- getMyMember, getMember, listOrganizationBoards, addReactionToComment, createCustomApiCallAction({
+ getMyMember, getMember, listOrganizationBoards, addReactionToComment,
+ listBoardCustomFields, getCustomField, listCustomFieldOptions, listCardCustomFieldValues,
+ setCardCustomFieldValue, createBoardCustomField, createCustomFieldOption, deleteCustomField,
+ copyCard, listCardActivity, voteOnCard, removeCardVote, listCardVotes,
+ deleteBoard, deleteLabel, moveListToBoard, updateChecklist, updateChecklistItem,
+ listBoardMemberships, addCardAttachmentFromUrl,
+ createCustomApiCallAction({
auth: trelloAuth,
baseUrl: () => 'https://api.trello.com/1',
authLocation: 'queryParams',
diff --git a/packages/pieces/community/trello/src/lib/actions/ai/add-card-attachment-from-url.ts b/packages/pieces/community/trello/src/lib/actions/ai/add-card-attachment-from-url.ts
new file mode 100644
index 00000000000..22c8d28522a
--- /dev/null
+++ b/packages/pieces/community/trello/src/lib/actions/ai/add-card-attachment-from-url.ts
@@ -0,0 +1,86 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import {
+ httpClient,
+ HttpRequest,
+ HttpMethod,
+ QueryParams,
+} from '@activepieces/pieces-common';
+import { trelloCommon } from '../../common';
+import { trelloAuth } from '../../..';
+import { withAuthParams, rethrowTrelloError } from './ai-common';
+import { addCardAttachmentFromUrlActionOutputSchema } from '../../output-schemas';
+
+export const addCardAttachmentFromUrl = createAction({
+ auth: trelloAuth,
+ name: 'add_card_attachment_from_url',
+ classification: 'WRITE',
+ displayName: 'Add Card Attachment From URL (Agent)',
+ description: 'Attach a link to a card by URL.',
+ audience: 'ai',
+ outputSchema: addCardAttachmentFromUrlActionOutputSchema,
+ aiMetadata: {
+ description:
+ 'Attaches a link to a card by URL, optionally naming it and making it the card cover. Use it to attach a document, image or page that is already hosted somewhere; the file-upload variant of this action takes binary content and is meant for people working in the flow builder, not agents. The URL must start with http:// or https://, and Trello stores the link without downloading it, so a private URL stays unreachable to anyone who cannot already open it. Each call adds another attachment, so it is not idempotent.',
+ idempotent: false,
+ },
+ props: {
+ card_id: Property.ShortText({
+ displayName: 'Card ID',
+ description: 'The ID of the card. Obtain it from Search Cards.',
+ required: true,
+ }),
+ url: Property.ShortText({
+ displayName: 'URL',
+ description: 'The link to attach. Must start with http:// or https://.',
+ required: true,
+ }),
+ name: Property.ShortText({
+ displayName: 'Name',
+ description:
+ 'Display name for the attachment (max 256 characters). Defaults to the URL.',
+ required: false,
+ }),
+ set_cover: Property.Checkbox({
+ displayName: 'Set As Cover',
+ description:
+ 'Use the attachment as the card cover. Only meaningful for images.',
+ required: false,
+ defaultValue: false,
+ }),
+ },
+
+ async run(context) {
+ const url = context.propsValue['url'];
+ if (!/^https?:\/\//i.test(url)) {
+ throw new Error(
+ 'URL must start with http:// or https:// to be attached to a Trello card.'
+ );
+ }
+
+ const params: QueryParams = { url };
+ if (context.propsValue['name']) {
+ params['name'] = context.propsValue['name'];
+ }
+ if (context.propsValue['set_cover'] === true) {
+ params['setCover'] = 'true';
+ }
+
+ try {
+ const request: HttpRequest = {
+ method: HttpMethod.POST,
+ url: `${trelloCommon.baseUrl}cards/${context.propsValue['card_id']}/attachments`,
+ headers: { Accept: 'application/json' },
+ queryParams: withAuthParams(context.auth, params),
+ };
+ const response = await httpClient.sendRequest<Record<string, unknown>>(
+ request
+ );
+ return response.body;
+ } catch (error: any) {
+ rethrowTrelloError(
+ error,
+ 'Card not found. Verify the card_id (resolve it via Search Cards).'
+ );
+ }
+ },
+});
diff --git a/packages/pieces/community/trello/src/lib/actions/ai/copy-card.ts b/packages/pieces/community/trello/src/lib/actions/ai/copy-card.ts
new file mode 100644
index 00000000000..b6a413750c6
--- /dev/null
+++ b/packages/pieces/community/trello/src/lib/actions/ai/copy-card.ts
@@ -0,0 +1,107 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import {
+ httpClient,
+ HttpRequest,
+ HttpMethod,
+ QueryParams,
+} from '@activepieces/pieces-common';
+import { trelloCommon } from '../../common';
+import { trelloAuth } from '../../..';
+import { withAuthParams, rethrowTrelloError } from './ai-common';
+import { copyCardActionOutputSchema } from '../../output-schemas';
+
+export const copyCard = createAction({
+ auth: trelloAuth,
+ name: 'copy_card',
+ classification: 'WRITE',
+ displayName: 'Copy Card (Agent)',
+ description: 'Copy an existing card into a list.',
+ audience: 'ai',
+ outputSchema: copyCardActionOutputSchema,
+ aiMetadata: {
+ description:
+ 'Copies an existing card into a list, optionally carrying over parts of the original such as its checklists, attachments, comments, custom fields, labels, members or dates. Only the parts listed in Keep From Source are carried over, so leaving it empty produces a bare copy. Use it to instantiate a template card; use Create Card when there is nothing to copy from. Both the source card id and the destination list id are required, and each call produces another copy, so it is not idempotent.',
+ idempotent: false,
+ },
+ props: {
+ source_card_id: Property.ShortText({
+ displayName: 'Source Card ID',
+ description: 'The ID of the card to copy. Obtain it from Search Cards.',
+ required: true,
+ }),
+ list_id: Property.ShortText({
+ displayName: 'Destination List ID',
+ description:
+ 'The ID of the list the copy is created in. Obtain it from List Lists.',
+ required: true,
+ }),
+ name: Property.ShortText({
+ displayName: 'Name',
+ description: 'Name for the copy. Defaults to the source card name.',
+ required: false,
+ }),
+ keep_from_source: Property.StaticMultiSelectDropdown({
+ displayName: 'Keep From Source',
+ description:
+ 'Which parts of the original to carry over. Leave empty to copy the card without any of them.',
+ required: false,
+ options: {
+ options: [
+ { label: 'Attachments', value: 'attachments' },
+ { label: 'Checklists', value: 'checklists' },
+ { label: 'Comments', value: 'comments' },
+ { label: 'Custom Fields', value: 'customFields' },
+ { label: 'Due Date', value: 'due' },
+ { label: 'Labels', value: 'labels' },
+ { label: 'Members', value: 'members' },
+ { label: 'Start Date', value: 'start' },
+ { label: 'Stickers', value: 'stickers' },
+ ],
+ },
+ }),
+ position: Property.StaticDropdown({
+ displayName: 'Position',
+ description: 'Where the copy lands in the destination list.',
+ required: false,
+ options: {
+ options: [
+ { label: 'Top', value: 'top' },
+ { label: 'Bottom', value: 'bottom' },
+ ],
+ },
+ }),
+ },
+
+ async run(context) {
+ const keepFromSource = context.propsValue['keep_from_source'];
+ const params: QueryParams = {
+ idCardSource: context.propsValue['source_card_id'],
+ idList: context.propsValue['list_id'],
+ };
+ if (context.propsValue['name']) {
+ params['name'] = context.propsValue['name'];
+ }
+ if (context.propsValue['position']) {
+ params['pos'] = context.propsValue['position'];
+ }
+ params['keepFromSource'] = keepFromSource?.join(',') ?? '';
+
+ try {
+ const request: HttpRequest = {
+ method: HttpMethod.POST,
+ url: `${trelloCommon.baseUrl}cards`,
+ headers: { Accept: 'application/json' },
+ queryParams: withAuthParams(context.auth, params),
+ };
+ const response = await httpClient.sendRequest<Record<string, unknown>>(
+ request
+ );
+ return response.body;
+ } catch (error: any) {
+ rethrowTrelloError(
+ error,
+ 'Source card or destination list not found. Verify the source_card_id and list_id.'
+ );
+ }
+ },
+});
diff --git a/packages/pieces/community/trello/src/lib/actions/ai/create-board-custom-field.ts b/packages/pieces/community/trello/src/lib/actions/ai/create-board-custom-field.ts
new file mode 100644
index 00000000000..bb661516fe5
--- /dev/null
+++ b/packages/pieces/community/trello/src/lib/actions/ai/create-board-custom-field.ts
@@ -0,0 +1,88 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import {
+ httpClient,
+ HttpRequest,
+ HttpMethod,
+} from '@activepieces/pieces-common';
+import { trelloCommon } from '../../common';
+import { trelloAuth } from '../../..';
+import { withAuthParams, rethrowTrelloError } from './ai-common';
+import { customFieldActionOutputSchema } from '../../output-schemas';
+
+export const createBoardCustomField = createAction({
+ auth: trelloAuth,
+ name: 'create_board_custom_field',
+ classification: 'WRITE',
+ displayName: 'Create Board Custom Field (Agent)',
+ description: 'Define a new custom field on a board.',
+ audience: 'ai',
+ outputSchema: customFieldActionOutputSchema,
+ aiMetadata: {
+ description:
+ 'Defines a new custom field on a board and returns its id. Use it when a board lacks a field the workflow needs; check List Board Custom Fields first, because Trello allows two fields with the same name and each call creates another one. A dropdown field is created empty, so follow up with Create Custom Field Option for each choice before any card can be given a value. Requires the Custom Fields Power-Up on the board; not idempotent.',
+ idempotent: false,
+ },
+ props: {
+ board_id: Property.ShortText({
+ displayName: 'Board ID',
+ description: 'The ID of the board. Obtain it from List Boards.',
+ required: true,
+ }),
+ name: Property.ShortText({
+ displayName: 'Name',
+ description: 'The name of the custom field.',
+ required: true,
+ }),
+ type: Property.StaticDropdown({
+ displayName: 'Type',
+ description: 'The kind of value the field holds. It cannot be changed later.',
+ required: true,
+ options: {
+ options: [
+ { label: 'Text', value: 'text' },
+ { label: 'Number', value: 'number' },
+ { label: 'Date', value: 'date' },
+ { label: 'Checkbox', value: 'checkbox' },
+ { label: 'Dropdown (list)', value: 'list' },
+ ],
+ },
+ }),
+ display_on_card: Property.Checkbox({
+ displayName: 'Show on Card Front',
+ description: 'Display the field on the front of the card.',
+ required: false,
+ defaultValue: false,
+ }),
+ },
+
+ async run(context) {
+ try {
+ const request: HttpRequest = {
+ method: HttpMethod.POST,
+ url: `${trelloCommon.baseUrl}customFields`,
+ headers: {
+ Accept: 'application/json',
+ 'Content-Type': 'application/json',
+ },
+ queryParams: withAuthParams(context.auth),
+ body: {
+ idModel: context.propsValue['board_id'],
+ modelType: 'board',
+ name: context.propsValue['name'],
+ type: context.propsValue['type'],
+ pos: 'bottom',
+ display_cardFront: context.propsValue['display_on_card'] === true,
+ },
+ };
+ const response = await httpClient.sendRequest<Record<string, unknown>>(
+ request
+ );
+ return response.body;
+ } catch (error: any) {
+ rethrowTrelloError(
+ error,
+ 'Board not found. Verify the board_id, and that the Custom Fields Power-Up is enabled on the board.'
+ );
+ }
+ },
+});
diff --git a/packages/pieces/community/trello/src/lib/actions/ai/create-custom-field-option.ts b/packages/pieces/community/trello/src/lib/actions/ai/create-custom-field-option.ts
new file mode 100644
index 00000000000..92c0f64e1ca
--- /dev/null
+++ b/packages/pieces/community/trello/src/lib/actions/ai/create-custom-field-option.ts
@@ -0,0 +1,65 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import {
+ httpClient,
+ HttpRequest,
+ HttpMethod,
+} from '@activepieces/pieces-common';
+import { trelloCommon } from '../../common';
+import { trelloAuth } from '../../..';
+import { withAuthParams, rethrowTrelloError } from './ai-common';
+import { customFieldOptionActionOutputSchema } from '../../output-schemas';
+
+export const createCustomFieldOption = createAction({
+ auth: trelloAuth,
+ name: 'create_custom_field_option',
+ classification: 'WRITE',
+ displayName: 'Create Custom Field Option (Agent)',
+ description: 'Add a selectable option to a dropdown custom field.',
+ audience: 'ai',
+ outputSchema: customFieldOptionActionOutputSchema,
+ aiMetadata: {
+ description:
+ 'Adds one selectable option to a dropdown custom field and returns the new option id. A dropdown field created by Create Board Custom Field starts with no options and no card can be given a value until options exist, so call this once per choice. Only dropdown fields accept options. Each call adds another option even if the text repeats, so it is not idempotent.',
+ idempotent: false,
+ },
+ props: {
+ custom_field_id: Property.ShortText({
+ displayName: 'Custom Field ID',
+ description:
+ 'The ID of a dropdown custom field. Obtain it from List Board Custom Fields.',
+ required: true,
+ }),
+ value: Property.ShortText({
+ displayName: 'Option Text',
+ description: 'The text shown for this option.',
+ required: true,
+ }),
+ },
+
+ async run(context) {
+ try {
+ const request: HttpRequest = {
+ method: HttpMethod.POST,
+ url: `${trelloCommon.baseUrl}customFields/${context.propsValue['custom_field_id']}/options`,
+ headers: {
+ Accept: 'application/json',
+ 'Content-Type': 'application/json',
+ },
+ queryParams: withAuthParams(context.auth),
+ body: {
+ value: { text: context.propsValue['value'] },
+ pos: 'bottom',
+ },
+ };
+ const response = await httpClient.sendRequest<Record<string, unknown>>(
+ request
+ );
+ return response.body;
+ } catch (error: any) {
+ rethrowTrelloError(
+ error,
+ 'Custom field not found. Verify the custom_field_id and that it is a dropdown (list) field.'
+ );
+ }
+ },
+});
diff --git a/packages/pieces/community/trello/src/lib/actions/ai/delete-board.ts b/packages/pieces/community/trello/src/lib/actions/ai/delete-board.ts
new file mode 100644
index 00000000000..55901445745
--- /dev/null
+++ b/packages/pieces/community/trello/src/lib/actions/ai/delete-board.ts
@@ -0,0 +1,52 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import {
+ httpClient,
+ HttpRequest,
+ HttpMethod,
+} from '@activepieces/pieces-common';
+import { trelloCommon } from '../../common';
+import { trelloAuth } from '../../..';
+import { withAuthParams, rethrowTrelloError } from './ai-common';
+import { deleteBoardActionOutputSchema } from '../../output-schemas';
+
+export const deleteBoard = createAction({
+ auth: trelloAuth,
+ name: 'delete_board',
+ classification: 'DESTRUCTIVE',
+ displayName: 'Delete Board (Agent)',
+ description:
+ 'Permanently delete a board and everything on it. This cannot be undone.',
+ audience: 'ai',
+ outputSchema: deleteBoardActionOutputSchema,
+ aiMetadata: {
+ description:
+ 'Permanently deletes a board together with every list, card, comment and attachment on it. This is irreversible: Trello offers no way to restore a deleted board, and the data is gone for every member of the board, not just the connected user. Prefer Archive Board, which hides the board and can be undone, and only use this when permanent destruction is explicitly intended. Confirm the board with Get Board first, since a board id that belongs to the wrong board destroys the wrong data. Deleting an already-deleted board errors rather than succeeding, so it is not idempotent.',
+ idempotent: false,
+ },
+ props: {
+ board_id: Property.ShortText({
+ displayName: 'Board ID',
+ description:
+ 'The ID of the board to permanently delete. Obtain it from List Boards and confirm it with Get Board first.',
+ required: true,
+ }),
+ },
+
+ async run(context) {
+ try {
+ const request: HttpRequest = {
+ method: HttpMethod.DELETE,
+ url: `${trelloCommon.baseUrl}boards/${context.propsValue['board_id']}`,
+ headers: { Accept: 'application/json' },
+ queryParams: withAuthParams(context.auth),
+ };
+ await httpClient.sendRequest(request);
+ return { success: true, board_id: context.propsValue['board_id'] };
+ } catch (error: any) {
+ rethrowTrelloError(
+ error,
+ 'Board not found. Verify the board_id (resolve it via List Boards).'
+ );
+ }
+ },
+});
diff --git a/packages/pieces/community/trello/src/lib/actions/ai/delete-custom-field.ts b/packages/pieces/community/trello/src/lib/actions/ai/delete-custom-field.ts
new file mode 100644
index 00000000000..2da5f63a668
--- /dev/null
+++ b/packages/pieces/community/trello/src/lib/actions/ai/delete-custom-field.ts
@@ -0,0 +1,54 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import {
+ httpClient,
+ HttpRequest,
+ HttpMethod,
+} from '@activepieces/pieces-common';
+import { trelloCommon } from '../../common';
+import { trelloAuth } from '../../..';
+import { withAuthParams, rethrowTrelloError } from './ai-common';
+import { deleteCustomFieldActionOutputSchema } from '../../output-schemas';
+
+export const deleteCustomField = createAction({
+ auth: trelloAuth,
+ name: 'delete_custom_field',
+ classification: 'DESTRUCTIVE',
+ displayName: 'Delete Custom Field (Agent)',
+ description: 'Permanently delete a custom field and every value stored in it.',
+ audience: 'ai',
+ outputSchema: deleteCustomFieldActionOutputSchema,
+ aiMetadata: {
+ description:
+ 'Permanently deletes a custom field definition from its board, discarding the value every card held in that field. This cannot be undone and affects all cards on the board at once, so confirm the field with Get Custom Field first. Deleting an already-deleted field errors rather than succeeding, so it is not idempotent.',
+ idempotent: false,
+ },
+ props: {
+ custom_field_id: Property.ShortText({
+ displayName: 'Custom Field ID',
+ description:
+ 'The ID of the custom field to delete. Obtain it from List Board Custom Fields.',
+ required: true,
+ }),
+ },
+
+ async run(context) {
+ try {
+ const request: HttpRequest = {
+ method: HttpMethod.DELETE,
+ url: `${trelloCommon.baseUrl}customFields/${context.propsValue['custom_field_id']}`,
+ headers: { Accept: 'application/json' },
+ queryParams: withAuthParams(context.auth),
+ };
+ await httpClient.sendRequest(request);
+ return {
+ success: true,
+ custom_field_id: context.propsValue['custom_field_id'],
+ };
+ } catch (error: any) {
+ rethrowTrelloError(
+ error,
+ 'Custom field not found. Verify the custom_field_id (resolve it via List Board Custom Fields).'
+ );
+ }
+ },
+});
diff --git a/packages/pieces/community/trello/src/lib/actions/ai/delete-label.ts b/packages/pieces/community/trello/src/lib/actions/ai/delete-label.ts
new file mode 100644
index 00000000000..c29e0c85c7a
--- /dev/null
+++ b/packages/pieces/community/trello/src/lib/actions/ai/delete-label.ts
@@ -0,0 +1,51 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import {
+ httpClient,
+ HttpRequest,
+ HttpMethod,
+} from '@activepieces/pieces-common';
+import { trelloCommon } from '../../common';
+import { trelloAuth } from '../../..';
+import { withAuthParams, rethrowTrelloError } from './ai-common';
+import { deleteLabelActionOutputSchema } from '../../output-schemas';
+
+export const deleteLabel = createAction({
+ auth: trelloAuth,
+ name: 'delete_label',
+ classification: 'DESTRUCTIVE',
+ displayName: 'Delete Label (Agent)',
+ description: 'Permanently delete a label from its board.',
+ audience: 'ai',
+ outputSchema: deleteLabelActionOutputSchema,
+ aiMetadata: {
+ description:
+ 'Permanently deletes a label from its board, which also strips it from every card that carried it. This affects the whole board rather than one card, so use Remove Label From Card when the intent is to untag a single card. Resolve the label_id with List Board Labels first; deleting an already-deleted label errors rather than succeeding, so it is not idempotent.',
+ idempotent: false,
+ },
+ props: {
+ label_id: Property.ShortText({
+ displayName: 'Label ID',
+ description:
+ 'The ID of the label to delete. Obtain it from List Board Labels.',
+ required: true,
+ }),
+ },
+
+ async run(context) {
+ try {
+ const request: HttpRequest = {
+ method: HttpMethod.DELETE,
+ url: `${trelloCommon.baseUrl}labels/${context.propsValue['label_id']}`,
+ headers: { Accept: 'application/json' },
+ queryParams: withAuthParams(context.auth),
+ };
+ await httpClient.sendRequest(request);
+ return { success: true, label_id: context.propsValue['label_id'] };
+ } catch (error: any) {
+ rethrowTrelloError(
+ error,
+ 'Label not found. Verify the label_id (resolve it via List Board Labels).'
+ );
+ }
+ },
+});
diff --git a/packages/pieces/community/trello/src/lib/actions/ai/get-custom-field.ts b/packages/pieces/community/trello/src/lib/actions/ai/get-custom-field.ts
new file mode 100644
index 00000000000..1a0761f0176
--- /dev/null
+++ b/packages/pieces/community/trello/src/lib/actions/ai/get-custom-field.ts
@@ -0,0 +1,53 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import {
+ httpClient,
+ HttpRequest,
+ HttpMethod,
+} from '@activepieces/pieces-common';
+import { trelloCommon } from '../../common';
+import { trelloAuth } from '../../..';
+import { withAuthParams, rethrowTrelloError } from './ai-common';
+import { customFieldActionOutputSchema } from '../../output-schemas';
+
+export const getCustomField = createAction({
+ auth: trelloAuth,
+ name: 'get_custom_field',
+ classification: 'READ',
+ displayName: 'Get Custom Field (Agent)',
+ description: 'Read one custom field definition by id.',
+ audience: 'ai',
+ outputSchema: customFieldActionOutputSchema,
+ aiMetadata: {
+ description:
+ 'Reads a single custom field definition, returning its name, type and the board it belongs to. Use it to confirm a field type before writing a value, since Set Card Custom Field Value needs a different body per type. Use List Board Custom Fields when only the board is known. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ custom_field_id: Property.ShortText({
+ displayName: 'Custom Field ID',
+ description:
+ 'The ID of the custom field. Obtain it from List Board Custom Fields.',
+ required: true,
+ }),
+ },
+
+ async run(context) {
+ try {
+ const request: HttpRequest = {
+ method: HttpMethod.GET,
+ url: `${trelloCommon.baseUrl}customFields/${context.propsValue['custom_field_id']}`,
+ headers: { Accept: 'application/json' },
+ queryParams: withAuthParams(context.auth),
+ };
+ const response = await httpClient.sendRequest<Record<string, unknown>>(
+ request
+ );
+ return response.body;
+ } catch (error: any) {
+ rethrowTrelloError(
+ error,
+ 'Custom field not found. Verify the custom_field_id (resolve it via List Board Custom Fields).'
+ );
+ }
+ },
+});
diff --git a/packages/pieces/community/trello/src/lib/actions/ai/list-board-custom-fields.ts b/packages/pieces/community/trello/src/lib/actions/ai/list-board-custom-fields.ts
new file mode 100644
index 00000000000..65e0948f657
--- /dev/null
+++ b/packages/pieces/community/trello/src/lib/actions/ai/list-board-custom-fields.ts
@@ -0,0 +1,53 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import {
+ httpClient,
+ HttpRequest,
+ HttpMethod,
+} from '@activepieces/pieces-common';
+import { trelloCommon } from '../../common';
+import { trelloAuth } from '../../..';
+import { withAuthParams, rethrowTrelloError } from './ai-common';
+import { listBoardCustomFieldsActionOutputSchema } from '../../output-schemas';
+
+export const listBoardCustomFields = createAction({
+ auth: trelloAuth,
+ name: 'list_board_custom_fields',
+ classification: 'SEARCH',
+ displayName: 'List Board Custom Fields (Agent)',
+ description: "List the custom fields defined on a board.",
+ audience: 'ai',
+ outputSchema: listBoardCustomFieldsActionOutputSchema,
+ aiMetadata: {
+ description:
+ 'Lists the custom fields defined on a board, returning each field id, name and type. Use it to resolve a custom_field_id before reading or writing a card value with List Card Custom Field Values or Set Card Custom Field Value. Custom fields need the Custom Fields Power-Up enabled on the board; obtain board_id from List Boards. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ board_id: Property.ShortText({
+ displayName: 'Board ID',
+ description: 'The ID of the board. Obtain it from List Boards.',
+ required: true,
+ }),
+ },
+
+ async run(context) {
+ try {
+ const request: HttpRequest = {
+ method: HttpMethod.GET,
+ url: `${trelloCommon.baseUrl}boards/${context.propsValue['board_id']}/customFields`,
+ headers: { Accept: 'application/json' },
+ queryParams: withAuthParams(context.auth),
+ };
+ const response = await httpClient.sendRequest<
+ Array<Record<string, unknown>>
+ >(request);
+ const custom_fields = response.body ?? [];
+ return { custom_fields, count: custom_fields.length };
+ } catch (error: any) {
+ rethrowTrelloError(
+ error,
+ 'Board not found. Verify the board_id (resolve it via List Boards).'
+ );
+ }
+ },
+});
diff --git a/packages/pieces/community/trello/src/lib/actions/ai/list-board-memberships.ts b/packages/pieces/community/trello/src/lib/actions/ai/list-board-memberships.ts
new file mode 100644
index 00000000000..5600043fb5f
--- /dev/null
+++ b/packages/pieces/community/trello/src/lib/actions/ai/list-board-memberships.ts
@@ -0,0 +1,56 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import {
+ httpClient,
+ HttpRequest,
+ HttpMethod,
+} from '@activepieces/pieces-common';
+import { trelloCommon } from '../../common';
+import { trelloAuth } from '../../..';
+import { withAuthParams, rethrowTrelloError } from './ai-common';
+import { listBoardMembershipsActionOutputSchema } from '../../output-schemas';
+
+export const listBoardMemberships = createAction({
+ auth: trelloAuth,
+ name: 'list_board_memberships',
+ classification: 'SEARCH',
+ displayName: 'List Board Memberships (Agent)',
+ description: "List a board's members together with their roles.",
+ audience: 'ai',
+ outputSchema: listBoardMembershipsActionOutputSchema,
+ aiMetadata: {
+ description:
+ 'Lists the members of a board with the role each one holds, such as admin, normal or observer, alongside their username. Use it when the role matters, for example before an action that needs board admin rights; List Board Members returns the same people without their roles. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ board_id: Property.ShortText({
+ displayName: 'Board ID',
+ description: 'The ID of the board. Obtain it from List Boards.',
+ required: true,
+ }),
+ },
+
+ async run(context) {
+ try {
+ const request: HttpRequest = {
+ method: HttpMethod.GET,
+ url: `${trelloCommon.baseUrl}boards/${context.propsValue['board_id']}/memberships`,
+ headers: { Accept: 'application/json' },
+ queryParams: withAuthParams(context.auth, {
+ member: 'true',
+ member_fields: 'username,fullName',
+ }),
+ };
+ const response = await httpClient.sendRequest<
+ Array<Record<string, unknown>>
+ >(request);
+ const memberships = response.body ?? [];
+ return { memberships, count: memberships.length };
+ } catch (error: any) {
+ rethrowTrelloError(
+ error,
+ 'Board not found. Verify the board_id (resolve it via List Boards).'
+ );
+ }
+ },
+});
diff --git a/packages/pieces/community/trello/src/lib/actions/ai/list-card-activity.ts b/packages/pieces/community/trello/src/lib/actions/ai/list-card-activity.ts
new file mode 100644
index 00000000000..cd49821ab8d
--- /dev/null
+++ b/packages/pieces/community/trello/src/lib/actions/ai/list-card-activity.ts
@@ -0,0 +1,88 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import {
+ httpClient,
+ HttpRequest,
+ HttpMethod,
+ QueryParams,
+} from '@activepieces/pieces-common';
+import { trelloCommon } from '../../common';
+import { trelloAuth } from '../../..';
+import { withAuthParams, rethrowTrelloError } from './ai-common';
+import { listCardActivityActionOutputSchema } from '../../output-schemas';
+
+export const listCardActivity = createAction({
+ auth: trelloAuth,
+ name: 'list_card_activity',
+ classification: 'SEARCH',
+ displayName: 'List Card Activity (Agent)',
+ description: "Read a card's activity history.",
+ audience: 'ai',
+ outputSchema: listCardActivityActionOutputSchema,
+ aiMetadata: {
+ description:
+ 'Reads the activity history of a card: when it was created, moved between lists, and who changed it. Use it to answer questions about how a card got to its current state; use List Card Comments for the discussion on a card, which this action leaves out by default. Results are newest first and paginated 50 at a time, so pass an increasing Page to reach older entries. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ card_id: Property.ShortText({
+ displayName: 'Card ID',
+ description: 'The ID of the card. Obtain it from Search Cards.',
+ required: true,
+ }),
+ filter: Property.StaticDropdown({
+ displayName: 'Activity Type',
+ description:
+ 'Which kind of activity to return. Defaults to card updates such as moves between lists.',
+ required: false,
+ defaultValue: 'updateCard',
+ options: {
+ options: [
+ { label: 'Card updates (moves, renames)', value: 'updateCard' },
+ { label: 'Card created', value: 'createCard' },
+ { label: 'Comments', value: 'commentCard' },
+ { label: 'All activity', value: 'all' },
+ ],
+ },
+ }),
+ page: Property.Number({
+ displayName: 'Page',
+ description:
+ 'Zero-based page of 50 entries, up to 19. Omit for the most recent page.',
+ required: false,
+ }),
+ },
+
+ async run(context) {
+ const page = context.propsValue['page'];
+ if (page !== undefined && (!Number.isInteger(page) || page < 0 || page > 19)) {
+ throw new Error('Page must be a whole number between 0 and 19.');
+ }
+
+ const params: QueryParams = {
+ filter: context.propsValue['filter'] ?? 'updateCard',
+ limit: '50',
+ };
+ if (page !== undefined) {
+ params['page'] = String(page);
+ }
+
+ try {
+ const request: HttpRequest = {
+ method: HttpMethod.GET,
+ url: `${trelloCommon.baseUrl}cards/${context.propsValue['card_id']}/actions`,
+ headers: { Accept: 'application/json' },
+ queryParams: withAuthParams(context.auth, params),
+ };
+ const response = await httpClient.sendRequest<
+ Array<Record<string, unknown>>
+ >(request);
+ const activity = response.body ?? [];
+ return { activity, count: activity.length };
+ } catch (error: any) {
+ rethrowTrelloError(
+ error,
+ 'Card not found. Verify the card_id (resolve it via Search Cards).'
+ );
+ }
+ },
+});
diff --git a/packages/pieces/community/trello/src/lib/actions/ai/list-card-custom-field-values.ts b/packages/pieces/community/trello/src/lib/actions/ai/list-card-custom-field-values.ts
new file mode 100644
index 00000000000..668241a7c97
--- /dev/null
+++ b/packages/pieces/community/trello/src/lib/actions/ai/list-card-custom-field-values.ts
@@ -0,0 +1,53 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import {
+ httpClient,
+ HttpRequest,
+ HttpMethod,
+} from '@activepieces/pieces-common';
+import { trelloCommon } from '../../common';
+import { trelloAuth } from '../../..';
+import { withAuthParams, rethrowTrelloError } from './ai-common';
+import { listCardCustomFieldValuesActionOutputSchema } from '../../output-schemas';
+
+export const listCardCustomFieldValues = createAction({
+ auth: trelloAuth,
+ name: 'list_card_custom_field_values',
+ classification: 'READ',
+ displayName: 'List Card Custom Field Values (Agent)',
+ description: 'Read the custom field values set on a card.',
+ audience: 'ai',
+ outputSchema: listCardCustomFieldValuesActionOutputSchema,
+ aiMetadata: {
+ description:
+ 'Reads the custom field values set on one card, returning each custom_field_id with its value. Get Card does not include custom fields, so this is the only way to read them. Only fields that have a value on the card come back, so a field missing from the result is unset rather than empty, and dropdown fields return an option id that List Custom Field Options resolves to text. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ card_id: Property.ShortText({
+ displayName: 'Card ID',
+ description: 'The ID of the card. Obtain it from Search Cards.',
+ required: true,
+ }),
+ },
+
+ async run(context) {
+ try {
+ const request: HttpRequest = {
+ method: HttpMethod.GET,
+ url: `${trelloCommon.baseUrl}cards/${context.propsValue['card_id']}/customFieldItems`,
+ headers: { Accept: 'application/json' },
+ queryParams: withAuthParams(context.auth),
+ };
+ const response = await httpClient.sendRequest<
+ Array<Record<string, unknown>>
+ >(request);
+ const custom_field_values = response.body ?? [];
+ return { custom_field_values, count: custom_field_values.length };
+ } catch (error: any) {
+ rethrowTrelloError(
+ error,
+ 'Card not found. Verify the card_id (resolve it via Search Cards).'
+ );
+ }
+ },
+});
diff --git a/packages/pieces/community/trello/src/lib/actions/ai/list-card-votes.ts b/packages/pieces/community/trello/src/lib/actions/ai/list-card-votes.ts
new file mode 100644
index 00000000000..b2c550c76ce
--- /dev/null
+++ b/packages/pieces/community/trello/src/lib/actions/ai/list-card-votes.ts
@@ -0,0 +1,53 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import {
+ httpClient,
+ HttpRequest,
+ HttpMethod,
+} from '@activepieces/pieces-common';
+import { trelloCommon } from '../../common';
+import { trelloAuth } from '../../..';
+import { withAuthParams, rethrowTrelloError } from './ai-common';
+import { listCardVotesActionOutputSchema } from '../../output-schemas';
+
+export const listCardVotes = createAction({
+ auth: trelloAuth,
+ name: 'list_card_votes',
+ classification: 'SEARCH',
+ displayName: 'List Card Votes (Agent)',
+ description: 'List the members who voted on a card.',
+ audience: 'ai',
+ outputSchema: listCardVotesActionOutputSchema,
+ aiMetadata: {
+ description:
+ 'Lists the members who have voted on a card, returning each member id and username, with the count as the vote tally. Use it to rank cards by support, or to check whether a member has already voted before calling Vote On Card or Remove Card Vote. Requires the Voting Power-Up on the board. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ card_id: Property.ShortText({
+ displayName: 'Card ID',
+ description: 'The ID of the card. Obtain it from Search Cards.',
+ required: true,
+ }),
+ },
+
+ async run(context) {
+ try {
+ const request: HttpRequest = {
+ method: HttpMethod.GET,
+ url: `${trelloCommon.baseUrl}cards/${context.propsValue['card_id']}/membersVoted`,
+ headers: { Accept: 'application/json' },
+ queryParams: withAuthParams(context.auth),
+ };
+ const response = await httpClient.sendRequest<
+ Array<Record<string, unknown>>
+ >(request);
+ const voters = response.body ?? [];
+ return { voters, count: voters.length };
+ } catch (error: any) {
+ rethrowTrelloError(
+ error,
+ 'Card not found. Verify the card_id (resolve it via Search Cards).'
+ );
+ }
+ },
+});
diff --git a/packages/pieces/community/trello/src/lib/actions/ai/list-custom-field-options.ts b/packages/pieces/community/trello/src/lib/actions/ai/list-custom-field-options.ts
new file mode 100644
index 00000000000..1a42e01941a
--- /dev/null
+++ b/packages/pieces/community/trello/src/lib/actions/ai/list-custom-field-options.ts
@@ -0,0 +1,54 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import {
+ httpClient,
+ HttpRequest,
+ HttpMethod,
+} from '@activepieces/pieces-common';
+import { trelloCommon } from '../../common';
+import { trelloAuth } from '../../..';
+import { withAuthParams, rethrowTrelloError } from './ai-common';
+import { listCustomFieldOptionsActionOutputSchema } from '../../output-schemas';
+
+export const listCustomFieldOptions = createAction({
+ auth: trelloAuth,
+ name: 'list_custom_field_options',
+ classification: 'SEARCH',
+ displayName: 'List Custom Field Options (Agent)',
+ description: 'List the options of a dropdown custom field.',
+ audience: 'ai',
+ outputSchema: listCustomFieldOptionsActionOutputSchema,
+ aiMetadata: {
+ description:
+ 'Lists the selectable options of a dropdown (list) custom field, returning each option id and its text. Use it to resolve the option id that Set Card Custom Field Value requires, because a dropdown field is written by option id rather than by text. Only dropdown fields have options; other field types return an empty list. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ custom_field_id: Property.ShortText({
+ displayName: 'Custom Field ID',
+ description:
+ 'The ID of a dropdown custom field. Obtain it from List Board Custom Fields.',
+ required: true,
+ }),
+ },
+
+ async run(context) {
+ try {
+ const request: HttpRequest = {
+ method: HttpMethod.GET,
+ url: `${trelloCommon.baseUrl}customFields/${context.propsValue['custom_field_id']}/options`,
+ headers: { Accept: 'application/json' },
+ queryParams: withAuthParams(context.auth),
+ };
+ const response = await httpClient.sendRequest<
+ Array<Record<string, unknown>>
+ >(request);
+ const options = response.body ?? [];
+ return { options, count: options.length };
+ } catch (error: any) {
+ rethrowTrelloError(
+ error,
+ 'Custom field not found. Verify the custom_field_id (resolve it via List Board Custom Fields).'
+ );
+ }
+ },
+});
diff --git a/packages/pieces/community/trello/src/lib/actions/ai/move-list-to-board.ts b/packages/pieces/community/trello/src/lib/actions/ai/move-list-to-board.ts
new file mode 100644
index 00000000000..26215fee8c5
--- /dev/null
+++ b/packages/pieces/community/trello/src/lib/actions/ai/move-list-to-board.ts
@@ -0,0 +1,60 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import {
+ httpClient,
+ HttpRequest,
+ HttpMethod,
+} from '@activepieces/pieces-common';
+import { trelloCommon } from '../../common';
+import { trelloAuth } from '../../..';
+import { withAuthParams, rethrowTrelloError } from './ai-common';
+import { moveListToBoardActionOutputSchema } from '../../output-schemas';
+
+export const moveListToBoard = createAction({
+ auth: trelloAuth,
+ name: 'move_list_to_board',
+ classification: 'WRITE',
+ displayName: 'Move List To Board (Agent)',
+ description: 'Move a whole list, with its cards, to another board.',
+ audience: 'ai',
+ outputSchema: moveListToBoardActionOutputSchema,
+ aiMetadata: {
+ description:
+ 'Moves an entire list, and every card on it, to a different board. Use it to reorganise across boards; use Move All Cards In List to move the cards while leaving the list where it is, and Move Card for a single card. Labels and members that do not exist on the destination board may be dropped from the moved cards, so check the result. Moving a list that already sits on that board is a no-op, so it is idempotent.',
+ idempotent: true,
+ },
+ props: {
+ list_id: Property.ShortText({
+ displayName: 'List ID',
+ description: 'The ID of the list to move. Obtain it from List Lists.',
+ required: true,
+ }),
+ board_id: Property.ShortText({
+ displayName: 'Destination Board ID',
+ description:
+ 'The ID of the board to move the list to. Obtain it from List Boards.',
+ required: true,
+ }),
+ },
+
+ async run(context) {
+ try {
+ const request: HttpRequest = {
+ method: HttpMethod.PUT,
+ url: `${trelloCommon.baseUrl}lists/${context.propsValue['list_id']}/idBoard`,
+ headers: { Accept: 'application/json' },
+ queryParams: withAuthParams(context.auth, {
+ value: context.propsValue['board_id'],
+ }),
+ };
+ const response = await httpClient.sendRequest<Record<string, unknown>>(
+ request
+ );
+ return response.body;
+ } catch (error: any) {
+ rethrowTrelloError(
+ error,
+ 'List or destination board not found. Verify the list_id and board_id.'
+ );
+ }
+ },
+});
diff --git a/packages/pieces/community/trello/src/lib/actions/ai/remove-card-vote.ts b/packages/pieces/community/trello/src/lib/actions/ai/remove-card-vote.ts
new file mode 100644
index 00000000000..2ab05b98d92
--- /dev/null
+++ b/packages/pieces/community/trello/src/lib/actions/ai/remove-card-vote.ts
@@ -0,0 +1,60 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import {
+ httpClient,
+ HttpRequest,
+ HttpMethod,
+} from '@activepieces/pieces-common';
+import { trelloCommon } from '../../common';
+import { trelloAuth } from '../../..';
+import { withAuthParams, rethrowTrelloError } from './ai-common';
+import { removeCardVoteActionOutputSchema } from '../../output-schemas';
+
+export const removeCardVote = createAction({
+ auth: trelloAuth,
+ name: 'remove_card_vote',
+ classification: 'DESTRUCTIVE',
+ displayName: 'Remove Card Vote (Agent)',
+ description: "Remove a member's vote from a card.",
+ audience: 'ai',
+ outputSchema: removeCardVoteActionOutputSchema,
+ aiMetadata: {
+ description:
+ "Removes one member's vote from a card. Use it to undo a vote cast by Vote On Card; check List Card Votes first to confirm the member actually voted, because removing a vote that was never cast returns an error rather than succeeding. Requires the Voting Power-Up on the board. Not idempotent.",
+ idempotent: false,
+ },
+ props: {
+ card_id: Property.ShortText({
+ displayName: 'Card ID',
+ description: 'The ID of the card. Obtain it from Search Cards.',
+ required: true,
+ }),
+ member_id: Property.ShortText({
+ displayName: 'Member ID',
+ description:
+ 'The ID of the member whose vote is removed. Obtain it from List Card Votes.',
+ required: true,
+ }),
+ },
+
+ async run(context) {
+ try {
+ const request: HttpRequest = {
+ method: HttpMethod.DELETE,
+ url: `${trelloCommon.baseUrl}cards/${context.propsValue['card_id']}/membersVoted/${context.propsValue['member_id']}`,
+ headers: { Accept: 'application/json' },
+ queryParams: withAuthParams(context.auth),
+ };
+ await httpClient.sendRequest(request);
+ return {
+ success: true,
+ card_id: context.propsValue['card_id'],
+ member_id: context.propsValue['member_id'],
+ };
+ } catch (error: any) {
+ rethrowTrelloError(
+ error,
+ 'Card or vote not found. Verify the card_id and member_id, and that the member has actually voted (check List Card Votes).'
+ );
+ }
+ },
+});
diff --git a/packages/pieces/community/trello/src/lib/actions/ai/set-card-custom-field-value.ts b/packages/pieces/community/trello/src/lib/actions/ai/set-card-custom-field-value.ts
new file mode 100644
index 00000000000..8a9f6a50443
--- /dev/null
+++ b/packages/pieces/community/trello/src/lib/actions/ai/set-card-custom-field-value.ts
@@ -0,0 +1,127 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import {
+ httpClient,
+ HttpRequest,
+ HttpMethod,
+} from '@activepieces/pieces-common';
+import { trelloCommon } from '../../common';
+import { trelloAuth } from '../../..';
+import { withAuthParams, rethrowTrelloError } from './ai-common';
+import { setCardCustomFieldValueActionOutputSchema } from '../../output-schemas';
+
+export const setCardCustomFieldValue = createAction({
+ auth: trelloAuth,
+ name: 'set_card_custom_field_value',
+ classification: 'WRITE',
+ displayName: 'Set Card Custom Field Value (Agent)',
+ description: "Set a custom field's value on a card.",
+ audience: 'ai',
+ outputSchema: setCardCustomFieldValueActionOutputSchema,
+ aiMetadata: {
+ description:
+ 'Sets one custom field value on one card. The Field Type must match the field definition from List Board Custom Fields, because Trello rejects a value written in the wrong shape: text, number and date take the value directly, checkbox takes true or false, and a dropdown takes an option id from List Custom Field Options rather than the option text. Writing the same value again produces the same state, so it is idempotent.',
+ idempotent: true,
+ },
+ props: {
+ card_id: Property.ShortText({
+ displayName: 'Card ID',
+ description: 'The ID of the card. Obtain it from Search Cards.',
+ required: true,
+ }),
+ custom_field_id: Property.ShortText({
+ displayName: 'Custom Field ID',
+ description:
+ 'The ID of the custom field. Obtain it from List Board Custom Fields.',
+ required: true,
+ }),
+ field_type: Property.StaticDropdown({
+ displayName: 'Field Type',
+ description:
+ 'Must match the type of the custom field being written, as reported by List Board Custom Fields.',
+ required: true,
+ options: {
+ options: [
+ { label: 'Text', value: 'text' },
+ { label: 'Number', value: 'number' },
+ { label: 'Date', value: 'date' },
+ { label: 'Checkbox', value: 'checkbox' },
+ { label: 'Dropdown (list)', value: 'list' },
+ ],
+ },
+ }),
+ value: Property.ShortText({
+ displayName: 'Value',
+ description:
+ 'Text for a text field, digits for a number, an ISO 8601 timestamp such as 2026-03-13T16:00:00.000Z for a date, true or false for a checkbox, or an option id from List Custom Field Options for a dropdown.',
+ required: true,
+ }),
+ },
+
+ async run(context) {
+ const fieldType = context.propsValue['field_type'];
+ const body = buildValueBody({
+ fieldType,
+ value: context.propsValue['value'],
+ });
+
+ try {
+ const request: HttpRequest = {
+ method: HttpMethod.PUT,
+ url: `${trelloCommon.baseUrl}cards/${context.propsValue['card_id']}/customField/${context.propsValue['custom_field_id']}/item`,
+ headers: {
+ Accept: 'application/json',
+ 'Content-Type': 'application/json',
+ },
+ queryParams: withAuthParams(context.auth),
+ body,
+ };
+ const response = await httpClient.sendRequest<Record<string, unknown>>(
+ request
+ );
+ return response.body;
+ } catch (error: any) {
+ rethrowTrelloError(
+ error,
+ 'Card or custom field not found. Verify the card_id and custom_field_id, and that the Custom Fields Power-Up is enabled on the board.'
+ );
+ }
+ },
+});
+
+function buildValueBody({
+ fieldType,
+ value,
+}: {
+ fieldType: string;
+ value: string;
+}): Record<string, unknown> {
+ switch (fieldType) {
+ case 'text':
+ return { value: { text: value } };
+ case 'number':
+ return { value: { number: value } };
+ case 'date':
+ return { value: { date: value } };
+ case 'checkbox':
+ return { value: { checked: parseCheckbox(value) } };
+ case 'list':
+ return { idValue: value };
+ default:
+ throw new Error(
+ `Unsupported field type "${fieldType}". Use text, number, date, checkbox or list.`
+ );
+ }
+}
+
+function parseCheckbox(value: string): boolean {
+ const normalized = value.trim().toLowerCase();
+ if (normalized === 'true') {
+ return true;
+ }
+ if (normalized === 'false') {
+ return false;
+ }
+ throw new Error(
+ `Checkbox fields accept only "true" or "false", but received "${value}".`
+ );
+}
diff --git a/packages/pieces/community/trello/src/lib/actions/ai/update-checklist-item.ts b/packages/pieces/community/trello/src/lib/actions/ai/update-checklist-item.ts
new file mode 100644
index 00000000000..7ed698f4d03
--- /dev/null
+++ b/packages/pieces/community/trello/src/lib/actions/ai/update-checklist-item.ts
@@ -0,0 +1,104 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import {
+ httpClient,
+ HttpRequest,
+ HttpMethod,
+ QueryParams,
+} from '@activepieces/pieces-common';
+import { trelloCommon } from '../../common';
+import { trelloAuth } from '../../..';
+import { withAuthParams, rethrowTrelloError } from './ai-common';
+import { updateChecklistItemActionOutputSchema } from '../../output-schemas';
+
+export const updateChecklistItem = createAction({
+ auth: trelloAuth,
+ name: 'update_checklist_item',
+ classification: 'WRITE',
+ displayName: 'Update Checklist Item (Agent)',
+ description: 'Rename or reposition an item inside a checklist.',
+ audience: 'ai',
+ outputSchema: updateChecklistItemActionOutputSchema,
+ aiMetadata: {
+ description:
+ 'Renames a checklist item or moves it within its checklist, and can also set its complete or incomplete state in the same call. Anything left unset keeps its current value. Use Set Checklist Item State when only ticking or unticking is needed, and Add Checklist Item to create a new entry. Re-sending the same values converges on the same state, so it is idempotent.',
+ idempotent: true,
+ },
+ props: {
+ card_id: Property.ShortText({
+ displayName: 'Card ID',
+ description: 'The ID of the card the checklist belongs to.',
+ required: true,
+ }),
+ checkitem_id: Property.ShortText({
+ displayName: 'Checklist Item ID',
+ description:
+ 'The ID of the checklist item. Obtain it from List Card Checklists.',
+ required: true,
+ }),
+ name: Property.ShortText({
+ displayName: 'Name',
+ description: 'New text for the item. Leave empty to keep it.',
+ required: false,
+ }),
+ state: Property.StaticDropdown({
+ displayName: 'State',
+ description: 'Completion state. Leave empty to keep it.',
+ required: false,
+ options: {
+ options: [
+ { label: 'Complete', value: 'complete' },
+ { label: 'Incomplete', value: 'incomplete' },
+ ],
+ },
+ }),
+ position: Property.StaticDropdown({
+ displayName: 'Position',
+ description:
+ 'Where the item sits within its checklist. Leave empty to keep it.',
+ required: false,
+ options: {
+ options: [
+ { label: 'Top', value: 'top' },
+ { label: 'Bottom', value: 'bottom' },
+ ],
+ },
+ }),
+ },
+
+ async run(context) {
+ const params: QueryParams = {};
+ if (context.propsValue['name']) {
+ params['name'] = context.propsValue['name'];
+ }
+ if (context.propsValue['state']) {
+ params['state'] = context.propsValue['state'];
+ }
+ if (context.propsValue['position']) {
+ params['pos'] = context.propsValue['position'];
+ }
+
+ if (Object.keys(params).length === 0) {
+ throw new Error(
+ 'Provide a name, state or position to update on the checklist item.'
+ );
+ }
+
+ try {
+ const request: HttpRequest = {
+ method: HttpMethod.PUT,
+ url: `${trelloCommon.baseUrl}cards/${context.propsValue['card_id']}/checkItem/${context.propsValue['checkitem_id']}`,
+ headers: { Accept: 'application/json' },
+ queryParams: withAuthParams(context.auth, params),
+ };
+ const response = await httpClient.sendRequest<Record<string, unknown>>(
+ request
+ );
+ return response.body;
+ } catch (error: any) {
+ rethrowTrelloError(
+ error,
+ 'Card or checklist item not found. Verify the card_id and checkitem_id (resolve them via List Card Checklists).'
+ );
+ }
+ },
+});
diff --git a/packages/pieces/community/trello/src/lib/actions/ai/update-checklist.ts b/packages/pieces/community/trello/src/lib/actions/ai/update-checklist.ts
new file mode 100644
index 00000000000..9fc310b36c6
--- /dev/null
+++ b/packages/pieces/community/trello/src/lib/actions/ai/update-checklist.ts
@@ -0,0 +1,85 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import {
+ httpClient,
+ HttpRequest,
+ HttpMethod,
+ QueryParams,
+} from '@activepieces/pieces-common';
+import { trelloCommon } from '../../common';
+import { trelloAuth } from '../../..';
+import { withAuthParams, rethrowTrelloError } from './ai-common';
+import { updateChecklistActionOutputSchema } from '../../output-schemas';
+
+export const updateChecklist = createAction({
+ auth: trelloAuth,
+ name: 'update_checklist',
+ classification: 'WRITE',
+ displayName: 'Update Checklist (Agent)',
+ description: "Rename a checklist or change its position on the card.",
+ audience: 'ai',
+ outputSchema: updateChecklistActionOutputSchema,
+ aiMetadata: {
+ description:
+ 'Renames a checklist or moves it up or down among the checklists on its card. Anything left unset keeps its current value, so the name can be corrected without touching the position. Use Update Checklist Item to change an entry inside the checklist rather than the checklist itself. Re-sending the same values converges on the same state, so it is idempotent.',
+ idempotent: true,
+ },
+ props: {
+ checklist_id: Property.ShortText({
+ displayName: 'Checklist ID',
+ description:
+ 'The ID of the checklist. Obtain it from List Card Checklists.',
+ required: true,
+ }),
+ name: Property.ShortText({
+ displayName: 'Name',
+ description: 'New name for the checklist. Leave empty to keep it.',
+ required: false,
+ }),
+ position: Property.StaticDropdown({
+ displayName: 'Position',
+ description:
+ 'Where the checklist sits among the card checklists. Leave empty to keep it.',
+ required: false,
+ options: {
+ options: [
+ { label: 'Top', value: 'top' },
+ { label: 'Bottom', value: 'bottom' },
+ ],
+ },
+ }),
+ },
+
+ async run(context) {
+ const params: QueryParams = {};
+ if (context.propsValue['name']) {
+ params['name'] = context.propsValue['name'];
+ }
+ if (context.propsValue['position']) {
+ params['pos'] = context.propsValue['position'];
+ }
+
+ if (Object.keys(params).length === 0) {
+ throw new Error(
+ 'Provide a name or a position to update on the checklist.'
+ );
+ }
+
+ try {
+ const request: HttpRequest = {
+ method: HttpMethod.PUT,
+ url: `${trelloCommon.baseUrl}checklists/${context.propsValue['checklist_id']}`,
+ headers: { Accept: 'application/json' },
+ queryParams: withAuthParams(context.auth, params),
+ };
+ const response = await httpClient.sendRequest<Record<string, unknown>>(
+ request
+ );
+ return response.body;
+ } catch (error: any) {
+ rethrowTrelloError(
+ error,
+ 'Checklist not found. Verify the checklist_id (resolve it via List Card Checklists).'
+ );
+ }
+ },
+});
diff --git a/packages/pieces/community/trello/src/lib/actions/ai/vote-on-card.ts b/packages/pieces/community/trello/src/lib/actions/ai/vote-on-card.ts
new file mode 100644
index 00000000000..5ac32bcbf22
--- /dev/null
+++ b/packages/pieces/community/trello/src/lib/actions/ai/vote-on-card.ts
@@ -0,0 +1,58 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import {
+ httpClient,
+ HttpRequest,
+ HttpMethod,
+} from '@activepieces/pieces-common';
+import { trelloCommon } from '../../common';
+import { trelloAuth } from '../../..';
+import { withAuthParams, rethrowTrelloError } from './ai-common';
+
+export const voteOnCard = createAction({
+ auth: trelloAuth,
+ name: 'vote_on_card',
+ classification: 'WRITE',
+ displayName: 'Vote On Card (Agent)',
+ description: 'Add a member vote to a card.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Records a vote on a card on behalf of a board member, whose id comes from Get My Member for the connected user or Search Members for someone else. Voting requires the Voting Power-Up to be enabled on the board, and the member must belong to the board. Voting again as the same member fails rather than doubling the vote, so treat it as not idempotent and use List Card Votes to check first.',
+ idempotent: false,
+ },
+ props: {
+ card_id: Property.ShortText({
+ displayName: 'Card ID',
+ description: 'The ID of the card. Obtain it from Search Cards.',
+ required: true,
+ }),
+ member_id: Property.ShortText({
+ displayName: 'Member ID',
+ description:
+ 'The ID of the member casting the vote. Obtain it from Get My Member or Search Members.',
+ required: true,
+ }),
+ },
+
+ async run(context) {
+ try {
+ const request: HttpRequest = {
+ method: HttpMethod.POST,
+ url: `${trelloCommon.baseUrl}cards/${context.propsValue['card_id']}/membersVoted`,
+ headers: { Accept: 'application/json' },
+ queryParams: withAuthParams(context.auth, {
+ value: context.propsValue['member_id'],
+ }),
+ };
+ const response = await httpClient.sendRequest<Record<string, unknown>>(
+ request
+ );
+ return response.body;
+ } catch (error: any) {
+ rethrowTrelloError(
+ error,
+ 'Card or member not found. Verify the card_id and member_id, and that the Voting Power-Up is enabled on the board.'
+ );
+ }
+ },
+});
diff --git a/packages/pieces/community/trello/src/lib/actions/card-attachment/add-card-attachment.ts b/packages/pieces/community/trello/src/lib/actions/card-attachment/add-card-attachment.ts
index dc1b95051ae..5cda0e4eca0 100644
--- a/packages/pieces/community/trello/src/lib/actions/card-attachment/add-card-attachment.ts
+++ b/packages/pieces/community/trello/src/lib/actions/card-attachment/add-card-attachment.ts
@@ -16,9 +16,8 @@ export const addCardAttachment = createAction({
classification: 'WRITE',
displayName: 'Add Card Attachment',
description: 'Adds an attachment to a card.',
- audience: 'both',
+ audience: 'human',
outputSchema: addCardAttachmentActionOutputSchema,
- aiMetadata: { description: 'Uploads a file as an attachment to a Trello card identified by card_id, optionally naming it, setting its MIME type, and using it as the card cover. Use to attach documents or images to a card. Requires card_id and the file; each call adds a new attachment, so it is not idempotent.', idempotent: false },
props: {
card_id: Property.ShortText({
description: 'The ID of the card to add attachment to',
diff --git a/packages/pieces/community/trello/src/lib/output-schemas.ts b/packages/pieces/community/trello/src/lib/output-schemas.ts
index e5f9a0a030d..cdaf0a29ca1 100644
--- a/packages/pieces/community/trello/src/lib/output-schemas.ts
+++ b/packages/pieces/community/trello/src/lib/output-schemas.ts
@@ -80,6 +80,46 @@ const boardMemberFields: OutputSchema['fields'] = [
{ key: 'username', label: 'Username' },
];
+const customFieldOptionFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Option ID' },
+ { key: 'idCustomField', label: 'Custom Field ID' },
+ {
+ key: 'value',
+ label: 'Value',
+ children: [{ key: 'text', label: 'Text' }],
+ },
+ { key: 'color', label: 'Color' },
+ { key: 'pos', label: 'Position', format: 'number' },
+];
+
+const customFieldFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Custom Field ID' },
+ { key: 'name', label: 'Name' },
+ {
+ key: 'type',
+ label: 'Type',
+ description: 'One of text, number, date, checkbox or list.',
+ },
+ { key: 'idModel', label: 'Board ID' },
+ { key: 'modelType', label: 'Model Type' },
+ { key: 'fieldGroup', label: 'Field Group' },
+ {
+ key: 'display',
+ label: 'Display',
+ children: [
+ { key: 'cardFront', label: 'Show on Card Front', format: 'boolean' },
+ ],
+ },
+ { key: 'pos', label: 'Position', format: 'number' },
+ {
+ key: 'options',
+ label: 'Options',
+ description: 'Present on list (dropdown) fields only.',
+ labelKey: 'id',
+ listItems: customFieldOptionFields,
+ },
+];
+
const checkItemFields: OutputSchema['fields'] = [
{ key: 'id', label: 'Check Item ID' },
{ key: 'name', label: 'Name' },
@@ -367,6 +407,203 @@ export const getCardAttachmentsActionOutputSchema: OutputSchema = {
export const addCardAttachmentActionOutputSchema: OutputSchema = { fields: attachmentFields };
+export const copyCardActionOutputSchema: OutputSchema = { fields: cardFields };
+
+export const addCardAttachmentFromUrlActionOutputSchema: OutputSchema = {
+ fields: attachmentFields,
+};
+
+export const updateChecklistActionOutputSchema: OutputSchema = {
+ fields: checklistFields,
+};
+
+export const updateChecklistItemActionOutputSchema: OutputSchema = {
+ fields: checkItemFields,
+};
+
+export const moveListToBoardActionOutputSchema: OutputSchema = {
+ fields: listFields,
+};
+
+export const listBoardMembershipsActionOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'memberships',
+ label: 'Memberships',
+ labelKey: 'memberType',
+ listItems: [
+ { key: 'id', label: 'Membership ID' },
+ { key: 'idMember', label: 'Member ID' },
+ { key: 'memberType', label: 'Role' },
+ { key: 'unconfirmed', label: 'Invite Pending', format: 'boolean' },
+ { key: 'deactivated', label: 'Deactivated', format: 'boolean' },
+ { key: 'member', label: 'Member', children: boardMemberFields },
+ ],
+ },
+ { key: 'count', label: 'Count', format: 'number' },
+ ],
+};
+
+export const listCardActivityActionOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'activity',
+ label: 'Activity',
+ description:
+ 'Activity entries, newest first, of the requested type. Each carries its type, date and the member who caused it.',
+ labelKey: 'type',
+ listItems: [
+ { key: 'id', label: 'Action ID' },
+ { key: 'type', label: 'Type' },
+ { key: 'date', label: 'Date', format: 'datetime' },
+ { key: 'idMemberCreator', label: 'Member ID' },
+ {
+ key: 'memberCreator',
+ label: 'Member',
+ children: boardMemberFields,
+ },
+ {
+ key: 'data',
+ label: 'Data',
+ description:
+ 'Payload specific to the activity type, such as the comment text or the lists a card moved between.',
+ dynamicKey: true,
+ },
+ ],
+ },
+ { key: 'count', label: 'Count on This Page', format: 'number' },
+ ],
+};
+
+export const listCardVotesActionOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'voters',
+ label: 'Voters',
+ description: 'The members who voted on this card.',
+ labelKey: 'username',
+ listItems: boardMemberFields,
+ },
+ { key: 'count', label: 'Vote Count', format: 'number' },
+ ],
+};
+
+export const deleteBoardActionOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'success', label: 'Success', format: 'boolean' },
+ { key: 'board_id', label: 'Board ID' },
+ ],
+};
+
+export const deleteLabelActionOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'success', label: 'Success', format: 'boolean' },
+ { key: 'label_id', label: 'Label ID' },
+ ],
+};
+
+export const deleteCustomFieldActionOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'success', label: 'Success', format: 'boolean' },
+ { key: 'custom_field_id', label: 'Custom Field ID' },
+ ],
+};
+
+export const removeCardVoteActionOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'success', label: 'Success', format: 'boolean' },
+ { key: 'card_id', label: 'Card ID' },
+ { key: 'member_id', label: 'Member ID' },
+ ],
+};
+
+export const customFieldActionOutputSchema: OutputSchema = {
+ fields: customFieldFields,
+};
+
+export const customFieldOptionActionOutputSchema: OutputSchema = {
+ fields: customFieldOptionFields,
+};
+
+export const listBoardCustomFieldsActionOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'custom_fields',
+ label: 'Custom Fields',
+ labelKey: 'name',
+ listItems: customFieldFields,
+ },
+ { key: 'count', label: 'Count', format: 'number' },
+ ],
+};
+
+export const listCustomFieldOptionsActionOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'options',
+ label: 'Options',
+ labelKey: 'id',
+ listItems: customFieldOptionFields,
+ },
+ { key: 'count', label: 'Count', format: 'number' },
+ ],
+};
+
+export const listCardCustomFieldValuesActionOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'custom_field_values',
+ label: 'Custom Field Values',
+ labelKey: 'idCustomField',
+ listItems: [
+ { key: 'id', label: 'Item ID' },
+ { key: 'idCustomField', label: 'Custom Field ID' },
+ { key: 'idModel', label: 'Card ID' },
+ { key: 'modelType', label: 'Model Type' },
+ {
+ key: 'idValue',
+ label: 'Selected Option ID',
+ description:
+ 'Set on dropdown fields only; resolve it to its text via List Custom Field Options.',
+ },
+ {
+ key: 'value',
+ label: 'Value',
+ description:
+ 'Absent on dropdown fields. Carries exactly one of the keys below, matching the field type.',
+ children: [
+ { key: 'text', label: 'Text' },
+ { key: 'number', label: 'Number' },
+ { key: 'date', label: 'Date', format: 'datetime' },
+ { key: 'checked', label: 'Checked' },
+ ],
+ },
+ ],
+ },
+ { key: 'count', label: 'Count', format: 'number' },
+ ],
+};
+
+export const setCardCustomFieldValueActionOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'id', label: 'Item ID' },
+ { key: 'idCustomField', label: 'Custom Field ID' },
+ { key: 'idModel', label: 'Card ID' },
+ { key: 'modelType', label: 'Model Type' },
+ { key: 'idValue', label: 'Selected Option ID' },
+ {
+ key: 'value',
+ label: 'Value',
+ children: [
+ { key: 'text', label: 'Text' },
+ { key: 'number', label: 'Number' },
+ { key: 'date', label: 'Date', format: 'datetime' },
+ { key: 'checked', label: 'Checked' },
+ ],
+ },
+ ],
+};
+
export const cardMovedTriggerOutputSchema: OutputSchema = { fields: cardFields };
export const newCardTriggerOutputSchema: OutputSchema = { fields: cardFields };