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

1.2 KB
Raw Blame
import { pipedriveAuth } from '../auth';
import { createAction, Property } from '@activepieces/pieces-framework';
import { pipedriveApiCall } from '../common';
import { HttpMethod } from '@activepieces/pieces-common';
import { getNoteActionOutputSchema } from '../output-schemas';

export const getNoteAction = createAction({
	auth: pipedriveAuth,
	name: 'get-note',
	outputSchema: getNoteActionOutputSchema,
	classification: 'READ',
	displayName: 'Retrieve a Note',
	description: 'Finds a note by ID.',
	audience: 'both',
	aiMetadata: {
		description:
			'Retrieves a single note by its numeric note ID. Use when you already have the note ID; to list the notes attached to a deal, lead, person, or organization, use Find Notes instead. Read-only and idempotent.',
		idempotent: true,
	},
	props: {
		noteId: Property.Number({
			displayName: 'Note ID',
			required: true,
		}),
	},
	async run(context) {
		try {
			const response = await pipedriveApiCall({
				accessToken: context.auth.access_token,
				apiDomain: context.auth.data['api_domain'],
				method: HttpMethod.GET,
				resourceUri: `/v1/notes/${context.propsValue.noteId}`,
			});
			return response;
		} catch (error) {
			return {
				success: false,
                data:{}
			};
		}
	},
});