=== Social Chat ===
Contributors: letscms
Donate link: https://www.letscms.com/
Tags: whatsapp, chat, messenger, click to chat, contact button
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 2.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

A floating chat button that lets visitors reach you on WhatsApp, Facebook Messenger, email or phone in one tap.

== Description ==

Social Chat adds a small floating button to the corner of every page. Visitors tap it and pick how to contact you: WhatsApp, Facebook Messenger, email or a phone call. There is no chat dashboard to watch: messages arrive in the apps you already use.

= Features =

* WhatsApp, Facebook Messenger, email and phone in one button.
* Show only the channels you fill in, in the order you choose. (The free GetButton widget shows two channels: the first two in your order.)
* Your own button colour, call-to-action text and position (bottom left or bottom right).
* Does not slow down your pages: the chat widget is loaded only after the visitor first scrolls, moves the mouse, taps or presses a key (or after four seconds), never while the page is loading.
* Nothing is loaded at all until at least one channel is filled in.
* Lightweight: one small file, no database tables, no admin scripts.
* Developers can hide the button on chosen pages with the `letscms_social_chat_options` filter (return `null`).

== Installation ==

1. Install the plugin from Plugins > Add New, or upload the `social-chat` folder to `/wp-content/plugins/`.
2. Activate the plugin.
3. Go to Settings > Social Chat, enter your WhatsApp number (with country code) and any other channels, and save.

== Frequently Asked Questions ==

= The button does not appear =

Fill in at least one channel (WhatsApp, Facebook page ID, email or phone) under Settings > Social Chat. The button then appears shortly after the visitor first interacts with the page.

= Only two of my channels are shown =

The free GetButton widget shows two channels. Put the two you want first under Button order, for example `whatsapp, call`.

= How do I hide the button on some pages? =

Add this to your theme's functions.php (example: hide it on the checkout):

`add_filter( 'letscms_social_chat_options', function ( $options ) { return is_checkout() ? null : $options; } );`

= Will my settings be kept when I update? =

Yes. Version 2.2 uses the same settings as earlier versions.

== External services ==

This plugin shows its chat button with the GetButton widget, a service provided by GetButton (https://getbutton.io/).

* What is loaded: the widget script from static.getbutton.io, on the front end of your site only, and only when at least one channel is filled in. It is loaded after the visitor first interacts with the page (or after four seconds).
* What is sent: the visitor's browser requests the script, so GetButton receives the visitor's IP address and browser details. The contact details you enter in the settings (WhatsApp number, Facebook page ID, email, phone number), the button text, colour, position and order are passed to the widget so it can show your buttons.
* GetButton terms of service: https://getbutton.io/terms-of-service
* GetButton privacy policy: https://getbutton.io/privacy-policy

== Screenshots ==

1. The chat button on a website.
2. The available chat channels.
3. Settings > Social Chat.

== Changelog ==

= 2.2 =
* Tested with WordPress 7.1.
* Fixed: you can now save the settings with only WhatsApp (or any single channel); Facebook and phone are no longer required.
* Fixed: the email error message was never shown, and a PHP warning appeared on the settings page.
* Fixed: function names are now unique to this plugin, so they can no longer clash with other plugins and break the site.
* Security: the settings page checks the user's permission when saving; the plugin file can no longer be run directly.
* Improved: the chat widget (about 440 KB) now loads after the visitor's first interaction instead of during the page load, so pages load faster.
* Improved: nothing is loaded when no channel is filled in.
* Improved: input checks for phone numbers and the button colour; settings stay in the form when there is an error.
* Improved: settings are removed when the plugin is deleted.
* Improved: ready for translation.

= 2.1 =
* Updated the widget to GetButton.io.

== Upgrade Notice ==

= 2.2 =
Faster pages (the chat widget no longer loads during the page load), WhatsApp-only setups can be saved, and conflict and security fixes. Your settings are kept.
