# Magento

Alhena supports Magento 2 stores.

## Prerequisites

* A Magento 2 store with admin access
* Magento API credentials (Consumer Key, Consumer Secret, Access Token, Access Token Secret)

## Getting Your API Credentials

1. In your Magento Admin, go to **System > Extensions > Integrations**
2. Click **Add New Integration**
3. Enter a name (e.g., "Alhena AI")
4. Under **API**, select the resources Alhena needs access to:
   * Sales (for order information)
   * Catalog (for product information)
5. Save and activate the integration
6. Copy the Consumer Key, Consumer Secret, Access Token, and Access Token Secret

## Setup

### Step 1: Enable Magento in Alhena

1. In Alhena, go to **Settings > Integrations**
2. Find **Magento** and click **Enable**
3. You'll be taken to the Magento configuration page

### Step 2: Connect Your Store

Enter your Magento API credentials:

1. **Store URL** - Your Magento store URL (e.g., `https://mystore.com`)
2. **Consumer Key** - From your Magento integration
3. **Consumer Secret** - From your Magento integration
4. **Access Token** - From your Magento integration
5. **Access Token Secret** - From your Magento integration

Click **Connect** to complete the setup.

***

## Enabled Agents

When you connect your Magento store, the following agents are enabled:

| Agent                      | Description                                                                |
| -------------------------- | -------------------------------------------------------------------------- |
| **Order management agent** | Handles order inquiries, tracking, and order-related customer support      |
| **Product expert agent**   | Provides detailed product information, specifications, and recommendations |

You can configure these agents in **AI Settings > Agents**.

***

## Custom Product Fields

Magento supports custom product attributes. You can configure which custom fields to sync so Alhena can answer questions about them.

1. Go to **Settings > Integrations > Magento**
2. Scroll to **Custom Product Fields**
3. Add the attribute codes for the custom fields you want to include

***

## Recommended: Add Your Store to Training

After connecting, we recommend adding your Magento store's domain to your training URLs so Alhena can learn from your product pages and help articles. See [Training on Websites](https://alhena.gitbook.io/docs/ai-configuration/data-sources/websites) for more information.

***

## Disconnecting

To disconnect your Magento store:

1. Go to **Settings > Integrations > Magento**
2. Click **Disconnect**
3. Confirm the disconnection

This will disable the Magento-connected agents and revoke access to your store data.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://alhena.gitbook.io/docs/integrations/ecommerce/integrating-alhena-ai-with-magento.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
