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 { AppConnectionValueForAuthProperty, TriggerStrategy, createTrigger } from '@activepieces/pieces-framework';
import {
DedupeStrategy,
Polling,
pollingHelper,
} from '@activepieces/pieces-common';
import { currentYear } from '../common';
import { ClockodoClient } from '../common/client';
import { clockodoAuth } from '../auth';
const polling: Polling<AppConnectionValueForAuthProperty<typeof clockodoAuth>, unknown> = {
strategy: DedupeStrategy.LAST_ITEM,
items: async ({ auth }) => {
const { email, token, company_name, company_email } = auth.props;
const client = new ClockodoClient(
email,
token,
company_name,
company_email
);
const time_since = currentYear() - 1 + '-01-01T00:00:00Z';
const time_until = currentYear() + 1 + '-12-31T23:59:59Z';
let res = await client.listEntries({ time_since, time_until });
if (res.paging.count_pages > 1) {
res = await client.listEntries({
time_since,
time_until,
page: res.paging.count_pages,
});
}
return res.entries
.sort((a, b) => b.id - a.id)
.map((a) => ({
id: a.id,
data: a,
}));
},
};
export default createTrigger({
auth: clockodoAuth,
name: 'new_entry',
classification: 'READ',
displayName: 'New Entry',
description: 'Triggers when a new time entry is created',
aiMetadata: {
description: 'Fires when a new time entry is created in Clockodo, such as logged work time, a lump-sum service, or a recorded expense. Emits the newly created entry record, including details like the associated customer, project, service, duration, and billing information.',
},
type: TriggerStrategy.POLLING,
props: {},
sampleData: {},
onEnable: async (context) => {
await pollingHelper.onEnable(polling, context);
},
onDisable: async (context) => {
await pollingHelper.onDisable(polling, context);
},
run: async (context) => {
return await pollingHelper.poll(polling, context);
},
test: async (context) => {
return await pollingHelper.test(polling, context);
},
});