Introduction

WP Chat Expert is an advanced WordPress plugin that provides an intelligent AI-powered chat widget. It uses the Google Gemini API to generate natural and contextually relevant responses, while automatically managing the conversation flow and capturing potential leads.

The plugin is designed to enhance the user experience on your website, providing immediate assistance and organically capturing valuable contact information during conversations.

Key Features:

  • AI-powered chat widget by Google Gemini
  • Automatic conversation state management
  • Intelligent lead capture
  • Full multilingual support
  • Anti-spam and ban protection system
  • Comprehensive administration panel
  • Extensible hooks for developers

Installation and Setup

Plugin Installation

1. Download the .zip file for the WP Chat Expert plugin.

2. In your WordPress admin dashboard, go to Plugins > Add New.

3. Click the Upload Plugin button at the top of the page.

4. Select the downloaded .zip file and click Install Now.

5. Once installed, click Activate Plugin.

Initial Configuration

After activating the plugin, a new “WP Chat Expert” menu will appear in your admin dashboard.

1. Go to WP Chat Expert > Settings.

2. Fill in the basic fields:

  • Business Name: The name of your company or website
  • Agent Name: How the bot will identify itself (e.g., “Virtual Assistant”)
  • Base Information: Information about your business, services, and products that the AI will use to respond

Google Gemini API Setup

For the AI chat to function, you need to configure your Google Gemini API key:

1. Obtain your API key from Google AI Studio.

2. In Settings, paste your key into the “Google Gemini API Key” field.

3. Select the Gemini model (default: gemini-2.0-pro-exp-02-05).

4. Save changes. The chat widget will automatically appear on your website.

Chat Widget

Chat Functionality

The chat widget appears as a floating button in the bottom-right corner of your website. Visitors can click to start a conversation.

Widget Features:

  • Responsive design compatible with mobile and desktop
  • Real-time typing indicators
  • Conversation persistence across pages
  • RTL (Right-to-Left) language support
  • Optional debug mode for development

Conversation States

The plugin automatically manages different states during the conversation:

  • Start: Initial greeting and general inquiries
  • Information: Providing information about products/services
  • Lead Capture: Collecting user contact details
  • Farewell: Ending the conversation

The AI automatically decides when to transition between states based on the conversation context.

Lead Capture

When the AI detects commercial interest, it will automatically activate lead capture mode:

1. It will naturally request the user’s name and email.

2. Optionally, it may ask for the phone number.

3. The data is automatically saved to the database.

4. Configurable notifications are sent to administrators.

Users can “escape” lead capture mode if they still have questions, returning to the informational flow.

Administration Panel

Leads Dashboard

Manage all captured leads from WP Chat Expert > Leads:

  • Lead List: View all captured contacts
  • Statuses: New, Contacted, Closed
  • Bulk Actions: Change the status of multiple leads
  • Conversation History: View the complete conversation that led to the lead
  • Export: Option to export data for external CRMs

Each lead includes detailed information such as name, email, phone (optional), and the full conversation log.

Ban Management

The plugin includes automatic protection against spam and abusive behavior:

1. Go to WP Chat Expert > Bans to manage banned IPs.

2. Bans are automatically applied when inappropriate content is detected.

3. You can manually unban IPs or clear local storage.

4. Bans are temporary and automatically lifted after the set period.

Advanced Settings

Additional options available in the settings panel:

  • Debug Mode: Displays technical information for development
  • AI Language: Language code for AI responses
  • Gemini Model: Selection of the AI model to use
  • Session Settings: Chat session lifetime

Multilingual Support

Available Languages

The plugin includes full support for multiple languages:

  • Spanish (es_ES): Default language
  • English (en_US): Full support
  • Other languages: Easily extensible

Language Configuration

1. In Settings, select the default interface language.

2. Configure the “Default AI Language” for artificial intelligence responses.

3. The AI can automatically detect the user’s language and adapt its responses.

4. Interface texts automatically adapt to the selected language.

Customization and Hooks

Developer Hooks

The plugin provides multiple hooks to extend its functionality:

Action Hooks:

  • especialista_wp_chat_lead_captured – Triggers when a lead is captured
  • especialista_wp_chat_conversation_started – When a conversation starts
  • especialista_wp_chat_message_processed – After a message is processed

CRM Integrations

Example of integration with an external CRM:


add_action('especialista_wp_chat_lead_captured', 'send_lead_to_crm', 10, 3);

function send_lead_to_crm($lead_id, $lead_data, $conversation_history) {
    // Your CRM integration code here
    // $lead_data contains: name, email, phone, etc.
    // $conversation_history contains the full history
}
      

Troubleshooting

Chat does not appear on the site:

  • Verify that the Gemini API key is configured correctly
  • Ensure the plugin is activated
  • Check the browser console for JavaScript errors

AI does not respond or gives errors:

  • Verify your API key in Google AI Studio
  • Check that the selected Gemini model is available
  • Activate debug mode to view detailed errors

Leads are not saving:

  • Verify that the database table has been created correctly
  • Check database permissions
  • Review PHP logs for errors

Performance issues:

  • The plugin uses transients to optimize performance
  • Bans and sessions are automatically cleared
  • Consider using object cache for high-traffic sites

For additional support: Contact EspecialistaEnWP.com

Campanella
Online
Desarrollado por Especialista en WP