Lead
Các API liên quan đến đối tượng Leads
1. Tạo mới Lead
POST
/{domain}/api/v1/lead
Tạo mới Lead
Headers
Content-Type
application/json
Authorization
Bearer <token>
Body
1*
lead
object
Đối tượng chứa thông tin lead
….
Các trường trong object lead
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
8
lead_status_id
Int
10
ID trạng thái lead (Mặc định không điền sẽ lấy trạng thái đầu
9
estimated_closed_date
DateTime
Dự kiến hoàn thành (Định dạng YYYY-MM-DD HH:mm:ss)
10
lead_label
Array
Mảng ID label của lead Dạng [1,2,3]
11
custom_fields
Array
Mảng custom_fields tương tự tạo ticket
12
comment
Text
5000
Nội dung ghi chú
13
unqualify_reason
Int
10
ID của lý do không đạt (Chỉ áp dụng nếu lead_status_id ở trạng thái cuối)
Mẫu body JSON tạo lead
{
"lead": {
"phone": "0983980148",
"service_id": 1244,
"subject": "Test lead",
"comment": "Helo world",
"estimated_closed_date": "2024/03/21 23:59:59",
"lead_status": 558,
"lead_label_id": [
10,
11
],
"ref_url": "https://gooogle.com?utm_content=TestREFERURL&utm_source=GANEW"
}
}
Kết quả phản hồi Trong đối tượng lead trả về có chứa ID chính là Lead Id dùng để cập nhật hoặc thực thi các tác vụ khác liên quan
{
"code": "ok",
"lead": {
"updated_at": "2024-03-21 15:11:06",
"subject": "Test referer lead",
"created_at": "2024-03-21 15:11:06",
"id": 414856017,
"requester_id": 63215969
}
}
2. Cập nhật Lead
PUT
/{domain}/api/v1/lead/{leadId}
Cập nhật 1 lead với {leadId} là ID từ quá trình tạo mới hoặc quét dữ liệu đồng bộ từ trước
Headers
Content-Type
application/json
Authorization
Bearer <token>
Body
1*
lead
object
Đối tượng chứa thông tin lead
….
2
subject
text
250
Tiêu đề
3
assignee_id
Int
10
ID chuyên viên tiếp nhận
4
lead_status_id
Int
10
ID trạng thái lead (Mặc định không điền sẽ lấy trạng thái đầu
5
estimated_closed_date
DateTime
Dự kiến hoàn thành (Định dạng YYYY-MM-DD HH:mm:ss)
6
lead_label
Array
Mảng ID label của lead Dạng [1,2,3]
7
custom_fields
Array
Mảng custom_fields tương tự tạo ticket
8
comment (*)
OBJECT
Object đối tượng comment
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
unqualify_reason
Int
10
ID của lý do không đạt (Chỉ áp dụng nếu lead_status_id ở trạng thái cuối)
Mẫu ví dụ body Json cập nhật LeadID: 414856017
PUT: /{domain}/api/v1/lead/414856017
{
"lead": {
"subject": "Tesst",
"comment": {
"body": "Cập nhật giá trị mua hành thành giao hàng",
"is_public": 1,
"author_id": 124734559
},
"lead_status_id": 1,
"estimated_closed_date": "2024-04-11 00:00:00",
"lead_label": [
11,
22
],
"custom_fields": [
{
"id": "6068",
"value": "106902"
}
]
}
}
Kết quả phản hồi
{
"code": "ok",
"lead": {
"updated_at": "2024-03-21 15:11:06",
"subject": "Test referer lead",
"created_at": "2024-03-21 15:11:06",
"id": 414856017,
"requester_id": 63215969
}
}
3. Chi tiết Lead
GET
/{domain}/api/v1/lead/{leadId}
<Description of the endpoint>
Headers
Content-Type
application/json
Authorization
Bearer <token>
Response
{
"lead": {
"account_id": 8187,
"id": 512534181,
"lead_no": 16843,
"requester_id": 207642682,
"group_id": 12945,
"ticket_source_end_status": null,
"assignee_id": 124734559,
"ticket_source": "Voice Out",
"merge_status": null,
"merge_to": null,
"clone_from": null,
"subject": "Cuộc gọi ra cho khách hàng theo chiến dịch: Mơ Sample",
"created_at": "2024-08-07 14:17:11",
"updated_at": "2024-09-30 12:04:38",
"duedate": null,
"satisfaction": null,
"satisfaction_content": null,
"satisfaction_at": null,
"satisfaction_send": null,
"campaign_id": 78830,
"campaign_action_id": -1,
"campaign_status": 0,
"automessage_id": null,
"manualmessage_id": null,
"incident_id": -1,
"service_id": null,
"qa_script_id": null,
"qa_agent": null,
"current_agent": null,
"ticket_source_detail_id": 1154135,
"convert_by": 124734559,
"convert_at": "2024-08-07 14:24:12",
"convert_type": 1,
"unqualified_reasons": null,
"last_lead_status_id": 25,
"estimated_closed_date": null,
"lead_status_id": 26,
"comments": [
{
"ticket_comments_id": 1211536855,
"ticket_id": 512534181,
"comment": "aa",
"commentator_id": 124734559,
"username": "Admin1",
"facebook": null,
"facebook_name": null,
"comment_source": null,
"created_at": "2024-09-30 12:04:38",
"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": 9579,
"label": "Phân loại ticket cha(2602)",
"type": "Single drop-down list",
"value": null
}
],
"tags": [],
"ccs": [],
"follows": [],
"labels": [],
"campaign": {
"id": 78830,
"campaign_name": "Mơ Sample",
"status": 0
},
"campaign_action": null,
"assignee": {
"id": 124734559,
"username": "Admin1",
"email": "**@gmail.com",
"phone_no": "***",
"agent_id": "50024",
"role_id": 1,
"group_id": 12153,
"group_name": "Default Group"
},
"requester": {
"id": 207642682,
"username": "cfsdcf",
"email": null,
"phone_no": null,
"organization_id": null
}
}
}
4. Danh sách lead
GET
/{domain}/api/v1/leads
Lấy danh sách các leads
Headers
Content-Type
application/json
Authorization
Bearer <token>
Parameter
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
status_ids
Trạng thái leads, chọn nhiều cách nhau bởi dấu phẩy VD: 12 hoặc 12,34,56
convert_type
Trạng thái chuyển đổi từ lead sang deal
1: Chuyển thành Lead, 2: Chuyển thành Không đạt
Mẫu dữ liệu phản hồi
{
"code": "ok",
"numFound": 1,
"leads": [
{
"id": 414857091,
"lead_no": 273763,
"requester_id": 63216680,
"ticket_source_end_status": 1,
"assignee_id": 1,
"ticket_priority": "Normal",
"ticket_source": "Voice Out",
"is_overdue": null,
"subject": "Cuộc gọi ra cho khách hàng loi.tranquang",
"created_at": "2024-05-03T15:28:40Z",
"updated_at": "2024-05-03T15:28:40Z",
"duedate": null,
"service_id": 2005289,
"incident_id": null,
"satisfaction": null,
"satisfaction_at": null,
"satisfaction_content": null,
"campaign_id": null,
"automessage_id": null,
"source_detail_id": 127,
"convert_by": null,
"convert_at": null,
"convert_type": null,
"unqualified_reasons": null,
"last_lead_status_id": null,
"lead_status_id": 525,
"estimated_closed_date": null
}
]
}
5. Các thành phần khác của Lead
Các API bổ sung cho lead
5.1 Danh sách trạng thái lead
GET
/{domain}/api/v1/lead/status
Danh sách các trạng thái lead đã cấu hình trên hệ thống
Trong đó:
label: Tên trạng thái
id: ID trạng thái
status_type: Kiểu trạng thái. 1: Đầu tiên, ,0 Giữa (đổi vị trí thoải mái-- index các loại), 2: Converted (index to nhất), 3: Unqualify
Headers
Content-Type
application/json
Authorization
Bearer <token>
Kết quả minh họa
{
"code": "ok",
"data": [
{"id": 525, "label": "Tương tác mới" , "status_type": 1},
{"id": 557, "label": "Đang liên hệ" , "status_type": 0},
{"id": 558, "label": "Comming" , "status_type": 0},
{"id": 643, "label": "Trạng thái demo" , "status_type": 0},
{"id": 527, "label": "Lead Converted1" , "status_type": 2},
{"id": 528, "label": "Lead Unqualified", "status_type": 3}
]
}
5.2 Danh sách lý do không đạt Lead
GET
/{domain}/api/v1/lead/unqualified-reason
Danh sách id các lý do không đạt đã được cấu hình cho lead
Headers
Content-Type
application/json
Authorization
Bearer <token>
Response
{
"code": "ok",
"data": [
{
"id": 176,
"label": "No need"
},
{
"id": 177,
"label": "Not the decision maker"
},
{
"id": 182,
"label": "No budget"
},
{
"id": 217,
"label": "Lead unqualified"
}
]
}
5.3 Danh sách lead labels
GET
/{domain}/lead/labels
<Description of the endpoint>
Headers
Content-Type
application/json
Authorization
Bearer <token>
Response
{
"code": "ok",
"data": [
{
"id": 17,
"label": "5",
"created_at": "2023-10-03 17:11:01",
"updated_at": "2023-10-03 17:11:01"
},
{
"id": 11,
"label": "Cold",
"created_at": "2023-10-02 11:13:17",
"updated_at": "2023-10-02 11:13:17"
},
{
"id": 22,
"label": "Freezing@2",
"created_at": "2023-10-25 14:22:14",
"updated_at": "2023-10-25 14:22:14"
}
]
}
Last updated