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 { HttpMethod } from '@activepieces/pieces-common';
import { greenhouseAuth } from '../auth';
import { greenhouseApiCall, shapeCandidate, GreenhouseCandidate } from '../common';
export const findCandidateAction = createAction({
name: 'find_candidate',
displayName: 'Find Candidate',
description: 'Searches for a candidate in Greenhouse by email address. Returns the first match.',
audience: 'both',
aiMetadata: {
description:
'Looks up a candidate by exact email address and returns the first match, or a not-found result if none exists. Use to resolve a candidate ID or check whether someone already exists before creating them. Idempotent read-only lookup; matches only on a full email, not partial names.',
idempotent: true,
},
auth: greenhouseAuth,
props: {
email: Property.ShortText({
displayName: 'Email Address',
description: 'The email address to search for. Returns the first candidate whose profile contains this address.',
required: true,
}),
},
async run(context) {
const { email } = context.propsValue;
const response = await greenhouseApiCall<GreenhouseCandidate[]>({
accessToken: context.auth.access_token,
method: HttpMethod.GET,
endpoint: '/candidates',
queryParams: { email },
});
const candidates = Array.isArray(response.body) ? response.body : [];
if (candidates.length === 0) {
return { found: false };
}
return { found: true, ...shapeCandidate(candidates[0]) };
},
});