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 } from '@activepieces/pieces-framework';
import { CopperAuth } from '../common/constants';
import { CopperApiService } from '../common/requests';
const CACHE_KEY = 'copper_updated_project_trigger_key';
export const updatedProject = createTrigger({
auth: CopperAuth,
name: 'updatedProject',
displayName: 'Updated Project',
description: 'Triggers when a project is updated.',
aiMetadata: {
description:
'Fires when an existing project is modified in Copper CRM (any field change), via a Copper webhook. Emits the updated project record.',
},
props: {},
sampleData: {},
type: TriggerStrategy.WEBHOOK,
async onEnable(context) {
const response = await CopperApiService.createWebhook(context.auth, {
target: context.webhookUrl,
type: 'project',
event: 'update',
});
await context.store.put(CACHE_KEY, {
webhookId: response.id,
});
},
async onDisable(context) {
const cachedWebhookData = (await context.store.get(CACHE_KEY)) as any;
if (cachedWebhookData) {
await CopperApiService.deleteWebhook(
context.auth,
cachedWebhookData.webhookId
).then(async () => {
await context.store.delete(CACHE_KEY);
});
}
},
async run(context) {
return [context.payload.body];
},
});