Skip to content

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

1.3 KB
Raw Blame
import { createTrigger, TriggerStrategy } from '@activepieces/pieces-framework';
import { simplybookAuth} from '../common';

export const bookingCanceled = createTrigger({
  auth: simplybookAuth,
  name: 'booking_canceled',
  classification: 'READ',
  displayName: 'Booking Cancellation',
  description: 'Triggers when a booking is canceled in SimplyBook.me',
  aiMetadata: {
    description: 'Fires when an existing booking is canceled in SimplyBook.me (the platform webhook with notification_type "cancel"). Represents an appointment that has been called off, by either the client or an admin.',
  },
  type: TriggerStrategy.WEBHOOK,
  props: {},
  async onEnable(context) {
    // Subscribe to 'cancel' event webhook will be added through simplybook platform
  },
  async onDisable(context) {
    // Subscribe to 'cancel' event webhook will be removed through simplybook platform
  },
  async run(context) {
    const body = context.payload.body as any;
    if (body.notification_type !== 'cancel') {
      return [];
    }
    return [body];
  },
  sampleData: {
    booking_id: '4',
    booking_hash: 'cfae2b34e23ec6e68545d60532234ae8',
    company: 'examplecompany',
    notification_type: 'cancel',
    webhook_timestamp: 1759919125,
    signature_algo: 'sha256',
  },
});