AI Chatbot Order System
WordPress/WooCommerce plugin for AI-powered ordering via AI Engine chatbot with confirmation link protection
by Entregamos Bebidas · github.com/taohi01-dotcom/chatbot-order-system
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/taohi01-dotcom/chatbot-order-system/archive/refs/heads/main.zipWordPress/WooCommerce Plugin for AI-powered ordering via AI Engine chatbot with confirmation link protection.
Features
- Order creation via AI Engine chatbot
- Spam protection with confirmation links (48h validity)
- 24h reminder emails
- Automatic cancellation after 48h without confirmation
- Product search functionality
- Delivery slot management
- Order status checking
- Admin column for chatbot orders
Requirements
- WordPress 6.0+
- WooCommerce 8.0+
- AI Engine Pro (Meow Apps)
- PHP 8.0+
Installation
- Upload
chatbot-order-systemfolder to/wp-content/plugins/ - Activate the plugin in WordPress Admin
- Ensure AI Engine Pro and WooCommerce are active
Registered AI Functions
The plugin registers 4 functions for AI Engine:
1. searchProducts
Search products in the shop.
Parameters: | Name | Type | Required | Description | |------|------|----------|-------------| | search_term | string | Yes | Search term for product name, SKU or category | | limit | integer | No | Maximum results (default: 10) |
Example:
"Search for San Miguel beer"
2. createOrder
Create a new WooCommerce order with confirmation link.
Parameters: | Name | Type | Required | Description | |------|------|----------|-------------| | customer_email | string | Yes | Customer email address | | customer_name | string | Yes | Full customer name | | customer_phone | string | No | Phone number | | delivery_address | string | Yes | Full delivery address | | delivery_city | string | Yes | Delivery city | | delivery_postcode | string | Yes | Postal code | | products | array | Yes | Array of {product_id, quantity} | | delivery_date | string | No | Desired date (YYYY-MM-DD) | | delivery_time | string | No | Desired time slot | | order_notes | string | No | Additional notes |
Example:
"I want to order 2 cases of San Miguel to Calle Mayor 10, Madrid 28001"
3. checkOrderStatus
Check the status of an existing order.
Parameters: | Name | Type | Required | Description | |------|------|----------|-------------| | order_id | integer | No | Order number | | customer_email | string | No | Email to find latest order |
Example:
"What is the status of order 12345?"
4. getDeliverySlots
Get available delivery times for a date.
Parameters: | Name | Type | Required | Description | |------|------|----------|-------------| | date | string | Yes | Date (YYYY-MM-DD) | | postcode | string | No | Postal code for area-specific slots |
Example:
"What delivery times are available for Monday?"
Order Workflow
Customer orders via Chatbot
│
▼
┌─────────────────────┐
│ Order created │
│ Status: pending │
│ Token generated │
└─────────────────────┘
│
▼
┌─────────────────────┐
│ Confirmation email │
│ sent to customer │
│ (48h valid) │
└─────────────────────┘
│
┌────┴────┐
│ │
▼ ▼
┌────────┐ ┌────────────────┐
│ 24h │ │ Customer │
│ passed │ │ clicks link │
└────────┘ └────────────────┘
│ │
▼ ▼
┌─────────────┐ ┌──────────────────┐
│ Reminder │ │ Order confirmed │
│ email sent │ │ Status:processing│
└─────────────┘ └──────────────────┘
│
▼
┌─────────────┐
│ 48h passed │
│ without │
│ confirmation│
└─────────────┘
│
▼
┌──────────────────┐
│ Auto-cancelled │
│ Status: cancelled│
│ Email sent │
└──────────────────┘
Email Templates
Confirmation Email
- Sent immediately after order creation
- Contains unique confirmation link
- Lists order details and total
Reminder Email (24h)
- Sent 24 hours after order if not confirmed
- Reminds customer to confirm
- Shows remaining time
Cancellation Email (48h)
- Sent when order auto-cancels
- Informs customer order was cancelled
- Invites to reorder
Database Meta Keys
| Key | Description |
|---|---|
_chatbot_order |
Boolean flag for chatbot orders |
_chatbot_confirmation_token |
Unique confirmation token |
_chatbot_confirmation_expiry |
Token expiry timestamp |
_chatbot_reminder_sent |
Flag if reminder was sent |
Cron Jobs
| Hook | Interval | Purpose |
|---|---|---|
chatbot_order_check_reminders |
Hourly | Send 24h reminders |
chatbot_order_check_cancellations |
Hourly | Cancel expired orders |
Hooks & Filters
Actions
// Fires when chatbot order is confirmed
do_action('chatbot_order_confirmed', $order_id);
// Fires when chatbot order is auto-cancelled
do_action('chatbot_order_auto_cancelled', $order_id);
Filters
// Modify delivery slots
add_filter('chatbot_order_delivery_slots', function($slots, $date, $postcode) {
// Custom logic
return $slots;
}, 10, 3);
// Modify confirmation email content
add_filter('chatbot_order_confirmation_email', function($message, $order) {
return $message;
}, 10, 2);
Admin Features
- Chatbot orders marked with chat icon in order list
- Order notes show chatbot origin
- Confirmation status visible in order meta
Security
- Unique 32-character tokens per order
- Tokens validated server-side
- Expired tokens rejected
- Email sanitization
- CSRF protection on all forms
Changelog
1.0.0 (2024-12-14)
- Initial release
- AI Engine function registration
- Confirmation link system
- 24h/48h email automation
- Admin integration
License
GPL v2 or later
Author
Entregamos Bebidas https://entregamos-bebidas.es