Skip to main content

Omisell & Boxme

Elton lấy dữ liệu từ hai hệ thống đi cùng nhau trong một source: đơn hàng từ Omisell (quản lý bán hàng đa kênh) qua Omisell Open API (https://api.omisell.com), và sản phẩm cùng tồn kho từ Boxme OMS (kho fulfillment) qua Boxme Open API (https://oms.boxme.asia). Elton chỉ đọc, không tạo hay sửa dữ liệu trên Omisell và Boxme.

Mỗi hệ thống có khoá riêng, và một connection chỉ cần khoá của dữ liệu nó lấy:

Dữ liệuLấy từKhoá cần có
Orders (Omisell)OmisellOmisell API Key và Omisell API Secret
Products (Boxme), Product stock (Boxme), daily snapshotBoxme OMSBoxme API Key

1. Chuẩn bị trên Omisell và Boxme​

Cho phép IP của Elton (whitelist)​

Form tạo source có khung Before you connect: bạn phải thêm IP của Elton Data vào danh sách cho phép (whitelist) ở cả cổng Omisell và cổng Boxme, nếu không connection sẽ lỗi. Khung này hiện danh sách IP cần thêm. Nếu workspace của bạn dùng Airflow riêng (self-hosted), khung này yêu cầu thêm IP đi ra (outbound) của Airflow đó thay vì IP của Elton.

Lấy Omisell API Key và API Secret​

Theo tài liệu Omisell Open API: đăng nhập https://app.omisell.com, rồi vào mục API Intergrated API Tool (tên mục theo đúng tài liệu của Omisell) để tạo API key. Bạn cần cả API key và API secret của khoá đó.

Elton dùng API key và API secret để xin access token của Omisell ở mỗi lần chạy (token có hạn 1 ngày; khi Omisell từ chối token giữa chừng, Elton tự xin token mới một lần).

Lấy Boxme API Key​

Theo hướng dẫn trong form: đăng nhập oms.boxme.asia → Settings → API Integration, sao chép API key. Elton gửi khoá này trong header Authorization: Token <Boxme API Key>.

Khoá có hạn

API key của Omisell và Boxme có hạn tối đa một năm. Khi khoá hết hạn, hãy tạo lại trên cổng Omisell và Boxme, rồi cập nhật data source trên Elton.

2. Tạo data source Omisell & Boxme​

  1. Vào Data Sources → Create data source, ở ô Type chọn Omisell & Boxme.
  2. Điền form:
TrườngGiá trị
NameTên hiển thị của source
DescriptionMô tả, không bắt buộc
Omisell API KeyAPI key của Omisell (mục 1). Cần để lấy đơn hàng
Omisell API SecretAPI secret đi cùng API key. Cần để lấy đơn hàng
Boxme API KeyAPI key của Boxme OMS (mục 1). Cần để lấy sản phẩm và tồn kho
  1. Bấm Create data source.

Form chấp nhận khi có đủ cặp khoá Omisell, hoặc khoá Boxme, hoặc cả hai. Nhập API key mà thiếu secret (hoặc ngược lại) thì form báo lỗi.

Khi sửa data source, ô Omisell API Secret và Boxme API Key hiện dạng **********. Để nguyên thì Elton dùng khoá đã lưu. Omisell API Key hiện giá trị thật.

Source Omisell & Boxme không có ô Account name, nên tên bảng không có hậu tố theo tài khoản (xem mục 4).

3. Tạo connection Omisell & Boxme​

Khi tạo connection với source là Omisell & Boxme:

  • Select 1 or many type of data (bắt buộc): chọn một hoặc nhiều loại: Orders (Omisell), Products (Boxme), Product stock (Boxme), daily snapshot. Mỗi loại là một bảng ở destination. Form kiểm tra khoá của source: chọn Orders (Omisell) mà source thiếu khoá Omisell, hoặc chọn sản phẩm/tồn kho mà source thiếu Boxme API Key, thì form báo lỗi.
  • First run loads from (không bắt buộc): chỉ dùng cho Orders (Omisell). Lần chạy đầu (và khi Full reload) lấy đơn có thời điểm cập nhật từ ngày này đến hôm nay. Không chọn được ngày trong tương lai. Để trống thì lần đầu chỉ lùi lại số ngày của Later runs rescan (mặc định 1 ngày), không lấy lịch sử.
  • Later runs rescan: chỉ dùng cho Orders (Omisell). Các lần chạy sau, Elton lấy đơn được cập nhật từ ngày của lần chạy thành công gần nhất (ngày UTC), lùi lại số ngày này: Last 1 day, Last 3 days, Last 7 days, Last 14 days hoặc Last 30 days. Connection mới được điền sẵn Last 1 day; nếu ô này không có giá trị (connection tạo từ trước) thì lùi 1 ngày (form hiện Last 1 day).

Products (Boxme) được lấy toàn bộ mỗi lần chạy, vì API Boxme không lọc được theo thời điểm cập nhật. Product stock (Boxme), daily snapshot là ảnh chụp tồn kho tại lần chạy.

  • Partial reload: chỉ Orders (Omisell) dùng khoảng ngày bạn chọn (đơn được cập nhật trong khoảng đó). Sản phẩm và tồn kho vẫn lấy như lần chạy thường.
  • Full reload xoá bảng rồi tải lại. Với bảng tồn kho (snapshot mỗi ngày), lịch sử các ngày trước bị mất khỏi bảng, chỉ còn snapshot của lần chạy reload. Với destination BigQuery, dữ liệu cũ được tạm giữ ở dataset elton_backup một thời gian.

Với kiểu ghi Merge, bản ghi được cập nhật theo khoá của bảng: lấy lại cùng một bản ghi thì dòng cũ được thay, không bị nhân đôi.

4. Omisell & Boxme: dữ liệu được đồng bộ​

Bảng có tên cố định omisell_boxme_<loại>, không có hậu tố theo source:

Loại dữ liệuBảngKhoáCách lấyGiới hạn lịch sửPhân vùng (partition) theo ngày
Orders (Omisell)omisell_boxme_orderomisell_order_numberĐơn được cập nhật trong khoảng lấy: lần đầu từ First run loads from, sau đó theo Later runs rescanElton không đặt giới hạn; để trống First run loads from thì lần đầu chỉ lấy vài ngày gần nhấtcreated_time
Products (Boxme)omisell_boxme_productbsinToàn bộ sản phẩm, mỗi lần chạyKhông theo ngàyKhông phân vùng
Product stock (Boxme), daily snapshotomisell_boxme_product_stockseller_sku, elton_record_dateTồn kho hiện tại của mọi sản phẩm Boxme, snapshot mỗi ngàyChỉ có từ ngày connection bắt đầu chạyelton_record_date

Nhiều tài khoản: mọi source Omisell & Boxme ghi vào cùng tên bảng. Nếu hai connection từ hai tài khoản khác nhau cùng ghi vào một dataset, dữ liệu nằm chung bảng; bảng đơn hàng phân biệt được bằng seller_id, nhưng bảng sản phẩm và tồn kho không có cột phân biệt tài khoản. Hãy cho mỗi tài khoản một dataset riêng ở destination. Nếu phần cài đặt destination của connection (Choose my own settings) có ô Table name suffix, bạn cũng có thể đặt suffix khác nhau cho mỗi tài khoản: Elton thêm _<suffix> vào cuối tên mọi bảng của connection, ví dụ omisell_boxme_order_<suffix>.

Lưu ý chung cho các bảng Omisell & Boxme:

  • Các cột object (ví dụ receiver, shipping_information) là một chuỗi JSON. Các cột danh sách (parcels, payment_information, seller_voucher_code, images, warehouse_inventory) là mảng chuỗi (ARRAY<STRING> trên BigQuery), mỗi phần tử là một chuỗi JSON (hoặc chuỗi thường nếu API trả danh sách chuỗi, như images). Dùng UNNEST rồi JSON_VALUE để đọc. Tiếng Việt trong JSON được giữ nguyên, không bị mã hoá.
  • Cột elton_created_at (thời điểm Elton lấy bản ghi) có trong danh sách cột của từng bảng, nhưng trên BigQuery chỉ được ghi khi connection dùng kiểu ghi Append. Với Merge (cập nhật theo khoá) và Overwrite, bảng ở BigQuery không có cột này.
  • Giới hạn gọi API: Omisell cho mỗi tài khoản người bán 100 lần gọi mỗi phút; Elton dùng tối đa 90 lần để chừa chỗ cho các tích hợp khác trên cùng tài khoản. Boxme giới hạn theo IP gọi (1 lần mỗi giây, 30 lần mỗi phút), Elton tự giữ dưới mức này.
  • Thử lại: khi API trả lỗi 429, lỗi 5xx, không trả lời, hoặc trả trang không phải JSON của API, Elton thử lại tối đa 5 lần, đợi 5, 10, 20, 40 rồi 60 giây (với lỗi 429 của Omisell: đợi số giây Omisell báo, cộng thêm 1 giây). Lỗi khác (ví dụ 400, 403) không được thử lại; riêng lỗi 401 của Omisell thì Elton xin token mới một lần.

Orders (omisell_boxme_order)​

Mỗi dòng là một đơn hàng Omisell. Elton làm hai bước:

  1. Lấy danh sách mã đơn được cập nhật trong khoảng lấy, chia theo từng ngày (UTC). Danh sách này chỉ dùng nội bộ, không thành bảng.
  2. Gọi API chi tiết cho từng đơn. Vì mỗi đơn là một lần gọi và Elton giữ dưới 90 lần gọi mỗi phút, lần chạy đầu với nhiều đơn sẽ mất nhiều thời gian (khoảng 90 đơn mỗi phút).

Elton lọc theo thời điểm cập nhật, nên đơn cũ đổi trạng thái vẫn được cập nhật nếu nằm trong khoảng Later runs rescan. Bảng được phân vùng theo created_time (thời điểm tạo đơn trên kênh bán).

CộtÝ nghĩa
omisell_order_numberMã đơn Omisell, ví dụ ODVN26081234ABCDEF (khoá của bảng)
order_numberMã đơn trên kênh bán (sàn, website, cửa hàng)
seller_idMã người bán (tài khoản) trên Omisell
shop_id, shop_nameMã và tên shop trên Omisell
platform, platform_nameMã và tên kênh bán, ví dụ retail / Offline store
order_typeLoại đơn: normal, pre_order, dropship, pod hoặc sample
status_id, status_nameTrạng thái đơn và tên trạng thái: 200 New, 250 Awaiting confirmation, 300 Approved, 360 Exception - Ready to Ship, 370 Cancellation Requested, 380 Label Generation Errors, 400 Processing, 440 Exceptions, 460 Ready to ship, 500 Shipped, 600 In-transit, 650 Returning, 702 Cancelled, 800 Returned, 850 Courier lost items, 890 Partially Completed, 900 Completed
is_fulfilledĐơn đã được xử lý xuất kho chưa
omisell_created_timeThời điểm (UTC) đơn được tạo trên Omisell
created_timeThời điểm (UTC) đơn được tạo trên kênh bán
fulfilled_timeThời điểm (UTC) đơn được xử lý xong (fulfilled, bàn giao cho hãng vận chuyển); trống cho tới lúc đó
shipped_timeThời điểm (UTC) đơn được xuất đi cho hãng vận chuyển (dispatched); trống cho tới lúc đó
completed_timeThời điểm (UTC) đơn hoàn tất, kể cả khi hoàn tất do giao xong, huỷ hay trả hàng; trống cho tới lúc đó
escrow_release_timeThời điểm (UTC) sàn giải ngân tiền đơn; trống cho tới lúc đó
updated_timeThời điểm (UTC) đơn được cập nhật lần cuối
receiverNgười nhận (JSON): fullname, email, phone, address, country, zip_code, province, province_id, district, district_id, subdistrict_name, subdistrict_id
invoice_informationThông tin xuất hoá đơn (JSON): code (mã số thuế), company, fullname, address, zip_code, commune, district, province, country, email, phone
shipping_informationPhí vận chuyển (JSON): origin_shipping_fee (trước khuyến mãi), buyer_shipping_fee, seller_shipping_fee, platform_ship_rebate, seller_ship_rebate, wrong_weight_adjustment (điều chỉnh do lệch cân nặng của hãng vận chuyển)
external_informationThông tin bên kênh bán (JSON), ví dụ cart_id
parcelsCác kiện hàng của đơn. Mỗi phần tử có package_number, pickup_id và pickup_code (kho Omisell), shipping_fee; khi đã có vận đơn: omisell_shipment_number, wms_order_number (mã đơn kho Boxme), courier_tracking_number, courier_name, courier_service, shipment_status, shipment_status_name; catalogue_items (dòng hàng của kênh bán, kèm giá, giảm giá, voucher) và inventory_items (SKU tồn kho đã xuất cho các dòng đó, kèm giá trị bán thuần và dòng hoá đơn)
payment_informationCác khoản thanh toán. Mỗi phần tử có origin_payment_method (trên kênh bán), payment_method và payment_method_name (trên Omisell), transaction_amount, transaction_status, transaction_status_name, transaction_code, transaction_external_code, transaction_reference, transaction_time (Unix giây), transaction_note
seller_voucher_codeVoucher của người bán áp dụng cho đơn. Mỗi phần tử có name, code, amount
order_noteGhi chú đơn

Omisell trả 0 cho mốc thời gian chưa xảy ra; Elton ghi các mốc đó là trống (NULL), không phải năm 1970.

Theo tài liệu Omisell, mỗi phần tử catalogue_items có order_item_id, catalogue_sku, product_name, quantity, original_price, discounted_price, discount_seller, discount_platform, voucher_seller, voucher_platform, is_gift, is_combo, warehouse_code…; mỗi phần tử inventory_items có order_item_id, inventory_sku, catalogue_sku, product_name, quantity, sale_price, sale_price_before_tax, sale_amount (số tiền của dòng, dùng khi cộng tổng), tax_vat…

Tất cả cột của omisell_boxme_order: omisell_order_number, order_number, seller_id, shop_id, shop_name, platform, platform_name, order_note, order_type, status_id, status_name, is_fulfilled, omisell_created_time, created_time, shipped_time, completed_time, escrow_release_time, fulfilled_time, updated_time, invoice_information, shipping_information, receiver, external_information, parcels, payment_information, seller_voucher_code, elton_created_at

Products (omisell_boxme_product)​

Mỗi dòng là một sản phẩm trên Boxme OMS, lấy toàn bộ mỗi lần chạy (50 sản phẩm mỗi trang). Bảng giữ thông tin mới nhất của sản phẩm.

CộtÝ nghĩa
bsinMã BSIN (Boxme Serial Identify Number) của sản phẩm (khoá của bảng)
seller_skuSKU của người bán, nối với omisell_boxme_product_stock.seller_sku
name, descriptionTên và mô tả
barcode_manufacturerMã vạch của nhà sản xuất
category_idMã danh mục Boxme
price, sale_price, wholesale_priceGiá niêm yết, giá bán, giá sỉ (B2B)
activeTrạng thái bán: true là đang bán
approveSản phẩm đã được duyệt để nhập kho chưa
min_quantityNgưỡng tồn kho thấp
warehouse_conditionĐiều kiện lưu kho: 1 thường, 2 có điều hoà
outbound_strategyChiến lược xuất kho: FIFO, FEFO hoặc LIFO
require_expire, shelf_life, expiry_threshold, min_inbound_shelf_lifeQuản lý theo hạn dùng; hạn dùng, ngưỡng cận hạn và hạn dùng còn lại tối thiểu khi nhập kho (đều tính bằng tháng)
batch_control, manage_by_serial_number, managed_by_gs1Quản lý theo lô, theo số serial, theo mã GS1
uomĐơn vị tính, ví dụ PC, BOX, PAIR, PACK, SET
is_fragile, pack_with_bubble, use_shredded_paper, protective_packaging_inbound, pack_materialYêu cầu đóng gói: hàng dễ vỡ, bọc bóng khí, chèn giấy vụn, bảo vệ khi nhập kho, mã vật liệu đóng gói
imagesLink ảnh sản phẩm

Tất cả cột của omisell_boxme_product: bsin, seller_sku, name, barcode_manufacturer, category_id, description, price, sale_price, wholesale_price, is_digital, min_quantity, warehouse_condition, pack_with_bubble, pack_material, weight, volume, images, manage_by_serial_number, managed_by_gs1, require_expire, outbound_strategy, shelf_life, expiry_threshold, min_inbound_shelf_life, is_fragile, use_shredded_paper, batch_control, uom, protective_packaging_inbound, allow_breakdown, active, approve, elton_created_at

Product stock (omisell_boxme_product_stock)​

Mỗi dòng là tồn kho của một SKU vào một ngày. Elton lấy danh sách sản phẩm Boxme trước (kể cả khi connection không chọn Products (Boxme); khi đó danh sách sản phẩm không được ghi thành bảng), rồi hỏi tồn kho theo seller_sku, 20 SKU mỗi lần gọi. SKU mà Boxme không nhận ra (không có bsin) bị bỏ qua.

"Snapshot mỗi ngày" nghĩa là mỗi lần chạy lấy tồn kho hiện tại và ghi kèm ngày chạy (elton_record_date, ngày theo giờ UTC). Với kiểu ghi Merge, chạy nhiều lần trong ngày thì dòng của ngày đó được thay bằng lần chạy mới nhất; các ngày trước được giữ lại. Với Overwrite, bảng chỉ còn snapshot của lần chạy gần nhất.

CộtÝ nghĩa
seller_skuSKU của người bán
bsinMã BSIN của sản phẩm, nối với omisell_boxme_product.bsin
elton_record_dateNgày (UTC) Elton chụp snapshot
total_stock_quantitySố lượng tồn, cộng mọi kho Boxme của người bán
total_awaiting_quantitySố lượng đang chờ, cộng mọi kho
total_reserved_quantitySố lượng đã giữ chỗ, cộng mọi kho
total_available_quantitySố lượng có thể bán, cộng mọi kho
total_incoming_quantitySố lượng đang về kho, cộng mọi kho
total_damaged_stock_quantity, total_damaged_awaiting_quantity, total_damaged_available_quantityCác số lượng tương ứng của hàng hỏng, cộng mọi kho
warehouse_inventoryTồn kho theo từng kho Boxme. Mỗi phần tử có pickup_id (kho), các số lượng stock, awaiting, reserved, available, incoming, damaged, và damaged_details theo mức tình trạng (D1, D2, D3)

Tất cả cột của omisell_boxme_product_stock: seller_sku, bsin, elton_record_date, total_stock_quantity, total_awaiting_quantity, total_reserved_quantity, total_available_quantity, total_incoming_quantity, total_damaged_stock_quantity, total_damaged_awaiting_quantity, total_damaged_available_quantity, warehouse_inventory, elton_created_at

5. Quan hệ giữa các bảng Omisell & Boxme​

Các bảng cần nối phải cùng một source (cùng dataset hoặc cùng suffix).

BảngNối với bảngĐiều kiện nốiQuan hệ
omisell_boxme_productomisell_boxme_product_stockbsin = bsin (hoặc seller_sku = seller_sku)1 sản phẩm – 1 dòng tồn kho mỗi ngày

Bảng đơn hàng (Omisell) không có cột SKU riêng: SKU nằm trong parcels (catalogue_items[].catalogue_sku là SKU trên kênh bán, inventory_items[].inventory_sku là SKU tồn kho). Elton không xác nhận inventory_sku của Omisell trùng với seller_sku của Boxme; hãy kiểm tra trên dữ liệu của bạn trước khi nối hai bảng này.

Ví dụ trên BigQuery, tồn kho có thể bán mới nhất theo sản phẩm:

SELECT p.bsin, p.seller_sku, p.name, s.total_available_quantity, s.elton_record_date
FROM `dataset.omisell_boxme_product` p
JOIN `dataset.omisell_boxme_product_stock` s ON s.bsin = p.bsin
WHERE s.elton_record_date = (
SELECT MAX(elton_record_date) FROM `dataset.omisell_boxme_product_stock`
);

Doanh thu thuần theo SKU tồn kho từ đơn Omisell tạo từ ngày 01/11/2026 (giờ Việt Nam), bỏ đơn đã huỷ (status_id 702):

SELECT
JSON_VALUE(item, '$.inventory_sku') AS inventory_sku,
SUM(CAST(JSON_VALUE(item, '$.quantity') AS INT64)) AS quantity,
SUM(CAST(JSON_VALUE(item, '$.sale_amount') AS FLOAT64)) AS sale_amount
FROM `dataset.omisell_boxme_order` o
CROSS JOIN UNNEST(o.parcels) AS parcel
CROSS JOIN UNNEST(JSON_QUERY_ARRAY(parcel, '$.inventory_items')) AS item
WHERE o.status_id != 702
AND DATE(o.created_time, 'Asia/Ho_Chi_Minh') >= '2026-11-01'
GROUP BY inventory_sku
ORDER BY sale_amount DESC;

6. Lỗi thường gặp với Omisell & Boxme​

LỗiNguyên nhân và cách xử lý
Enter the Omisell keys, the Boxme API key, or both.Form data source chưa có khoá nào. Nhập cặp khoá Omisell, khoá Boxme, hoặc cả hai
Enter the API key that goes with the secret. / Enter the API secret that goes with the key.Chỉ nhập một nửa cặp khoá Omisell. Nhập đủ Omisell API Key và Omisell API Secret
Orders need the Omisell API key and secret. Add them to the data source.Connection chọn Orders (Omisell) nhưng source thiếu khoá Omisell. Thêm khoá vào data source
Products and product stock need the Boxme API key. Add it to the data source.Connection chọn sản phẩm/tồn kho nhưng source thiếu Boxme API Key
Missing Omisell API key or API secret!Lần chạy lấy đơn nhưng source thiếu khoá Omisell
Missing Boxme OMS API key!Lần chạy lấy sản phẩm/tồn kho nhưng source thiếu Boxme API Key
Failed to get an Omisell access token: ...Omisell không cấp token. Phần sau dấu : là lỗi Omisell trả về. Kiểm tra API key/secret còn hạn và IP của Elton đã được whitelist trên Omisell (mục 1), rồi cập nhật data source
Failed to fetch https://oms.boxme.asia/... with ... after ... attempt(s): ...Boxme trả lỗi. Lỗi 429, 5xx (Boxme trả 503 khi vượt giới hạn gọi) được thử lại trước khi báo; lỗi khác báo ngay (after 1 attempt(s)). Phần cuối lỗi là mã HTTP và thông báo của Boxme. Kiểm tra Boxme API Key còn hạn và IP của Elton đã được whitelist trên Boxme (mục 1)
Failed to fetch https://api.omisell.com/... with ... after ... attempt(s): ...Omisell trả lỗi sau khi Elton đã thử lại. Phần cuối lỗi có mã HTTP, error_code, thông báo và request_id của Omisell (gửi request_id cho Omisell nếu cần hỗ trợ)
Unexpected order detail: ...API chi tiết đơn của Omisell trả dữ liệu rỗng hoặc sai dạng. Chạy lại; nếu vẫn lỗi, liên hệ Elton
No data to load found! Please select data to load in Connection configuration!Connection chưa chọn loại dữ liệu nào. Sửa connection và chọn ở Select 1 or many type of data
Lần đầu chỉ có đơn vài ngày gần nhấtFirst run loads from để trống. Chọn ngày rồi Full reload
Lần chạy đầu rất lâuElton gọi chi tiết từng đơn, khoảng 90 đơn mỗi phút do giới hạn của Omisell. Chọn First run loads from gần hơn nếu không cần lịch sử dài
Một số SKU không có trong bảng tồn khoBoxme không nhận ra SKU đó (không có bsin), nên Elton bỏ qua

Cách tính Billable Pipeline​

Cách tính phí theo số pipeline của từng loại source xem ở đây.