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.7 KB
Raw Blame
import {
  createTrigger,
  TriggerStrategy,
  Property,
} from '@activepieces/pieces-framework';
import { youcanbookmeAuth } from '../common/auth';
export const newBooking = createTrigger({
  auth: youcanbookmeAuth,
  name: 'newBooking',
  classification: 'READ',
  displayName: 'New Booking',
  description: 'Trigger when a new booking is made',
  aiMetadata: {
    description:
      'Fires when a YouCanBookMe webhook notification is received for a booking event. Configured against a booking page notification (e.g. after a new booking is made), it represents an incoming booking with details such as start/end times, time zone, and the booker\'s name and email.',
  },
  props: {
    webhook_setup: Property.MarkDown({
      value: `
## Setting up a Webhook

1. Select the booking page you want to add a webhook to and click **Edit Settings**
2. Select **Additional options** from the left menu
3. Click **Notifications** under the sub-menu
4. Click into the notification you wish to have the webhook fire (After new booking made, rescheduled, cancelled, reminder, after appointment ends, etc)
5. Click the **+** to add a new notification
6. Click **Webhook**
7. Enter the URL provided by Activepieces (copy from the input field below)
	\`\`\`text
			{{webhookUrl}}
			\`\`\`
8. Choose method:
   - **POST** 
9. Add payload (optional)
10. Click **Save changes**
            `,
    }),
  },
  sampleData: {
    startsAt: '2025-12-17',
    endsAt: '08:30',
    timeZone: 'UTC',
    firstName: 'sa',
    email: '[email protected]',
  },
  type: TriggerStrategy.WEBHOOK,
  async onEnable(context) {
    // implement webhook creation logic
  },
  async onDisable(context) {
    // implement webhook deletion logic
  },
  async run(context) {
    return [context.payload.body];
  },
});