Integration

Learn how to integrate the Meeting BaaS SDK with your applications and MCP servers.

This guide uses v2 API, the recommended version for new projects. Get your API key at dashboard.meetingbaas.com.

SDK Integration

The Meeting BaaS SDK provides a clean, type-safe interface for integrating with the Meeting BaaS API. Here are the main integration patterns:

Basic SDK Integration

The simplest way to integrate the SDK:

import { createBaasClient } from '@meeting-baas/sdk';

// Create a v2 BaaS client with your API key
const client = createBaasClient({
  api_key: process.env.MEETING_BAAS_API_KEY,
  api_version: 'v2'
});

// Use the client for API calls
const { success, data, error } = await client.createBot({
  bot_name: 'My Bot',
  meeting_url: 'https://meet.google.com/abc-def-ghi',
});

if (success) {
  console.log('Bot created successfully:', data.bot_id);
} else {
  console.error('Error creating bot:', error);
}

MCP Server Integration

For MCP (Model Context Protocol) server integration, you can use the SDK functions directly within your tool handlers:

import { createBaasClient } from "@meeting-baas/sdk"
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"
import { z } from "zod"

// Create an MCP server
const server = new McpServer({
  name: "demo-server",
  version: "1.0.0"
})

// @modelcontextprotocol/sdk expects the input schema to be a ZodRawShape (plain object with zod types)
const createBotInputSchema = {
  bot_name: z.string().default("Meeting BaaS Bot"),
  meeting_url: z.string()
}

// Add a createBot tool
server.registerTool(
  "createBot",
  {
    title: "Send a Meeting BaaS bot to a meeting",
    description:
      "Send a Meeting BaaS bot to a Google Meet/Teams/Zoom meeting to automatically record and transcribe the meeting with speech diarization",
    inputSchema: createBotInputSchema
  },
  async (args) => {
    const client = createBaasClient({
      api_key: "your-api-key",
      api_version: "v2"
    })

    const { success, data, error } = await client.createBot(args)

    if (success) {
      return {
        content: [{ type: "text", text: `Successfully created bot: ${JSON.stringify(data)}` }]
      }
    }

    return {
      content: [{ type: "text", text: `Failed to create bot: ${error}` }]
    }
  }
)

Calendar Integration

For calendar integration:

import { createBaasClient } from '@meeting-baas/sdk';

const client = createBaasClient({
  api_key: 'your-api-key',
  api_version: 'v2'
});

// Create a calendar connection
const calendarResult = await client.createCalendarConnection({
  calendar_platform: 'google',
  oauth_client_id: 'your-oauth-client-id',
  oauth_client_secret: 'your-oauth-client-secret',
  oauth_refresh_token: 'your-oauth-refresh-token',
  raw_calendar_id: 'primary'
});

if (calendarResult.success) {
  console.log('Calendar connected:', calendarResult.data);

  // List all calendars
  const calendarsResult = await client.listCalendars();
  if (calendarsResult.success) {
    console.log('All calendars:', calendarsResult.data);
  }

  // List events from a calendar
  const eventsResult = await client.listEvents({
    calendar_id: calendarResult.data.calendar_id
  });
  
  if (eventsResult.success) {
    console.log('Events:', eventsResult.data);
  }

  // Schedule a bot for an event
  if (eventsResult.success && eventsResult.data.events.length > 0) {
    const scheduleResult = await client.createCalendarBot({
      calendar_id: calendarResult.data.calendar_id,
      body: {
        event_id: eventsResult.data.events[0].event_id,
        bot_name: 'Event Recording Bot'
      }
    });
    
    if (scheduleResult.success) {
      console.log('Bot scheduled for event successfully');
    }
  }
} else {
  console.error('Error connecting calendar:', calendarResult.error);
}

Next.js API Route Example

For Next.js applications:

// app/api/meeting-baas/route.ts
import { createBaasClient } from "@meeting-baas/sdk";

export async function POST(req: Request) {
  const { meeting_url, bot_name } = await req.json();

  const client = createBaasClient({
    api_key: process.env.MEETING_BAAS_API_KEY!,
    api_version: 'v2'
  });

  const result = await client.createBot({
    meeting_url,
    bot_name: bot_name || 'Meeting BaaS Bot',
  });

  if (result.success) {
    return Response.json({ 
      success: true, 
      bot_id: result.data.bot_id 
    });
  } else {
    return Response.json({ 
      success: false, 
      error: result.error,
      code: result.code
    }, { status: result.statusCode || 400 });
  }
}

Express.js Integration

For Express.js applications:

import express from 'express';
import { createBaasClient } from '@meeting-baas/sdk';

const app = express();
app.use(express.json());

const client = createBaasClient({
  api_key: process.env.MEETING_BAAS_API_KEY!,
  api_version: 'v2'
});

app.post('/create-bot', async (req, res) => {
  const { meeting_url, bot_name } = req.body;

  const result = await client.createBot({
    meeting_url,
    bot_name: bot_name || 'Meeting BaaS Bot',
  });

  if (result.success) {
    res.json({ 
      success: true, 
      bot_id: result.data.bot_id 
    });
  } else {
    res.status(result.statusCode || 400).json({ 
      success: false, 
      error: result.error,
      code: result.code
    });
  }
});

app.listen(3000, () => {
  console.log('Server running on port 3000');
});

On this page