# Connect ERPNext

> Sync items from ERPNext into Message24 and create Sales Orders in ERPNext from the orders the AI captures.

Source: https://docs.message24.net/owners/integrations/erpnext/

The ERPNext integration copies your sales items into Message24 and creates a Sales Order in ERPNext for each order your team accepts or confirms in Message24. Order stages then follow the Sales Order's status in ERPNext.

## Before you start

You need an ERPNext user with an API key and secret, and access to the company and warehouse you sell from.

1. In ERPNext, open the user Message24 should act as.
2. In the user's settings, go to **API Access** and generate a key.
3. Copy the **API Key** and **API Secret**. ERPNext shows the secret only once.

## Connect

The form has two steps.

1. Go to **Settings > Integrations** and click **Connect** on the ERPNext card.
2. Fill in your credentials:
   - **ERPNext Site URL**: your ERPNext address, for example `https://yourcompany.erpnext.com`.
   - **API Key** and **API Secret** from the steps above.
3. Click **Verify & Continue**. Message24 checks the credentials and loads your companies.
4. Configure the sync settings:
   - **Company**: the company used for orders and inventory. If you have only one, it is selected for you.
   - **Default Warehouse**: the warehouse used for order items. The list shows the warehouses of the selected company.
   - **Push orders to ERPNext when**: **Order is accepted (New stage)** or **Order is confirmed**.
5. Click **Connect**.

## What syncs

- Items marked as sales items that are not disabled.
- Item templates together with their variants, including variant attributes such as colour and size, each variant's price and image.
- The item name, description, standard selling rate and image.
- Whether each item is in stock.

Items that are deleted in ERPNext are deactivated in Message24. Products sync automatically in the background, and **Sync** on the ERPNext card fetches recent changes right away. See [How syncing works](/owners/integrations/overview/#how-syncing-works).

## Orders in ERPNext

Sending orders is always on for ERPNext. When an order reaches the stage you chose, Message24 creates a Sales Order under your selected company:

- The customer is matched to an existing ERPNext Customer by phone, then email, then name. If none is found, a new Customer is created.
- Order lines use the ERPNext item codes of synced products, with the price from the Message24 order and your default warehouse.
- The Message24 order number, delivery address, delivery fee and notes are added to the Sales Order's remarks.
- The Sales Order is submitted, not left as a draft.

Only one integration can send orders at a time. If another integration already sends orders, turn that off before connecting ERPNext.

### Status updates from ERPNext

Message24 checks your Sales Orders regularly and updates the order's stage on the [Orders](/owners/catalog/orders/) page:

| Sales Order status | Stage in Message24 |
| --- | --- |
| Draft, To Deliver and Bill, To Deliver, On Hold | Confirmed |
| To Bill, Completed, Closed | Delivered |
| Cancelled | Cancelled |
| Return | Returned |

## Change settings

Click the settings icon on the ERPNext card to change the company, default warehouse or order stage. To use new credentials, click **Change Credentials**, enter the new key or secret (leave a field empty to keep the current value), and click **Save Changes**.

## Disconnect

Click **Disconnect** on the ERPNext card and confirm. Product syncing and order sending stop.
