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 { createAction, Property } from '@activepieces/pieces-framework';
import { HttpMethod } from '@activepieces/pieces-common';
import { podioAuth } from '../auth';
import { podioApiCall, getAccessToken, dynamicTaskProperty } from '../common';

export const findTaskAction = createAction({
  auth: podioAuth,
  name: 'find_task',
  classification: 'READ',
  displayName: 'Find Task',
  description: 'Retrieve a task by ID for further updates.',
  audience: 'both',
  aiMetadata: { description: 'Fetches a single Podio task by its task id. Use to read a task\'s current details before updating it or to verify it exists; requires the task id. Idempotent — a read that does not modify data.', idempotent: true },
  props: {
    taskId: dynamicTaskProperty,
  },
  async run(context) {
    const accessToken = getAccessToken(context.auth);
    const { taskId } = context.propsValue;

    if (!taskId) {
      throw new Error('Task selection is required. Please select a task from the dropdown.');
    }

    const response = await podioApiCall<any>({
      method: HttpMethod.GET,
      accessToken,
      resourceUri: `/task/${taskId}`,
    });

    return response;
  },
});