PHPackages                             salesrender/plugin-core-chat - 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. salesrender/plugin-core-chat

ActiveLibrary

salesrender/plugin-core-chat
============================

SalesRender plugin chat core

0.3.0(2y ago)0226proprietaryPHPPHP &gt;=7.4.0

Since Oct 18Pushed 3mo ago2 watchersCompare

[ Source](https://github.com/SalesRender/plugin-core-chat)[ Packagist](https://packagist.org/packages/salesrender/plugin-core-chat)[ RSS](/packages/salesrender-plugin-core-chat/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (13)Used By (0)

Plugin Core Chat
================

[](#plugin-core-chat)

> Type-specific core framework for SalesRender **CHAT** plugins

Overview
--------

[](#overview)

`salesrender/plugin-core-chat` is a specialized core library that extends the base `salesrender/plugin-core` to build **Chat-type** plugins. Chat plugins handle sending and receiving messages to/from customers via various messaging platforms -- WhatsApp, Telegram, SMS, email, and other gateways.

This core provides:

- A queue-based message sending architecture (`ChatSendTask`, `ChatSendQueueCommand`, `ChatSendQueueHandleCommand`)
- A `ChatSenderInterface` that the developer must implement with actual gateway logic
- An HTTP endpoint (`POST /special/send`) for receiving outgoing messages from SalesRender
- A `Chat::send()` method for forwarding incoming messages back to SalesRender CRM
- A `MessageStatusSender` for reporting delivery statuses (sent, delivered, read, error)
- Automatic cron scheduling for processing the send queue

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

[](#installation)

```
composer require salesrender/plugin-core-chat
```

### Requirements

[](#requirements)

- PHP &gt;= 7.4
- ext-json
- `salesrender/plugin-core` ^0.4.1 (installed automatically)
- `salesrender/plugin-component-queue` ^0.3.0 (installed automatically)
- `xakepehok/enum-helper` ^0.1.1 (installed automatically)

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

[](#architecture)

### How This Core Extends plugin-core

[](#how-this-core-extends-plugin-core)

`plugin-core-chat` overrides both factory classes from the base `plugin-core`:

**`WebAppFactory`** (extends `\SalesRender\Plugin\Core\Factories\WebAppFactory`):

- Adds CORS support
- Registers the `SenderAction` as a special request action, creating the route `POST /special/send`

**`ConsoleAppFactory`** (extends `\SalesRender\Plugin\Core\Factories\ConsoleAppFactory`):

- Registers `ChatSendQueueCommand` (`chatSendQueue:queue`)
- Registers `ChatSendQueueHandleCommand` (`chatSendQueue:handle`)
- Adds a cron task that runs `chatSendQueue:queue` every minute

### Message Flow

[](#message-flow)

```
SalesRender CRM                          Chat Plugin                         External Gateway
      |                                       |                                      |
      |--- POST /special/send (outgoing) ---->|                                      |
      |                                       |--- ChatSendTask (queued) ----------->|
      |                                       |--- ChatSenderInterface::__invoke() -->|
      |                                       |                                      |
      |
