# NetCat Connection

ChatRex finds published NetCat merchandise, receives cards and options, checks leftovers and returns links to the storefront. Integration reads the catalog; orders, buyers, and payments are not transferred.

## Before connecting n

Supports **NetCat 7.2.0 E-Commerce** installed at the root of the HTTPS site, with PHP 8.0 or later and the OpenSSL, mbstring and cURL extensions. You need an administrator with the right to install modules. Other versions and revisions require separate verification.

Ask the server administrator to create a random key of 32 bytes in base64 and transfer it to PHP and cron processes via the `ChatRex_NETCAT_KEY` variable. Keep the key out of the site’s public directory and save it when you update. Without it, the module will not be able to safely store the connection.

## Catalog connection

1. In ChatRex, open **Integrations → Connect integration**, find **NetCat** and click **Connect**.
2. On the **Connection installation** tab, download the module for NetCat 7.2.0 E-Commerce.
3. Install TGZ with the NetCat module installer. Open the **ChatRex** settings.
4. Choose a website, language and directory. For the Netshop store, select **Module Online Store (Netshop)** and mark the desired infoblocks of goods. For conventional components, additionally match the name, price, currency and other data fields. Leave the unknown amount empty.
5. Save the settings and get a one-time code. It lasts 10 minutes and is used once.
6. In ChatRex, specify **Public Site Address** and **Disposable Code from NetCat**, then click **Connect directory**.
7. Wait for the status **Connected**. Check the subscription terms in ChatRex.

To search for the product, its infoblock, site and all parent sections must be included. If the search is blank, start by checking the publication of these items.

The server administrator must run `netcat/modules/chatrex/cron.php` once per minute from the user of the site with the same environment key. This delivers notifications about changing the directory and checks for connection recall. Receipt of goods and the balance is carried out directly from NetCat.

## Chat in the window

1. Connect to ChatRex integration **OnChat** - online chat to the site.
2. On its tab **Settings** add the exact HTTPS-front domain in the **Domains field to which the chat widget** will be connected.
3. In the bot editor, open **Channels and Start → Add channel**, select OnChat and save the changes.
4. In the NetCat connection, select this chat in the **Chat on the site** and click **Install the widget**.
5. Open the published store page and send a test message. Check the answer on your computer and phone.

The module adds a widget without editing CMS templates. If the site uses CSP, the administrator must allow the download of the script from `app.chatrex.pro`, access to the ChatRex API, and connection to `socket.chatrex.pro`. After changing the connection, clear the cache of the site pages.

## Update and shutdown

Before updating, save the module files, its tables and the environment key. [Update Archive](https://app.chatrex.pro/api/public/integration-packages/netcat_update/download) contains module files and idempotent SQL. It is installed by the server administrator: a regular NetCat installer does not accept re-installation of an already installed module.

The **Break connection** button in ChatRex revokes access and turns off the widget of this connection. If the site is temporarily unavailable, the review will arrive at the next successful launch of cron. When removing the module, also remove its cron task and clear the cache of the pages. Store goods are retained.

Set up [NetCat actions](<../../actions/integrations/netcat.md>) so that the bot can access the directory. A ChatRex subscription is separate from a NetCat license.
