zithara / webhook
Zithara Magento 2 plugin for syncing Customers, Orders and Cart data from merchants magento ecommerce to Zithara.AI CRM.
Installs: 4
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:magento2-module
pkg:composer/zithara/webhook
Requires
- php: >=8.2
- magento/framework: ^103.0
- dev-main
- 1.0.3
- 1.0.3beta
- 1.0.2
- 1.0.1
- 1.0.0.x-dev
- 1.0.0
- dev-dev
- dev-mujeebzithara-patch-2
- dev-fetch-mobile-number-from-customattributes
- dev-mujeebzithara-patch-1
- dev-wonderd
- dev-bugfix/platform_customer_id-dev
- dev-bugfix/platform_customer_id
- dev-message-type-fix
- dev-adding-production-url
- dev-fixing-issues
This package is auto-updated.
Last update: 2026-01-20 12:31:26 UTC
README
Overview
The Zithara Webhook module enables real-time data synchronization between Magento 2 and Zithara's API. It handles various events including cart operations, customer actions, and order processing.
Features
- Real-time cart synchronization
- Customer event tracking
- Order status updates
- Secure API authentication
- Queue-based processing
- Robust error handling and logging
Architecture
Core Components
1. Event Observers
- Cart Events (
CartSave,CartUpdate, etc.) - Customer Events (
CustomerSave,CustomerLogin, etc.) - Order Events (
OrderCreate,OrderUpdate, etc.) - Payment Events (
PaymentCapture,PaymentRefund, etc.)
2. Queue System
- Message Publishers
- Queue Processors
- Event-specific handlers
3. API Integration
- Authentication management
- API endpoints configuration
- Request/Response handling
Directory Structure
app/code/Zithara/Webhook/
├── Block/
│ └── Adminhtml/
│ └── Config/
│ └── Edit/
│ └── Form.php
├── Controller/
│ └── Adminhtml/
│ └── Config/
│ ├── Index.php
│ └── Save.php
├── Helper/
│ └── Data.php
├── Model/
│ ├── Config.php
│ ├── Config/
│ │ └── ApiEndpoints.php
│ ├── Queue/
│ │ ├── Api/
│ │ │ └── ZitharaApiClient.php
│ │ ├── CartProcessor.php
│ │ ├── CustomerProcessor.php
│ │ ├── OrderProcessor.php
│ │ └── WebhookProcessor.php
│ └── ResourceModel/
│ └── Config/
│ └── Collection.php
├── Observer/
│ ├── Cart/
│ │ ├── CartAddProduct.php
│ │ ├── CartDelete.php
│ │ ├── CartRemoveItem.php
│ │ ├── CartSave.php
│ │ └── CartUpdate.php
│ ├── Customer/
│ │ ├── CustomerAddressSave.php
│ │ ├── CustomerDelete.php
│ │ ├── CustomerEdit.php
│ │ ├── CustomerLogin.php
│ │ ├── CustomerLogout.php
│ │ └── CustomerSave.php
│ ├── Order/
│ │ ├── OrderCancel.php
│ │ ├── OrderCreate.php
│ │ ├── OrderPayment.php
│ │ ├── OrderRefund.php
│ │ └── OrderUpdate.php
│ └── Payment/
│ ├── PaymentCapture.php
│ ├── PaymentFail.php
│ └── PaymentVoid.php
└── etc/
├── adminhtml/
│ ├── menu.xml
│ └── routes.xml
├── communication.xml
├── config.xml
├── crontab.xml
├── db_schema.xml
├── di.xml
├── events.xml
├── module.xml
├── queue_consumer.xml
├── queue_publisher.xml
└── queue_topology.xml
Configuration
Admin Configuration
Path: Stores > Configuration > Zithara > Webhook Settings
General Settings
- Enable/Disable Module
- API Credentials
- Client ID
- Client Secret
- Event Selection
- Retry Settings
- Maximum Retries
- Retry Delay
Queue Configuration
- Queue Names:
zithara.webhook.eventszithara.customer.eventszithara.order.eventszithara.cart.events
API Integration
Authentication
The module uses OAuth2 for API authentication:
- Obtains access token using client credentials
- Manages token expiration and refresh
- Securely stores credentials
Endpoints
Base URL: https://dev-pos-api.zithara.com/v1
Available Endpoints:
/generate-access-token- Authentication/cart- Cart operations/customer- Customer operations/order- Order operations
Data Formats
Cart Data Structure
{
"customer": {
"platform_customer_id": "string",
"first_name": "string",
"last_name": "string",
"name": "string",
"whatsapp_phone_number": "string",
"email": "string|false",
"custom_attributes": {}
},
"cart_item": [
{
"platform_cart_item_id": "string",
"price": "float",
"product_id": "integer",
"quantity": "float"
}
],
"cart": {
"currency": "string",
"platform_cart_id": "string",
"name": "string",
"created_at": "datetime",
"total_tax": "float",
"total_price": "float",
"shopify_customer_id": "integer"
}
}
Event Handling
Cart Events
checkout_cart_save_aftercheckout_cart_update_items_aftercheckout_cart_product_add_aftercheckout_cart_deletesales_quote_remove_item
Customer Events
customer_save_aftercustomer_logincustomer_logoutcustomer_address_save_aftercustomer_delete_after
Order Events
sales_order_save_aftersales_order_place_afterorder_cancel_aftersales_order_creditmemo_save_after
Payment Events
sales_order_payment_paysales_order_payment_capturesales_order_payment_voidpayment_cancel
Error Handling
Logging
- Location:
var/log/zithara_webhook.log - Log Levels:
- ERROR: Critical failures
- WARNING: Non-critical issues
- INFO: Important operations
- DEBUG: Detailed debugging
Retry Mechanism
- Failed events are requeued
- Configurable retry attempts
- Exponential backoff
Installation
Requirements
- Magento 2.4.x
- PHP 7.4 or higher
- RabbitMQ/MySQL for queue management
Steps
- Copy module to
app/code/Zithara/Webhook - Enable module:
bin/magento module:enable Zithara_Webhook bin/magento setup:upgrade bin/magento setup:di:compile bin/magento cache:clean
- Configure module in admin panel
- Set up cron jobs
Troubleshooting
Common Issues
-
Queue Processing Issues
- Check RabbitMQ connection
- Verify queue consumer is running
- Check for queue backlog
-
API Connection Issues
- Verify credentials
- Check API endpoint availability
- Review SSL certificates
-
Event Processing Issues
- Check event observer registration
- Verify event data structure
- Review error logs
Debug Mode
Enable debug logging in admin configuration for detailed troubleshooting.
Security
Data Protection
- Sensitive data encryption
- Secure credential storage
- Token-based authentication
Best Practices
- Input validation
- Error handling
- Rate limiting
- Audit logging
Performance
Optimization
- Asynchronous processing
- Batch processing
- Queue management
- Cache utilization
Monitoring
- Queue length
- Processing time
- Error rates
- API response times