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,
AppConnectionValueForAuthProperty,
} from '@activepieces/pieces-framework';
import {
DedupeStrategy,
Polling,
pollingHelper,
} from '@activepieces/pieces-common';
import { bufferAuth } from '../common/auth';
import { bufferProps, bufferQueries, Channel } from '../common/props';
const polling: Polling<
AppConnectionValueForAuthProperty<typeof bufferAuth>,
{ organizationId: string }
> = {
strategy: DedupeStrategy.TIMEBASED,
async items({ auth, propsValue }) {
const channels = await bufferQueries.fetchChannels(
auth.secret_text,
propsValue.organizationId,
);
return channels.map((channel) => ({
epochMilliSeconds: channel.createdAt
? new Date(channel.createdAt).getTime()
: 0,
data: channel,
}));
},
};
export const newChannel = createTrigger({
auth: bufferAuth,
name: 'new_channel',
classification: 'READ',
displayName: 'New Channel',
description: 'Triggers when a new channel is connected to your Buffer organization.',
aiMetadata: {
description:
'Fires when a new social media channel (e.g. a Facebook page, Instagram or X account) is connected to the selected Buffer organization, representing the newly linked channel.',
},
type: TriggerStrategy.POLLING,
props: {
organizationId: bufferProps.organizationId(),
},
sampleData: {
id: 'channel_id_example',
name: 'My Page',
service: 'facebook',
organizationId: 'org_id_example',
createdAt: '2026-05-25T10:00:00.000Z',
} satisfies Channel,
async onEnable(context) {
await pollingHelper.onEnable(polling, context);
},
async onDisable(context) {
await pollingHelper.onDisable(polling, context);
},
async test(context) {
return await pollingHelper.test(polling, context);
},
async run(context) {
return await pollingHelper.poll(polling, context);
},
});