Skip to main content

AI Chat Bots

Better Messages allows you to create AI-powered chat bots using multiple AI providers: OpenAI, Anthropic (Claude), and Google Gemini.

How it works#

AI bots appear as regular users in the messaging interface. When a user sends a message to a bot, the message is processed through the selected AI provider and a response is generated. Each bot can be configured with its own provider, model, system instructions, and specific capabilities. In group conversations, bots respond when mentioned with @botname.

Key capabilities#

  • Multiple AI providers — choose between OpenAI, Anthropic (Claude), and Google Gemini per bot
  • Create multiple AI bots with different personalities and purposes
  • Custom system prompts to define bot behavior and knowledge
  • Welcome message — auto-sent by the bot when a user starts a new 1:1 conversation, with a live preview of the first-message experience
  • Dynamic placeholders and conditionals in system prompts and welcome messages — reference the user, site, current date/time, and bot identity
  • Per-bot settings — each bot can have its own provider, model selection, and API key override
  • Voice messages — users can speak to a bot instead of typing. The recording is transcribed and the bot answers what was said, on any provider
  • Web search — bots can search the web for current information
  • File search — bots can search through uploaded knowledge base files (OpenAI)
  • Image generation — bots can generate images (OpenAI, Gemini)
  • Real-time response streaming in conversations
  • Group conversation support — add bots to group conversations, bots respond when mentioned with @botname
  • Conversation summarization — AI-generated summaries of conversation history, configurable per thread
  • Scheduled digests — AI-generated conversation digests on a schedule (hourly, twice daily, daily), configurable per thread
  • Token usage tracking — per-bot token usage with the cost of each answer, from an up-to-date price list
  • Points charging — charge users MyCred or GamiPress points for AI responses
  • Extended thinking on Claude models, with adaptive thinking on Claude 4.7 and later
  • API keys sealed in the keychain every WordPlus plugin on the site shares, never shown in full again
  • Online presence — bots that can answer appear as online users (WebSocket version), and chat rooms list them in their online users list with a bot icon
  • Typing indicators — bots show a typing indicator while generating responses (WebSocket version)
  • E2E encryption exclusion — bots are automatically excluded from end-to-end encrypted conversations
  • Dedicated admin page for bot management

How to enable#

Step 1: Configure your AI provider API keys at WP Admin → Better Messages → Settings → Integrations → AI Services.

Paste the key and click Save key. It is checked and saved at once, with no need for the save bar. You only need to configure the providers you plan to use. See API keys for how keys are kept.

Requirements

AI chat bots need PHP 8.1 or newer. On an older PHP the AI Chat Bots page and the AI Services tab say so, and a key typed there is kept as typed until the site can run them.

Step 2: Create and configure bots at WP Admin → Better Messages → AI Chat Bots.

  • Click Create New Bot in the left sidebar and give the bot a name
  • General — avatar, Enabled, Respond to Mentions, and the bot's shortcodes
  • AI Provider — provider, model with its prices (Model & Pricing), optional per-bot API key overriding the global one, temperature, token limits and, on Claude, Extended Thinking
  • Behavior — the Instruction (system prompt) and the Welcome Message
  • Capabilities — Enable Images, File Input, Voice Input, Image Generation, Web Search, File Search (availability depends on provider)
  • Summarization, Scheduled Digest and User Pricing as needed
  • Click Save in the bar that appears once there are unsaved changes
info

Write detailed system prompts for your bots. The more specific the instructions, the better the bot will perform for your specific use case.

API keys#

Since Better Messages 3.2 the AI keys, the site's keys of OpenAI, Anthropic and Gemini and the own key of each bot, are sealed in the keychain that every WordPlus plugin on the site shares. They are no longer kept in the plugin settings.

Settings, Integrations, AI Services: OpenAI, Anthropic (Claude) and Google Gemini sections, each API Key row showing "Key ending in" and four characters with Get API Key, Replace, Remove and Test API Key and the note that every WordPlus plugin on the site shares the key, then Model Prices with Check for new prices ringed in red
  • Never shown in full again. A saved key shows as Key ending in and its last four characters, with Replace, Remove and Test API Key. A provider with no key shows a field and Save key. Each is saved, checked and removed at once.

  • Shared by the WordPlus plugins. A key of the site reads "Shared by every WordPlus plugin on this site, which all use this key for this provider", so another WordPlus plugin with AI uses the same key and you save it once.

  • A bot's own key. The bot editor's API Key row, in the AI Provider section, can use the key of the site or a key of the bot's own, which is sealed the same way. The model list follows the key the bot uses.

  • Keys in wp-config.php. A key can be defined in wp-config.php instead, and it wins over a saved one. The row then says Set in wp-config.php:

    define( 'WORDPLUS_AI_OPENAI_KEY', 'sk-...' );
    define( 'WORDPLUS_AI_ANTHROPIC_KEY', 'sk-ant-...' );
    define( 'WORDPLUS_AI_GEMINI_KEY', '...' );
  • A key that stops working. When a request finds a key refused, the row says what the provider answered: "The last check of this key failed: …".

  • Safe in a database copy. A key is sealed under a key made from the site's salts and never stored, so a copy of the database alone does not give the keys away.

The keys move into the keychain by themselves on the update to 3.2.

Going back to 3.1

A site that goes back to Better Messages 3.1 after the update finds the AI keys empty, as 3.1 reads them from the settings. Save them again there.

Costs and the price list#

Every answer of a bot stores the tokens it used, and its cost is counted from a price list of the models. The cost shows in the bot's Token Usage and in the Estimated Cost of its summaries and digests, and it is what Based on API cost charges members points by (see MyCred and GamiPress).

The price list is checked against the pricing pages of OpenAI, Anthropic and Google. Better Messages 3.2 ships with the list checked on October 31, 2026, and a newer list comes from WordPlus Cloud:

  • WP Admin → Better Messages → Settings → Integrations → AI Services → Model Prices → Price List says which list is in use ("Prices of …, as shipped with the plugin" or "Prices of …, from WordPlus Cloud"), when it was last checked, and why the last check failed if it did.
  • Check for new prices gets the newest list at once. A licensed site also checks once a week with its licence check.
  • In the bot editor, Model & Pricing shows the prices of the chosen model per million tokens. Customize prices sets the bot's own Input, Output, Cache Write and Cache Read prices, which win over the list, and Reset to default goes back to it.
The Model Prices section with its Price List row: "Prices of 2026-10-31, as shipped with the plugin", the time it was last checked, and the Check for new prices button ringed in red

What the list counts:

  • Long prompts at their long prices, where a provider charges more for them: Claude Haiku 5.5 above 100,000 prompt tokens (the cache reads and writes counted), OpenAI above 272,000 and Gemini Pro above 200,000.
  • The cache of Claude models counted once. Before 3.2 the cached input was taken away twice, so a cached answer looked nearly free. Answers of Claude with a cache now cost a little more than before, as Anthropic bills them.
  • Images from their tokens on OpenAI, as the image tool bills them, and per image on Gemini.

Costs stored before the update stay as they were. A price that changes on a known date switches over by itself.

Extended thinking#

Extended Thinking, in the AI Provider section of a Claude bot, lets the model think through a problem before it answers, with Thinking Budget (tokens) for how much (10,000 when left empty). The thinking tokens count in the bot's token usage.

Claude 4.7 and later (such as Opus 5.5, Sonnet 5.5 and Haiku 5.5) refuse a thinking budget. Since Better Messages 3.2 these models use adaptive thinking instead, at an effort taken from the budget, and no temperature is sent:

Thinking Budget (tokens)Effort
Up to 4,096Low
Up to 16,384 (the default 10,000 included)Medium
Up to 32,768High
MoreExtra high, or the highest the model offers

Claude 4.6 takes either, and Claude 4.5 and earlier a budget only. Before 3.2, a bot on Claude 4.7 or later with Extended Thinking on got an error from Anthropic instead of an answer.

OpenAI's reasoning models (the o-series and GPT-5) have Reasoning Effort in the same section instead.

Voice messages#

Users can speak to a bot instead of typing. The recording is transcribed and the transcript is what the bot reads, so this works on every provider — an Anthropic or Gemini bot takes a voice message just as well as an OpenAI one. No audio is ever sent to the bot's own provider.

Two things are needed:

  1. The Voice and Video Messages add-on, active as usual.
  2. A transcription provider at WP Admin → Better Messages → Settings → Voice Messages — either Better Messages Transcription AI (included with the WebSocket license) or the OpenAI Transcription API (your OpenAI key).
info

The Enable Transcription switch on that tab is not required. It governs the Transcribe button people press on a voice message themselves. A bot only needs a transcription provider to be configured, because it is handed the transcript either way.

Each bot then has its own Voice Input switch in the bot editor, under Capabilities, on by default. Turn it off for a bot that should be written to only — the microphone then disappears in that bot's conversations. Role restrictions set on the Voice Messages tab still apply on top: a role that may not send voice messages cannot send them to a bot either.

What the sender sees#

The moment the voice message is sent it shows Transcribing… instead of a Transcribe button, and the transcript appears under the recording as soon as it is ready — the same text the bot received. The bot's reply streams in right after.

If the recording cannot be transcribed, the bot answers with a short note saying so instead of replying to silence.

tip

OpenAI's audio models (model names containing -audio-) work differently: they accept voice messages regardless of these settings and reply with a voice message of their own, in the voice picked in the bot editor.

Welcome message#

Each bot can have a Welcome message — the first thing the bot says when a user starts a new 1:1 conversation with it.

Bot welcome message shown virtually on the New Conversation screen

The welcome message appears in two places:

  1. Virtually on the New Conversation screen the moment the user picks the bot as the recipient — before the thread even exists, so visitors can see how the bot greets them before typing anything.
  2. Persisted as the first real message of the thread once the user sends their first message, so it shows in the conversation history on reload.

Delivery is silent: the welcome message does not increment the unread badge and does not send push notifications.

The welcome message is sent only for 1:1 conversations. Adding the bot to an existing group chat or a chat room does not trigger it.

By default the welcome message is also passed to the AI provider as part of the conversation history, so the bot stays aware of what it said. You can turn this off per-bot with the Include Welcome in Context toggle to save input tokens.

Formatting#

The welcome message supports both Markdown and raw HTML — use whichever is more convenient:

Hi **{first_name}**! Check out our [knowledge base](https://example.com/docs)
or jump to <a href="/support" target="_blank">support</a>.

Unlike AI-generated replies (which are HTML-entity-encoded before rendering so that any < in model output shows as literal text), the welcome message template is authored by an admin and is therefore rendered as-is through the same Markdown + HTML pipeline used by other bot messages. This means you can embed links, bold text, line breaks, and simple tags like <code>, <b>, <em>, and <a href> directly.

Placeholders#

Bot Behavior panel with Instruction, Welcome Message and placeholder chips

Both the Instruction (system prompt) and the Welcome message support curly-brace placeholders that are expanded at runtime. Unknown tokens are left unchanged.

User: {name}, {display_name}, {first_name}, {last_name}, {email}, {user_id}, {user_role}

Site: {site_name}, {site_url}, {site_description}

Date & time (uses WordPress site timezone): {current_date}, {current_time}, {current_datetime}, {current_year}, {day_of_week}, {time_of_day} (morning / afternoon / evening / night)

Bot: {bot_name}, {bot_id}

The admin UI shows every available token as a clickable chip. Clicking a chip inserts the token at the cursor in whichever field (Instruction or Welcome message) you last focused. With no field focused it copies the token to the clipboard instead.

Conditionals#

You can also wrap content in conditional blocks that only render when the condition matches. Content inside non-matching blocks is stripped.

  • {if_guest}...{/if_guest} — shown only to guest visitors
  • {if_user}...{/if_user} — shown only to logged-in WordPress users
  • {if_role:<slug>}...{/if_role:<slug>} — shown only when the user has the given WP role (e.g. administrator, editor, subscriber). Opening and closing tags must reference the same role.
  • {if_morning} / {if_afternoon} / {if_evening} / {if_night} — shown only during that time-of-day band

Conditionals can be combined with plain placeholders. Example welcome message:

{if_user}Welcome back, {first_name}!{/if_user}{if_guest}Hi! Create an account for a smoother experience.{/if_guest} It's {time_of_day} at {site_name} — how can I help?

Preview button#

Every textarea that supports placeholders has a Preview button next to it. Clicking it resolves the template against your current admin account and shows the rendered result, so you can verify tokens and conditionals produce the output you expect before saving.