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
TypeScript ai-agentai-agent-toolsai-agentsai-agents-frameworkmcpmcp-servermcp-toolsmcpsn8n-alternativeno-code-automationworkflowworkflow-automationworkflows
import { createAction, Property } from "@activepieces/pieces-framework";
import { housecallProAuth, makeHousecallProRequest } from "../common";
import { HttpMethod } from "@activepieces/pieces-common";
export const convertLeadToEstimateOrJob = createAction({
auth: housecallProAuth,
name: "convert_lead_to_estimate_or_job",
classification: 'WRITE',
displayName: "Convert Lead to Estimate or Job",
description: "Converts a lead into an estimate or job.",
audience: 'both',
aiMetadata: { description: "Convert an existing Housecall Pro lead (by lead ID) into either an estimate or a job, selected via the type field ('estimate' or 'job'). Not idempotent: each call performs a fresh conversion that creates a new estimate or job record.", idempotent: false },
props: {
id: Property.ShortText({
displayName: "Lead ID",
required: true,
}),
type: Property.ShortText({
displayName: "Type",
description: "The type to convert the lead to. Must be either 'estimate' or 'job'",
required: true,
}),
},
async run(context) {
const { auth, propsValue } = context;
const bodyData: Record<string, any> = {
type: propsValue['type'],
};
const response = await makeHousecallProRequest(
auth,
`/leads/${propsValue['id']}/convert`,
HttpMethod.POST,
bodyData
);
return response.body;
},
});