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 { crmContactOutputSchema } from '../../../output-schemas';
import { HttpMethod } from '@activepieces/pieces-common';
import { whatsscaleAuth } from '../../../auth';
import { whatsscaleClient } from '../../../common/client';
import { ConductorCrmContact, flattenCrmContact } from '../../../common/crm';
export const findCrmContactByPhoneAction = createAction({
auth: whatsscaleAuth,
name: 'whatsscale_find_crm_contact_by_phone',
classification: 'READ',
displayName: 'Find a CRM Contact by Phone',
description: 'Look up a CRM contact using their phone number',
audience: 'both',
aiMetadata: { description: 'Fetch a single WhatsScale CRM contact by exact phone number (include country code). Read-only lookup; pick this when you already have the phone and want that one contact, versus List CRM Contacts for browsing/filtering or searching by name. Fails the step with a 404 if the number is not in the CRM, so it cannot be used as a lookup-then-branch predicate without error handling.', idempotent: true },
outputSchema: crmContactOutputSchema,
props: {
phone: Property.ShortText({
displayName: 'Phone Number',
required: true,
}),
},
async run(context) {
const auth = context.auth.secret_text;
const { phone } = context.propsValue;
const encodedPhone = encodeURIComponent(phone);
const response = await whatsscaleClient(
auth,
HttpMethod.GET,
`/api/crm/contacts/phone/${encodedPhone}`,
undefined
);
return flattenCrmContact(response.body as ConductorCrmContact);
},
});