Overview
The WordPress integration enables you to:- Import WordPress users as contacts
- Trigger campaigns from WordPress events
- Sync user data between WordPress and TelemanAI
- Authenticate API requests with token-based security
Prerequisites
- WordPress site with admin access
- TelemanAI plugin installed on WordPress
- PHP 7.4 or higher on your WordPress server
Installation
Install TelemanAI WordPress Plugin
- Download the TelemanAI WordPress plugin
- Upload to
/wp-content/plugins/teleman-wordpress/ - Activate the plugin from Plugins menu in WordPress admin
Configure WordPress in TelemanAI
- Log in to TelemanAI dashboard
- Navigate to Integrations → WordPress
- Enter your WordPress configuration:
- WordPress URL: Your WordPress site URL (e.g.,
https://example.com) - Admin Email: Your WordPress admin email address
- Click Save Configuration
Generate API Token
In TelemanAI:
- Click Generate Token button
- Copy the generated token
- This token will be used to authenticate API requests
Importing WordPress Users
Fetch WordPress Users
In TelemanAI:
- Go to Integrations → WordPress
- Click Fetch Data
- TelemanAI will retrieve all WordPress users via API
Review Imported Data
TelemanAI displays a preview of fetched contacts:
- User name
- Phone number (if available)
- Email address
- User role
API Integration Details
Authentication Flow
The integration uses token-based authentication:Fetching Contacts
The API endpoint for fetching WordPress contacts:WordPress Plugin Setup
The TelemanAI WordPress plugin should expose a contacts endpoint:Plugin File Structure
Example Plugin Implementation
teleman/phonebook.php:Triggering Campaigns from WordPress
You can trigger TelemanAI campaigns from WordPress events:Example: New User Registration Campaign
Routes and Controller Reference
Key routes for WordPress integration (seeroutes/woocommerce.php):
| Route | Method | Description |
|---|---|---|
/dashboard/wp | GET | WordPress integration page |
/dashboard/wp/store | POST | Save WordPress configuration |
/dashboard/wp/token | POST | Generate API token |
/dashboard/wp/fetch_data | GET | Fetch WordPress users |
/dashboard/wp/store_data | GET | Import users to contacts |
WordPressController.php (lines 1-228)
Configuration Storage
WordPress configuration is stored in thethird_party table:
application_name: ‘wordpress’application_url: WordPress site URLuser_email: Admin emailuser_token: API authentication token
Troubleshooting
Token Generation Failed
Token Generation Failed
Problem: “The connection is failed” when generating tokenSolution:
- Verify WordPress URL is accessible from TelemanAI server
- Check that the plugin is installed and activated
- Ensure the plugin endpoint is publicly accessible
- Test the URL manually in a browser
No Contacts Fetched
No Contacts Fetched
Problem: Fetch returns empty or failsSolution:
- Verify users have phone numbers in WordPress
- Check the API endpoint returns valid JSON
- Ensure the token is correctly passed in the URL
- Review WordPress error logs for PHP errors
Import Fails
Import Fails
Problem: Contacts won’t import to databaseSolution:
- Ensure phone numbers are in valid format
- Check that you’ve fetched data first (session ‘woocommerce’ exists)
- Verify database permissions
- Review TelemanAI logs for specific errors
401 Unauthorized Error
401 Unauthorized Error
Security Best Practices
Advanced Configuration
Custom User Meta Fields
To include additional WordPress user meta:Webhook Integration
Set up webhooks to receive events from TelemanAI:Next Steps
WooCommerce Integration
Connect with WooCommerce for order-based campaigns
Campaign Automation
Automate campaigns based on WordPress events
Contact Management
Manage your WordPress contacts
API Reference
Complete API documentation