Docs/E-Commerce/Magento 2 Integration

Magento 2 Integration

The Magento 2 integration uses a downloadable Magento module that handles both the chat widget injection and the API bridge. The recommended path is a one-command auto-installer that installs the module and completes the OAuth handshake for you, with no credentials to copy by hand. A fully manual install is also available as an advanced fallback.

Quick Install (recommended)

On the Magento integration page in AIChatVault, go to the Install Connector step. You'll see a one-line command with a Quick Install badge — copy it and run it from your Magento root directory over SSH or your host's terminal (e.g. cPanel Terminal):

1

Copy the install command

It looks like php <(curl -sL https://www.aichatvault.com/installer/magento/<your-secret>). The URL is unique to your agent and pre-filled with your webhook secret — no need to edit it.
2

Run it from your Magento root

The script downloads the AIChatVault Connector module (bundled inside the script itself — nothing else to download), writes its files into app/code/AIChatVault/Connector/, enables the module and registers it with Magento, saves the connector settings (webhook secret, widget script URL, Chatbot ID and the widget switch) and flushes the caches. It is all done in one pass, typically under a minute. No compile step is needed: you do not have to run setup:di:compile, even in production mode.
3

OAuth completes automatically

Unlike the manual flow, you never see or copy OAuth credentials. The installer performs the OAuth exchange itself and reports the result back to AIChatVault directly — you don't visit Magento Admin at all.
4

Connection complete

Back on the AIChatVault integration page, the status flips to Connected and a background product sync starts automatically.
💡
The install command is generated per-agent and expires if left unused, so grab a fresh copy from the integration page if it's been a while since you started the connection.

Advanced: manual installation

If you can't run the one-line installer (e.g. restricted shell access, or you manage deployments through Composer only), you can install the module and connect by hand instead:

1

Download the module

On the Magento integration page in AIChatVault, use the Alternative installation methods section to download the module zip, or add it via Composer.
2

Install the module

Upload the module to your Magento installation via Composer (recommended for production) or by copying the files manually to app/code/AIChatVault/Connector/.
3

Enable and run setup

Run the following commands in your Magento root:
  • •php bin/magento module:enable AIChatVault_Connector
  • •php bin/magento setup:upgrade
  • •php bin/magento cache:flush
4

Verify installation

Log in to Magento Admin and navigate to System → Extensions → Integrations. You should see an "AIChatVault" integration entry.
5

Activate the integration and copy credentials

Go to System → Extensions → Integrations, find the AIChatVault entry, click Activate, review the requested API resources, and click Allow. Magento generates four OAuth credentials — copy the Consumer Key, Consumer Secret, Access Token, and Access Token Secret. You'll need all four.
6

Enter credentials in AIChatVault

On the Magento integration page, click "I already have OAuth credentials — connect manually", paste your store's base URL (e.g. https://yourstore.com) and all four OAuth values, then click Connect Magento Store. AIChatVault verifies the credentials and starts a background product sync.

Available actions

ActionDescription
Product Search & RecommendationsSearches the Magento catalogue and shows product cards with images, prices, and Add to Cart links.
Order Status LookupRetrieves order status, tracking info, and purchase history by order number.
View CartDisplays the customer's current cart contents, quantities, and totals.
Browse CategoriesBrowses Magento categories to help the AI find relevant products when keyword search returns no results.
Update Customer ProfileLets signed-in customers update their name or email through chat.
Update Billing AddressLets signed-in customers add or update billing addresses through natural conversation.
Compare ProductsShows a side-by-side comparison of up to 4 products the customer is considering.
Check Return EligibilityChecks whether an order is still within your configured return window. Governed by the Return Policy panel on the integration page (return window in days, and any excluded product tags).
Check Discount CodeValidates whether a discount or coupon code the customer mentions is currently active.
Get Cross-Sell / Related ProductsSuggests related products after the customer shows interest in an item.
ℹ️
Order Cancellation is not currently available for Magento stores — it's supported on Shopify and WooCommerce only.

Widget injection

The connector adds the AIChatVault chat widget to every storefront page. No theme editing is needed. The widget appears once three settings are saved in Magento Admin under Stores → Configuration → AIChatVault → Connector Settings: Widget Script URL, Chatbot ID and the widget switch. The Quick Install command fills all three in for you.

You can switch the widget on or off at any time from the Magento integration page in AIChatVault. The change reaches your store immediately and the connector clears the page caches, so you do not need to flush the cache yourself.

Product sync

A product sync runs automatically when you first connect. The integration page shows the synced product count and last sync timestamp. Click Sync Products to trigger a manual sync after catalogue updates.

Connector settings in Magento

Open Stores → Configuration → AIChatVault → Connector Settings. The Quick Install command sets these for you; you only need them for a manual install:

  • Webhook URL: where product changes are sent. The default is correct for most stores.
  • Webhook Secret: the secret shown on the AIChatVault Magento integration page. It signs every request between the two sides, so both must hold the same value.
  • Widget Script URL and Chatbot ID: shown on the same page for manual installs.

After changing a setting by hand, flush the cache in System → Cache Management.

Troubleshooting

  • The widget switch shows "The store rejected the Webhook Secret". The secret in Magento differs from the one in AIChatVault, usually because an older value was saved in the Magento admin. Run the Quick Install command again: it resets the secret in Magento to the correct value. Or paste the secret from the integration page into Webhook Secret and flush the cache.
  • The widget shows on some pages but not others. Magento is serving an older cached copy of those pages. In System → Cache Management click Flush Cache Storage, or delete the contents of var/page_cache. If your store uses Redis or Varnish, flush those too.
  • The integration page says the connector is not found. Check that the module is enabled (php bin/magento module:status AIChatVault_Connector) and that your store is reachable over HTTPS.

Disconnecting Magento

Clicking Disconnect in AIChatVault removes the stored credentials and clears synced products from the knowledge base. To also remove the widget from your store, disable or uninstall the Magento module via php bin/magento module:disable AIChatVault_Connector.

⚠️
Magento's REST API requires HTTPS with a valid SSL certificate. HTTP-only installs and self-signed certificates will cause connection failures. Ensure your Magento base URL is set to HTTPS in Stores → Configuration → General → Web.

Was this page helpful?