Contact Form 7 to Dolibarr
WorsPress Plugin: Send Contact Form 7 forms to Dolibarr
by Carlos Herrera · github.com/cehojac/cf7todolibarr · website
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/cehojac/cf7todolibarr/archive/refs/heads/main.zipSeamless integration between Contact Form 7 and Dolibarr CRM/ERP
Automatically send your Contact Form 7 submissions to Dolibarr via REST API. Create prospects, customers, suppliers, or contacts directly from WordPress.
🚀 Developed with Antonella Framework
This plugin is built on top of Antonella Framework, a powerful MVC framework for WordPress that provides:
- ✅ Enterprise-level security (CSRF protection, input sanitization, output escaping)
- ✅ MVC architecture for clean, maintainable code
- ✅ PSR-4 autoloading for modern PHP development
- ✅ Built-in security API for safe WordPress development
📖 Documentation: https://carlos-herrera.com/plugins/cf7-to-dolibarr
👨💻 Author: Carlos Herrera
🔧 Framework: Antonella Framework
English
📖 What is this plugin?
Contact Form 7 to Dolibarr is a WordPress plugin that automatically sends Contact Form 7 submissions to your Dolibarr CRM/ERP system via REST API. When a user submits a form on your WordPress site, the plugin captures the data and creates the corresponding entity in Dolibarr (prospect, customer, supplier, or contact).
🎯 How it works
- User submits a Contact Form 7 on your WordPress site
- Plugin intercepts the submission using WordPress hooks
- Data is mapped according to your field mapping configuration
- API call is made to your Dolibarr instance
- Entity is created in Dolibarr (prospect, customer, supplier, or contact)
- Confirmation is logged in WordPress for tracking
⚡ Key Features
- ✅ Automatic integration - No manual data entry needed
- ✅ Multiple entity types - Create prospects, customers, suppliers, or contacts
- ✅ Visual JSON editor - Easy field mapping without coding
- ✅ Connection testing - Verify your Dolibarr API before going live
- ✅ Multi-language - Available in English, Spanish, French, German, Italian, Portuguese
- ✅ Detailed logging - Track all submissions and errors
- ✅ Secure - Built with enterprise-level security using Antonella Framework
📋 Requirements
- WordPress: 5.0 or higher
- PHP: 8.0 or higher
- Contact Form 7: Active and configured
- Dolibarr: 10.0+ with REST API enabled
- Composer: For installation
🚀 Installation
Option 1: Manual Installation
- Download or clone this repository
- Upload to
/wp-content/plugins/cf7todolibarr/ - Run
composer installin the plugin directory - Activate the plugin in WordPress Admin
Option 2: Via Composer
cd wp-content/plugins
composer require cehojac/cf7-to-dolibarr
⚙️ Configuration
Step 1: Enable Dolibarr API
- Log in to your Dolibarr instance
- Go to Home → Setup → Modules
- Enable API/Web services module
- Go to Home → Setup → Users
- Select your user and generate an API Key (DOLAPIKEY)
Step 2: Configure the Plugin
- In WordPress, go to CF7 to Dolibarr in the admin menu
- Enter your Dolibarr URL (e.g.,
https://your-dolibarr.com) - Enter your API Key (DOLAPIKEY)
- Select the Entity Type you want to create:
- Prospect/Lead (client=2) - For contact form leads
- Customer (client=1) - For confirmed customers
- Supplier (client=4) - For supplier registrations
- Contact - For individual contacts
- (Optional) Configure Field Mapping using the visual JSON editor
- Click Test Dolibarr Connection to verify
- Click Save Settings
Step 3: Field Mapping (Optional)
The plugin automatically maps common fields, but you can customize the mapping:
- Click 🎨 Open Visual JSON Editor
- Add field mappings:
- Left: Contact Form 7 field name (e.g.,
your-name) - Right: Dolibarr field name (e.g.,
name)
- Left: Contact Form 7 field name (e.g.,
- Click USAR JSON to apply
Example mapping:
{
"your-name": "name",
"your-email": "email",
"your-phone": "phone",
"your-company": "company",
"your-message": "note_private"
}
🎨 Visual JSON Editor
The plugin includes a modern visual editor for field mapping:
- Add Simple Fields: Map individual form fields to Dolibarr fields
- Add Groups: Create nested field structures
- Real-time Preview: See your JSON as you build it
- No Coding Required: Point-and-click interface
🌍 Supported Languages
- 🇬🇧 English (default)
- 🇪🇸 Español
- 🇫🇷 Français
- 🇩🇪 Deutsch
- 🇮🇹 Italiano
- 🇵🇹 Português
The plugin automatically displays in your WordPress site language.
🔍 How Data Flows
┌─────────────────┐
│ User submits │
│ Contact Form 7 │
└────────┬────────┘
│
▼
┌─────────────────┐
│ CF7 Hook │
│ (wpcf7_mail_ │
│ sent) │
└────────┬────────┘
│
▼
┌─────────────────┐
│ Plugin │
│ Intercepts │
│ Submission │
└────────┬────────┘
│
▼
┌─────────────────┐
│ Field Mapping │
│ Applied │
└────────┬────────┘
│
▼
┌─────────────────┐
│ API Call to │
│ Dolibarr │
│ REST API │
└────────┬────────┘
│
▼
┌─────────────────┐
│ Entity Created │
│ in Dolibarr │
│ (Prospect/ │
│ Customer/etc) │
└─────────────────┘
🛡️ Security (Powered by Antonella Framework)
This plugin uses Antonella Framework's Security API to ensure enterprise-level protection:
- CSRF Protection: All forms use WordPress nonces
- Input Sanitization: All user input is sanitized before processing
- Output Escaping: All output is escaped to prevent XSS attacks
- Permission Checks: Only administrators can configure the plugin
- Secure API Calls: API keys are never exposed in frontend code
Example from the codebase:
use CH\Security;
// Verify admin permissions
Security::check_user_capability('manage_options');
// Verify nonce for form submission
Security::verify_nonce('cf7doli_nonce', 'cf7doli_config_action');
// Sanitize all input
$api_url = Security::sanitize_input($_POST['cf7doli_api_url'], 'url');
$api_key = Security::sanitize_input($_POST['cf7doli_api_key'], 'text');
🐛 Troubleshooting
Plugin doesn't send data to Dolibarr
- Check that Contact Form 7 is active
- Click Test Dolibarr Connection to verify API connectivity
- Check WordPress debug logs:
docker logs wp-antonella | grep "CF7→Dolibarr" - Verify Dolibarr API module is enabled
"API not found" error
- Verify your Dolibarr URL is correct (include
https://) - Ensure the API/Web services module is active in Dolibarr
- Check that your API key is valid
Fields not mapping correctly
- Use the visual JSON editor to verify field names
- Check Contact Form 7 field names (they use hyphens, e.g.,
your-name) - Consult Dolibarr API documentation for field names
View detailed logs
# View all plugin activity
docker logs wp-antonella | grep "CF7→Dolibarr"
# View only errors
docker logs wp-antonella | grep "CF7→Dolibarr.*❌"
# View successful submissions
docker logs wp-antonella | grep "CF7→Dolibarr.*✅"
🏗️ Built with Antonella Framework
This plugin showcases the power of Antonella Framework, a modern MVC framework for WordPress.
Why Antonella Framework?
- 🏛️ MVC Architecture: Clean separation of concerns (Models, Views, Controllers)
- 🔒 Security First: Built-in Security API for CSRF, sanitization, and escaping
- ⚡ PSR-4 Autoloading: Modern PHP standards
- 🎨 Blade Templates: Optional Laravel-style templating
- 🔧 CLI Tools: Generate controllers, widgets, blocks, and more
- 🐳 Docker Support: Complete development environment included
- 📦 Easy Distribution: One command to create production-ready ZIP files
Project Structure
cf7todolibarr/
├── src/
│ ├── Controllers/
│ │ └── CF7Controller.php # Main controller
│ ├── Services/
│ │ └── DolibarrService.php # Dolibarr API service
│ ├── Config.php # Plugin configuration
│ └── helpers.php # Helper functions
├── languages/ # Translation files
├── composer.json # Dependencies
└── cf7todolibarr.php # Plugin entry point
Learn more: https://antonellaframework.com
📞 Support & Documentation
- Plugin Documentation: carlos-herrera.com/plugins/cf7-to-dolibarr
- Antonella Framework: antonellaframework.com
- Dolibarr API Docs: wiki.dolibarr.org/index.php/REST_API
- Contact Form 7: contactform7.com
📄 License
GPL2+ - See LICENSE for details.
👨💻 Author
Carlos Herrera
- Website: https://carlos-herrera.com
- Email: hi@carlos-herrera.com
- Framework: Antonella Framework
🙏 Acknowledgments
- Antonella Framework - The foundation of this plugin
- Contact Form 7 - The best WordPress form plugin
- Dolibarr - Open-source CRM/ERP system
Developed with ❤️ using Antonella Framework
⭐ If you find this plugin useful, please star it on GitHub!
Español
📖 ¿Qué es este plugin?
Contact Form 7 to Dolibarr es un plugin de WordPress que envía automáticamente los envíos de Contact Form 7 a tu sistema CRM/ERP Dolibarr mediante la API REST. Cuando un usuario envía un formulario en tu sitio WordPress, el plugin captura los datos y crea la entidad correspondiente en Dolibarr (prospecto, cliente, proveedor o contacto).
🎯 Cómo funciona
- El usuario envía un Contact Form 7 en tu sitio WordPress
- El plugin intercepta el envío usando hooks de WordPress
- Los datos se mapean según tu configuración de mapeo de campos
- Se realiza la llamada API a tu instancia de Dolibarr
- Se crea la entidad en Dolibarr (prospecto, cliente, proveedor o contacto)
- Se registra la confirmación en WordPress para seguimiento
⚡ Características Principales
- ✅ Integración automática - No se necesita entrada manual de datos
- ✅ Múltiples tipos de entidad - Crea prospectos, clientes, proveedores o contactos
- ✅ Editor visual JSON - Mapeo de campos fácil sin programar
- ✅ Prueba de conexión - Verifica tu API de Dolibarr antes de publicar
- ✅ Multiidioma - Disponible en inglés, español, francés, alemán, italiano, portugués
- ✅ Registro detallado - Rastrea todos los envíos y errores
- ✅ Seguro - Construido con seguridad empresarial usando Antonella Framework
📋 Requisitos
- WordPress: 5.0 o superior
- PHP: 8.0 o superior
- Contact Form 7: Activo y configurado
- Dolibarr: 10.0+ con API REST habilitada
- Composer: Para instalación
🚀 Instalación
Opción 1: Instalación Manual
- Descarga o clona este repositorio
- Sube a
/wp-content/plugins/cf7todolibarr/ - Ejecuta
composer installen el directorio del plugin - Activa el plugin en WordPress Admin
Opción 2: Vía Composer
cd wp-content/plugins
composer require cehojac/cf7-to-dolibarr
⚙️ Configuración
Paso 1: Habilitar API de Dolibarr
- Inicia sesión en tu instancia de Dolibarr
- Ve a Inicio → Configuración → Módulos
- Habilita el módulo API/Servicios web
- Ve a Inicio → Configuración → Usuarios
- Selecciona tu usuario y genera una Clave API (DOLAPIKEY)
Paso 2: Configurar el Plugin
- En WordPress, ve a CF7 to Dolibarr en el menú admin
- Ingresa tu URL de Dolibarr (ej:
https://tu-dolibarr.com) - Ingresa tu Clave API (DOLAPIKEY)
- Selecciona el Tipo de Entidad que deseas crear:
- Prospecto/Lead (client=2) - Para leads de formularios de contacto
- Cliente (client=1) - Para clientes confirmados
- Proveedor (client=4) - Para registros de proveedores
- Contacto - Para contactos individuales
- (Opcional) Configura el Mapeo de Campos usando el editor visual JSON
- Haz clic en Probar Conexión Dolibarr para verificar
- Haz clic en Guardar Configuración
Paso 3: Mapeo de Campos (Opcional)
El plugin mapea automáticamente los campos comunes, pero puedes personalizar el mapeo:
- Haz clic en 🎨 Abrir Editor Visual JSON
- Agrega mapeos de campos:
- Izquierda: Nombre del campo de Contact Form 7 (ej:
your-name) - Derecha: Nombre del campo de Dolibarr (ej:
name)
- Izquierda: Nombre del campo de Contact Form 7 (ej:
- Haz clic en USAR JSON para aplicar
Ejemplo de mapeo:
{
"your-name": "name",
"your-email": "email",
"your-phone": "phone",
"your-company": "company",
"your-message": "note_private"
}
🎨 Editor Visual JSON
El plugin incluye un editor visual moderno para el mapeo de campos:
- Agregar Campos Simples: Mapea campos individuales del formulario a campos de Dolibarr
- Agregar Grupos: Crea estructuras de campos anidadas
- Vista Previa en Tiempo Real: Ve tu JSON mientras lo construyes
- Sin Programación: Interfaz de apuntar y hacer clic
🌍 Idiomas Soportados
- 🇬🇧 English (predeterminado)
- 🇪🇸 Español
- 🇫🇷 Français
- 🇩🇪 Deutsch
- 🇮🇹 Italiano
- 🇵🇹 Português
El plugin se muestra automáticamente en el idioma de tu sitio WordPress.
🔍 Flujo de Datos
┌─────────────────┐
│ Usuario envía │
│ Contact Form 7 │
└────────┬────────┘
│
▼
┌─────────────────┐
│ Hook CF7 │
│ (wpcf7_mail_ │
│ sent) │
└────────┬────────┘
│
▼
┌─────────────────┐
│ Plugin │
│ Intercepta │
│ Envío │
└────────┬────────┘
│
▼
┌─────────────────┐
│ Mapeo de │
│ Campos │
│ Aplicado │
└────────┬────────┘
│
▼
┌─────────────────┐
│ Llamada API a │
│ Dolibarr │
│ REST API │
└────────┬────────┘
│
▼
┌─────────────────┐
│ Entidad Creada │
│ en Dolibarr │
│ (Prospecto/ │
│ Cliente/etc) │
└─────────────────┘
🛡️ Seguridad (Powered by Antonella Framework)
Este plugin usa la API de Seguridad de Antonella Framework para garantizar protección empresarial:
- Protección CSRF: Todos los formularios usan nonces de WordPress
- Sanitización de Entrada: Toda entrada de usuario se sanitiza antes de procesar
- Escapado de Salida: Toda salida se escapa para prevenir ataques XSS
- Verificación de Permisos: Solo administradores pueden configurar el plugin
- Llamadas API Seguras: Las claves API nunca se exponen en código frontend
Ejemplo del código:
use CH\Security;
// Verificar permisos de admin
Security::check_user_capability('manage_options');
// Verificar nonce para envío de formulario
Security::verify_nonce('cf7doli_nonce', 'cf7doli_config_action');
// Sanitizar toda entrada
$api_url = Security::sanitize_input($_POST['cf7doli_api_url'], 'url');
$api_key = Security::sanitize_input($_POST['cf7doli_api_key'], 'text');
🐛 Solución de Problemas
El plugin no envía datos a Dolibarr
- Verifica que Contact Form 7 esté activo
- Haz clic en Probar Conexión Dolibarr para verificar conectividad API
- Revisa los logs de debug de WordPress:
docker logs wp-antonella | grep "CF7→Dolibarr" - Verifica que el módulo API de Dolibarr esté habilitado
Error "API not found"
- Verifica que tu URL de Dolibarr sea correcta (incluye
https://) - Asegúrate de que el módulo API/Servicios web esté activo en Dolibarr
- Verifica que tu clave API sea válida
Los campos no se mapean correctamente
- Usa el editor visual JSON para verificar nombres de campos
- Verifica los nombres de campos de Contact Form 7 (usan guiones, ej:
your-name) - Consulta la documentación de la API de Dolibarr para nombres de campos
Ver logs detallados
# Ver toda la actividad del plugin
docker logs wp-antonella | grep "CF7→Dolibarr"
# Ver solo errores
docker logs wp-antonella | grep "CF7→Dolibarr.*❌"
# Ver envíos exitosos
docker logs wp-antonella | grep "CF7→Dolibarr.*✅"
🏗️ Construido con Antonella Framework
Este plugin demuestra el poder de Antonella Framework, un framework MVC moderno para WordPress.
¿Por qué Antonella Framework?
- 🏛️ Arquitectura MVC: Separación limpia de responsabilidades (Modelos, Vistas, Controladores)
- 🔒 Seguridad Primero: API de Seguridad integrada para CSRF, sanitización y escapado
- ⚡ Autoloading PSR-4: Estándares modernos de PHP
- 🎨 Plantillas Blade: Templating estilo Laravel opcional
- 🔧 Herramientas CLI: Genera controladores, widgets, bloques y más
- 🐳 Soporte Docker: Entorno de desarrollo completo incluido
- 📦 Distribución Fácil: Un comando para crear archivos ZIP listos para producción
Estructura del Proyecto
cf7todolibarr/
├── src/
│ ├── Controllers/
│ │ └── CF7Controller.php # Controlador principal
│ ├── Services/
│ │ └── DolibarrService.php # Servicio API Dolibarr
│ ├── Config.php # Configuración del plugin
│ └── helpers.php # Funciones helper
├── languages/ # Archivos de traducción
├── composer.json # Dependencias
└── cf7todolibarr.php # Punto de entrada del plugin
Aprende más: https://antonellaframework.com
📞 Soporte y Documentación
- Documentación del Plugin: carlos-herrera.com/plugins/cf7-to-dolibarr
- Antonella Framework: antonellaframework.com
- Docs API Dolibarr: wiki.dolibarr.org/index.php/REST_API
- Contact Form 7: contactform7.com
📄 Licencia
GPL2+ - Ver LICENSE para detalles.
👨💻 Autor
Carlos Herrera
- Sitio web: https://carlos-herrera.com
- Email: hi@carlos-herrera.com
- Framework: Antonella Framework
🙏 Agradecimientos
- Antonella Framework - La base de este plugin
- Contact Form 7 - El mejor plugin de formularios para WordPress
- Dolibarr - Sistema CRM/ERP de código abierto
Desarrollado con ❤️ usando Antonella Framework
⭐ ¡Si encuentras útil este plugin, dale una estrella en GitHub!