Deal
Các API Liên quan đến deals
1. Tạo mới deal
POST
/{domain}/api/v1/deal
Tạo mới deal
Headers
Content-Type
application/json
Authorization
Bearer <token>
JSON body payload
1*
deal
object
Đối tượng chứa thông tin lead
..
Các trường trong object deal
1
username
Text
250
Họ tên khách hàng (Trong trường hợp số điện thoại hoặc email của khách đã tồn tại sẽ không sử dụng tham số này)
2
subject (*)
text
250
Tiêu đề
3
phone (*)
tel
50
Số điện thoại của khách hàng
4
email (*)
50
Email của khách hàng
5
service_id (**)
Int
10
Dịch vụ tiếp nhận Lead
6
group_id (**)
Int
10
ID bộ phận tiếp nhận
7
assignee_id (**)
Int
10
ID chuyên viên tiếp nhận
9
estimated_closed_date
DateTime
Dự kiến hoàn thành (Định dạng YYYY-MM-DD HH:mm:ss)
10
deal_label
Array
Mảng ID label của deal dạng [1,2,3]
12
custom_fields
Array
Mảng custom_fields tương tự tạo ticket
13
probability
Int
10
Tỉ lệ thành công (từ 0-100)
14
value
Int
10
Giá trị đơn hàng (Số)
15
comment
Text
5000
Nội dung ghi chú
9
comment.body
Text
5000
Nội dung comment
10
comment.is_public
Int
1
Trạng thái comment 0: Ghi chú 1: Public (VD: Gửi email cho người yêu cầu …)
11
comment.author_id
Int
10
ID của người bình luận
12
order_address_detail
String
255
Địa chỉ chi tiết
13
order_buyer_note
String
500
Ghi chú của người mua
15
order_district_id
String
10
ID của huyện/quận (Theo danh sách quận huyện)
16
order_ward_id
String
10
ID của Xã/phường (Theo danh sách xã phường)
17
order_receiver_name
String
200
Người nhận
18
order_receiver_phone
String
20
Số ĐT người nhận
19
order_shipping_fee
Float
Cước vận chuyển
20
order_status
String
50
Là một trong danh sách sau -
21
order_tracking_code
String
50
Mã vận chuyển
22
order_tracking_url
500
Đường dẫn kiểm tra trạng thái vận chuyển
23
order_products
Array
Mảng sản phẩm ()
Mẫu Payload
{
"deal": {
"phone": "0983980148",
"subject": "Test referer url",
"value": "233333",
"probability": 23,
"estimated_closed_date": "2024/03/21 23:59:59",
"deal_label": [
10,
11
],
"pipeline_id": 56,
"pipeline_stage_id": "377",
"custom_fields": [
{
"id": "6068",
"value": "106902"
}
]
}
}
Mẫu phản hồi
{
"code": "ok",
"deal": {
"updated_at": "2024-03-21 15:04:04",
"subject": "Test referer url",
"created_at": "2024-03-21 15:04:04",
"id": 414856013,
"requester_id": 63215969
}
}
2. Cập nhật deal
PUT
/{domain}/api/v1/deal/{dealId}
Cập nhật deal cần ID được lấy từ giá trị deal.id ở tiến trình tạo deal hoặc từ các nguồn khai thác đã tạo deal từ trước.
Headers
Content-Type
application/json
Authorization
Bearer <token>
JSON body payload
1*
deal
object
Đối tượng chứa thông tin lead
….
2
subject
text
250
Tiêu đề
7
assignee_id
Int
10
ID chuyên viên tiếp nhận
8
pipeline_id
Int
10
ID tiến trình (Mặc định theo cấu hình)
9
estimated_closed_date
DateTime
Dự kiến hoàn thành (Định dạng YYYY-MM-DD HH:mm:ss)
10
deal_label
Array
Mảng ID label của deal dạng [1,2,3]
11
pipeline_stage_id
Int
ID giai đoạn của tiến trình (mặc định là đầu giai đoạn)
12
custom_fields
Array
Mảng custom_fields tương tự tạo ticket
13
probability
Int
10
Tỉ lệ thành công (từ 0-100)
14
value
INt
10
Giá trị đơn hàng (Số)
15
comment (*)
Object
Nội dung ghi chú
16
order_address_detail
String
255
Địa chỉ chi tiết
17
order_buyer_note
String
20
Ghi chú của người mua
18
order_city_id
String
10
ID tỉnh thành trên CareSoft
19
order_district_id
String
10
ID huyện trên CareSoft
20
order_ward_id
String
10
ID xã trên CareSoft
21
order_receiver_name
String
299
Người nhận
22
order_receiver_phone
String
29
SDT người nhận
23
order_shipping_fee
Float
Giá cước
24
order_status
String
50
Trạng thái đơn hàng, Là một trong
25
order_tracking_code
String
59
Mã vận chuyển
26
order_tracking_url
String
500
Đường dẫn kiểm tra trạng thái vận chuyển
27
order_products
Array
Mảng sản phẩm (Xem )
Mẫu JSON BODY
{
"deal": {
"subject": "Tesst",
"comment": {
"body": "Cập nhật giá trị mua hành thành giao hàng",
"is_public": 1,
"author_id": 124734559
},
"pipeline_stage_id": 1,
"pipeline_id": 122,
"probability": "70",
"value": "200000",
"estimated_closed_date": "2024-04-11 00:00:00",
"deal_label": [
11,
22
],
"custom_fields": [
{
"id": "6068",
"value": "106902"
}
]
}
}
Response
{
"code": "ok",
"deal": {
"updated_at": "2024-03-21 15:04:04",
"subject": "Test referer url",
"created_at": "2024-03-21 15:04:04",
"id": 414856013,
"requester_id": 63215969
}
}
3. Chi tiết deal
GET
/{domain}/api/v1/deal/{dealId}
Lấy chi tiết 1 deal theo tham số dealID được tạo từ bước 1 hoặc được khai thác từ quá trình đồng bộ
Các tham số của Deal gồm
converted_at: Ngày chuyển đổi
converted_by: ID chuyên viên chuyển đổi
converted_type: Kiểu chuyển đổi ( 1: Chuyển thành deal, 2: Chuyển thành không đạt
lead_status_id: Id của trạng thái lead ( mục I.2)
last_lead_status_id: ID trạng thái trước khi chuyển đổi
unqualified_reasons: Id Lý do không đạt (Xem mục I.4)
labels : nhãn của Lead (Xem mục I.3)
estimated_closed_date: thời gian dự kiến hoàn thành
closed_at: Thời gian đóng deal
closed_by: Người đóng deal
closed_type: Kiểu đóng deal( kiểu Won/ Lost/ Unqualified)
pipeline_id: ID tiến trình của deal
pipeline_stage_id: ID giai đoạn của deal
value: Giá trị của deal
probability: Tỷ lệ thành công của deal
last_deal_stage_id: ID giai đoạn cuối trước khi đóng của deal
lost_reasons: Lý do mất của deal
order_address_detail: Chi tiết địa chỉ giao hàng
order_buyer_note: Ghi chú của người mua
order_city_id: ID City (Theo danh sách thành phố)
order_district_id: ID quận huyện (Theo danh sách quận huyện)
order_ward_id: ID phường xã (Theo danh sách phường xã )
order_receiver_name: Tên người nhận
order_receiver_phone: Số điện thoại người nhận đơn
order_shipping_fee: Giá cước vận chuyển
order_payment: Phương thức thanh toán
order_status: Trạng thái đặt hàng, ORDER_STARTED
order_tracking_code: Mã vận chuyển
order_tracking_url: Đường dẫn tra cứu vận chuyển của nhà cung cấp dịch vụ
order_products: [...]. Mảng sản phẩm đặt mua
name:Tên sản phẩm
sku: SKU sản phẩm,
is_free: Là sản phẩm tặng kèm (1) hoặc bình thường (0)
unit_price: Đơn giá
quantity: Số lượng
discount_markup:Giảm giá bằng %
discount_value: Giảm giá bằng tiền
total_amount: Tổng tiền của sản phẩm
Headers
Content-Type
application/json
Authorization
Bearer <token>
Response
{
"deal": {
"account_id": 8187,
"id": 474845380,
"deal_no": 13241,
"requester_id": 156011012,
"group_id": 14181,
"ticket_source_end_status": null,
"assignee_id": 124733804,
"ticket_source": "Facebook",
"merge_status": null,
"merge_to": null,
"clone_from": null,
"subject": "Test Deal",
"created_at": "2024-03-16 02:22:55",
"updated_at": "2024-10-21 13:58:39",
"duedate": null,
"satisfaction": null,
"satisfaction_content": null,
"satisfaction_at": null,
"satisfaction_send": null,
"campaign_id": null,
"campaign_action_id": null,
"campaign_status": null,
"automessage_id": null,
"manualmessage_id": null,
"incident_id": -1,
"service_id": 91047363,
"qa_script_id": null,
"qa_agent": null,
"current_agent": null,
"ticket_source_detail_id": 290025,
"convert_by": null,
"convert_at": null,
"convert_type": null,
"unqualified_reasons": 0,
"last_lead_status_id": null,
"lead_status_id": null,
"estimated_closed_date": "2024-10-23 23:59:59",
"closed_at": "2024-10-12 01:48:54",
"closed_by": 124733804,
"closed_type": 3,
"pipeline_id": 17,
"pipeline_stage_id": 129,
"value": 1000,
"probability": 40,
"last_deal_stage_id": 125,
"lost_reasons": null,
"order_address_detail": "Đơn hàng từ Khách lẻ",
"order_buyer_note": "Giao giờ hành chính",
"order_city_id": "01",
"order_district_id": "021",
"order_receiver_name": "windy",
"order_receiver_phone": "03466****66",
"order_shipping_fee": 30000,
"order_payment": null,
"order_status": "ORDER_STARTED",
"order_tracking_code": "122xxx",
"order_tracking_url": "https://shippingprovider..../?trackingId=",
"order_ward_id": "00617",
"order_products": [
{
"name": "Boots",
"sku": "2",
"is_free": 0,
"unit_price": 50000,
"quantity": 1,
"discount_markup": 10,
"discount_value": 0,
"total_amount": 45000
},
{
"name": "Harpic White and Shine Disinfectant Toilet Cleaner Bleach - 500 ml | India's # 1 Toilet Cleaner",
"sku": "11",
"is_free": 0,
"unit_price": 6245,
"quantity": 1,
"discount_markup": 0,
"discount_value": 2000,
"total_amount": 4245
}
],
"comments": [
{
"ticket_comments_id": 1224857808,
"ticket_id": 474845380,
"comment": "1",
"commentator_id": 124734559,
"username": "Admin1",
"facebook": null,
"facebook_name": null,
"comment_source": null,
"created_at": "2024-10-21 13:58:39",
"attack_file_id": null,
"file_name": null,
"file_id": null,
"download_connection_string": null,
"call_id": null,
"email_receive_id": null,
"addition_details": null,
"is_public": 0,
"can_hide": null,
"can_remove": null,
"can_reply_privately": null,
"facebook_comment_state": 0,
"role_id": 1,
"avatar": "https://3.bp.blogspot.com/-qCI9fu4I2SE/Y7UkNAM4jhI/AAAAAAAENjs/YWNtRIeDGjghZbiZmu9aduswuxvmuTYSACNcBGAsYHQ/photo.png?imgmax=3000"
}
],
"custom_fields": [
{
"id": 5159,
"label": "Kí tự 19",
"type": "Text",
"value": null
},
{
"id": 6055,
"label": "Địa chỉ link 19",
"type": "Link",
"value": null
},
{
"id": 9579,
"label": "Phân loại ticket cha(2602)",
"type": "Single drop-down list",
"value": null
}
],
"tags": [],
"ccs": [
{
"id": 156011012,
"username": "Hùng Nguyễn",
"email": "[email protected]"
}
],
"follows": [],
"labels": [
{
"id": 32,
"label": "New letter",
"updated_at": "2024-10-21 13:58:39"
},
{
"id": 31,
"label": "No Label",
"updated_at": "2024-10-21 13:58:39"
}
],
"assignee": {
"id": 124733804,
"username": "Hùng zx",
"email": "[email protected]",
"phone_no": "0334992975",
"agent_id": "50000",
"role_id": 1,
"group_id": 14181,
"group_name": "ORV"
},
"requester": {
"id": 156011012,
"username": "Sample",
"email": "[email protected]",
"phone_no": "09***12009",
"organization_id": 245826,
"organization": {
"organization_id": 245826,
"organization_domain": "",
"organization_name": "Sample org"
}
}
}
}
4. Danh sách deals
GET
/{domain}/api/v1/deals
Danh sách deal đang có trên hệ thống
Headers
Content-Type
application/json
Authorization
Bearer <token>
Parameters
requester_id
ID Người yêu cầu
assignee_id
ID Chuyên viên
service_id
ID dịch vụ
page
Trang số (mặc định 1)
count
Số bản ghi /trang (mặc định 50, max 500)
created_since
Ngày tạo từ (Kiểu Time TZ) Vd: 2024-06-01T00:00:00Z
created_to
Ngày tạo tới (Kiểu Time TZ) Vd: 2024-06-01T00:00:00Z
updated_since
Ngày cập nhật từ (Kiểu Time TZ) Vd: 2024-06-01T00:00:00Z
updated_to
Ngày cập nhật tới (Kiểu Time TZ) Vd: 2024-06-01T00:00:00Z
convert_since
Ngày chuyển đổi thành deal (từ lead) (Kiểu Time TZ) Vd: 2024-06-01T00:00:00Z
convert_to
Ngày chuyển đổi thành deal tới (Kiểu Time TZ) Vd: 2024-06-01T00:00:00Z
closed_since
Ngày đóng Deal từ (Kiểu Time TZ) Vd: 2024-06-01T00:00:00Z
closed_to
Ngày đóng Deal tới (Kiểu Time TZ) Vd: 2024-06-01T00:00:00Z
pipeline_ids
ID Tiến trình chọn nhiều cách nhau bởi dấu phẩy VD: 12 hoặc 12,34,56
stage_ids
ID chọn nhiều cách nhau bởi dấu phẩy VD: 12 hoặc 12,34,56
closed_type
Trạng thái đóng: 1: Thành công, 2: Mất Deal , 3: Không đạt
convert_type
Trạng thái chuyển đổi từ lead sang deal
1:Chuyển thành Deal , 2: Chuyển thành unqualified.
Response
{
"code": "ok",
"numFound": 2,
"deals": [
{
"id": 414858584,
"deal_no": 275062,
"requester_id": 63203703,
"ticket_source_end_status": null,
"assignee_id": 63203703,
"ticket_priority": "Normal",
"ticket_source": "Web",
"is_overdue": null,
"subject": "csxcsxdv",
"created_at": "2024-05-24T17:22:21Z",
"updated_at": "2024-05-27T11:32:17Z",
"duedate": null,
"service_id": null,
"incident_id": -1,
"satisfaction": null,
"satisfaction_at": null,
"satisfaction_content": null,
"campaign_id": null,
"automessage_id": null,
"ticket_source_detail_id": null,
"convert_by": null,
"convert_at": null,
"convert_type": null,
"unqualified_reasons": null,
"last_lead_status_id": null,
"lead_status_id": null,
"estimated_closed_date": "2024-05-24 23:59:59",
"closed_at": "2024-05-27 11:06:02",
"closed_by": 63203703,
"closed_type": 2,
"pipeline_id": 56,
"pipeline_stage_id": 382,
"value": 0,
"probability": 20,
"last_deal_stage_id": 377,
"lost_reasons": 79
},
{
"id": 414857144,
"deal_no": 273806,
"requester_id": 1,
"ticket_source_end_status": null,
"assignee_id": 1,
"ticket_priority": "Normal",
"ticket_source": "Web",
"is_overdue": null,
"subject": "xxxx",
"created_at": "2024-05-07T13:46:14Z",
"updated_at": "2024-05-07T17:48:36Z",
"duedate": null,
"service_id": null,
"incident_id": -1,
"satisfaction": null,
"satisfaction_at": null,
"satisfaction_content": null,
"campaign_id": null,
"automessage_id": null,
"ticket_source_detail_id": null,
"convert_by": null,
"convert_at": null,
"convert_type": null,
"unqualified_reasons": null,
"last_lead_status_id": null,
"lead_status_id": null,
"estimated_closed_date": null,
"closed_at": "2024-05-07 17:48:36",
"closed_by": 29370874,
"closed_type": 2,
"pipeline_id": 56,
"pipeline_stage_id": 382,
"value": 0,
"probability": 5,
"last_deal_stage_id": 376,
"lost_reasons": 85
}
]
}
5. Các API liên quan khác
5.1 Danh sách Các tiến trình và giai đoạn
GET
/{domain}/api/v1/deal/pipelines
Headers
Content-Type
application/json
Authorization
Bearer <token>
Response
{
"code": "ok",
"data": [
{
"id": 41,
"label": "Sale pipeline",
"created_at": "2024-03-01 09:43:10",
"updated_at": "2024-03-30 00:40:06",
"default": 0,
"stages": [
{
"id": 296,
"pipeline_id": 41,
"stage_name": "Tư vấn triển khai ",
"stage_type": 1,
"probability": 50
},
{
"id": 298,
"pipeline_id": 41,
"stage_name": "Hợp đồng báo giá",
"stage_type": 0,
"probability": 20
},
{
"id": 299,
"pipeline_id": 41,
"stage_name": "Vận đơn Logistic",
"stage_type": 0,
"probability": 70
},
{
"id": 300,
"pipeline_id": 41,
"stage_name": "Thanh toán thành công",
"stage_type": 2,
"probability": 0
},
{
"id": 301,
"pipeline_id": 41,
"stage_name": "Hoàn hàng ",
"stage_type": 3,
"probability": 0
},
{
"id": 302,
"pipeline_id": 41,
"stage_name": "Đổi trả ",
"stage_type": 4,
"probability": 0
}
]
}
]
}
5.2 Lý do không đạt
GET
/{domain}/api/v1/deal/unqualified-reasons
Headers
Content-Type
application/json
Authorization
Bearer <token>
Response
{
"code": "ok",
"data": [
{
"id": 193,
"label": "No need"
},
{
"id": 194,
"label": "Not the decision maker"
},
{
"id": 195,
"label": "No budget"
},
{
"id": 196,
"label": "Not the right timing"
},
{
"id": 197,
"label": "Other"
}
]
}
5.3 Lý do mất đơn
POST
/{domain}/api/v1/deal/lost-reasons
<Description of the endpoint>
Headers
Content-Type
application/json
Authorization
Bearer <token>
Body
name
string
Name of the user
age
number
Age of the user
Response
{
"code": "ok",
"data": [
{
"id": 20,
"label": "Lost to competiton"
},
{
"id": 21,
"label": "Poor follow up"
},
{
"id": 22,
"label": "We are too expensive"
},
{
"id": 23,
"label": "Timing Gap"
}
]
}
5.4 Deal labels
GET
/{domain}/api/v1/deal/labels
Headers
Content-Type
application/json
Authorization
Bearer <token>
Body
name
string
Name of the user
age
number
Age of the user
Response
{
"code": "ok",
"data": [
{
"id": 37,
"label": "Automation",
"created_at": "2023-10-27 23:18:55",
"updated_at": "2023-10-27 23:18:55"
},
{
"id": 29,
"label": "Cold Deal",
"created_at": "2023-10-27 23:16:34",
"updated_at": "2023-10-27 23:16:34"
},
{
"id": 30,
"label": "Web Form",
"created_at": "2023-10-27 23:16:45",
"updated_at": "2023-10-27 23:16:45"
}
]
}
Last updated