Quick Start

Quick guide for integrating with Meeting BaaS services.

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

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

// Create a v2 BaaS client
const client = createBaasClient({
  api_key: 'your-api-key', // Get yours at https://dashboard.meetingbaas.com
  api_version: 'v2'
});

// Create a bot to join a meeting
const { success, data, error } = await client.createBot({
  bot_name: 'Meeting Assistant',
  meeting_url: 'https://meet.google.com/abc-def-ghi',
});

if (success) {
  console.log('Bot created successfully:', data.bot_id);
  
  // Get bot details
  const botDetails = await client.getBotDetails({
    bot_id: data.bot_id
  });
  
  if (botDetails.success) {
    console.log('Bot details:', botDetails.data);
  }
} else {
  console.error('Error creating bot:', error);
}

Usage Examples

Basic Usage

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

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

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

if (createResult.success) {
  console.log('Bot created successfully:', createResult.data.bot_id);
  
  // Get bot details
  const botDetails = await client.getBotDetails({
    bot_id: createResult.data.bot_id
  });
  
  if (botDetails.success) {
    console.log('Bot details:', botDetails.data);
  } else {
    console.error('Error getting bot details:', botDetails.error);
  }
  
  // Delete bot data
  const deleteResult = await client.deleteBotData({
    bot_id: createResult.data.bot_id
  });
  
  if (deleteResult.success) {
    console.log('Bot data deleted successfully');
  }
} else {
  console.error('Error creating bot:', createResult.error);
}

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);
  }
} else {
  console.error('Error connecting calendar:', calendarResult.error);
}

Advanced Usage with Error Handling

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

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

async function comprehensiveExample() {
  // Create a bot with all options
  const createResult = await client.createBot({
    meeting_url: 'https://meet.google.com/abc-defg-hij',
    bot_name: 'Advanced Test Bot',
    bot_image: 'https://example.com/bot-image.jpg',
    entry_message: 'Hello from the advanced test bot!',
    recording_mode: 'speaker_view',
    transcription_config: { 
      provider: 'gladia' 
    },
    extra: { test_id: 'advanced-example' }
  });

  if (createResult.success) {
    const botId = createResult.data.bot_id;
    console.log('Bot created with ID:', botId);

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

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

    // Get bot details
    const detailsResult = await client.getBotDetails({
      bot_id: botId
    });

    if (detailsResult.success) {
      console.log('Bot details:', detailsResult.data);
    }

    // Leave the meeting
    const leaveResult = await client.leaveBot({
      bot_id: botId
    });

    if (leaveResult.success) {
      console.log('Bot left meeting successfully');
    }

    // Delete bot data
    const deleteResult = await client.deleteBotData({
      bot_id: botId
    });

    if (deleteResult.success) {
      console.log('Bot data deleted successfully');
    }
  } else {
    console.error('Error creating bot:', createResult.error);
    console.error('Error code:', createResult.code);
  }
}

On this page