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

4.2 KB
Raw Blame
import { createAction, Property } from '@activepieces/pieces-framework';
import { recallAiAuth } from '../common/auth';
import { makeRequest } from '../common/client';
import { HttpMethod } from '@activepieces/pieces-common';

export const createBot = createAction({
  auth: recallAiAuth,
  name: 'createBot',
  displayName: 'create bot',
  description: 'Creates a new bot that will join a meeting',
  audience: 'both',
  aiMetadata: { description: 'Dispatches a Recall.ai notetaker bot to join a video meeting (Zoom, Google Meet, Microsoft Teams, etc.) at the given meeting URL so it can record and transcribe the call. Use to start capturing a meeting; the meeting URL is required and the optional bot name (max 100 chars) sets the display name shown to participants. Not idempotent — each call spins up a new bot instance, even for the same meeting URL.', idempotent: false },
  props: {
    meeting_url: Property.ShortText({
      displayName: 'Meeting URL',
      description:
        'The URL of the meeting (e.g., https://zoom.us/j/123?pwd=456)',
      required: true,
    }),
    bot_name: Property.ShortText({
      displayName: 'Bot Name',
      description:
        'The name of the bot that will be displayed in the call (max 100 characters). Defaults to "Meeting Notetaker"',
      required: false,
    }),
    // recording_config: Property.Json({
    //   displayName: 'Recording Config',
    //   description:
    //     'Configure the recording generated by the bot including transcript options, layout, and when to start recording',
    //   required: false,
    //   defaultValue: {},
    // }),
    // output_media: Property.Json({
    //   displayName: 'Output Media',
    //   description:
    //     'Settings for the bot output media including video and audio output options',
    //   required: false,
    // }),
    // chat: Property.Json({
    //   displayName: 'Chat',
    //   description:
    //     'Settings for the bot to send chat messages (supported for Zoom, Google Meet, and Microsoft Teams)',
    //   required: false,
    // }),
    // automatic_leave: Property.Json({
    //   displayName: 'Automatic Leave',
    //   description: 'Configure when the bot automatically leaves the meeting',
    //   required: false,
    // }),
    // variant: Property.Json({
    //   displayName: 'Variant',
    //   description:
    //     'Configure bot variants per meeting platforms (e.g., {"zoom": "web_4_core"})',
    //   required: false,
    // }),
    // breakout_room: Property.Json({
    //   displayName: 'Breakout Room',
    //   description:
    //     'Configure how the bot handles breakout rooms (Zoom only). Options: {"mode": "join_main_room"}, {"mode": "join_specific_room", "room_id": ""}, or {"mode": "auto_accept_all_invites"}',
    //   required: false,
    // }),
    // metadata: Property.Json({
    //   displayName: 'Metadata',
    //   description: 'Custom metadata to attach to the bot',
    //   required: false,
    // }),
  },
  async run(context) {
    const {
      meeting_url,
      bot_name,

      // recording_config,
      // output_media,
      // chat,
      // automatic_leave,
      // variant,
      // zoom,
      // google_meet,
      // breakout_room,
      // metadata,
    } = context.propsValue;

    const body: Record<string, unknown> = {
      meeting_url,
    };

    if (bot_name) {
      body['bot_name'] = bot_name;
    }

    // if (recording_config) {
    //   body['recording_config'] = recording_config;
    // }

    // if (output_media) {
    //   body['output_media'] = output_media;
    // }

    // if (chat) {
    //   body['chat'] = chat;
    // }

    // if (automatic_leave) {
    //   body['automatic_leave'] = automatic_leave;
    // }

    // if (variant) {
    //   body['variant'] = variant;
    // }

    // if (zoom) {
    //   body['zoom'] = zoom;
    // }

    // if (google_meet) {
    //   body['google_meet'] = google_meet;
    // }

    // if (breakout_room) {
    //   body['breakout_room'] = breakout_room;
    // }

    // if (metadata) {
    //   body['metadata'] = metadata;
    // }

    const response = await makeRequest(
      context.auth.props.server,
      context.auth.props.api_key,
      HttpMethod.POST,
      '/bot/',
      body
    );

    return response;
  },
});