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

1004 B
Raw Blame
import { createAction, Property } from "@activepieces/pieces-framework";
import { shippoAuth } from "../../lib/auth";
import { ShippoClient } from "../../lib/client";

export const findOrder = createAction({
  name: 'find_order',
  classification: 'READ',
  displayName: 'Find Order',
  description: 'Search for an order by its ID',
  audience: 'both',
  aiMetadata: { description: 'Retrieves a single Shippo order by its object ID. Use to look up the full details of a known order. Requires the exact order ID; it does not search by order number or other fields. Read-only and idempotent.', idempotent: true },
  auth: shippoAuth,
  props: {
    order_id: Property.ShortText({
      displayName: 'Order ID',
      description: 'The ID of the order to find',
      required: true,
    }),
  },
  async run(context) {
    const { order_id } = context.propsValue;

    const client = new ShippoClient({
      apiToken: context.auth.secret_text,
    });

    return await client.getOrder(order_id);
  },
});