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 { on } from 'events';
import { oncehubAuth } from '../common/auth';
import { makeRequest } from '../common/client';
import { HttpMethod } from '@activepieces/pieces-common';
export const bookingCompleted = createTrigger({
auth: oncehubAuth,
name: 'bookingCompleted',
classification: 'READ',
displayName: 'Booking Completed',
description: 'Triggered when booking end time has passed.',
aiMetadata: {
description:
'Fires when a booking has finished, i.e. its scheduled end time has passed in OnceHub. Use to run follow-up actions after a meeting concludes.',
},
props: {},
sampleData: {},
type: TriggerStrategy.WEBHOOK,
async onEnable(context) {
const api_key = context.auth.secret_text;
const { webhookUrl } = context;
const response = await makeRequest(api_key, HttpMethod.POST, '/webhooks', {
url: webhookUrl,
name: `Booking Completed Webhook - ${new Date().getTime()}`,
events: ['booking.completed'],
});
await context.store.put('webhookId_bookingCompleted', response.id);
},
async onDisable(context) {
const api_key = context.auth.secret_text;
const webhookId = await context.store.get<string>(
'webhookId_bookingCompleted'
);
if (webhookId) {
await makeRequest(api_key, HttpMethod.DELETE, `/webhooks/${webhookId}`);
}
await context.store.delete('webhookId_bookingCompleted');
},
async run(context) {
return [context.payload.body];
},
});