Widget Integration Documentation

Learn how to integrate Nexva AI Chat widget into your website

Quick Start

Add these two lines of code before the closing </body> tag:

<!-- Add this before closing </body> tag -->
<script src="https://cdn.nexva.ai/widget.js"></script>
<script>
  NexvaChat.init('YOUR_API_KEY', {
    position: 'bottom-right',
    primaryColor: '#32f08c',
    welcomeMessage: 'Hi! How can I help you today?',
    enableVoice: true,
    enableHumanSupport: true
  });
</script>

💡 Pro Tip: Get your API key from the API Tokens page

Framework Integration

React

// npm install nexva-react

import { NexvaChat } from 'nexva-react';

export default function App() {
  return (
    <div>
      <h1>Your App Content</h1>
      <NexvaChat
        config={{
          apiKey: 'YOUR_API_KEY',
          position: 'bottom-right',
          primaryColor: '#32f08c',
          enableVoice: true,
          enableHumanSupport: true
        }}
      />
    </div>
  );
}

Next.js

// npm install nexva-react
// app/layout.tsx or pages/_app.tsx

import { NexvaChatNext } from 'nexva-react';

export default function RootLayout({ children }) {
  return (
    <html>
      <body>
        {children}
        <NexvaChatNext
          config={{
            apiKey: 'YOUR_API_KEY',
            position: 'bottom-right',
            primaryColor: '#32f08c',
            enableVoice: true,
            enableHumanSupport: true
          }}
        />
      </body>
    </html>
  );
}

WordPress

<?php
// Add to functions.php
function nexva_chat_widget() {
    $api_key = 'YOUR_API_KEY';
    ?>
    <script src="https://cdn.nexva.ai/widget.js"></script>
    <script>
      NexvaChat.init('<?php echo $api_key; ?>', {
        position: 'bottom-right',
        primaryColor: '#32f08c',
        enableVoice: true
      });
    </script>
    <?php
}
add_action('wp_footer', 'nexva_chat_widget');
?>

Laravel

{{-- resources/views/layouts/app.blade.php --}}
<!DOCTYPE html>
<html>
<head>
    <title>@yield('title')</title>
</head>
<body>
    @yield('content')
    
    <script src="https://cdn.nexva.ai/widget.js"></script>
    <script>
      NexvaChat.init('{{ config('services.nexva.api_key') }}', {
        position: 'bottom-right',
        primaryColor: '#32f08c'
      });
    </script>
</body>
</html>

Vue.js

// main.js or App.vue
export default {
  mounted() {
    const script = document.createElement('script');
    script.src = 'https://cdn.nexva.ai/widget.js';
    script.async = true;
    
    script.onload = () => {
      window.NexvaChat.init('YOUR_API_KEY', {
        position: 'bottom-right',
        primaryColor: '#32f08c'
      });
    };
    
    document.body.appendChild(script);
  }
}

Configuration Options

OptionTypeDefaultDescription
apiKeystring-Required. Your chatbot API key
apiUrlstringhttps://api.nexva.aiYour backend API URL
positionstringbottom-rightbottom-right, bottom-left
primaryColorstring#32f08cBrand color (hex code)
welcomeMessagestringHi! How can I help...Initial greeting message
placeholderstringType your message...Input placeholder text
enableVoicebooleantrueEnable voice chat tab
enableHumanSupportbooleantrueShow "Talk to Human" button
autoOpenbooleanfalseAuto-open chat on page load
borderRadiusstring12pxBorder radius for widget (e.g., '0px' for square)
buttonSizestring60pxSize of the chat button
buttonColorstringprimaryColorChat button color (defaults to primaryColor)
headerTextstringNexvaHeader title text
themestringlightlight, dark

🎨 Customization Examples

Custom Colors

NexvaChat.init('your-api-key', {
  primaryColor: '#667eea',    // Purple theme
  buttonColor: '#ed64a6'      // Pink button
});

Square Design

NexvaChat.init('your-api-key', {
  borderRadius: '0px',        // Square corners
  buttonSize: '70px'          // Larger button
});

Full Customization

NexvaChat.init('your-api-key', {
  // Colors
  primaryColor: '#10b981',
  buttonColor: '#059669',
  
  // Size & Shape
  buttonSize: '65px',
  borderRadius: '8px',
  
  // Position
  position: 'bottom-left',
  
  // Text Content
  headerText: 'Support Team',
  welcomeMessage: 'Hello! How can we help?',
  placeholder: 'Type your question...',
  
  // Features
  enableVoice: true,
  enableHumanSupport: true,
  autoOpen: false
});

Features

💬 Text Chat

Full AI-powered chat with streaming responses and markdown support

🎤 Voice Chat

Real-time speech recognition for hands-free interaction

👤 Human Support

Escalate to human support team with one click

🎨 Customizable

Match your brand with custom colors and messages

📱 Responsive

Works perfectly on desktop, tablet, and mobile devices

âš¡ Zero Dependencies

Lightweight, fast-loading with no external libraries

Browser Support

Chrome 90+

Firefox 88+

Safari 14+

Edge 90+

Voice chat requires Speech Recognition API (Chrome, Edge, Safari)