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

899 B
Raw Blame
import { createAction, Property } from "@activepieces/pieces-framework";
import { housecallProAuth, makeHousecallProRequest } from "../common";
import { HttpMethod } from "@activepieces/pieces-common";

export const getLead = createAction({
  auth: housecallProAuth,
  name: "get_lead",
  classification: 'READ',
  displayName: "Get Lead",
  description: "Get the lead via ID.",
  audience: 'both',
  aiMetadata: {
    description: "Fetch a single Housecall Pro lead by its lead ID. Read-only and repeatable. Requires a known lead ID.",
    idempotent: true,
  },
  props: {
    id: Property.ShortText({
      displayName: "Lead ID",
      required: true,
    }),
  },
  async run(context) {
    const { auth, propsValue } = context;

    const response = await makeHousecallProRequest(
      auth,
      `/leads/${propsValue['id']}`,
      HttpMethod.GET
    );

    return response.body;
  },
});