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 { makeRequest } from '../common/client';
import { webexAuth } from '../common/auth';

export const findMessage = createAction({
  auth: webexAuth,
  name: 'findMessage',
  classification: 'READ',
  displayName: 'Find Message',
  description: 'Retrieve details for a specific message by message ID',
  audience: 'both',
  aiMetadata: {
    description:
      'Retrieves the details of a single Webex message by its message ID. Use it to look up the content and metadata of a known message. Read-only and idempotent; requires the exact message ID (this is not a search across messages).',
    idempotent: true,
  },
  props: {
    messageId: Property.ShortText({
      displayName: 'Message ID',
      description: 'The unique identifier for the message',
      required: true,
    }),
  },
  async run(context) {
    const messageId = context.propsValue.messageId as string;

    const response = await makeRequest(
      context.auth.access_token,
      HttpMethod.GET,
      `/messages/${encodeURIComponent(messageId)}`,
      undefined
    );

    return response;
  },
});