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 updateCrmContactByIdAction = createAction({
auth: whatsscaleAuth,
name: 'whatsscale_update_crm_contact_by_id',
classification: 'WRITE',
displayName: 'Update a CRM Contact (By ID)',
description: 'Update the name or tags of a CRM contact, entered directly rather than picked from a list.',
audience: 'ai',
aiMetadata: { description: 'Updates the name and/or tags of an existing WhatsScale CRM contact identified by contact ID. Leave a field empty to keep its current value unchanged; tags are replaced wholesale, not merged. Idempotent: re-running with the same values converges the contact to the same state. Its twin Update a CRM Contact makes the identical call but sources the contact from a builder dropdown instead of a free-text ID.', idempotent: true },
outputSchema: crmContactOutputSchema,
props: {
contactId: Property.ShortText({
displayName: 'Contact ID',
description: 'The WhatsScale CRM contact ID (from List CRM Contacts or Find a CRM Contact by Phone).',
required: true,
}),
name: Property.ShortText({
displayName: 'Name',
description: 'Leave empty to keep the current name unchanged. Clearing the name is not supported.',
required: false,
}),
tags: Property.Array({
displayName: 'Tags',
description: 'Replaces all existing tags (e.g. vip, lead). Leave untouched to keep current tags unchanged. Clearing every tag is not supported.',
required: false,
}),
},
async run(context) {
const auth = context.auth.secret_text;
const { contactId, name, tags } = context.propsValue;
const body: Record<string, unknown> = {};
if (name !== undefined && name !== null) body['name'] = name;
if (tags !== undefined) body['tags'] = tags.join(',');
const response = await whatsscaleClient(
auth,
HttpMethod.PATCH,
`/api/crm/contacts/${contactId}`,
body
);
return flattenCrmContact(response.body as ConductorCrmContact);
},
});