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,
createTrigger,
TriggerStrategy,
} from '@activepieces/pieces-framework';
import { DedupeStrategy, Polling, pollingHelper } from '@activepieces/pieces-common';
import { confluenceAuth } from '../auth';
import { confluenceApi } from '../common/api';
import { confluenceProps } from '../common/props';
import { newPageOutputSchema } from '../output-schemas';
const props = {
spaceId: confluenceProps.spaceId({ required: true }),
};
const polling: Polling<
AppConnectionValueForAuthProperty<typeof confluenceAuth>, { spaceId?: string,pageId?: string }> = {
strategy: DedupeStrategy.TIMEBASED,
async items({ auth, propsValue }) {
const results = await confluenceApi.listSpacePages({
auth,
spaceId: propsValue.spaceId,
sort: '-created-date',
});
return results.map((page) => ({
epochMilliSeconds: new Date(page.createdAt).getTime(),
data: page,
}));
},
};
export const newPageTrigger = createTrigger({
name: 'new-page',
outputSchema: newPageOutputSchema,
classification: 'READ',
displayName: 'New Page',
description: 'Triggers when a new page is created.',
aiMetadata: {
description: 'Fires when a new page is created in the selected Confluence space. Polls for recently created pages; each event represents one newly created page with its metadata.',
},
auth: confluenceAuth,
type: TriggerStrategy.POLLING,
props,
async onEnable(context) {
await pollingHelper.onEnable(polling, context);
},
async onDisable(context) {
await pollingHelper.onDisable(polling, context);
},
async run(context) {
return await pollingHelper.poll(polling, context);
},
async test(context) {
return await pollingHelper.test(polling, context);
},
sampleData: {
parentType: 'page',
parentId: '123456',
spaceId: 'SAMPLE123',
ownerId: '12345678abcd',
lastOwnerId: null,
createdAt: '2024-01-01T12:00:00.000Z',
authorId: '12345678abcd',
position: 1000,
version: {
number: 1,
message: 'Initial version',
minorEdit: false,
authorId: '12345678abcd',
createdAt: '2024-01-01T12:00:00.000Z',
},
body: {},
status: 'current',
title: 'Sample Confluence Page',
id: '987654321',
_links: {
editui: '/pages/resumedraft.action?draftId=987654321',
webui: '/spaces/SAMPLE/pages/987654321/Sample+Confluence+Page',
edituiv2: '/spaces/SAMPLE/pages/edit-v2/987654321',
tinyui: '/x/abcd123',
},
},
});