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 { housecallProAuth, makeHousecallProRequest } from "../common";
import { HttpMethod } from "@activepieces/pieces-common";

export const addJobNote = createAction({
  auth: housecallProAuth,
  name: "add_job_note",
  classification: 'WRITE',
  displayName: "Add job note",
  description: "Add a note to a job",
  audience: 'both',
  aiMetadata: {
    description: "Append a text note to a Housecall Pro job by job ID. Not idempotent: each call adds another note, so repeating it creates duplicate notes.",
    idempotent: false,
  },
  props: {
    job_id: Property.ShortText({
      displayName: "Job ID",
      description: "The ID of the job",
      required: true,
    }),
    content: Property.LongText({
      displayName: "Content",
      description: "The content of the note",
      required: true,
    }),
  },
  async run({ auth, propsValue }) {
    const body: Record<string, unknown> = {
      content: propsValue['content'],
    };

    const response = await makeHousecallProRequest(
      auth,
      `/jobs/${propsValue['job_id']}/notes`,
      HttpMethod.POST,
      body
    );

    return response.body;
  },
});