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.3 KB
Raw Blame
import { createAction, Property } from "@activepieces/pieces-framework";
import { housecallProAuth, makeHousecallProRequest } from "../common";
import { HttpMethod } from "@activepieces/pieces-common";

export const createEstimateOptionNote = createAction({
  auth: housecallProAuth,
  name: "create_estimate_option_note",
  classification: 'WRITE',
  displayName: "Create estimate option note",
  description: "Create a new estimate option note",
  audience: 'both',
  aiMetadata: { description: "Add a free-text note to a specific option within a Housecall Pro estimate, identified by estimate ID and option ID. Not idempotent: repeated calls create additional notes. Use delete-estimate-option-note to remove a note.", idempotent: false },
  props: {
    estimate_id: Property.ShortText({ displayName: "Estimate ID", required: true }),
    option_id: Property.ShortText({ displayName: "Option ID", required: true }),
    content: Property.LongText({ displayName: "Content", required: true }),
  },
  async run({ auth, propsValue }) {
    const response = await makeHousecallProRequest(
      auth,
      `/estimates/${propsValue["estimate_id"]}/options/${propsValue["option_id"]}/notes`,
      HttpMethod.POST,
      { content: propsValue["content"] }
    );
    return response.body;
  },
});