PHPackages                             zithara/webhook - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. zithara/webhook

ActiveMagento2-module[API Development](/categories/api)

zithara/webhook
===============

Zithara Magento 2 plugin for syncing Customers, Orders and Cart data from merchants magento ecommerce to Zithara.AI CRM.

1.0.3(1y ago)04proprietaryPHPPHP &gt;=8.2

Since Dec 15Pushed 1y ago1 watchersCompare

[ Source](https://github.com/mujeebzithara/magento-plugin)[ Packagist](https://packagist.org/packages/zithara/webhook)[ RSS](/packages/zithara-webhook/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (1)Versions (17)Used By (0)

Zithara Webhook Module Documentation
====================================

[](#zithara-webhook-module-documentation)

Overview
--------

[](#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
--------

[](#features)

- Real-time cart synchronization
- Customer event tracking
- Order status updates
- Secure API authentication
- Queue-based processing
- Robust error handling and logging

Architecture
------------

[](#architecture)

### Core Components

[](#core-components)

#### 1. Event Observers

[](#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

[](#2-queue-system)

- Message Publishers
- Queue Processors
- Event-specific handlers

#### 3. API Integration

[](#3-api-integration)

- Authentication management
- API endpoints configuration
- Request/Response handling

### Directory Structure

[](#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
-------------

[](#configuration)

### Admin Configuration

[](#admin-configuration)

Path: `Stores > Configuration > Zithara > Webhook Settings`

#### General Settings

[](#general-settings)

- Enable/Disable Module
- API Credentials
    - Client ID
    - Client Secret
- Event Selection
- Retry Settings
    - Maximum Retries
    - Retry Delay

### Queue Configuration

[](#queue-configuration)

- Queue Names:
    - `zithara.webhook.events`
    - `zithara.customer.events`
    - `zithara.order.events`
    - `zithara.cart.events`

API Integration
---------------

[](#api-integration)

### Authentication

[](#authentication)

The module uses OAuth2 for API authentication:

1. Obtains access token using client credentials
2. Manages token expiration and refresh
3. Securely stores credentials

### Endpoints

[](#endpoints)

Base URL: `https://dev-pos-api.zithara.com/v1`

#### Available Endpoints:

[](#available-endpoints)

- `/generate-access-token` - Authentication
- `/cart` - Cart operations
- `/customer` - Customer operations
- `/order` - Order operations

### Data Formats

[](#data-formats)

#### Cart Data Structure

[](#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
--------------

[](#event-handling)

### Cart Events

[](#cart-events)

- `checkout_cart_save_after`
- `checkout_cart_update_items_after`
- `checkout_cart_product_add_after`
- `checkout_cart_delete`
- `sales_quote_remove_item`

### Customer Events

[](#customer-events)

- `customer_save_after`
- `customer_login`
- `customer_logout`
- `customer_address_save_after`
- `customer_delete_after`

### Order Events

[](#order-events)

- `sales_order_save_after`
- `sales_order_place_after`
- `order_cancel_after`
- `sales_order_creditmemo_save_after`

### Payment Events

[](#payment-events)

- `sales_order_payment_pay`
- `sales_order_payment_capture`
- `sales_order_payment_void`
- `payment_cancel`

Error Handling
--------------

[](#error-handling)

### Logging

[](#logging)

- Location: `var/log/zithara_webhook.log`
- Log Levels:
    - ERROR: Critical failures
    - WARNING: Non-critical issues
    - INFO: Important operations
    - DEBUG: Detailed debugging

### Retry Mechanism

[](#retry-mechanism)

- Failed events are requeued
- Configurable retry attempts
- Exponential backoff

Installation
------------

[](#installation)

### Requirements

[](#requirements)

- Magento 2.4.x
- PHP 7.4 or higher
- RabbitMQ/MySQL for queue management

### Steps

[](#steps)

1. Copy module to `app/code/Zithara/Webhook`
2. Enable module: ```
    bin/magento module:enable Zithara_Webhook
    bin/magento setup:upgrade
    bin/magento setup:di:compile
    bin/magento cache:clean
    ```
3. Configure module in admin panel
4. Set up cron jobs

Troubleshooting
---------------

[](#troubleshooting)

### Common Issues

[](#common-issues)

1. Queue Processing Issues

    - Check RabbitMQ connection
    - Verify queue consumer is running
    - Check for queue backlog
2. API Connection Issues

    - Verify credentials
    - Check API endpoint availability
    - Review SSL certificates
3. Event Processing Issues

    - Check event observer registration
    - Verify event data structure
    - Review error logs

### Debug Mode

[](#debug-mode)

Enable debug logging in admin configuration for detailed troubleshooting.

Security
--------

[](#security)

### Data Protection

[](#data-protection)

- Sensitive data encryption
- Secure credential storage
- Token-based authentication

### Best Practices

[](#best-practices)

- Input validation
- Error handling
- Rate limiting
- Audit logging

Performance
-----------

[](#performance)

### Optimization

[](#optimization)

- Asynchronous processing
- Batch processing
- Queue management
- Cache utilization

### Monitoring

[](#monitoring)

- Queue length
- Processing time
- Error rates
- API response times

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance40

Moderate activity, may be stable

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

6

Last Release

519d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6a61e828cba327db672cde433cb2e2e3a0ebddb567afbdcc1616aa02ac5fe4e2?d=identicon)[mujeeb1238](/maintainers/mujeeb1238)

---

Top Contributors

[![mujeebzithara](https://avatars.githubusercontent.com/u/191693181?v=4)](https://github.com/mujeebzithara "mujeebzithara (34 commits)")

### Embed Badge

![Health badge](/badges/zithara-webhook/health.svg)

```
[![Health](https://phpackages.com/badges/zithara-webhook/health.svg)](https://phpackages.com/packages/zithara-webhook)
```

###  Alternatives

[smile/elasticsuite

Magento 2 merchandising and search engine built on ElasticSearch

8044.5M33](/packages/smile-elasticsuite)[mollie/magento2

Mollie Payment Module for Magento 2

1121.6M10](/packages/mollie-magento2)[graycore/magento2-cors

A Magento 2 module that enables CORS on the GraphQL and REST Apis

99516.1k](/packages/graycore-magento2-cors)[elgentos/module-prismicio

Magento 2 - Prismic.io integration

39112.0k3](/packages/elgentos-module-prismicio)[zepgram/module-rest

Technical module to industrialize API REST call with dependency injection pattern using Guzzle library

1326.2k](/packages/zepgram-module-rest)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
