# Tài liệu Webhook

Bạn đang muốn đồng bộ thông tin hệ thống do mình phát triển với hệ thống của Abaha thì đây là tài liệu dành cho bạn ^^

## A. TỔNG QUAN

1. Loại sự kiện: các loại sự kiện sẽ được gửi cho khách hàng sau khi cài đặt cấu hình thành công.
2. Webhook url: đường dẫn khách hàng cung cấp, nhận data Abaha gửi sang khi sự kiện xảy ra.
3. Thời gian gửi lại khi lỗi: Nếu gửi sang lần 1 bị lỗi thì sau x phút sẽ gửi lại lần 2, tối đa 3 lần tự động gửi

## B. CẤU HÌNH WEBHOOK

1\. Vào trang Cấu hình webhook, click vào button <mark style="color:blue;background-color:blue;">**Thêm mới**</mark><br>

![](https://lh4.googleusercontent.com/Dnob8qVy4gjNPYslQ5kycjw7jVkh8EK41CadqXg0_vL8LHEir2U6jDa2mVPTuKNYxDhO--B2gU33eHa1U_aj9Phevfs1O1C27z4ojccw99PjmMGcEAsihpXwsHtJiPOymDuqznzt-i5jPqOSkONtyWc)

2\. Bổ sung thông tin vào popup cấu hình Webhook\
\- Mở ra popup Thêm/sửa cấu hình webhook trong cửa hàng:

![](https://lh4.googleusercontent.com/TCx1D2T6kKTzSuiTpKlzuGYO3kV9ToV_2v5xObFx-Wq7n-21YEKNmbtAQVVzX5hypEtE2Tws5mdsI5VOa7c9IiNTflOn_YWzPlkVQHiKGNZH0iW2--qlRv93JmgGCHxnOcZdRfWi2exw-rTRnSWoaCQ)

\- Webhook URL: Nhập đường dẫn. Đây là địa chỉ Webhook callback URL (bắt buộc chạy https)\
\- Sự kiện: Chọn sự kiện muốn lấy nhận thông tin.\
\- Thông tin header: Bao gồm Key và Value, trường thông tin này không bắt buộc nhập (có thể là thông tin của ABAHA hoặc của bên bạn cần xuất hiện trong quá trình gửi dữ liệu để nhận biết nguồn tin)

3\. Ấn <mark style="background-color:green;">**Cập nhật**</mark> để kết thúc quá trình

## C. SỰ KIỆN WEBHOOK

Đây là trang báo cáo về các event webhook của hệ thống giúp bạn theo dõi và kiểm tra lại khi có phát sinh.

![](https://lh4.googleusercontent.com/pUa0P28zXRSVkU1uB4Aswbe40VZJSDBTARQS0G4eUXmXc1nkN-SLHadDPfk4HOGps3rRjmFdg7pBIhYd0hTv_C-KwvsHmbFaaYd2YiFlZlgbN4-8ruhM23rr8LRkziz6FecLUq4Sn-Dx9zdqFms)

**I. HƯỚNG DẪN SỬ DỤNG**

1\. STT là số thứ tự xuất hiện mới nhất của sự kiện phát sinh trên hệ thống.

2\. Loại sự kiện chỉ định event phát sinh trong hệ thống Abaha.

3\. Mỗi event phát sinh mới sẽ được hiển thị đầu danh sách, ứng với một ID đối tượng cụ thể.

4\. Số lần đã xử lý là số request của hệ thống bạn trả về với sự kiện được hệ thống Abaha ghi nhận.

5\. Trạng thái:\
\- Chỉ định trạng lần xử lý mới nhất của event đó, là kết quả của việc gửi dữ liệu sang hệ thống của bạn.\
\- Nội dung các trạng thái:

![](/files/xHmmZps428IZiUwaL0UD)

6\. Ngày tạo: Thời gian event được sinh ra trên hệ thống Abaha.

7\. Hành động:\
\- Click vào <mark style="background-color:orange;">Lịch sử</mark>  để mở ra popup theo dõi lịch sử của sự kiện.

![Có thể truy cập json.parser.online.fr xem các dữ liệu đã gửi và đã nhận rõ hơn](https://lh6.googleusercontent.com/d94BFITClalMBL0lM7xu9O5Bn94uXNLHHiXjaE12yIOnuP43Zn1WzngOPQTFv1KANnDKhAPEImIt3fkWJOvq2WEWi1NvGwe16GlAMlv9k4DcfAw7MThO-lqbeo1IsOMLbKEPEvC7Mp73G_ixjos)

\- Click <mark style="background-color:green;">Gửi lại</mark> để gửi lại bằng tay 1 sự kiện cho bên khách hàng.

## D. CÁC MẪU WEBHOOK

1. Mẫu của ĐƠN HÀNG\
   \- Webhook URL: [https://testapi.io/api/ToanPV/webhook](<https://testapi.io/api/ToanPV/webhook >)\
   \- Method: POST\
   \- Paramsend:\
   {\
   "id": "208610",\
   "cart\_code": "00000208610",\
   "cart\_type": "cart",\
   "user\_id": "56913",\
   "ref\_user\_id": null,\
   "payment\_type": "1",\
   "payment\_content": "",\
   "promotion\_id": "0",\
   "user\_voucher\_id": null,\
   "voucher\_status": "0",\
   "total\_value": "1790000",\
   "total\_after": "1790000",\
   "total\_cashback": null,\
   "fee\_ship": null,\
   "weight": "0",\
   "wallet\_fee": null,\
   "commission\_ref": null,\
   "dropship\_commission\_ref": null,\
   "accept\_commission\_ref": "0",\
   "cashback": { "tickid": { "user\_cashback": 35\
   }\
   },\
   "total\_before": "1790000",\
   "total\_cal\_commission": "1790000",\
   "total\_discount\_value": "0",\
   "total\_count\_selected": "5",\
   "count\_selected": "3", "status": "5",\
   "before\_status": "5",\
   "address\_id": "30822",\
   "store\_id": "552",\
   "user\_note": null,\
   "site\_note": null,\
   "payment": "Khi nhận hàng (COD)",\
   "payment\_method\_id": null,\
   "payment\_id": null,\
   "payment\_status": 0,\
   "txn\_id": null,\
   "item\_fee": {\
   "Phí Ship": "Chưa tính"\
   },\
   "used\_wallets": null,\
   "wallet\_option": null,\
   "cart\_fees": null,\
   "commerce\_fee": "0",\
   "is\_reject": "0",\
   "commissions": null,\
   "orders\_time": "2022-06-10 10:48:14",\
   "delete\_flag": "0",\
   "delivery\_time": null,\
   "utm\_source": "App",\
   "modified": "2022-06-10 10:53:56",\
   "created": "2022-06-10 10:47:45",\
   "accept\_commission\_ref\_date": null,\
   "comment": "",\
   "comment\_time": null,\
   "star": null, "pricing\_id": null,\
   "cart\_type\_name": "Đơn hàng",\
   "count": 0,\
   "user": {\
   "user\_id": "56913",\
   "name": "Đinh Thị Phương Thảo"\
   },\
   "pos\_details": "",\
   "promotions": \[],\
   "address": { "id": "30822",\
   "user\_id": "56913",\
   "name": "Thẻo",\
   "tel": "0336965825",\
   "address": "64 đội cấn(Phường Đội Cấn,Quận Ba Đình,Thành phố Hà Nội)",\
   "province\_id": "1",\
   "district\_id": "101",\
   "ward\_id": "1096",\
   "city": "Thành phố Hà Nội",\
   "district": "Quận Ba Đình",\
   "ward": "Phường Đội Cấn",\
   "latitude": "21.0344836",\
   "longitude": "105.8298894",\
   "default\_flag": "1",\
   "delete\_flag": "0",\
   "modified": "2022-05-26 14:02:22",\
   "created": "2022-05-26 14:02:22"\
   },\
   "name\_payment\_method": "Khi nhận hàng (COD)",\
   "store\_name": "Điểm bán 1",\
   "pricing\_name": "",\
   "payment\_status\_name": "Chưa thanh toán"

}

Response:

{

&#x20;     "status": 200,\
&#x20;     "message": "OK"

}

&#x20;2\.   Mẫu của SẢN PHẨM\
\- Webhook URL: <https://testapi.io/api/ToanPV/webhook>\
\- Method: POST\
\- Paramsend:

{\
&#x20;      "id": "873167",\
&#x20;      "order\_type": "1",\
&#x20;      "product\_code": "CEkJ48H4W4",\
&#x20;      "product\_type": "0",\
&#x20;      "name": "Kẻ chân mày - Chanel",\
&#x20;      "unit\_name": null,\
&#x20;      "discount": "1500000",\
&#x20;      "discount\_percent": "0",\
&#x20;      "price": "1500000",\
&#x20;      "price\_steps": null,\
&#x20;      "commission\_ref": "0",\
&#x20;      "cashback\_percent": null,\
&#x20;      "cart\_step": "1.0",\
&#x20;      "cat\_id": "53560",\
&#x20;      "ordering": "1",\
&#x20;      "brand": "",\
&#x20;      "sku": null,\
&#x20;      "rate": "5",\
&#x20;      "inventory": "998",\
&#x20;      "sale\_in\_stock": "0",\
&#x20;      "level\_inventory\_min": "0",\
&#x20;      "level\_inventory\_max": "999999999",\
&#x20;      "weight": "0",\
&#x20;      "slug": "ke-chan-may-chanel",\
&#x20;      "image": "<https://abphotos.link/photos/origin/no-product-image.png",\\>
&#x20;      "video": null,\
&#x20;      "short\_content": "",\
&#x20;      "content": "",\
&#x20;      "desc": null,\
&#x20;      "made\_in": "",\
&#x20;      "tags": null,\
&#x20;      "share\_link": null,\
&#x20;      "has\_attr": "0",\
&#x20;      "sales": "2",\
&#x20;      "delete\_flag": "0",\
&#x20;      "empty\_flag": "0",\
&#x20;      "modified": "2022-06-09 13:10:30",\
&#x20;      "created": "2022-05-26 14:34:10",\
&#x20;      "attributes": null

}

Response

{

&#x20;       "status": 200,\
&#x20;       "message": "OK"

}

&#x20;3\.  Mẫu của KHÁCH HÀNG\
\- Webhook URL: <https://testapi.io/api/ToanPV/webhook>\
\- Method: POST\
\- Paramsend:

{

&#x20;      "user\_id": "1347849",\
&#x20;      "name": "Robot 2",\
&#x20;      "tel": "0989898990",\
&#x20;      "premium": "0",\
&#x20;      "premium\_point": "0",\
&#x20;      "premium\_name": null,\
&#x20;      "premium\_date": null,\
&#x20;      "last\_login": null,\
&#x20;      "tags": null,\
&#x20;      "quote": null,\
&#x20;      "intro": null,\
&#x20;      "youtube": null,\
&#x20;      "facebook": null,\
&#x20;      "birthday": "",\
&#x20;      "gender": "",\
&#x20;      "email": "",\
&#x20;      "image": null,\
&#x20;      "image\_cover": null,\
&#x20;      "id\_card": null,\
&#x20;      "image\_id\_card\_front": null,\
&#x20;      "image\_id\_card\_back": null,\
&#x20;      "image\_id\_card": null,\
&#x20;      "bank\_account": null,\
&#x20;      "bank\_account\_name": null,\
&#x20;      "bank\_branch": null,\
&#x20;      "brand": null,\
&#x20;      "delete\_flag": "0",\
&#x20;      "invite\_id": null,\
&#x20;      "refer": null,\
&#x20;      "is\_refer": "0",\
&#x20;      "ref\_code": null,\
&#x20;      "invite\_link": null,\
&#x20;      "invite\_link\_shorten": null,\
&#x20;      "language": "vi",\
&#x20;      "invite\_user\_id": null,\
&#x20;      "bonus\_invite\_flag": "0",\
&#x20;      "pricing\_id": null,\
&#x20;      "pos\_type": null,\
&#x20;      "pos\_id": null,\
&#x20;      "store\_id": null,\
&#x20;      "modified": "2022-06-09 13:16:01",\
&#x20;      "created": "2022-06-09 13:16:01",\
&#x20;      "accept\_refer\_date": null

}

Response:

{

&#x20;      "status": 200,\
&#x20;      "message": "OK"

}


---

# 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://tailieu.abaha.vn/quan-ly-modules/cua-hang/cau-hinh-cua-hang/tai-lieu-webhook.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.
