Step-by-Step Guide to Adding an AI Engine ChatBot to WordPress
Apr 15, 2025
0

Anna
Frontend developer
AI Engine is a powerful plugin that integrates OpenAI capabilities (including GPT-3.5/4) into WordPress. It enables users to create AI chatbots, generate content, automate tasks, and more.
This tool is ideal for bloggers, copywriters, e-commerce store owners, educational platforms, and corporate websites.
Key Features of AI Engine
AI Chatbot
Create a customizable AI chatbot to interact with users. You can:
- Connect ChatGPT and set personalized responses.
- Define prompts to control the bot’s behavior and tone.
- Customize the widget’s appearance and functionality.
- Enable chat history storage.
Content Generation
Automatically generate text based on specified parameters:
- Blog posts.
- SEO titles and descriptions.
- Content ideas.
- Summaries, lists, tips, and more.
- Ideal for websites requiring regular content updates.
Playground (Testing Environment)
Experiment with AI prompts in the plugin’s built-in playground:
- Test response quality.
- Generate sample text.
- Fine-tune communication styles.
Analytics and Control
Track usage statistics:
- Token consumption.
- Query history.
- Chatbot activity levels.
Important Notes
OpenAI API Key Required: Full functionality requires an active OpenAI API key. Costs may apply based on token usage.
Setting Up the OpenAI API
- Sign up at https://platform.openai.com/.
- Navigate to API Keys.
- Generate and save your API key.
- In WordPress, go to AI Engine → Settings → OpenAI Key and paste the key.
Secure Key Storage:
Store the key in .env
or wp-config.php
(optional):
define('AI_ENGINE_OPENAI_KEY', 'your-api-key-here');
Configuring Features
Content Generator
Path: AI Engine → Content Generator
- Create templates for articles, product descriptions, headlines, etc.
- Adjust tone, style, language, and text length.
- Generate content automatically using keywords.
AI Chatbot
Path: AI Engine → Playground / ChatBot
Customize styles and behavior.
Choose models: gpt-3.5-turbo
, gpt-4
, or custom.
Configure context memory.
Embed using the shortcode: [mwai_chat]
.
echo do_shortcode('[mwai_chat]');
Analytics Dashboard
- Track token usage.
- Monitor request volume.
- Analyze user interactions.
REST API Integration
Access via:
POST /wp-json/mwai/v1/chat Authorization: Bearer <your_nonce>
Custom Hooks & Filters
Modify chatbot behavior using filters:
add_filter('mwai_chat_prompt', function($prompt, $context) { return $prompt . "\n\nPlease answer like a pirate."; }, 10, 2);
Pro Features
- WooCommerce integration.
- Backend script execution via AI.
- Custom user role handling.
- DALL-E image generation.
Performance & Security Best Practices
- Log prompts and responses for debugging and auditing.
- Use nonce and permission checks for custom API handlers.
- Limit tokens and chat history depth to control costs.
- Set user access limits (e.g., API call quotas).