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 createCrmContactAction = createAction({
auth: whatsscaleAuth,
name: 'whatsscale_create_crm_contact',
classification: 'WRITE',
displayName: 'Create a CRM Contact',
description: 'Add a new contact to your WhatsScale CRM',
audience: 'both',
aiMetadata: { description: 'Create a new WhatsScale CRM contact from a phone number (with country code), optionally setting a name and a list of tags. Not idempotent: calling it again may produce a duplicate contact, so look the phone up first with Find a CRM Contact by Phone if you need to avoid duplicates.', idempotent: false },
outputSchema: crmContactOutputSchema,
props: {
phone: Property.ShortText({
displayName: 'Phone Number',
description: 'The phone number in international format, digits only (e.g. 31649931832 — no +, spaces or dashes).',
required: true,
}),
name: Property.ShortText({
displayName: 'Name',
description: 'Full name of the contact (e.g. John Smith)',
required: false,
}),
tags: Property.Array({
displayName: 'Tags',
description: 'e.g. vip, customer, lead. Tags are automatically lowercased.',
required: false,
}),
},
async run(context) {
const auth = context.auth.secret_text;
const { phone, name, tags } = context.propsValue;
const body: Record<string, unknown> = { phone };
if (name) body['name'] = name;
if (tags && tags.length > 0) body['tags'] = tags.join(',');
const response = await whatsscaleClient(auth, HttpMethod.POST, '/api/crm/contacts', body);
return flattenCrmContact(response.body as ConductorCrmContact);
},
});