Multi-Channel Integrations

Connect Slack, WhatsApp, email, and custom channels for unified customer support.

20 min read
Intermediate level

Channel Configuration

Slack Integration

Slack Bot Setup
// Connect Slack channel for team collaboration
const slackChannel = await client.connectChannel({
  type: 'slack',
  name: 'Customer Support Slack',
  config: {
    botToken: process.env.SLACK_BOT_TOKEN,
    appToken: process.env.SLACK_APP_TOKEN,
    signingSecret: process.env.SLACK_SIGNING_SECRET,
    
    // Channel routing
    channels: {
      'general-support': {
        teamId: 'support-team-123',
        aiAgent: 'slack-support-agent',
        autoResponse: true,
        escalationChannel: 'urgent-support'
      },
      'technical-help': {
        teamId: 'technical-team-456', 
        humanOnly: true,
        skillsRequired: ['technical_support']
      }
    },

    // Workflow automation
    workflows: {
      ticketCreation: {
        enabled: true,
        trigger: 'emoji_reaction', // React with 🎫 to create ticket
        assignToTeam: true
      },
      statusUpdates: {
        enabled: true,
        updateCustomer: true,
        channel: 'status-updates'
      }
    }
  }
});

WhatsApp Business Integration

WhatsApp Business API
// Connect WhatsApp Business for customer messaging
const whatsappChannel = await client.connectChannel({
  type: 'whatsapp_business',
  name: 'Customer WhatsApp',
  config: {
    phoneNumberId: process.env.WHATSAPP_PHONE_NUMBER_ID,
    accessToken: process.env.WHATSAPP_ACCESS_TOKEN,
    webhookVerifyToken: process.env.WHATSAPP_VERIFY_TOKEN,
    
    // Message handling
    messageHandling: {
      aiFirstResponse: true,
      aiAgent: 'whatsapp-support-agent',
      humanBackup: true,
      businessHours: {
        timezone: 'America/New_York',
        hours: '09:00-17:00',
        days: ['monday', 'tuesday', 'wednesday', 'thursday', 'friday']
      }
    },

    // Templates and automation
    templates: {
      welcome: 'Hello! How can we help you today?',
      afterHours: 'Thanks for contacting us. We\'ll respond during business hours.',
      escalation: 'Let me connect you with a specialist.',
      resolved: 'Is there anything else I can help you with?'
    },

    // Media handling
    mediaSupport: {
      images: true,
      documents: true,
      maxFileSize: '10MB',
      allowedTypes: ['pdf', 'jpg', 'png', 'docx']
    }
  }
});

Email Integration

Email Channel Configuration
// Set up email support with ticket system
const emailChannel = await client.connectChannel({
  type: 'email',
  name: 'Email Support',
  config: {
    // IMAP configuration for incoming emails
    imap: {
      host: 'imap.company.com',
      port: 993,
      secure: true,
      auth: {
        user: 'support@company.com',
        pass: process.env.EMAIL_PASSWORD
      },
      mailbox: 'INBOX'
    },

    // SMTP configuration for outgoing emails
    smtp: {
      host: 'smtp.company.com',
      port: 587,
      secure: false,
      auth: {
        user: 'support@company.com',
        pass: process.env.EMAIL_PASSWORD
      }
    },

    // Processing rules
    processing: {
      autoResponse: true,
      aiAgent: 'email-support-agent',
      createTickets: true,
      
      // Email parsing
      parseHtml: true,
      extractAttachments: true,
      detectLanguage: true,
      
      // Routing rules
      routingRules: [
        {
          condition: { subject: /urgent|emergency/i },
          action: { priority: 'high', assignToHuman: true }
        },
        {
          condition: { from: /@enterprise-customer.com$/ },
          action: { team: 'enterprise-support', sla: '2h' }
        }
      ]
    }
  }
});

Unified Channel Management

Cross-Channel Coordination
class UnifiedChannelManager {
  async handleIncomingMessage(channelId: string, message: any) {
    // Extract customer identity across channels
    const customerId = await this.identifyCustomer(message, channelId);
    
    // Get unified conversation history
    const conversationHistory = await client.getCustomerHistory(customerId, {
      includeAllChannels: true,
      timeframe: '30d'
    });

    // Route to appropriate team with full context
    const routing = await client.routeConversation({
      customerId,
      channelId,
      message: message.content,
      context: {
        previousChannels: conversationHistory.channels,
        customerTier: await this.getCustomerTier(customerId),
        recentInteractions: conversationHistory.recent
      }
    });

    return routing;
  }

  async synchronizeChannels() {
    // Keep customer data synchronized across all channels
    const channels = await client.getChannels();
    
    for (const channel of channels) {
      await this.syncCustomerData(channel);
      await this.updateChannelStatus(channel);
    }
  }

  // Handle cross-channel escalations
  async escalateAcrossChannels(conversationId: string, targetChannel: string) {
    const conversation = await client.getConversation(conversationId);
    
    // Create continuation in target channel
    await client.createChannelThread({
      channelId: targetChannel,
      customerId: conversation.customerId,
      context: `Escalated from ${conversation.channelType}:`,
      previousMessages: conversation.messages,
      priority: 'high'
    });

    // Notify customer of channel switch if needed
    if (conversation.customerNotificationRequired) {
      await this.notifyCustomerOfChannelChange(conversation, targetChannel);
    }
  }
}

Webhook Integration

Real-time Event Handling
// Set up webhooks for real-time channel events
const webhookConfig = {
  url: 'https://yourapp.com/webhooks/rodger',
  events: [
    'message.received',
    'conversation.escalated', 
    'agent.assigned',
    'conversation.resolved'
  ],
  security: {
    verifySignature: true,
    secret: process.env.WEBHOOK_SECRET
  }
};

// Handle incoming webhooks
app.post('/webhooks/rodger', (req, res) => {
  const event = req.body;
  
  switch (event.type) {
    case 'message.received':
      // Process new message from any channel
      handleNewMessage(event.data);
      break;
      
    case 'conversation.escalated':
      // Notify supervisors of escalations
      notifyEscalation(event.data);
      break;
      
    case 'agent.assigned':
      // Update team dashboard with assignment
      updateDashboard(event.data);
      break;
  }
  
  res.status(200).send('OK');
});