How to Add an AI Chatbot to Magento 2 — Step by Step
↑ Part of AI chatbot for your website
In short: you create an agent in BotChata, let it index your store, and paste one script tag into Content → Design → Configuration → Footer → Miscellaneous HTML. From then on the bot answers shipping, returns and product questions from your store's own pages, in 40+ languages, around the clock. About 5 minutes, no extension, no developer. On the Base plan you can also connect a Magento integration token: then the bot shows product cards from your catalog and looks up order status after checking the customer's e-mail or phone.
→ Start free — no credit card · Live in 5 minutes · Free plan forever
Why Magento stores do this: Magento catalogs are large, and the answers customers need are spread across CMS pages, product attributes and the footer. A bot that has read all of it answers in seconds. Once a week you get an e-mail listing the questions it couldn't answer: the gaps worth fixing on your pages.
What You Need
- Magento Open Source or Adobe Commerce 2.4 with admin access to Content → Design.
- A BotChata account. The free plan is enough for the widget (e-mail sign-up, no credit card). The free plan indexes up to 200K characters; a large catalog needs Base.
- For product cards and order status: the Base plan and access to System → Integrations.
Part 1 — Set Up BotChata (about 3 minutes)
Step 1: Create the agent
Sign up at botchata.net and open the dashboard. Click "Add site", enter the Site name and your store's Website URL in the "Add an agent" dialog, and click "Create & start indexing".

Step 2: Wait for indexing
BotChata reads product and category pages, shipping and returns, terms, FAQ and contact pages. Under Training → Links you see every page it found; when they show as indexed, the agent is ready. On a large catalog, check that the CMS pages (shipping, returns) are there too, not only products.

Step 3: Test it
Open the agent's Overview and ask real customer questions in the test chat: "Do you ship to Ireland?", "How long do I have to return?". A "don't know" answer means the information isn't on your site, which is exactly what you want to find before customers do.

Step 4: Copy the embed code
Go to Publish → Widget, open the "Script" tab and click "Copy":

<script
src="https://botchata.net/api/widget.js"
data-api-key="YOUR_KEY"
data-api-url="https://botchata.net/api"
defer
></script>
Part 2 — Add the Script to Magento (about 2 minutes)
Magento has a field for this in the admin. No theme files, no module.
✅ Method A (recommended): Footer → Miscellaneous HTML
- In the Admin sidebar, go to Content → Design → Configuration.
- Find your store view in the grid and click Edit in the Action column.
- Under Other Settings, expand Footer.
- Paste the BotChata script into Miscellaneous HTML. Magento places it just before the closing
</body>tag. - Click Save Configuration.
- If Magento reports invalidated cache types, go to System → Tools → Cache Management and refresh them. With Varnish or a CDN in front, purge it as well.
Several store views (e.g. one per language)? Repeat for each one that should show the chat. One agent serves them all: it detects the customer's language.
Method B: HTML Head → Scripts and Style Sheets
Same screen, the HTML Head section instead of Footer. The script then sits before </head>. Because of defer, it still waits for the page. Use this if your theme or another extension already manages the footer field.
About checkout. From Magento 2.4.7, payment pages enforce the Content Security Policy, and Adobe notes that scripts entered in these design fields must be allow-listed to run there. Elsewhere in the store the policy only reports. In practice: the chat shows on product, category and CMS pages; on checkout it may not, unless your developer adds
botchata.nettoscript-srcandconnect-srcin the store's CSP allow-list (csp_whitelist.xml). For most stores no chat inside checkout is fine.
Optional: Product Cards and Order Status (Base)
The script gives the bot your pages. The integration gives it your catalog and orders, live. It uses Magento's own integration token; nothing is installed in your store.
In Magento
- System → Extensions → Integrations → Add New Integration. Enter a name (e.g. "BotChata") and confirm with your admin password.
- In the left panel open API, set Resource Access to Custom and tick:
- Catalog → Inventory → Products (product search);
- Sales → Operations → Orders → Actions → View (order status);
- Sales → Operations → Shipments (tracking numbers).
- Save, then click Activate → Allow and copy the Access Token.
- On Magento 2.4.4 and later: Stores → Configuration → Services → OAuth → Consumer Settings → "Allow OAuth Access Tokens to be used as standalone Bearer tokens" → Yes, then save.
Adobe marks this switch as not recommended, because an integration token doesn't expire. Give the integration only the three resources above, and revoke it in System → Integrations if you stop using BotChata.
Skip step 4 and every request is refused with the same
401 "The consumer isn't authorized to access %resources"that a missing permission gives, so the two look identical. Check this switch first.
In BotChata
- Functionality → Integrations → Magento → Connect.
- Enter the Store URL and the Integration access token, then Save.
- Click Test connection. It checks the product search only.
- To check orders, ask about a real order in the Overview test chat, with the order's e-mail.
- Under Functionality → Capabilities → Online store, set "Price currency on cards" (shown with product cards on). Magento's API sends the price without a currency.
What the bot gets from Magento
| Customer asks | What happens |
|---|---|
| "Do you have the linen tee?" | Search by product name, up to 6 results, shown as cards: photo, name, price, link |
| "Where is order 42?" | The lookup needs the order number and the e-mail or phone on the order; without both it returns nothing. "42" finds 000000042; a number with a store prefix must be typed in full |
| Contact matches | Status, date, total and currency, shipping method, tracking number with carrier, items. A configurable product shows as the variant bought ("Linen tee Blue") |
| Contact doesn't match | Nothing. The check runs in code, before the model sees any order data |
Five Magento-specific details worth knowing before you connect:
- Status is Magento's code, not your label, e.g.
pending,processing,complete,canceled,holded,closed. Magento's REST API has no endpoint for status labels. - Search matches the phrase inside the name. "linen tee" finds "Linen tee Blue"; "tee linen" doesn't.
- The card shows the regular price. Special prices and catalog price rules don't reach it.
- The card link is built as
your-store.com/<url-key>.html, Magento's default. If you changed the product URL suffix or put store codes in your URLs, click one card link to check it. - The same order number in two store views? The bot answers only the one whose contact matches, and refuses if both match.
Why order status says "temporarily unavailable"
An integration created earlier for something else usually has Catalog rights only. Product search then works, while order questions get "temporarily unavailable". Add Orders (and Shipments for tracking) to the integration's resources and click Reauthorize: Magento then issues a new token, which you paste into BotChata. Or create a separate integration just for BotChata, as above. Without Shipments the order still answers, and the bot simply doesn't know the tracking number: it gets tracking: null instead of an empty list, so it has nothing that says "not shipped".
Check That It Works
- Open your store in a private window.
- The BotChata bubble appears in the bottom-right.
- Ask a real question ("Do you ship to Austria?").
- The answer comes within seconds, from your store's pages.
Common Problems
| Problem | Fix |
|---|---|
| The widget doesn't appear. | Refresh caches in System → Tools → Cache Management and purge Varnish/CDN. Check you edited the store view you're looking at. |
| It shows everywhere except checkout. | That's the payment-page CSP from 2.4.7 (see above). Allow-list botchata.net or leave checkout without chat. |
| Test connection fails with 401. | The Bearer switch in Stores → Configuration → Services → OAuth is off, or the integration lacks Catalog → Products. |
| Product cards show a bare number. | Set "Price currency on cards" under Functionality → Capabilities → Online store. |
| A card link leads to a 404. | Your product URL suffix isn't .html or the URL has a store code. Check one product's real URL. |
| The bot doesn't know a new product. | It was added after indexing. Re-index under Training → Links, or connect the integration so search reads the catalog live. |
| Answers in the wrong language. | The bot detects the customer's language (40+). Test in a fresh window. |
FAQ
Is there a BotChata extension on the Magento Marketplace? No, and you don't need one. The widget is one script tag in your design configuration. Product search and order status connect through Magento's own integration token.
Does it work on Adobe Commerce and Adobe Commerce Cloud? Yes on Magento Open Source and Adobe Commerce on-premises or on cloud infrastructure. Adobe Commerce as a Cloud Service (Edge Delivery storefront) uses a different storefront, so this guide doesn't apply there.
Can the bot tell a customer where their order is? Yes, on Base, with an integration token that has the Orders permission. The customer gives the order number and the e-mail or phone on the order; if they don't match, the bot shows nothing.
What does it cost? The free plan is $0 forever, 100 messages/month, no card. Paid plans are fixed: Base $39, Business $119, Premium $299 per month, no tokens or credits (pricing). The Magento integration is from Base. (Your Magento hosting is billed separately.)
Will it slow down my store?
No. defer, an isolated Shadow DOM, no render blocking.
Start Now
Give your Magento store an assistant that has read every page and answers customers at any hour.
Live in 5 minutes. 100 messages/month free. Product cards and order status from Base ($39/month). For the broader picture, see AI chatbot for e-commerce.