=== Baza Live Chat ===
Contributors: bazadevelopers
Donate link: https://www.paypal.com/donate/?business=A9R843N82XG3G&no_recurring=0&currency_code=USD
Tags: live chat, telegram, live support, chat widget, customer support
Requires at least: 5.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.3.3
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Live chat with Telegram integration. Visitors chat on your site — you reply in Telegram. Self-hosted, no monthly fees.

== Description ==

**Baza Live Chat** connects your WordPress site to Telegram — self-hosted, no third-party servers, no data sharing. Visitors chat on your site and you reply directly from Telegram.

### Features:

* Live chat widget embedded on your WordPress site
* Visitors send messages - you reply via Telegram bot
* Real-time polling for instant message delivery
* Webhook support for instant operator replies
* Sound notifications for new messages
* GDPR consent support
* IP blocking, rate limiting, and a visitor activity log
* Custom colors and avatar for the chat widget
* Auto-questions for quick replies
* Static mode - embed chat inline anywhere
* Built-in protection from bots: only real visitors reach your Telegram

### Want more? Baza Live Chat Pro

This free plugin is complete on its own. If you want your chat to do more of the work, the paid versions of [Baza Live Chat](https://bazadevelopers.com/products/live-chat/) add:

**AI assistant**
* Answers visitors with the AI you choose - **Google Gemini, OpenAI (GPT) or Anthropic Claude** - using your own API key, so you pay the provider directly and nothing passes through our servers.
* Learns from your own site: pick the post types (pages, services, FAQ, products...) it may read and exclude single posts; it sees each page's address, so it can point visitors to the right page.
* Your tone and rules in a system prompt; hand-over keywords and a "Talk to an operator" button - the chat moves to you the moment the visitor asks for a person, or when the assistant cannot find an answer.
* Interface texts, auto-questions and teaser messages are translated into each visitor's language automatically.

**Booking assistant for [Baza Booking Calendar](https://wordpress.org/plugins/baza-booking-calendar/)**
* Visitors book without leaving the chat: it lists the services you allow, checks the real free slots for the day they ask about, offers extras, asks the questions of your booking form and applies promo codes.
* The price they are quoted is calculated by Baza Booking Calendar itself (taxes, extras, discounts), and a slot is re-checked for clashes right before the booking is written - the AI never invents a time, a price or a booking number.
* Payment in the chat: a payment link, or pay from the client's balance confirmed with a one-time code sent by email; the visitor is thanked automatically when the money arrives.
* Recognises signed-in clients and their loyalty discount, and you get a Telegram message for every booking made through the chat.

**WooCommerce order assistant**
* Visitors ask "where is my order?" and get the status after a verification step (order number plus the email or phone on the order); you choose which order fields may be shared and how many failed attempts are allowed before the chat is handed to you.

**Smarter Telegram workflow and visitor insight**
* **Supergroup mode** - every visitor gets a separate topic in your Telegram group; several operators can work in parallel, you reply inside the topic, and the topic closes with the chat.
* **Teaser messages** - an animated bubble with a typing effect invites visitors to open the chat; random message, delay and "remember that it was closed" are adjustable.
* **Geo tracking** - the visitor's country in the chat and a Telegram note (country, IP, page) on each unique daily visit.
* **Chat session log** - every conversation kept and searchable in the admin.
* **Cloudflare Turnstile** - an invisible anti-bot check on top of the built-in one.

The features above are not part of this plugin; it never locks or limits what it already does. Baza Booking Calendar itself is [free on WordPress.org](https://wordpress.org/plugins/baza-booking-calendar/).

== Installation ==

1. Upload the plugin files to `/wp-content/plugins/baza-live-chat/` or install via the WordPress plugin screen.
2. Activate the plugin through the **Plugins** screen in WordPress.
3. Go to **Baza Live Chat → Settings** and create a Telegram bot via [@BotFather](https://t.me/BotFather).
4. Enter your Bot Token and Chat ID, click **Save**.
5. Click **Set Webhook** to connect Telegram to your site.
6. The chat widget will appear on your site automatically.

== Frequently Asked Questions ==

= Do I need a paid account? =

No. Everything in this plugin is free. You only need a Telegram bot, which is free to create with @BotFather. A paid Pro version with extra features (AI assistant with Gemini, OpenAI or Claude, a booking assistant for Baza Booking Calendar, WooCommerce order lookup, Supergroup mode and more) is available at bazadevelopers.com, see the list in the description.

= Is my data stored on your servers? =

No. All chat data is stored in your own WordPress database. Messages go directly from your site to your Telegram bot.

= Does it work with page builders? =

Yes. Use the `[baza_live_chat]` shortcode to embed the chat anywhere, including Gutenberg, Elementor, and other page builders. Add `static="true"` to show it as an inline block.

= Where is the readable source of the minified scripts? =

In the plugin itself: every `*.min.js` in `assets/js/` sits next to the file of the same name without `.min`. They are generated with Terser (`npx terser blc.js -c -m -o blc.min.js`).

== External services ==

This plugin connects to the following external services. Please review their terms and privacy policies before use.

= Telegram Bot API (api.telegram.org) =
Required for core chat functionality. Every visitor message and operator reply is transmitted through Telegram's servers using the bot token you configure.
* Terms of Service: https://telegram.org/tos
* Privacy Policy: https://telegram.org/privacy

== Changelog ==

= 1.3.3 =
* Fixed: pages could not be cached by page-cache plugins and server caches (and cache warm-ups reported "response-sets-cookie"), because the visitor cookie was set in the page's own response. The cookie is now set in the browser, once a real person has been seen, and the page itself sets no cookie.

= 1.3.2 =
* Only real visitors reach your Telegram. A visit is reported, and a chat can be started, only by a browser that passes a quiet check: the request must look like a visitor's browser (crawlers, headless browsers, HTTP libraries, AI and SEO bots, link previews and speed tests are refused by name; calls from other sites are refused), the page does a small proof-of-work in the background (about a tenth of a second, once), and a visit is reported only after a real mouse, key, touch or scroll event and a moment on screen.
* The visitor's address is no longer taken from headers anyone can write (Client-IP, X-Forwarded-For): they are read only behind a reverse proxy you run or Cloudflare, so per-address limits and IP blocks cannot be sidestepped. Extra trusted proxies: the filter `baza_lc_trusted_proxies`.
* The visit counter asks "was this address already counted today?" before it spends a rate-limit write.

= 1.3.1 =
* A "Get Pro" button in the plugin's header and an "Upgrade to Pro" item at the bottom of its menu; both are plain links to the plugin's page and can be turned off.

== Upgrade Notice ==

= 1.3.3 =
Pages are cacheable again: the plugin no longer sets a cookie in the page's response.

= 1.3.2 =
Bots, crawlers and scripts no longer reach your Telegram: visits and chats are counted only after a quiet proof that a person is there.

= 1.3.1 =
Adds a link to the Pro version in the plugin's header and menu.
