MeetingRouter

Getting Started with v2 API

@meeting-baas/sdk - v2 API Reference / v2-getting-started

Getting Started with v2 API

This guide will help you get started with the Meeting BaaS v2 API using the SDK.

Installation

npm install @meeting-baas/sdk

Quick Start

Creating a Client

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

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

Creating Your First Bot

async function createBot() {
  const result = await client.createBot({
    meeting_url: "https://meet.google.com/abc-def-ghi",
    bot_name: "My Meeting Assistant"
  });

  if (result.success) {
    console.log("Bot created:", result.data.bot_id);
  } else {
    console.error("Error:", result.error);
  }
}

Key Features

Type-Safe Responses

The v2 API returns structured responses with detailed error information:

type ApiResponseV2\<T\> =
  | { success: true; data: T; error?: never }
  | {
      success: false;
      error: string;
      code: string;
      statusCode: number;
      details: unknown | null;
      data?: never
    }

Batch Operations

Create multiple bots at once:

const result = await client.batchCreateBots({
  bots: [
    { meeting_url: "https://meet.google.com/abc-def-ghi", bot_name: "Bot 1" },
    { meeting_url: "https://zoom.us/j/123456789", bot_name: "Bot 2" }
  ]
});

if (result.success) {
  console.log("Created:", result.data.length);
  console.log("Errors:", result.errors.length);
}

Common Patterns

Bot Lifecycle Management

// 1. Create bot
const createResult = await client.createBot({
  meeting_url: "https://meet.google.com/abc-def-ghi",
  bot_name: "Assistant"
});

if (!createResult.success) {
  console.error("Failed to create bot:", createResult.error);
  return;
}

const botId = createResult.data.bot_id;

// 2. Get bot status
const statusResult = await client.getBot({ bot_id: botId });

if (statusResult.success) {
  console.log("Bot status:", statusResult.data.status);
}

// 3. Stop bot when done
const stopResult = await client.stopBot({ bot_id: botId });

if (stopResult.success) {
  console.log("Bot stopped successfully");
}

Error Handling

const result = await client.createBot({ ... });

if (!result.success) {
  switch (result.code) {
    case "INVALID_MEETING_URL":
      console.error("Invalid meeting URL provided");
      break;
    case "RATE_LIMIT_EXCEEDED":
      console.error("Rate limit exceeded, please try again later");
      break;
    default:
      console.error(`Error: ${result.error}`);
  }
}

Next Steps

On this page