Skip to main content

How to use eChat on a staging or cloned copy

A staging or development store is usually built from a copy of the production database. That copy also carries production's eChat connection: the same Instance ID and Secret Key. Without protection, the copy's sync would write its own content and URLs into production's eChat workspace, and the production chatbot could start sending visitors to the staging site.

The extension protects against this by remembering the address of the store that connected the workspace.

How a copy is detected​

When a store connects to eChat, the extension records the host of its secure base URL, for example www.example.com. Stores that were connected before this protection existed record their host on their first sync after the upgrade, or when the eChat configuration page confirms the connection.

If the current host later differs from the recorded one, the install is treated as a copy:

  • The knowledge base sync is skipped. The sync output and its log say EChat sync skipped for store ...: this install looks like a copy of another.
  • The store's details in eChat (its URL and license) are not updated, so production keeps its own.
  • A critical admin notice names the store that registered the workspace and explains the options below.

Only the host is compared. A change of scheme (http to https) or path does not count as a copy.

On a staging or development copy​

When the notice appears, go to Stores > Configuration > Mirasvit Extensions > eChat and click Disconnect.

Disconnect only clears the connection stored in this copy's database. Production's workspace, knowledge base and conversations are not touched. On a detected copy, the copy also gets a new store identifier, so it is not mistaken for production when it connects again. Delete Workspace is not offered on a detected copy.

After that you can leave the copy disconnected, or click Connect with eChat to create a separate workspace for testing.

warning

Never use Delete Workspace on a copy. The copy's workspace is production's, so deleting it removes production's chatbot, knowledge base and conversations. Before deleting, the confirmation names the address the workspace is registered to: if that is not the store you are on, cancel and use Disconnect.

A copy is not detected when production had not recorded its host yet at the moment the database was copied, for example a backup taken before the first sync after the upgrade. Such a copy records its own host and behaves like a separate store, so it can still sync into production's workspace. To avoid this:

  1. After upgrading production, run bin/magento mirasvit:echat:sync on production once, or open its eChat configuration page.
  2. Rebuild existing staging copies from a production backup taken after that.

When you move from staging to production​

If you built and tested eChat on a staging store and now go live on production, keep the same workspace instead of creating a new one:

  1. On staging, go to the eChat configuration and copy the Instance ID and the Secret Key (click the masked key to reveal it).
  2. On production, open the Restore with credentials tab, enter both values, and click Restore.
  3. Run bin/magento mirasvit:echat:sync on production, or wait for the nightly sync. The workspace is relabeled with production's address, and products, categories, pages and store information are synced from production.
  4. On staging, click Disconnect so its sync stops writing into the workspace. Do not use Delete Workspace there: the workspace is now production's.

The knowledge base, guidance, FAQ, AI provider settings, appearance and conversation history stay in the workspace.

note

Use the Restore with credentials tab in the Magento admin for this. Restoring through Connect with eChat on the consent screen is refused when the workspace is registered to another address, and asks you to contact support.

When you have moved the store to a new domain​

A real domain change looks the same as a copy: the sync stops and the notice appears. To confirm the move and keep your workspace:

  1. In the eChat configuration, copy the Instance ID and the Secret Key (click the masked key to reveal it).
  2. Click Disconnect. This clears only the local connection; the workspace and its content stay in eChat.
  3. Open the Restore with credentials tab, enter the Instance ID and Secret Key, and click Restore.

The new host is recorded, the notice disappears, and the next sync runs again and relabels the workspace with the new URL.

A change between example.com and www.example.com is also a host change and needs the same step.

If a copy already overwrote production's workspace​

This can happen with a staging copy made before this protection existed. On production:

  1. Run a full sync, which also sends production's URL and license to the workspace again:

    bin/magento mirasvit:echat:sync --full
  2. Check the chatbot's answers and links on the production storefront.

Then deal with the copy:

  • Click Disconnect on the copy, whether or not its admin notice is shown. It never deletes the workspace.
  • Never use Delete Workspace on the copy: it would delete production's workspace.
  • If no notice is shown, rebuild the copy from a production backup taken after step 1 before connecting it again. The new copy carries production's recorded host, so it is detected and its sync stays off.