=== SwissAI Click to Call ===
Contributors: swissvoip
Tags: click to call, voice agent, chatbot, ai, webrtc
Requires at least: 5.8
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.3.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

A call button and a chat for your site: visitors talk or write to your SwissAI agent from the browser, without a phone.

== Description ==

SwissAI Click to Call puts your SwissAI agent on your WordPress site, by voice, in writing or both.

* **Call**: the visitor clicks, allows the microphone and talks to your SwissAI voice agent directly from the browser.
* **Chat**: the visitor opens a small chat window and writes; the same agent answers in writing, with the same instructions, knowledge base and tools (it can book an appointment in the chat as it does on the phone).
* In the settings you choose what the site shows: Call, Chat or Both. One shortcode can choose otherwise: `[swissai_call mode="chat"]`.
* One agent per language: a WebRTC client for each language, the button and the chat use the language of the page (works with Polylang and WPML).
* Shortcode `[swissai_call]` to place the buttons in any page or post, `[swissai_call lang="de"]` to force a language.
* Optional floating buttons on every page.
* Button texts can be changed in the settings or per shortcode: `[swissai_call label="Talk to us" hangup="End call" chat_label="Write to us"]`.
* The secret key stays on your server and never reaches the browser.

**A SwissAI account is required.** The button and the chat talk to an agent that you create in the SwissAI dashboard: [create your account on swissai.dev](https://www.swissai.dev/login.html?signup=1).

The settings page is translated into Italian, German, French, Spanish, Russian, Portuguese and Chinese; the buttons, the chat and their messages speak the language of the page.

== External services ==

This plugin connects to SwissAI (developers.swissai.dev), a service of Swissvoip SA, to let visitors talk or write to your agent.

* **Call**: when a visitor clicks the call button, your server sends the client name and the secret key you saved in the settings to `https://developers.swissai.dev/api/webrtc/token` and receives a temporary password valid for one call. On pages that show the call button, the browser loads `https://developers.swissai.dev/js/call.js`, which opens the call (audio from the visitor's microphone) to the SwissAI switchboard.
* **Chat**: when a visitor sends a message, your server sends to `https://developers.swissai.dev/api/messages` the client name and the secret key, the text of the message, the last exchanges of the conversation (at most 20) and a random identifier of the browser session, and receives the agent's reply. The conversation is kept in the visitor's browser only for the session; the plugin stores nothing on your server.

No data is sent until the buttons are on a page; no call is started and no message is sent until the visitor clicks or writes.

Terms of service: https://www.swissai.dev/terms.html
Privacy policy: https://www.swissai.dev/privacy.html

== Installation ==

1. Create a SwissAI account on [swissai.dev](https://www.swissai.dev/login.html?signup=1): the button and the chat talk to a SwissAI agent and do not work without one.
2. In the SwissAI dashboard create an agent for each language of your site: its instructions, its knowledge base and, if you want, the tools it uses to book or look things up.
3. In the dashboard open Telephony › WebRTC clients, create one client per agent and add your site's domain. Copy the client name (`wc_…`) and the secret key (`wk_…`): the key is shown only once. The same client is used by the call and by the chat.
4. In WordPress install and activate the plugin, then open Settings › SwissAI Click to Call and paste each client name and secret key in the row of its language; mark one as default.
5. Choose what to show on the site: Call, Chat or Both.
6. Add the shortcode `[swissai_call]` to a page, or enable the floating button. For the call the site must use HTTPS: browsers allow the microphone only there.

== Frequently Asked Questions ==

= Do I need a SwissAI account? =

Yes. You create the agent and the WebRTC client in the SwissAI dashboard.

= Do I need a different key for the chat? =

No. The chat uses the same client name and secret key as the call, and the same agent answers.

= Can I show only the chat? =

Yes. In the settings choose Chat; or use `[swissai_call mode="chat"]` on a single page while the rest of the site keeps the call.

= Are calls and messages billed? =

Calls from the button count as minutes on your SwissAI plan, like any other call. Chat messages follow the conditions of your SwissAI plan.

= The button does not start the call =

Check that your site's domain is listed in the WebRTC client in the SwissAI dashboard and that the site is served over HTTPS (browsers require it for the microphone).

= The chat says it is not available =

The SwissAI account behind the client has no active trial or plan, or no credit: check Billing in the SwissAI dashboard.

== Changelog ==

= 1.3.0 =
* Chat with the agent: a small chat window next to the call button, or instead of it. Same client name and secret key, same agent.
* New setting "Show on the site": Call, Chat or Both; the shortcode accepts mode="call", mode="chat" or mode="both" and chat_label="…".
* The call script is loaded only on pages that show the call button.

= 1.2.0 =
* Getting started box on the settings page, with the link to create a SwissAI account.
* Settings page translated into Italian, German, French, Spanish, Russian, Portuguese and Chinese.
* "Settings" link in the plugin list.

= 1.1.0 =
* One WebRTC client per language; the button follows the language of the page, the shortcode accepts lang="xx".
* Button and status texts in English, Italian, German, French, Spanish, Russian, Portuguese and Chinese.

= 1.0.0 =
* First release.
