=== Webfon ===
Contributors: cesurapp
Tags: live chat, video call, click to call, chatbot, woocommerce
Requires at least: 6.3
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.3
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Voice and video calls, live chat and an AI agent on your site. Visitors call you from the browser: no app, no phone number.

== Description ==

Webfon puts a phone on your website. Visitors call your team by voice or video straight from the browser, with no app to install and no phone number to dial, and chat with you in the same widget. Your team answers in the Webfon panel or the Webfon mobile app.

= Features =

* **Voice and video calls** from the browser, in one click.
* **Live chat** with messages and files, in the same widget.
* **AI agent** that answers chats and calls, and hands over to your team.
* **Signed-in users recognised:** your team sees who they are talking to, and a user's conversation follows them to every device they sign in on. WooCommerce customers included.
* **Call routing:** calls ring your agents in turn, within your working hours and daily limits.
* **Set up in one click:** Connect with Webfon fills in the settings. The widget's look, working hours and channels are managed in the Webfon panel, with no code.
* **Hide it on any page**, such as the checkout.
* **Events for your own code:** run your JavaScript when the widget opens, a conversation starts, a call connects or ends, or a message arrives: count it in any analytics tool or send it to your own server.

= WooCommerce: an AI agent that knows your store =

Give Webfon's AI agent tools for your store, and it can:

* find products and answer questions about them, for any visitor;
* tell a signed-in customer about their account, orders, downloads and coupons;
* on the customer's request, cancel an order awaiting payment, add their note to an order, email them an order's details again or sign them up for a back-in-stock email.

You choose the tools: none is on until you tick it, and the agent only ever sees the customer it is talking to.

= What you need =

* A Webfon account: [webfon.io](https://webfon.io). The plugin itself is free.
* WordPress 6.3 or later and PHP 7.4 or later. WooCommerce is optional.

== Installation ==

1. Install Webfon from Plugins → Add New Plugin and activate it.
2. Open Settings → Webfon. On a WooCommerce store, tick the AI agent tools you want it to have.
3. Click Connect with Webfon. In the Webfon panel, choose your provider and click Connect: you come back to the settings page with everything filled in.
4. In the Webfon panel, set the provider's Domain to your site's address, such as www.example.com. The widget does not open on any other address.

No way back to your site from the panel? Paste the code it shows under Have a connection code?, or each value into its own field under Advanced.

== External services ==

The plugin uses the Webfon service (https://webfon.io) to offer voice calls, video calls and live chat on your site.

* **The widget:** On every page of the site it loads the widget from https://assets.webfon.io/sdk.js. When a visitor opens the widget (on Webfon's Enterprise plan with Engage on, already after their first click on the page) it connects to Webfon's servers and sends what the conversation needs: messages, files, call audio and video, the address of the page, the browser's language and the device type. Webfon also sees the visitor's IP address.
* **Connecting:** The Connect with Webfon and Reconnect buttons open the Webfon panel (https://panel.webfon.io) with your site's address, the address of the plugin's settings page and, on a WooCommerce store, the AI agent tools you ticked: their descriptions and this site's addresses for them, and the names of those you did not tick, which the panel takes off the AI agent. The panel adds those tools to the chosen provider's AI agent and sends the provider's settings back to that page.
* **Connection check:** Each time you open Settings → Webfon, the plugin asks the Webfon API (api.webfon.io, or the API URL set there) whether the connection is still current: it sends the provider ID and the SHA-256 hashes of the secret key and the signing secret, never the keys themselves.
* **Your own API address:** If an API URL is set under Settings → Webfon, the widget connects to that address instead of api.webfon.io.
* **Signed-in users:** Only when a secret key is set: for a user signed in to your site, the plugin signs their user ID, display name, email address, avatar address, language and WooCommerce billing phone into a token, which the widget sends to Webfon when it connects.
* **Gravatar:** Only when a secret key is set, the site shows avatars (Settings → Discussion → Show Avatars) and you turn on Gravatar photos under Settings → Webfon (off by default): to send a signed-in user's avatar address only when they have one, the plugin asks Gravatar (https://gravatar.com, by Automattic) once a day whether that address exists. The request carries the hash of the user's email address that WordPress puts in every Gravatar address. A site whose avatars come from a local-avatar plugin sends no such request. Gravatar terms of service: https://wordpress.com/tos/ · privacy policy: https://automattic.com/privacy/
* **AI agent tools (WooCommerce):** Only on a WooCommerce store, for the AI agent tools you ticked: the agent calls WooCommerce's public product addresses (its Store API, wc/store/v1/products) for product search and details, and the plugin's addresses (webfon/v1/customers/) for a customer signed in this way who chats with it (never for an account that can edit posts: administrators, editors, shop managers), each of those calls signed with the signing secret set under Settings → Webfon. The plugin answers with that customer's own data: their name, email address, phone and saved addresses; their orders with items, totals, addresses, payment link, refunds and the store's notes to them; their downloads; the coupons meant for them. Webfon gives these answers to the AI model of your agent, at the AI provider whose key you entered in the Webfon panel.

* **Events:** the plugin sends nothing for them. The JavaScript you write under Settings → Webfon → Widget → Events runs on your pages and sends only what your code sends.

Webfon terms of service: https://webfon.io/legal/terms
Webfon privacy policy: https://webfon.io/legal/privacy

== Frequently Asked Questions ==

= Do I need a Webfon account? =

Yes. The plugin is free and puts the widget on your site; the calls, chats and AI agent run on Webfon. Create an account at [webfon.io](https://webfon.io).

= Where do I change the widget's color, position or working hours? =

In the Webfon panel. A change there reaches your site at once, with nothing to change in WordPress.

= Can I hide the widget on some pages? =

Yes. List their addresses under Settings → Webfon → Widget → Hide on pages, one per line. `*` matches anything: `/checkout*` hides the checkout and the order confirmation, and `/` is the home page alone.

= Does it slow my site down? =

No. The widget's script loads asynchronously, so your page does not wait for it.

= Does it work with page caching? =

Yes. Hidden pages are decided by address, and page caches keep signed-out pages, which carry nothing about a user.

= Can I run my own code when a call ends or a conversation starts? =

Yes. Under Settings → Webfon → Widget → Events, write JavaScript for any of the widget's events: it opens or closes, a conversation starts, a call connects or ends, a message arrives, a visitor signs in or out inside the widget. `event` holds what the event carries, such as a call's duration. Ready code for Google Tag Manager, Google Analytics, Meta Pixel, Matomo and Plausible is a click away. Only users who may add scripts to the site see this section.

= Are my signed-in users recognised? =

Yes, once the site is connected with a secret key (Connect with Webfon sets one). Your team sees their name and email, and their conversation follows them to every device they sign in on. Users who are not signed in chat as visitors.

= How does the AI agent reach my customers' orders? =

Tick its tools under Settings → Webfon and click Reconnect while your provider has an AI agent in the Webfon panel: the panel adds the ticked tools to the agent and sends its signing secret back. The agent then asks the plugin about the signed-in customer it is talking to, and no one else. A call without the secret's signature is refused, an unticked tool answers no call, and the plugin never answers for an account that can edit posts (administrators, editors, shop managers).

== Changelog ==

= 1.0.3 =
* Reconnect takes the AI agent tools you untick off the agent.
* The settings page in three tabs: Connection, Widget and Advanced.
* The connection card is laid out anew: the AI agent tools as tiles, Gravatar photos as a switch under them, and Have a connection code? beside Connect with Webfon, in a dialog.
* Reconnect sits under the connection card and stands out, saying why, when the site and Webfon are out of step: AI agent tools ticked or unticked, a change in Webfon, or tools changed since the last connection.
* AI agent tools: Select all.
* Events: your own JavaScript when the widget opens or closes, a conversation starts, a call connects or ends, a message arrives, or a visitor signs in or out inside the widget, with ready code for Google Tag Manager, Google Analytics, Meta Pixel, Matomo and Plausible.

= 1.0.2 =
* A clearer description in the plugin directory.

= 1.0.1 =
* The plugin's icon in the plugin directory.

= 1.0.0 =
* First release.
