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 { outsetaAuth } from '../auth';
import { OutsetaClient } from '../common/client';
import { makeClient } from '../common/dropdowns';
export const addCustomActivityAction = createAction({
name: 'add_custom_activity',
classification: 'WRITE',
auth: outsetaAuth,
displayName: 'Add Custom Activity',
description:
'Record a custom activity on an account, person, or deal. Activities show on the activity feed and can trigger drip campaigns.',
audience: 'both',
aiMetadata: {
description:
'Records a custom activity entry on an account, person, or deal (entity type selects which, then its UID), appearing in the activity feed and able to start/stop drip campaigns. Use to log a custom event or drive automation; the title must match the drip-campaign start/stop value when used for automation. Not idempotent: each call appends a new activity record.',
idempotent: false,
},
props: {
title: Property.ShortText({
displayName: 'Title',
required: true,
description:
'The activity title. Must match the start/stop value in drip campaigns if used for automation.',
}),
entityType: Property.StaticDropdown({
displayName: 'Entity Type',
required: true,
options: {
options: [
{ label: 'Account', value: 1 },
{ label: 'Person', value: 2 },
{ label: 'Deal', value: 3 },
],
},
}),
entityUid: Property.Dropdown({
auth: outsetaAuth,
displayName: 'Entity',
description: 'Select the account, person, or deal to record the activity on.',
refreshers: ['entityType'],
required: true,
options: async ({ auth, entityType }) => {
const client = makeClient(auth);
if (!client) {
return { disabled: true, options: [], placeholder: 'Connect your Outseta account first.' };
}
if (!entityType) {
return { disabled: true, options: [], placeholder: 'Select an entity type first.' };
}
try {
let path = '';
if (entityType === 1) path = '/api/v1/crm/accounts?limit=100';
else if (entityType === 2) path = '/api/v1/crm/people?limit=100';
else if (entityType === 3) path = '/api/v1/crm/deals?limit=100';
else return { disabled: true, options: [], placeholder: 'Unknown entity type.' };
const res = await client.get<any>(path);
const items: any[] = res?.items ?? res?.Items ?? [];
return {
disabled: false,
options: items.map((item: any) => {
if (entityType === 2) {
return { label: `${item.FullName} (${item.Email ?? item.Uid})`, value: item.Uid };
}
return { label: item.Name ?? item.Uid, value: item.Uid };
}),
};
} catch {
return { disabled: true, options: [], placeholder: 'Failed to load entities.' };
}
},
}),
description: Property.LongText({
displayName: 'Description',
required: false,
}),
activityData: Property.LongText({
displayName: 'Data',
required: false,
description: 'Optional string to store serialized JSON or other metadata with this activity.',
}),
},
async run(context) {
const client = new OutsetaClient({
domain: context.auth.props.domain,
apiKey: context.auth.props.apiKey,
apiSecret: context.auth.props.apiSecret,
});
const body: Record<string, unknown> = {
Title: context.propsValue.title,
EntityType: context.propsValue.entityType,
EntityUid: context.propsValue.entityUid,
};
if (context.propsValue.description) {
body['Description'] = context.propsValue.description;
}
if (context.propsValue.activityData) {
body['ActivityData'] = context.propsValue.activityData;
}
const result = await client.post<any>(
'/api/v1/activities/customactivity',
body
);
return {
uid: result.Uid ?? null,
title: result.Title ?? null,
entity_type: result.EntityType ?? null,
entity_uid: result.EntityUid ?? null,
created: result.Created ?? null,
};
},
});