# KiotViet To LarkBase

Workflows KiotViet To LarkBase are workflows that support transferring data from KiotViet to LarkBase automatically. Workflows support transferring data of product, price book, price book detail, customer, order, invoice, branch, group product, inventory.

**Authentication and terms:** Refer to [KiotViet Public API ](https://www.kiotviet.vn/huong-dan-su-dung-public-api-retail/)for guidance on setting up authentication and terms about KiotViet Public API.

## Workflows

* Customer
  * KiotViet-LarkBase Create and Update Customer
  * KiotViet-LarkBase Delete Customer
* Product
  * KiotViet-LarkBase Create and Update Product
  * KiotViet-LarkBase Delete Product
* Order
  * KiotViet-LarkBase Create and Update Order
  * KiotViet-LarkBase Delete Order
* Price Book
  * KiotViet-LarkBase Create and Update Price Book
  * KiotViet-LarkBase Delete Price Book
* Price Book Detail
  * KiotViet-LarkBase Create and Update Price Book Detail
  * KiotViet-LarkBase Delete Price Book Detail
* Invoice
  * KiotViet-LarkBase Create and Update Invoice
  * KiotViet-LarkBase Delete Invoice
* Branch
  * KiotViet-LarkBase Create and Update Branch
  * KiotViet-LarkBase Delete Branch
  * KiotViet-LarkBase Create Central branch
* Group Product
  * KiotViet-LarkBase Create and Update Group Product
  * KiotViet-LarkBase Delete Group Product
* Inventory
  * KiotViet-LarkBase Update Inventory

### 1. Branch

#### a.  KiotViet-LarkBase Create Central branch

This workflow is the first workflow that must be run when creating a store on KiotViet and run exactly once. This workflow allows taking central branch data and transferring it to LarkBase

<figure><img src="/files/fqukFnsw0IHoLAew3mVb" alt=""><figcaption><p>Workflow takes the central branch data and transfers it into LarkBase</p></figcaption></figure>

To use KiotViet node, register for a seller account at <https://www.kiotviet.vn/dang-ky/>. After creating an account, go to "Thiết lập cửa hàng" and select "Thiết lập kết nối API" to get Client ID, Client Secret and Retailer. Instructions are available at <https://www.kiotviet.vn/huong-dan-su-dung-public-api-retail/>

<figure><img src="/files/g7Ppj8qXf8OJlf6vE3vY" alt=""><figcaption><p>Select "Thiết lập của hàng"</p></figcaption></figure>

<figure><img src="/files/KxGwL0VtuJeK1SpF9YgU" alt=""><figcaption><p>Select "Thiết lập kết nối API"</p></figcaption></figure>

<figure><img src="/files/1BFQrD8CmIaa5FQjtrCR" alt=""><figcaption><p>Get Retailer, Client ID and Client Secret</p></figcaption></figure>

* Click on the KiotViet node then click Create New Credential

<figure><img src="/files/mjRwrN6xV1UefYGxoOqW" alt=""><figcaption><p>Create new credential</p></figcaption></figure>

* Provide your Client ID, Client Secret and Retailer. After that, you can click save to finish creating credentials.

  <figure><img src="/files/MEBmDTDniVxkcrG0NF99" alt=""><figcaption><p>Enter Client ID, Client Secret and Retailer to create credentials</p></figcaption></figure>

* Click on the Lark Authentication node then click Create New Credential

* Enter your app ID in the *App ID* field.

* Enter your app secret in the *App Secret* field.

* Click on *Save* to save credentials.

* Turn off the popup and click on *Execute Node* to run a node.

  <figure><img src="/files/pBhTas14xutRiFvCmNKk" alt=""><figcaption><p>In this screenshot, you will notice that the node sets the value for create new credential.</p></figcaption></figure>

  <figure><img src="/files/LzT4sjSiYZOa44CnEtva" alt=""><figcaption><p>In this screenshot, you will notice that the node sets the value for App ID and App Secret.</p></figcaption></figure>

  <figure><img src="/files/kVV7xeqDZ0Jmy500Fbv0" alt=""><figcaption><p>After executing Lark Authentication node</p></figcaption></figure>

* Click on the Edit Fields node and enter App Token and Table ID of Lark Base

<figure><img src="/files/1VgLC6qvv23QQnYBEOPi" alt=""><figcaption><p>Get App Token and Table ID from LarkBase link</p></figcaption></figure>

<figure><img src="/files/4U1cixjy3SqP96rujN6t" alt=""><figcaption><p>Enter App token and table ID</p></figcaption></figure>

* Click Execute Workflow button to start workflow

<figure><img src="/files/84ELnyaWlrpukaYvPVTn" alt=""><figcaption><p>Run workflow</p></figcaption></figure>

* When the workflow runs successfully, your LarkBase page will have data from the central branch added.

<figure><img src="/files/sWojBl3G2E4k6nMMnpjl" alt=""><figcaption><p>Added successful</p></figcaption></figure>

#### b. KiotViet-LarkBase Create and Update Branch

This workflow supports transferring data when users create or update branch information.

<figure><img src="/files/dROtOsn273wUqYVLxuKe" alt=""><figcaption><p>Workflow Create and Update Branch </p></figcaption></figure>

To use workflows, you must register webhooks that match the workflow you want to use.

<figure><img src="/files/o5hcsdZLYzbQUv9ixwJC" alt=""><figcaption><p>Register webhook</p></figcaption></figure>

* Click KiotViet trigger and enter Path. Then click on Webhook URLs, select Production URL and copy the link

<figure><img src="/files/c6vnvf8zysh8BV5j9yMe" alt=""><figcaption><p>Get link webhook</p></figcaption></figure>

* Click the KiotViet button on the remaining workflow, resource select Webhook, Operation select "Đăng ký Webhook". Select credentail, webhook type suitable for the purpose of use, fill in Url and Description then select Is Active and click execute node

<figure><img src="/files/VnQavTVCusi0h9l99ya6" alt=""><figcaption><p>Register webhook</p></figcaption></figure>

* Click Lark Authentication node and select credential as part **1.a**
* Click Set Value node and enter App token and Table ID of Branch Table in LarkBase

<figure><img src="/files/snsfrkf0T6ryI5G0VLJo" alt=""><figcaption><p>Set value</p></figcaption></figure>

* After completing the above steps and ensuring that you have activated the workflow, when you create and update branch on KiotViet's site, the data will automatically be transferred to LarkBase.

<figure><img src="/files/I4vXJIEu2NCVhmxHrtov" alt=""><figcaption><p>Active workflow</p></figcaption></figure>

Steps to follow on KiotViet website

* Select "Quản lý chi nhánh"

<figure><img src="/files/wo02sP8FkLSgY3xZ7xHF" alt=""><figcaption><p>Select "Quản lý chi nhánh"</p></figcaption></figure>

* Click button to add branch

<figure><img src="/files/TPCh9QOpxrl9SbuAJWoX" alt=""><figcaption><p>Click button to add branch</p></figcaption></figure>

* Enter field required

<figure><img src="/files/UU1FF0tcWnKBJSzaTRRH" alt=""><figcaption><p>Enter data to create branch</p></figcaption></figure>

* After completing creating or editing data will be added to LarkBase

<figure><img src="/files/QPuWPPUQvbkW507rWHx5" alt=""><figcaption><p>Complete data transfer</p></figcaption></figure>

#### c. KiotViet-LarkBase Delete branch

This workflow supports transferring data when users delete branch.

<figure><img src="/files/sL4OtJUGyqogTKW8o2GW" alt=""><figcaption><p>Workflow delete branch</p></figcaption></figure>

* To use this workflow you need to register a webhook similar to part **1.b** with webhook type is "Xóa chi nhánh"
* Click Lark Authentication node and select credential as part **1.a**
* Enter App Token and Branch Table ID

<figure><img src="/files/JlPAAxtwF4atS3xMf2xK" alt=""><figcaption><p>Enter App Token and Branch Table ID</p></figcaption></figure>

* After completing the above steps and ensuring that you have activated the workflow, when you delete branch on KiotViet's site, the data will automatically be transferred to LarkBase.

<figure><img src="/files/Nmq3RBToTjry5yLEP6Od" alt=""><figcaption><p>Active workflow</p></figcaption></figure>

Steps to follow on KiotViet website

* Select "Quản lý chi nhánh"

  <figure><img src="/files/wo02sP8FkLSgY3xZ7xHF" alt=""><figcaption><p>Select "Quản lý chi nhánh"</p></figcaption></figure>
* Select the branch to delete and press the "Xóa" button

<figure><img src="/files/Yh4vKnghbTVdSY4J3Z6u" alt=""><figcaption><p>Select branch and click "Xóa" Button</p></figcaption></figure>

* Click "Đồng ý" Button to confirm delete

<figure><img src="/files/xZqcBmyOLSnb0JlMwkgM" alt=""><figcaption><p>Confirm delete branch</p></figcaption></figure>

* After completing the operations on the KiotViet site, the data on LarkBase will be deleted.

<figure><img src="/files/I0sERXOuxz1o4ZiEVDBR" alt=""><figcaption><p>Data is deleted</p></figcaption></figure>

### 2. Customer

#### a. KiotViet-LarkBase Create and update Customer

This workflow supports transferring data when users create or update customer information.

<figure><img src="/files/LV74xFOqjQKzPCaWlR3h" alt=""><figcaption><p>Workflow to create and update customer</p></figcaption></figure>

* To use this workflow you need to register a webhook similar to part **1.b** with webhook type is "Cập nhật khách hàng"
* Click Lark Authentication node and select credential as part **1.a**
* Click Set value node and enter App Token, Customer Table ID, Branch Table ID

<figure><img src="/files/PYGB2Z6nslP0IIYqjL1D" alt=""><figcaption><p>Enter App Token, Customer Table ID and Branch Table ID</p></figcaption></figure>

* After completing the above steps and ensuring that you have activated the workflow, when you create and update customer on KiotViet's site, the data will automatically be transferred to LarkBase.

<figure><img src="/files/N8XcIJKdHgub4qRacFcM" alt=""><figcaption><p>Active workflow</p></figcaption></figure>

Steps to follow on KiotViet website

* Select "Đối tác" then select "Khách hàng"

<figure><img src="/files/W2ZETsFXNp6cTBiE8RJs" alt=""><figcaption><p>Select "Khách hàng"</p></figcaption></figure>

* Click button add customer

<figure><img src="/files/enCIqEqOikVEI3TlRvGG" alt=""><figcaption><p>Click button add customer</p></figcaption></figure>

* Enter require field and click "Lưu" button

<figure><img src="/files/T93nGAdCZm6sE3zC2yJ6" alt=""><figcaption><p>Enter information and click "Lưu" button</p></figcaption></figure>

* After completing creating or editing data will be added to LarkBase

<figure><img src="/files/wH6mtyo2nSIDFQUgpMds" alt=""><figcaption><p>Customer data has been transferred successfully </p></figcaption></figure>

#### b. KiotViet-LarkBase Delete Customer

This workflow supports transferring data when users delete customer.

<figure><img src="/files/rnSMn52k0u0DFbQKRUr0" alt=""><figcaption><p>Workflow delete customer</p></figcaption></figure>

* To use this workflow you need to register a webhook similar to part **1.b** with webhook type is "Xoá khách hàng"
* Click Lark Authentication node and select credential as part **1.a**
* Click Set value node and enter App Token, Customer Table ID

<figure><img src="/files/hz1ZrpF8uhOL41TiGBeX" alt=""><figcaption><p>Enter App Token and Customer Table ID</p></figcaption></figure>

* After completing the above steps and ensuring that you have activated the workflow, when you delete customer on KiotViet's site, the data will automatically be transferred to LarkBase.

<figure><img src="/files/zW4xCknvdPiS51wxCtLn" alt=""><figcaption><p>Active workflow</p></figcaption></figure>

Steps to follow on KiotViet website

* Select "Đối tác" then select "Khách hàng"

<figure><img src="/files/W2ZETsFXNp6cTBiE8RJs" alt=""><figcaption><p>Select "Khách hàng"</p></figcaption></figure>

* Select the customer to delete and press the "Xóa" button

<figure><img src="/files/juXWxUYn98LIRWNeSTGo" alt=""><figcaption><p>Select customer and click "Xóa" button</p></figcaption></figure>

* Click "Đồng ý" button to confirm delete customer

<figure><img src="/files/lYl4AHQsOR93MEhSBCgP" alt=""><figcaption><p>Confirm delete customer</p></figcaption></figure>

* After completing the operations on the KiotViet site, the data on LarkBase will be deleted.

<figure><img src="/files/ClP9DTsg6V8x04NsCKJ1" alt=""><figcaption><p>Customer data has been deleted</p></figcaption></figure>

### 3. Group Product

#### a. KiotViet-LarkBase Create and Update Group Product

This workflow supports transferring data when users create or update group product information.

<figure><img src="/files/dxqsaaCUOFd41dNev7Mf" alt=""><figcaption><p>Workflow create update group product</p></figcaption></figure>

* To use this workflow you need to register a webhook similar to part **1.b** with webhook type is "Danh mục hàng hóa"
* Click Lark Authentication node and select credential as part **1.a**
* Click Set value node and enter App Token, Group Product Table ID

<figure><img src="/files/H5TLzeyuAaGsYjoPQQeZ" alt=""><figcaption><p>Enter App token and group product table ID</p></figcaption></figure>

* After completing the above steps and ensuring that you have activated the workflow, when you create and update group product on KiotViet's site, the data will automatically be transferred to LarkBase.

<figure><img src="/files/uv8pqHODMOOLApFvFgSv" alt=""><figcaption><p>Active workflow</p></figcaption></figure>

Steps to follow on KiotViet website

* Select "Hàng hóa" then select "Danh mục"

<figure><img src="/files/TJFpO6qLvAYSDJOc8Kgq" alt=""><figcaption><p>Select "Danh mục"</p></figcaption></figure>

* Click this button

<figure><img src="/files/ZzGyZTFcbza9kbUEksZ0" alt=""><figcaption><p>Click add button</p></figcaption></figure>

* Enter require field and click "Lưu" button

<figure><img src="/files/whOrMP22Z6nIEJ5suOMp" alt=""><figcaption><p>Save data</p></figcaption></figure>

* After completing creating or editing data will be added to LarkBase

<figure><img src="/files/jPUm07c0MSodayAOFumx" alt=""><figcaption><p>Customer data has been transferred successfully </p></figcaption></figure>

#### b. KiotViet-LarkBase Delete Group Product

This workflow supports transferring data when users delete group product.

<figure><img src="/files/xRnSZWTNvvVy3ghrwViE" alt=""><figcaption><p>Workflow delete group product</p></figcaption></figure>

* To use this workflow you need to register a webhook similar to part **1.b** with webhook type is "Xoá danh mục hàng hóa"
* Click Lark Authentication node and select credential as part **1.a**
* Click Set value node and enter App Token, Group Product Table ID

<figure><img src="/files/zL6hj8TlUUxvbhCljjn7" alt=""><figcaption><p>Enter App Token and Group Product Table ID</p></figcaption></figure>

* After completing the above steps and ensuring that you have activated the workflow, when you delete group product on KiotViet's site, the data will automatically be transferred to LarkBase.

<figure><img src="/files/wHxyAwpJasxnUbLWKpkE" alt=""><figcaption><p>Make workflow is active</p></figcaption></figure>

Steps to follow on KiotViet website

* Select "Hàng hóa" then select "Danh mục"

<figure><img src="/files/STy8WKdbrPppvoCrI2PB" alt=""><figcaption><p>Select "Danh mục"</p></figcaption></figure>

* Select the product group you want to delete and select the button as shown

<figure><img src="/files/OrPgakW7CZXr0q45btx0" alt=""><figcaption><p>Choose edit button</p></figcaption></figure>

* Click "Xoá" button

<figure><img src="/files/K8WkfhS5mIneeqY0zcPM" alt=""><figcaption><p>Click "Xóa" button</p></figcaption></figure>

* Click "Đồng ý" button to confirm delete.

<figure><img src="/files/pnJuq118rouDvkIWUWhD" alt=""><figcaption><p>Confirm delete</p></figcaption></figure>

After completing the operations on the KiotViet site, the data on LarkBase will be deleted.

<figure><img src="/files/jzM9NJLGJxPCh2JuDgZd" alt=""><figcaption><p>Data has been deleted</p></figcaption></figure>

### 4. Product

#### a. KiotViet-LarkBase Create and Update Product

This workflow supports transferring data when users create or update product information.

<figure><img src="/files/cm6kpcl9VTA0EZq85Xr1" alt=""><figcaption><p>Workflow create and update product</p></figcaption></figure>

* To use this workflow you need to register a webhook similar to part **1.b** with webhook type is "Cập nhật hàng hóa"
* Click Lark Authentication node and select credential as part **1.a**
* Click Set value node and enter App Token, Product Table ID, Attribute Table ID, Branch Table ID

<figure><img src="/files/yUheMCi0iThMuLxcSaPE" alt=""><figcaption><p>Enter App Token, Product Table ID, Attribute Table ID</p></figcaption></figure>

<figure><img src="/files/dx6V94QTmkKYUAG2SLma" alt=""><figcaption><p>Enter Branch Table ID</p></figcaption></figure>

* After completing the above steps and ensuring that you have activated the workflow, when you create and update product on KiotViet's site, the data will automatically be transferred to LarkBase.

<figure><img src="/files/KLFDe5PeanfQCMDqlhLc" alt=""><figcaption><p>Active workflow</p></figcaption></figure>

Steps to follow on KiotViet website

* Select "Hàng hóa" then select "Danh mục"

<figure><img src="/files/Ggo5mtPw66oouSHElz6W" alt=""><figcaption><p>Select "Danh mục"</p></figcaption></figure>

* Select "Thêm mới" then select "Thêm hàng hóa"

<figure><img src="/files/HoDUZU0Fe1o6bOL7Acde" alt=""><figcaption><p>Select "Thêm hàng hóa"</p></figcaption></figure>

* Enter require field and click "Lưu" button

<figure><img src="/files/g1M9CPSAmZkhFUB40dpv" alt=""><figcaption><p>Enter data and click "Lưu" button</p></figcaption></figure>

* After completing creating or editing data will be added to Product Table and Attribute Table LarkBase. Wait about 1 to 2 minutes for data to flow to LarkBase

<figure><img src="/files/FehlOUJL9wUBJ0qGkqXR" alt=""><figcaption><p>New Products</p></figcaption></figure>

<figure><img src="/files/B4gymExu9SZuTE1Y5m4Z" alt=""><figcaption><p>New Attributes</p></figcaption></figure>

#### b. KiotViet-LarkBase Delete Product

This workflow supports transferring data when users delete product.

<figure><img src="/files/rRofq7OKcXfIVMJ4unZE" alt=""><figcaption><p>Workflow delete product</p></figcaption></figure>

* To use this workflow you need to register a webhook similar to part **1.b** with webhook type is "Xoá hàng hóa"
* Click Lark Authentication node and select credential as part **1.a**
* Click Set value node and enter App Token, Product Table ID, Attribute Table ID, Price Book Detail Table ID

<figure><img src="/files/EM571c2XHTopxbiEvJKA" alt=""><figcaption><p>Enter App token, product table ID, attribute table ID</p></figcaption></figure>

<figure><img src="/files/9D5X4VhRN52NkvrFKt9j" alt=""><figcaption><p>enter price book detail ID</p></figcaption></figure>

* After completing the above steps and ensuring that you have activated the workflow, when you delete product on KiotViet's site, the data will automatically be transferred to LarkBase.

<figure><img src="/files/NASwm2TRSq7voJMkqlKv" alt=""><figcaption><p>Make workflow is active</p></figcaption></figure>

Steps to follow on KiotViet website

* Select "Hàng hóa" then select "Danh mục"

<figure><img src="/files/STy8WKdbrPppvoCrI2PB" alt=""><figcaption><p>Select "Danh mục"</p></figcaption></figure>

* Select the product that needs to be deleted and click the "Xóa" button

<figure><img src="/files/gHJUglqY7Be1fhKlymP6" alt=""><figcaption><p>Click "Xóa" button</p></figcaption></figure>

* Click "Đồng ý" button to confirm delete

<figure><img src="/files/9m3ZsozBn3JHSXLP9tQa" alt=""><figcaption><p>Confirm delete</p></figcaption></figure>

After completing the operations on the KiotViet site, the data on LarkBase will be deleted.

<figure><img src="/files/JUxACjgIAIhb207Sn1go" alt=""><figcaption><p>Data has been deleted</p></figcaption></figure>

### 5. Price Book

#### a. KiotViet-LarkBase Create and Update Price Book

This workflow supports transferring data when users create or update price book information.

<figure><img src="/files/Mvo4aNYYCYXfoXgUxz9R" alt=""><figcaption><p>Workflow create and update price book</p></figcaption></figure>

* To use this workflow you need to register a webhook similar to part **1.b** with webhook type is "Cập nhật bảng giá"
* Click Lark Authentication node and select credential as part **1.a**
* Click Set value node and enter App Token, Price Book Table ID, Branch Table ID

<figure><img src="/files/Utmlc90FTpICDhsIBAyw" alt=""><figcaption><p>Enter app token, price book table ID, branch table ID</p></figcaption></figure>

* After completing the above steps and ensuring that you have activated the workflow, when you create and update price book on KiotViet's site, the data will automatically be transferred to LarkBase.

<figure><img src="/files/tjyqb1KqhNlxnmmpM0JK" alt=""><figcaption><p>Active workflow</p></figcaption></figure>

Steps to follow on KiotViet website

* Select "Hàng hóa" then select "Thiết lập giá"

<figure><img src="/files/lLVboYxVvi8Yuusnbxf9" alt=""><figcaption><p>Select ""Thiết lập giá"</p></figcaption></figure>

* Select the button as shown

<figure><img src="/files/DpMGLPeAPF0gUdeFt1gJ" alt=""><figcaption><p>Click add new button</p></figcaption></figure>

* Enter field require and click "Lưu" button

<figure><img src="/files/iLH7sbu6yhP76EA9WP3i" alt=""><figcaption><p>Enter data and click "Lưu" button</p></figcaption></figure>

After completing creating or editing data will be added to LarkBase.

<figure><img src="/files/yOu8vunYJMTcMwsOT8lr" alt=""><figcaption><p>Data has been transferred/head</p></figcaption></figure>

#### b. KiotViet-LarkBase Delete Price Book

This workflow supports transferring data when users delete product.

<figure><img src="/files/s5PM2TLTm11PWoz5dppZ" alt=""><figcaption><p>Workflow delete price book</p></figcaption></figure>

* To use this workflow you need to register a webhook similar to part **1.b** with webhook type is "Xoá bảng giá"
* Click Lark Authentication node and select credential as part **1.a**
* Click Set value node and enter App Token, Product Table ID, Attribute Table ID, Price Book Detail Table ID


---

# 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://docs-tech.n8n.vn/kiotviet-to-larkbase.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.
