# Magento

Add the AI chatbot to your Magento or Adobe Commerce store and let it check orders, tracking, prices and stock during chats, texts and calls.

Updated Dec 1, 2026. Source: https://smallbusinesschatbot.com/docs/integrations/online-stores/magento

- **Direction:** In and out
- **Works with:** Magento Open Source and Adobe Commerce 2.4
- **Sign-in:** An integration's access token, saved as a Bearer token credential
- **Time to set up:** About twenty minutes for the first action

## What this does

One line of code in the Magento admin puts the chat widget on every page of your store, and the AI chatbot answers from your product pages once it has [read your website](https://smallbusinesschatbot.com/docs/user-guides/chat-widget/train-on-your-website). [Conversation Actions](https://smallbusinesschatbot.com/docs/user-guides/conversation-actions) then call Magento's REST API during a website chat, text conversation or phone call, so the AI receptionist can:

- Tell a customer the status of their order, found by order number and the email on it.
- Give the carrier and tracking number of a shipped order.
- Say the price of a product and how many are in stock.
- Send a link to the product's page.
- Add the customer's request to the order's comments, for your team to see in the admin.

## Before you start

- A Magento admin login that can change the design configuration and create integrations.
- The order and product actions below use Conversation Actions. [Create an action](https://smallbusinesschatbot.com/docs/user-guides/conversation-actions/create-an-action) covers the editor.

## Put the chatbot on your store

1. **Copy the installation code**

   In the app, open [Add to Website](https://smallbusinesschatbot.com/app?panel=add-to-website) and click **Copy installation code**. [Any website](https://smallbusinesschatbot.com/docs/integrations/your-website/any-website) shows the code.

2. **Open the store view's design**

   In the Magento admin, open **Content › Design › Configuration** and click **Edit** on your store view's row.

3. **Paste the code**

   Expand **Other Settings › HTML Head** and paste the code at the end of **Scripts and Style Sheets**. **Other Settings › Footer › Miscellaneous HTML** works too.

4. **Save and refresh the cache**

   Click **Save Configuration**. If the admin says cache types are invalidated, open **System › Tools › Cache Management** and click **Flush Magento Cache**.

5. **Check it loads**

   Open your store in a private browser window. The launcher shows in the bottom right corner.

Repeat the paste for each store view that should show the chat. On payment pages, Magento 2.4.7 and later run only scripts on the Content Security Policy allow list. To show the chat there too, have your developer add `smallbusinesschatbot.com` to `script-src` and `frame-src` in a module's `csp_whitelist.xml`.

## Create an integration and its token

Magento gives each outside app its own integration, with a token limited to the parts of the store you tick.

1. **Allow the token as a Bearer token**

   Open **Stores › Settings › Configuration › Services › OAuth › Consumer Settings**. Set **Allow OAuth Access Tokens to be used as standalone Bearer tokens** to **Yes** and click **Save Config**. It is off by default since Magento 2.4.4.

2. **Add the integration**

   Open **System › Extensions › Integrations** and click **Add New Integration**. Type a **Name**, such as Small Business Chatbot, and enter your admin password to confirm.

3. **Pick what it can read**

   In the **API** tab, set **Resource Access** to **Custom** and tick only what your actions use (list below). Click **Save**.

4. **Activate it**

   On the grid, click **Activate**, then **Allow**. Magento shows four values. Copy the **Access Token** and click **Done**.

| Action | Resource to tick |
|---|---|
| Order status | **Sales › Operations › Orders › Actions › View** |
| Tracking number | **Sales › Operations › Shipments** |
| Price and stock | **Catalog › Inventory › Products** |
| Comment on an order | **Sales › Operations › Orders › Actions › Comment** |

## Save the token in Small Business Chatbot

In an action's **Send an API request** step, under **Credential**, click **New credential**. Type a **Name**, such as Magento store, pick **Bearer token** as the **Type**, paste the **Access Token** and click **Create credential**. It is saved for your workspace, encrypted, and every action and workflow can pick it.

![The request step with GET, the Magento orders address and a new Bearer token credential named Magento store](https://smallbusinesschatbot.com/static/images/docs/integrations/magento-order-request-2026-12-01.webp)
*Conversation Actions › an action › Steps, December 2026*

In the examples below, replace `shop.example.com` with your store's address. `/rest/V1/` answers for the default store view. For another store view, put its code in the address, such as `/rest/french/V1/`.

## Check an order's status

The customer gives their order number and the email they used at checkout. The request asks Magento for the order with both, so a wrong email finds nothing.

| Setting | Value |
|---|---|
| **Name** | Check order status |
| **When to use it** | When a customer asks where their order is or what its status is. Ask for the order number and the email used at checkout. |
| **Parameters** | `order_number` (Text), `email` (Text) |
| **Step type** | Send an API request |
| **Step name** | `find_order` |
| **Method** | GET |
| **Address** | `https://shop.example.com/rest/V1/orders` |
| **Credential** | Magento store |
| **Query parameters** | The four rows below |
| **Fields to keep** | `items.0.entity_id` as `order_id`, `items.0.status` as `status`, `items.0.created_at` as `ordered_on`, `items.0.grand_total` as `total` |
| **What the agent gets back** | `status`, `ordered_on`, `total` |
| **What to do with the result** | Tell the customer the order status and the date it was placed. |

| Query parameter | Value |
|---|---|
| `searchCriteria[filter_groups][0][filters][0][field]` | `increment_id` |
| `searchCriteria[filter_groups][0][filters][0][value]` | `{{parameters.order_number}}` |
| `searchCriteria[filter_groups][1][filters][0][field]` | `customer_email` |
| `searchCriteria[filter_groups][1][filters][0][value]` | `{{parameters.email}}` |

![Query parameters filtering by order number and customer email, and fields to keep for the order's ID, status, date and total](https://smallbusinesschatbot.com/static/images/docs/integrations/magento-order-fields-2026-12-01.webp)
*Conversation Actions › an action › Steps, December 2026*

`increment_id` is the order number customers see, such as `000000123`. Filters in different groups must all match, so the order is found only when the number and the email both fit. When nothing matches, the AI receptionist asks the customer to check what they gave.

`status` is the order's status code, such as `pending`, `processing`, `complete`, `holded`, `canceled` or `closed`, or one your store added. To give the AI receptionist plain wording, add it to **What to do with the result**, for example "`holded` means the order is on hold".

## Give the tracking number

Make this a second action, so a customer whose order has not shipped still gets their order status from the first.

1. **Copy the order check**

   Create an action named Get tracking number, with the same parameters and the same `find_order` step as [Check an order's status](#check-an-orders-status).

2. **Add the shipment step**

   Add a second **Send an API request** step named `shipment`: **Method** GET, **Address** `https://shop.example.com/rest/V1/shipments`, **Credential** Magento store, and two query parameters: `searchCriteria[filter_groups][0][filters][0][field]` = `order_id` and `searchCriteria[filter_groups][0][filters][0][value]` = `{{steps.find_order.order_id}}`.

3. **Keep the tracking fields**

   Keep `items.0.tracks.0.title` as `carrier` and `items.0.tracks.0.track_number` as `tracking_number`, and tick both under **What the agent gets back**.

The integration needs **Sales › Operations › Shipments** for this step.

## Answer price and stock questions

By SKU, Magento returns one product with its stock:

| Setting | Value |
|---|---|
| **Name** | Check price and stock |
| **When to use it** | When a customer asks the price or stock of a product by its SKU or model number. |
| **Parameters** | `sku` (Text) |
| **Method** | GET |
| **Address** | `https://shop.example.com/rest/V1/products/{{parameters.sku}}` |
| **Credential** | Magento store |
| **Fields to keep** | `name` as `name`, `price` as `price`, `extension_attributes.stock_item.is_in_stock` as `in_stock`, `extension_attributes.stock_item.qty` as `quantity` |
| **What the agent gets back** | All four |

To search by name instead, use the address `https://shop.example.com/rest/V1/products` with three query parameters: `searchCriteria[filter_groups][0][filters][0][field]` = `name`, `searchCriteria[filter_groups][0][filters][0][value]` = `%{{parameters.product_name}}%` and `searchCriteria[filter_groups][0][filters][0][condition_type]` = `like`. Keep `items.0.sku`, `items.0.name` and `items.0.price`. Add `searchCriteria[pageSize]` = `3` to keep the reply short.

`price` is the product's regular price, before special prices and catalog price rules.

## Send a product link

Keep your product links in a [lookup table](https://smallbusinesschatbot.com/docs/user-guides/conversation-actions/lookup-tables), with the SKU as the key and the full link in its own column:

1. **Export your products**

   In the Magento admin, open **System › Data Transfer › Export**, pick **Products** as the **Entity Type** and **CSV** as the format, and click **Continue**. When the file is ready, it shows in the list on the same page, with a **Download** link.

2. **Build the table**

   Keep the `sku` and `name` columns, and add `product_link`: your store's address, the product's `url_key` and the URL suffix, `.html` by default.

3. **Add the action**

   Create an action named Send a product link with the parameter `sku`, and a **Look up in a table** step on that table with **Value to look up** `{{parameters.sku}}`. Tick `name` and `product_link` under **Columns to return** and **What the agent gets back**.

```csv product-links.csv
sku,name,product_link
24-MB01,Joust Duffle Bag,https://shop.example.com/joust-duffle-bag.html
24-WB04,Overnight Duffle,https://shop.example.com/overnight-duffle.html
```

The AI receptionist sends a link only when it is the whole value of a returned field, so each link sits in a column of its own. With [Website Research](https://smallbusinesschatbot.com/docs/user-guides/conversation-actions/website-research) on, the AI chatbot also finds product pages on your store by itself and links to them in website chats.

## Add the customer's request to the order

A customer asks to change a delivery address or add a gift note. A third step writes their words into the order's comments, which your team sees on the order in the admin.

1. **Start from the order check**

   Create an action named Note a change request, with the `find_order` step from [Check an order's status](#check-an-orders-status) and a third parameter, `request` (Text).

2. **Add the comment step**

   Add a **Send an API request** step: **Method** POST, **Address** `https://shop.example.com/rest/V1/orders/{{steps.find_order.order_id}}/comments`, **Credential** Magento store, **Body** JSON as below.

3. **Confirm it**

   Under **What to do with the result**, tell the AI receptionist to say the team has the request on the order.

```json JSON body
{
  "statusHistory": {
    "comment": "From chat: {{parameters.request}}",
    "is_customer_notified": 0,
    "is_visible_on_front": 0,
    "parent_id": {{steps.find_order.order_id}},
    "status": "{{steps.find_order.status}}"
  }
}
```

The integration needs **Sales › Operations › Orders › Actions › Comment**. An action that sends POST changes something, so the [limits on those runs](https://smallbusinesschatbot.com/docs/user-guides/conversation-actions#limits) apply. To give someone a follow-up as well, add a [Create a task](https://smallbusinesschatbot.com/docs/user-guides/conversation-actions/use-your-crm) step.

## If something goes wrong

| What you see | Why | What to do |
|---|---|---|
| **Your system answered with status 401.** in a test | Standalone Bearer tokens are off, or the token is wrong | Set **Allow OAuth Access Tokens to be used as standalone Bearer tokens** to **Yes**, or copy the **Access Token** again |
| Status 401 with the message "The consumer isn't authorized to access %resources." | The integration lacks the resource for that request | Tick the resource in the integration's **API** tab, save, and click **Reauthorize** |
| "Not found" for an order that exists | The email isn't the one on the order, or the order belongs to another store view | Check the email, or put the store view's code in the address |
| No launcher on the store | The code is on another store view, or the cache still holds the old pages | Paste it on the store view's row and flush the cache |
| No launcher on payment pages only | Magento's Content Security Policy blocks the script there | Add `smallbusinesschatbot.com` to `csp_whitelist.xml` |
