# Connect Moguta.CMS

ChatRex searches published Moguta.CMS products, retrieves products and variants, checks availability and returns storefront links. The integration reads the catalog. It does not create orders, modify products or receive the administrator password.

## Before you connect

Use **ChatRex 1.0.7**. These instructions cover **Moguta.CMS 13.1.1 Hypermarket with PHP 8.1**. Other versions and editions require separate verification. You need a valid Moguta.CMS license, administrator permission to install plugins, published products and a store available over HTTPS. The server needs PDO MySQL, OpenSSL, mbstring and cURL.

The store can run at the domain root or in a subdirectory. Enter the complete store address, such as `https://shop.example/store/`, including the subdirectory.

The Moguta.CMS license and ChatRex subscriptions are separate. Installing the module does not provide a free CMS license or service subscription.

## Install and connect the catalog

1. In ChatRex, open **Integrations → Connect integration**, select **Moguta.CMS** and open the connection setup tab.
2. Select **Download the ChatRex module for Moguta**. You can also download the same [ChatRex 1.0.7 archive](https://app.chatrex.pro/api/public/integration-packages/moguta/download) directly.
3. In Moguta.CMS, open **Plugins**, select the plugin upload control and upload the complete ZIP. Keep the `chatrex` folder name inside the archive.
4. Enable the ChatRex plugin and open its settings.
5. Enter the store HTTPS address, currency and language. Use a three-letter currency code, such as `RUB`, and a language code such as `ru` or `en`.
6. Generate a connection code. Copy the displayed connection URL and one-time code.
7. In ChatRex, fill in **Connection URL from the module** and **One-time code**, then select **Connect catalog**.
8. Wait for **Connected** and check the integration subscription in ChatRex.

The Moguta module settings may appear in Russian; the steps above describe each field by its purpose. A code is valid for ten minutes and can be used once. Generate a new code in the plugin settings if it expires. Copy the complete connection URL: a store in a subdirectory uses an address such as `https://shop.example/store/chatrex-catalog`.

The archive is distributed through ChatRex. This download does not mean that the module is published in the Moguta.CMS plugin store.

## Catalog updates

Give the command displayed in the plugin settings for the five-minute cron job to the server administrator. Add it to the site's normal scheduler with a five-minute interval. It delivers catalog change notifications and checks the connection state. Products and inventory are read directly from Moguta.CMS.

The command contains a service token. Keep it outside public website files and do not publish it in messages or documentation. Confirm that the scheduler actually runs the command without errors.

## Storefront chat

1. Connect **Website chat** in ChatRex and add the store's HTTPS domain to that chat's allowed domains.
2. In the bot editor, open **Channels and launch**, add this chat and save.
3. In the Moguta.CMS connection, open **Website chat**, select that chat and choose **Install widget**.
4. After installation is confirmed, reload the storefront and send a test message.

The module adds the selected widget without changing the template. Remove any duplicate installation of the same chat first. If the site uses CSP, the site administrator must allow ChatRex widget resources.

## Verify, update and disconnect

Configure [Moguta.CMS actions](../../actions/integrations/moguta.md). Ask about a real published product and verify the title, SKU, price, currency, selected variant inventory and returned link.

Before updating, back up the plugin files and data. Upload the new archive through Moguta's normal plugin upload control while preserving the existing configuration. Do not disable the plugin just to update it: disabling revokes the connection and removes its generated connection pages. After the update, check the version, connection status, widget and scheduler.

**Disconnect** in ChatRex revokes catalog access and the widget. If the site is unavailable, also disable the plugin in Moguta.CMS. When permanently removing the plugin, remove its cron job. Store products and orders remain unchanged.

If the URL or code is rejected, check HTTPS, the subdirectory, plugin activity and code expiry. Contact [ChatRex support](mailto:support@chatrex.pro) without sending the CMS password or the service cron command.
