Chatbots - Data
The Data tab is where you configure what your chatbot knows about. This determines the context the AI receives when responding to user queries.
Wizard Mode
Wizard mode is the easiest way to set up your chatbot's data. It handles all the technical configuration automatically, so you can focus on what content your chatbot should know about.
To use Wizard mode, make sure the toggle in the top right is enabled.
Post Types
Select which post types your chatbot should have access to. The chatbot will be able to search and reference this content when answering questions.
For example, if you're building a product support chatbot, select your product post type. If you're building a general site assistant, you might select Pages and Posts.
You can select multiple post types. The chatbot will search across all of them.
Context
Give the chatbot access to additional context beyond post content:
- Current user: Include the visitor's display name, email, and role. Useful for personalized responses.
System Instruction
Add custom instructions for the AI. This will be prepended to the generated context instruction.
For example, you might add:
You are a helpful assistant for our website. Be friendly and concise.
If you don't know the answer, say so honestly.
Copy
Generated Context Instruction
Below your custom instruction, you'll see the generated context instruction. This
is what actually gets sent to the AI model. Variables in {curly brackets} will
be replaced with actual content from your selected post types.
You don't need to edit this directly when using Wizard mode. It's generated automatically based on your selections.
Advanced Mode
For power users who need more control, disable the Wizard toggle to access advanced mode. This gives you full control over data sources, variables, and the system message.
Sources
In advanced mode, you can incorporate dynamic data from various sources:
- Text: A simple text field.
- Query: A query to the WordPress database. This source allows you to loop through the results in your system message.
- Post title: The title of a post.
- Post content: The content of a post.
- Bricks content: The content of a Bricks page. (if Bricks is installed)
- Elementor content: The content of an Elementor page. (if Elementor is installed)
- Oxygen content: The content of an Oxygen page. (if Oxygen is installed)
- Postmeta: Metadata associated with a post.
- Taxonomy: A post's taxonomy.
- Term: A term within a taxonomy.
- User: User data.
- Usermeta: Metadata associated with a user.
To add custom data sources, use the sleekAi/chatbot/source filter.
add_filter('sleekAi/chatbot/sources', function ($data) {
$data[] = [
'id' => 'customSource',
'label' => 'Custom Source',
'value' => functionToGetCustomData(),
];
return $data;
});
Copy
Variables
Data query results are stored in variables. For instance, you could save the
title of a post as postTitle. In the system message, you can reference the
variable using curly braces: {postTitle}. This will dynamically replace
{postTitle} with the actual title of the specified post when the system
message is sent.
You can define multiple data sources, and each will be available as a variable.
For example, if you add a "Post title" source and name the variable
myPostTitle, and a "User" data source named currentUserInfo with the meta
key data.user_email, your system message can use both:
The title of the current post is {myPostTitle}.
The current user's email is {currentUserInfo}.
Copy
Meta Keys
For data types like postmeta and usermeta that return an object, you must define a meta-key. This key specifies which object value to retrieve.
For instance, to fetch the current user's email, select the user data source
and set the meta-key to data.user_email. You can then assign a variable name
like userEmail to this source.
System Message
The system message is the first message received by the chatbot. It should be a clear instruction to guide its behavior. All previously defined data variables can be included in this message.
Consider the following example where we want the chatbot to be aware of the current post title and the current user's display name:
- Add a "Post title" data source, variable name:
currentPostTitle. - Add a "User" data source, variable name:
currentUserDisplayName, meta key:data.display_name.
Example System Instruction:
You are an assistant helping users with the content on this page.
The current page title is: {currentPostTitle}.
The user you are chatting with is: {currentUserDisplayName}.
Be polite and refer to them by their name if possible.
Copy
The Query Source
The "Query" source type is particularly powerful. It allows you to fetch multiple posts based on your criteria (post types, terms, search value) and then loop through these posts in your system message.
When configuring a Query source, you define a template for each post found by
the query. Since SleekAI returns the full post object for each item, you will
access its properties using nested syntax like {post.post_title},
{post.post_content}, {post.ID}, {post.permalink}, etc.
If the query returns multiple posts, each rendered template output will be separated by three dashes (---). This allows you to supply a cleanly structured list of items to the language model.
Example template:
Project Title: {post.post_title}
Description: {post.post_excerpt}
Link: {post.permalink}
Copy
Then in your system instruction, reference the variable:
You are a portfolio assistant. Recent projects:
{recentProjects}
Copy