=== Optlo ===
Contributors: optlo
Tags: live chat, ai chatbot, customer support, help desk, chat
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Deploy AI support agents on your WordPress site. Adds the Optlo messenger to your pages in a couple of clicks.

== Description ==

Optlo is an AI customer support platform that runs on your own AI provider account, so you pay the model provider directly instead of a per-resolution markup.

This plugin adds the Optlo messenger to your WordPress site without editing a theme file.

= Built to stay out of the way =

The messenger puts about 2 KB of JavaScript on your page. The chat interface itself runs inside an iframe, so it never competes with your theme for the main thread. Most chat widgets load between 150 KB and 750 KB directly onto the page they appear on.

= Features =

* Connect to your Optlo workspace in a couple of clicks, no copying and pasting
* Identify your signed-in users securely, so their conversation history follows them
* Choose which post types, URLs and user roles see it
* Hide it on search results and 404 pages
* A `[optlo]` shortcode and an editor block for "chat with us" buttons anywhere on a page
* Refuses to load on staging copies of your site by default

= Safe to put behind a cache =

Nothing about the visitor is written into your pages, so a cached page can never
identify one visitor as another. Visitors who are not signed in receive no cookie
from this plugin, so caches that bypass on cookies keep working. Sites using a page
cache or a CDN need no special configuration.

= Requires an Optlo account =

The messenger is a hosted service. You need an Optlo workspace, which you can create at [optlo.com](https://optlo.com/).

== External services ==

This plugin connects your website to Optlo, a hosted customer support service operated by Optlo. It is required for the plugin to do anything: the chat interface itself is served by Optlo, not by your site.

**What is sent, and when**

On every page where the messenger is enabled, the visitor's browser loads a script from `https://optlo.com/embed/v1/<your workspace ID>` and opens a connection to Optlo. This happens for every visitor to those pages, including visitors who never open the chat.

Optlo receives, as a normal consequence of the visitor's browser making that request: the page address the messenger is loaded on, the visitor IP address, the browser user agent, and a cookie Optlo sets to recognise a returning visitor across page loads. Anything a visitor types into the messenger is sent to Optlo so it can be answered.

**If you turn on "Identify signed-in users"**

This setting is off by default. When it is on, the browser of each signed-in WordPress user fetches a short-lived token from your own site and passes it to the messenger, which sends it to Optlo. The token carries that user's WordPress user ID, email address, display name, username, first role, registration date, this site's host name, and avatar URL if avatars are enabled and the URL is https. Optlo uses it to attach the conversation to that user in your Optlo inbox. Visitors who are not signed in, and users in roles you exclude, are not identified. The `optlo_user_claims` filter lets a developer change or remove any of these fields, or add organizations the user belongs to.

Beyond that, this plugin sends nothing else. It does not transmit your posts, site content, or the accounts of users who are not signed in.

The plugin also sets one cookie of its own on your site, named `optlo_signed_in`, for signed-in users only. It holds the fixed value `1`, identifies nobody, and only tells the browser that it is worth asking your site for a token. It is set when someone signs in and removed when they sign out. Visitors who are not signed in never receive it, so it does not affect page caching for them. It is never sent to Optlo.

**Terms and privacy**

* Terms of service: https://optlo.com/terms
* Privacy policy: https://optlo.com/privacy

== Installation ==

1. Install and activate the plugin.
2. In your Optlo dashboard, go to Settings, Workspace, Profile and copy the workspace ID.
3. In WordPress, go to Settings, Optlo, paste the workspace ID and save.
4. Visit your site. The chat launcher appears in the corner.

== Frequently Asked Questions ==

= The messenger is not showing up =

Check Settings, Optlo for a notice explaining why. The two common causes are that WordPress reports this site as something other than production, or that the site address changed since the workspace ID was saved.

= I moved my site to a new domain =

Settings, Optlo shows a notice that the site was connected under its old address. If you moved the site, click "This site moved here" and the messenger loads again. If you are looking at a copy of another site, click "Disconnect" instead, so conversations from the copy do not reach your live inbox.

= Why does it refuse to load on my staging site? =

Staging sites are normally created by copying the production database, which copies your workspace ID with it. Without this check, test conversations from a staging site would arrive in your live inbox. Untick "Only load on production" under Settings, Optlo if you want it there.

Note that a database copy also carries the private key this site signs identity tokens with, protected by the security keys in wp-config.php. Anyone who holds both a copy of the database and those keys can sign tokens as your users. If you hand a copy to someone who should not have that power, generate a new key from Settings, Optlo afterwards.

= Can I open the chat from a button or link? =

Yes. Use the `[optlo]` shortcode, or the "Optlo chat button" block. Both accept a label and an opening message.

= Can developers change what is sent about a user? =

Yes. The `optlo_user_claims` filter receives the user payload before it is signed. It can change or remove any field, add attributes, or add up to ten organizations, each with an `id`, a `name` and optional `attrs`, which Optlo shows alongside the user. Anything Optlo would reject is dropped rather than failing the whole payload. The `optlo_should_load` filter can suppress the messenger entirely for a request.

== Screenshots ==

1. Choose how to connect: one click through Optlo, or paste a workspace ID yourself.
2. Decide where the messenger appears, by post type, URL, user role, search results and 404 pages.
3. Conversations arrive in a shared inbox, with the details of the signed-in user beside them.
4. A visual editor controls when the AI answers, what it can reach, and what happens next.
5. Connect your own AI provider account and watch requests, tokens and errors per provider.
6. Point Optlo at your site and it trains on your own pages.

== Changelog ==

= 1.0.0 =
* First release.
