🤖

CRM AI Consultant

Version 4.1 • Documentation

A universal AI chat system with multi-channel support and complete individual customization for each website.

1. Introduction

CRM AI Consultant is a universal two-way AI chat system that allows you to connect an intelligent widget to any website (WordPress, Tilda, pure HTML, Laravel, etc.).

Each website has completely individual settings: chat design, communication channel, AI model, API keys, and its own conversation history.

Supported channels: Telegram, OpenAI (GPT), Grok (xAI), WhatsApp, Viber

NEW What's New in Version 4.1

  • ⚡ Prompt saved to file — AI responses are now much faster
  • Settings caching — fewer database queries
  • Additional sending to Telegram — even when using Grok or OpenAI
  • Optimized Grok and OpenAI channels — reduced response time
  • Improved prompt storage structure — main prompt in system_prompt field
  • New checkbox "Send to Telegram as well" in site settings
  • Stability and security — improved error handling and caching
  • Overall chat speed optimization

The bot now responds noticeably faster, especially with Grok and OpenAI.

2. Project Structure

crm-ai-consultant/
├── index.php                 ← Main widget file (serves JS config + handles all AJAX)
├── config.php                ← Main system configuration (database, constants)
├── version.php               ← Current version
├── documentation.html        ← Full documentation (this file)
├── changelog.html            ← Version history
├── crm-ai-error.log          ← Error log (auto-created)
│
├── admin/
│   ├── index.php             ← Main admin dashboard (list of all sites)
│   ├── sites.php             ← Edit site settings
│   ├── conversations.php     ← View all chat history
│   ├── login.php             ← Admin login
│   ├── navigation.php        ← Admin header
│   ├── footer.php            ← Admin footer
│   ├── icon.php              ← Bot icon picker modal
│   └── settings_*.php        ← Channel settings (telegram, grok, openai, etc.)
│
├── sites/                    ← Individual site settings + prompt files
│   └── cache/                ← Cached site settings (for speed)
│
├── conversations/            ← All chat histories stored in MySQL
│
├── channels/
│   ├── telegram.php          ← Telegram handler
│   ├── grok.php              ← Grok (xAI) handler
│   ├── openai.php            ← OpenAI GPT handler
│   ├── whatsapp.php          ← WhatsApp handler
│   └── viber.php             ← Viber handler
│
├── assets/
│   ├── chat.js               ← Main chat widget script
│   └── style.css             ← Chat widget styles
│
└── includes/
    ├── functions.php         ← Core functions (save messages, routing, caching)
    ├── get-messages.php      ← AJAX: get conversation messages
    └── get-conversation.php  ← AJAX: full conversation view (for admin)
                

3. Installation

  1. Upload all files to the /ai/crm/ folder on your server
  2. Create folders sites/ and sites/cache/
  3. Set write permissions: 755 for folders, 644 for files
  4. Go to admin panel: https://bilohash.com/ai/crm/admin/
  5. Login with password 12345 (change it immediately!)

4. How to Use

1. Add a new website in the admin panel

2. Fill in the settings (especially the system prompt!)

3. Copy the generated code

4. Paste it on your website before the </body> tag

5. Click the "Check" button in the admin panel

5. Managing Websites

Each website has its own unique site_id, generated automatically from the domain.
Example: mapsme_no, bilohash_com

<script src="https://bilohash.com/ai/crm/index.php?site=YOUR_SITE_ID"></script>

6. Communication Channels

Telegram

The fastest and most stable channel. Messages arrive in your Telegram.

OpenAI / Grok

Automatic replies powered by artificial intelligence.

WhatsApp

Business API support (in development).

Viber

Business API support (in development).

7. Chat Design

Each website can have a fully custom design: colors, bot icon, title, subtitle, widget position (left/right), greeting text, and auto-open settings.

8. API Keys

  • Telegram — Bot Token + Chat ID
  • OpenAI — API Key (get here)
  • Grok (xAI) — API Key (get here)

9. Troubleshooting

White screen

Check the file crm-ai-error.log in the /ai/ folder

Chat doesn't appear

Make sure the script is placed before </body> and the site_id is correct.

"Connection error"

Check that the channel is configured correctly and the API keys are valid.

CRM AI Consultant © 2026 Ruslan Bilohash
GitHubbilohash.com