Business API Integration Guide

Complete guide to building business applications with team management, analytics, and enterprise features.

25 min read
Intermediate level

Prerequisites

Basic understanding of Core API
Active Rodger Developer account
API key with Business API access
Node.js/TypeScript development environment
1

Set Up Team Structure

Create teams to organize your agents and human collaborators with proper roles and permissions.

Team Creation
import { RodgerClient } from '@rodger-ai/sdk';

const client = new RodgerClient({
  apiKey: process.env.RODGER_API_KEY,
  apiUrl: 'https://api.rodger.ai'
});

async function setupCustomerSupportTeam() {
  // Create the team
  const team = await client.createTeam({
    name: 'Customer Support Team',
    description: 'Handles all customer inquiries and support requests',
    department: 'customer_success',
    members: [
      { 
        email: 'alice@company.com', 
        role: 'agent',
        skills: ['technical_support', 'billing']
      },
      { 
        email: 'bob@company.com', 
        role: 'supervisor',
        skills: ['escalation', 'training']
      }
    ]
  });

  console.log('Team created:', team.id);
  return team;
}
2

Configure Availability & Routing

Set up team schedules and intelligent routing to balance AI and human agents effectively.

Availability Configuration
// Configure team availability
await client.updateTeamAvailability(team.id, {
  timezone: 'America/New_York',
  schedule: {
    monday: { start: '09:00', end: '17:00', available: true },
    tuesday: { start: '09:00', end: '17:00', available: true },
    wednesday: { start: '09:00', end: '17:00', available: true },
    thursday: { start: '09:00', end: '17:00', available: true },
    friday: { start: '09:00', end: '17:00', available: true },
    saturday: { available: false },
    sunday: { available: false }
  },
  holidays: ['2024-12-25', '2024-01-01'] // Optional holiday exclusions
});

// Set up intelligent routing
await client.updateTeamRouting(team.id, {
  strategy: 'skill_based', // Options: round_robin, skill_based, load_balanced
  fallback_agent_id: 'ai-support-agent-123', // AI handles off-hours
  max_queue_size: 25,
  auto_escalation: {
    enabled: true,
    criteria: {
      wait_time_minutes: 10,
      complexity_threshold: 0.8
    }
  }
});
3

Implement Analytics & Monitoring

Track team performance, customer satisfaction, and operational metrics.

Analytics Setup
// Get comprehensive team analytics
async function getTeamInsights(teamId: string) {
  const analytics = await client.getAnalytics({
    timeframe: '30d',
    team_id: teamId,
    metrics: [
      'conversations',
      'resolution_time', 
      'satisfaction_score',
      'escalation_rate',
      'first_contact_resolution'
    ],
    breakdown: ['agent', 'channel', 'time_of_day']
  });

  return analytics;
}

// Set up real-time monitoring
const monitor = await client.createMonitor({
  name: 'Team Performance Monitor',
  team_id: team.id,
  alerts: [
    {
      metric: 'average_wait_time',
      threshold: 300, // 5 minutes
      action: 'notify_supervisor'
    },
    {
      metric: 'satisfaction_score',
      threshold: 4.0, // Below 4/5 stars
      comparison: 'less_than',
      action: 'escalate'
    }
  ]
});
4

Optimize with A/B Testing

Continuously improve team performance with controlled experiments.

A/B Testing Implementation
// Test different routing strategies
const routingTest = await client.createABTest({
  name: 'Routing Strategy Optimization',
  description: 'Compare skill-based vs round-robin routing',
  team_id: team.id,
  variants: {
    variant_a: {
      name: 'Skill-Based Routing',
      config: { strategy: 'skill_based' }
    },
    variant_b: {
      name: 'Round-Robin Routing', 
      config: { strategy: 'round_robin' }
    }
  },
  traffic_split: 50,
  success_metrics: ['resolution_time', 'satisfaction_score'],
  min_sample_size: 200,
  max_duration_days: 14
});

// Start the test
await client.startABTest(routingTest.id);

// Monitor results
const results = await client.getABTestResults(routingTest.id);
if (results.statistical_significance >= 0.95) {
  console.log('Test completed with significance:', results);
  
  // Implement winning strategy
  const winner = results.winner; // 'variant_a' or 'variant_b'
  await client.updateTeamRouting(team.id, 
    routingTest.variants[winner].config
  );
  
  await client.stopABTest(routingTest.id);
}