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 { createAction, Property } from '@activepieces/pieces-framework';
import { HttpMethod } from '@activepieces/pieces-common';
import { savvyCalApiCall } from '../common';
import { savvyCalAuth, getToken } from '../auth';

export const cancelEventAction = createAction({
  auth: savvyCalAuth,
  name: 'cancel_event',
  displayName: 'Cancel Event',
  description: 'Cancels a scheduled meeting in SavvyCal.',
  audience: 'both',
  aiMetadata: { description: 'Cancels a scheduled SavvyCal meeting identified by its event id. Use when a booking needs to be called off; obtain the event id from a trigger, List Events, or Get Event. Cancelling an already-cancelled event has no further effect, but this mutates state and is not a read.', idempotent: false },
  props: {
    event_id: Property.ShortText({
      displayName: 'Event ID',
      description: 'The unique ID of the event to cancel. You can find this from the output of a trigger or the List Events / Get Event actions.',
      required: true,
    }),
  },
  async run(context) {
    await savvyCalApiCall({
      token: getToken(context.auth),
      method: HttpMethod.POST,
      path: `/events/${context.propsValue.event_id}/cancel`,
    });

    return {
      success: true,
      event_id: context.propsValue.event_id,
      message: 'Event cancelled successfully.',
    };
  },
});