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.5 KB
Raw Blame
import { createAction } from '@activepieces/pieces-framework';
import { Property } from '@activepieces/pieces-framework';
import { HttpMethod, getAccessTokenOrThrow } from '@activepieces/pieces-common';
import { callClickUpApi3, clickupCommon } from '../../common';
import { clickupAuth } from '../../auth';
import { messageRepliesOutputSchema } from '../../output-schemas';

export const getClickupMessageReplies = createAction({
  auth: clickupAuth,
  name: 'get_message_replies',
  classification: 'SEARCH',
  description: "Get the replies in a chat message's thread.",
  audience: 'both',
  aiMetadata: { description: 'Read-only: retrieve the threaded replies to a specific Chat message in a ClickUp workspace, given the workspace and message IDs. Use to read a reply thread; does not post anything. Safe to call repeatedly.', idempotent: true },
  displayName: 'Get Message Replies',
  props: {
    workspace_id: clickupCommon.workspace_id(),
    message_id: Property.ShortText({
      description: 'Returned by Get Channel Messages or Create Message.',
      displayName: 'Message ID',
      required: true,
    }),
  },

  outputSchema: messageRepliesOutputSchema,
  async run(configValue) {
    const { workspace_id, message_id } = configValue.propsValue;
    const response = await callClickUpApi3(
      HttpMethod.GET,
      `workspaces/${workspace_id}/chat/messages/${message_id}/replies`,
      getAccessTokenOrThrow(configValue.auth),
      {},
      {}
    );
    return response.body;
  },
});