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 { createTrigger, TriggerStrategy, OAuth2PropertyValue } from '@activepieces/pieces-framework';
import { connectucAuth } from '../../index';
import { registerConnectUCWebhook, unregisterConnectUCWebhook } from '../common/webhook-helpers';
import { domainProp, usersProp } from '../common/props';
export const newCdr = createTrigger({
auth: connectucAuth,
name: 'newCdr',
classification: 'READ',
displayName: 'New CDR',
description: 'Triggers when a new Call Detail Record (CDR) is created',
aiMetadata: {
description: 'Fires when a new Call Detail Record (CDR) is created for the selected ConnectUC domain and users. Represents a logged call (incoming or outgoing) with its metadata such as direction, duration, from/to numbers, and disposition.',
},
props: {
domain: domainProp(),
users: usersProp(),
},
sampleData: {
id: "17624380791dba1cd5a13fcb8b4c6b66094f564b0fa",
contactId: null,
dateTime: "2025-11-06T14:07:59.000Z",
duration: 8,
toLabel: "7862881234",
toNumber: "7862881235",
recordingId: null,
origCallid: "8c0spnvbfr8gltgqfseo",
termCallid: "20251106140759036333-7e6c15a2661d06d7d0281ecd502b4679",
missed: false,
direction: "outgoing",
fromLabel: "Example",
fromNumber: "17869811611",
voicemailId: null,
recordingType: null,
disposition: null,
reason: null,
onnet: 0,
uid: "[email protected]"
},
type: TriggerStrategy.WEBHOOK,
async onEnable(context){
const auth = context.auth as OAuth2PropertyValue;
await registerConnectUCWebhook({
auth: {
access_token: auth.access_token,
},
webhookUrl: context.webhookUrl,
event: 'CdrCreated',
context,
});
},
async onDisable(context){
const auth = context.auth as OAuth2PropertyValue;
await unregisterConnectUCWebhook({
auth: {
access_token: auth.access_token,
},
webhookUrl: context.webhookUrl,
context,
});
},
async run(context){
return [context.payload.body]
}
})