Other sites
A saved chatbot can be shown on any other website, built with WordPress or not, with a script tag: as the floating widget, or as a chat embedded in the page. It still runs on your WordPress site; the other site only shows it.
Create a key
A public key decides which chatbot a script shows and which sites may show it. Keys are created in the workspace’s Settings, in the Public keys section:
- New key for:
sleek-ai/chatbot. - Item id (optional): the chatbot’s id, the number in its editor’s
address, such as
3in#/ai/chatbots/3. Left empty, the key shows every published chatbot, and the script names the one to show. - Name: what the key is called in the list.
- Allowed origins: the sites that may show the chatbot, separated by
commas: an origin such as
https://shop.example.com, a domain such asexample.comfor it over HTTP and HTTPS,*.example.comfor its subdomains, or*for any site.
Saving creates the key, a pk_ followed by forty characters, and shows it
under Created key. Each key in use is listed with what it shows and the
sites it allows; its Revoke switch, saved, stops it on every site.
Place the script
Put the script tag on the other site’s pages, with your site’s address and the key:
<script
src="https://your-site.com/wp-json/sleek-ai/v1/embed?sleek_key=pk_..."
async
></script>
On a site with plain permalinks the address is
https://your-site.com/?rest_route=/sleek-ai/v1/embed&sleek_key=pk_.... More
parameters can follow the key:
type=embedshows the embedded chat instead of the floating widget.chatbot=3names the chatbot a key for every chatbot shows. A key for one chatbot refuses another.
The widget sits in the corner its position
names. The embedded chat follows the script tag, or fills the element whose
CSS selector the tag’s data-target names, and is as tall as its
data-height, 600px unless it says otherwise:
<div id="help"></div>
<script
src="https://your-site.com/wp-json/sleek-ai/v1/embed?sleek_key=pk_...&type=embed"
data-target="#help"
data-height="520px"
async
></script>
Which sites may show it
Only the sites the key allows get the script and the chatbot, which your
site checks on every request by the page’s address, and browsers are told
that only those sites may show the chatbot’s frame. A page that sends no
address, such as one with Referrer-Policy: no-referrer, can show only a
chatbot whose key allows *. A revoked key stops showing the chatbot within
five minutes, and a conversation already open stops within a day.
What it knows
The chatbot answers with everything it knows on your site, exactly as configured: its instruction, its data, the files synchronized for it and your site’s content. Nothing is read from the other site and no text of its pages is sent. A variable that reads the current post, term or user finds none there, since the visitor is on no page of your site and is never signed in to it.
Its conditions do not apply on another site: it shows wherever the script tag is. Its logs, message limits and budget are the ones it has on your site.
How it shows
The chatbot is a frame of your site on the other site’s page. The widget’s frame covers only its button until a visitor opens the chat; while the chat is open, the frame covers the page, and a click outside the chat closes it. The JavaScript methods that open, close, hide and show a widget work on your own site’s pages only.
Limits
Each visitor’s address may load the script and the chatbot 120 times a
minute with one key, and all visitors together 6,000 times a minute; a
request past either limit is refused with HTTP 429 until the minute ends.
Messages are limited as on your site, by the sleekAi/chatbot/rateLimit and
sleekAi/chatbot/budget filters.