Skip to main content
Copy-paste code examples to get started quickly with the meetergo API.

Quick Reference

const MEETERGO_API = 'https://api.meetergo.com/v4';
const API_KEY = process.env.MEETERGO_API_KEY;

const headers = {
  'Authorization': `Bearer ${API_KEY}`,
  'Content-Type': 'application/json'
};

// Add user ID header for most requests
function withUser(userId) {
  return { ...headers, 'x-meetergo-api-user-id': userId };
}

Authentication

Verify API Key

async function verifyApiKey() {
  const response = await fetch(`${MEETERGO_API}/user/me`, { headers });

  if (!response.ok) {
    throw new Error(`API key invalid: ${response.status}`);
  }

  return response.json();
}

// Usage
const user = await verifyApiKey();
console.log('Authenticated as:', user.email);

Users

Create User

async function createUser({ email, firstName, lastName, timezone = 'Europe/Berlin' }) {
  const response = await fetch(`${MEETERGO_API}/user`, {
    method: 'POST',
    headers,
    body: JSON.stringify({
      email,
      givenName: firstName,
      familyName: lastName,
      timezone
    })
  });

  if (!response.ok) {
    const error = await response.json();
    throw new Error(`Failed to create user: ${error.message}`);
  }

  return response.json();
}

// Usage
const user = await createUser({
  email: '[email protected]',
  firstName: 'John',
  lastName: 'Doe'
});
console.log('Created user:', user.userId);
console.log('Booking URL:', user.bookingUrl);

Availability

Get Available Slots

async function getAvailableSlots(meetingTypeId, startDate, endDate, userId) {
  const params = new URLSearchParams({
    meetingTypeId,
    start: startDate,
    end: endDate
  });

  const response = await fetch(
    `${MEETERGO_API}/booking-availability?${params}`,
    { headers: withUser(userId) }
  );

  const data = await response.json();
  return data.availableSlots || [];
}

// Usage
const slots = await getAvailableSlots(
  'meeting-type-id',
  '2024-01-15',
  '2024-01-22',
  'user-id'
);

slots.forEach(slot => {
  console.log(`Available: ${new Date(slot.start).toLocaleString()}`);
});

Bookings

Create Booking

async function createBooking({
  meetingTypeId,
  start,
  attendee,
  userId
}) {
  const response = await fetch(`${MEETERGO_API}/booking`, {
    method: 'POST',
    headers: withUser(userId),
    body: JSON.stringify({
      meetingTypeId,
      start,
      attendee: {
        email: attendee.email,
        fullname: attendee.name,
        phone: attendee.phone
      }
    })
  });

  if (!response.ok) {
    const error = await response.json();
    throw new Error(`Booking failed: ${error.message}`);
  }

  return response.json();
}

// Usage
const booking = await createBooking({
  meetingTypeId: 'meeting-type-id',
  start: '2024-01-16T10:00:00Z',
  attendee: {
    email: '[email protected]',
    name: 'Jane Client',
    phone: '+1234567890'
  },
  userId: 'user-id'
});

console.log('Booking confirmed:', booking.id);
console.log('Meeting link:', booking.meetingLink);

Cancel Booking

async function cancelBooking(appointmentId, userId, reason = null) {
  const response = await fetch(`${MEETERGO_API}/appointment/${appointmentId}`, {
    method: 'DELETE',
    headers: withUser(userId),
    body: reason ? JSON.stringify({ reason, notifyAttendees: true }) : undefined
  });

  if (!response.ok) {
    throw new Error(`Cancel failed: ${response.status}`);
  }

  return true;
}

// Usage
await cancelBooking('appointment-id', 'user-id', 'Customer requested');

Webhooks

Webhook Handler (Express.js)

const express = require('express');
const app = express();

app.use(express.json());

app.post('/webhooks/meetergo', async (req, res) => {
  // Respond immediately
  res.status(200).send('OK');

  const { event, data } = req.body;

  try {
    switch (event) {
      case 'booking_created':
        console.log('New booking:', data.id);
        // Add to CRM, send notifications, etc.
        break;

      case 'booking_cancelled':
        console.log('Booking cancelled:', data.id);
        // Update records, process refunds, etc.
        break;

      case 'booking_rescheduled':
        console.log('Booking rescheduled:', data.rescheduledAppointment.id);
        // Update calendar, notify team, etc.
        break;
    }
  } catch (error) {
    console.error('Webhook processing failed:', error);
  }
});

app.listen(3000);

Webhook Handler (Python/Flask)

from flask import Flask, request, jsonify
import threading

app = Flask(__name__)

def process_webhook(event, data):
    if event == 'booking_created':
        print(f'New booking: {data["id"]}')
    elif event == 'booking_cancelled':
        print(f'Booking cancelled: {data["id"]}')
    elif event == 'booking_rescheduled':
        print(f'Booking rescheduled: {data["rescheduledAppointment"]["id"]}')

@app.route('/webhooks/meetergo', methods=['POST'])
def webhook():
    payload = request.json
    event = payload.get('event')
    data = payload.get('data')

    # Process in background thread
    thread = threading.Thread(target=process_webhook, args=(event, data))
    thread.start()

    return jsonify({'status': 'ok'}), 200

if __name__ == '__main__':
    app.run(port=3000)

Complete Example: Booking Flow

Full example of checking availability and creating a booking:
class MeetergoClient {
  constructor(apiKey) {
    this.apiKey = apiKey;
    this.baseUrl = 'https://api.meetergo.com/v4';
  }

  async request(method, path, userId = null, body = null) {
    const headers = {
      'Authorization': `Bearer ${this.apiKey}`,
      'Content-Type': 'application/json'
    };

    if (userId) {
      headers['x-meetergo-api-user-id'] = userId;
    }

    const response = await fetch(`${this.baseUrl}${path}`, {
      method,
      headers,
      body: body ? JSON.stringify(body) : undefined
    });

    if (!response.ok) {
      const error = await response.json().catch(() => ({}));
      throw new Error(error.message || `HTTP ${response.status}`);
    }

    return response.json();
  }

  async getAvailability(meetingTypeId, startDate, endDate, userId) {
    const params = new URLSearchParams({
      meetingTypeId,
      start: startDate,
      end: endDate
    });
    return this.request('GET', `/booking-availability?${params}`, userId);
  }

  async createBooking(meetingTypeId, start, attendee, userId) {
    return this.request('POST', '/booking', userId, {
      meetingTypeId,
      start,
      attendee
    });
  }
}

// Usage
async function bookAppointment() {
  const client = new MeetergoClient(process.env.MEETERGO_API_KEY);

  const meetingTypeId = 'your-meeting-type-id';
  const userId = 'your-user-id';

  // 1. Get available slots
  const today = new Date().toISOString().split('T')[0];
  const nextWeek = new Date(Date.now() + 7 * 86400000).toISOString().split('T')[0];

  const availability = await client.getAvailability(
    meetingTypeId,
    today,
    nextWeek,
    userId
  );

  if (!availability.availableSlots?.length) {
    throw new Error('No available slots');
  }

  // 2. Book the first available slot
  const slot = availability.availableSlots[0];
  const booking = await client.createBooking(
    meetingTypeId,
    slot.start,
    {
      email: '[email protected]',
      fullname: 'Client Name',
      phone: '+1234567890'
    },
    userId
  );

  console.log('Booked!', booking);
  return booking;
}

bookAppointment().catch(console.error);

Next Steps