CareSoft cung cấp tính năng hỗ trợ các webhook để nhận thông tin cập nhật người dùng, tổ chức, phiếu ghi, các sự kiện realtime cho cuộc gọi vào, sự kiện kết thúc cuộc gọi trên smartdialer.
I. Chuẩn bị thông tin
Khách hàng gửi thông tin server webhook cho support hỗ trợ cấu hình bao gồm:
Callback Url (VD: http://sample.com/api/webHook)
SecretKey (option)
Các sự kiện hỗ trợ đăng ký:
Người dùng:user
Tổ chức: organization
Phiếu ghi: ticket.voice, ticket.voice_out, ticket.ivr, ticket.voicemail, ticket.voice_campaign, ticket.email, ticket.email_out, ticket.web, ticket.api, ticket.sms_out, ticket.ticket_form, ticket.ticket_sharing, ticket.chat, ticket.facebook, ticket.inbox_facebook, ticket.inbox_facebook_out, ticket.facebook_rating, ticket.facebook_lead_ads, ticket.instagram, ticket.chat_instagram, ticket.inbox_zalo, ticket.inbox_zalo_out, ticket.inbox_zalo_zns, ticket.zalo_lead_form
Lead: lead
Deal: deal
SmartDialer: smart_dialer
Cuộc gọi vào: call_in
LƯU Ý: Event sẽ được trả về theo method POST. Request body dạng application/json. Header bao gồm X-Hub-Signature được mã hoá body theo chuẩn HmacSHA1 với secret key đã được cấu hình (Kết quả mã hoá ở dạng uppercase)
// Sự kiện người dùng được tạo{"object":"user","action":"create","user": {"id":0,"username":"","account_id":0,"email":"","email2":"","phone_no":"","phone_no2":"","phone_no3":"","role_id":3,"facebook":"","note":"","gender":0,"organization_id":0,"detail":"","avatar":"","user_info1":"",//facebook name"user_info5":"",//address"user_info10":"",//instagram name"user_info12":"",//instagram link"user_info16":"",//zalo name"follower_id":0,"updated_at":0,//Time in millis"created_at":0,//Time in millis"addition_fields": [ {"id":0,//id trường động"field":"addition_field1",//Mã trường động"label":"",//Tên trường động"type":0|1|2|3|4|6|7,//String|Number|DateTime|SingleSelect|MultiSelect|TextArea|Stage"value":"",//value in string"value_id":0//value id } ] }}
Sự kiện người dùng
// Sự kiện cập nhật người dùng{"object":"user","action":"update","user": {"id":0,"username":"","account_id":0,"email":"","email2":"","phone_no":"","phone_no2":"","phone_no3":"","role_id":3,"facebook":"","note":"","gender":0,"organization_id":0,"detail":"","avatar":"","user_info1":"",//facebook name"user_info5":"",//address"user_info10":"",//instagram name"user_info12":"",//instagram link"user_info16":"",//zalo name"follower_id":0,"updated_at":0,//Time in millis"created_at":0,//Time in millis"addition_fields": [ {"id":0,//id trường động"field":"addition_field1",//Mã trường động"label":"",//Tên trường động"type":0|1|2|3|4|6|7,//String|Number|DateTime|SingleSelect|MultiSelect|TextArea|Stage"value":"",//value in string"value_id":0//value id } ] }}
2. Sự kiện trên tổ chức
Tổ chức
// Sự kiện tổ chức được tạo{"object":"organization","action":"create","organization": {"organization_id":0,"account_id":0,"organization_name":"","organization_domain":"","details":"","note":"","created_at":0,//Time in millis"updated_at":0,//Time in millis,"addition_fields": [ {"id":0,//id trường động"field":"addition_field1",//Mã trường động"label":"",//Tên trường động"type":0|1|2|3|4|6|7,//String|Number|DateTime|SingleSelect|MultiSelect|TextArea|Stage"value":"",//value in string"value_id":0//value id } ] }}
Tổ chức
// Sự kiện tổ chức được cập nhật{"object":"organization","action":"update","organization": {"organization_id":0,"account_id":0,"organization_name":"","organization_domain":"","details":"","note":"","created_at":0,//Time in millis"updated_at":0,//Time in millis,"addition_fields": [ {"id":0,//id trường động"field":"addition_field1",//Mã trường động"label":"",//Tên trường động"type":0|1|2|3|4|6|7,//String|Number|DateTime|SingleSelect|MultiSelect|TextArea|Stage"value":"",//value in string"value_id":0//value id } ] }}
3. Sự kiện trên phiếu ghi
Khi có sự kiện xảy ra trên phiếu ghi, nguồn của sự kiện này sẽ phân biệt bằng giá trị của thuộc tính source trong ticket_comment.
Ví dụ để phân biệt sự kiện là cuộc gọi vào hay cuộc gọi ra:
Các giá trị source cuộc gọi vào: Voice, IVR, ZCC In, MissCall, VoiceMail, Voicemail
Các giá trị source cho gọi ra: Voice Out, ZCC Out, Voice Campaign
Xem đầy đủ danh sách các giá trị của nguồn tại Danh sách nguồn.
Phiếu ghi
// Phiếu ghi được tạo{"object":"ticket","action":"create","ticket": {"ticket_id":0,"ticket_no":0,"assignee_id":0,"service_id":0,"ticket_priority":"normal","ticket_source":"web","ticket_source_end_status":0,"ticket_status":"open","ticket_subject":"","created_at":0,//Time in millis"updated_at":0,//Time in millis,"last_change_status_at":0,//Time in millis"campaignId":0,"addition_fields": [ {"id":0,//id trường động"field":"addition_field1",//Mã trường động"label":"",//Tên trường động"type":0|1|2|3|4|6|7,//String|Number|DateTime|SingleSelect|MultiSelect|TextArea|Stage"value":"",//value in string"value_id":0//value id } ]"ticket_comment": {"ticket_id":0,"comment":"","addition_details":"","commentator_id":0,"source":"web","is_public":0,"type":0,"created_at":0,//Time in millis"updated_at":0,//Time in millis, } }}
Phiếu ghi
// Phiếu ghi được cập nhật{"object":"ticket","action":"update","ticket": {"ticket_id":0,"ticket_no":0,"assignee_id":0,"service_id":0,"ticket_priority":"normal","ticket_source":"web","ticket_source_end_status":0,"ticket_status":"open","ticket_subject":"","created_at":0,//Time in millis"updated_at":0,//Time in millis,"last_change_status_at":0,//Time in millis"campaignId":0,"addition_fields": [ {"id":0,//id trường động"field":"addition_field1",//Mã trường động"label":"",//Tên trường động"type":0|1|2|3|4|6|7,//String|Number|DateTime|SingleSelect|MultiSelect|TextArea|Stage"value":"",//value in string"value_id":0//value id }, { } ]"ticket_comment": {"ticket_id":0,"comment":"","addition_details":"","commentator_id":0,"source":"web","is_public":0,"type":0,"created_at":0,//Time in millis"updated_at":0,//Time in millis, } },"call_info"://Thông tin cuộc gọi nếu có { "call_id":"","caller":"",//SĐT khách hàng"called":"",//Đầu số"status_code":"200","start_time":000//Time in millis"answer_time": 000//Time in millis"end_time": 000//Time in millis }}
// Phiếu bị bị xoá{"object":"ticket","action":"delete","ticket": {"ticket_id":0 }}
Phiếu ghi
// Phiếu ghi bị ghép{"object":"ticket","action":"merge","mergeOption": {"primaryTicket":0,"secondaryTickets":1,"primaryComment":"","primaryIsPublic":0,"secondaryComment":"","secondaryIsPublic":0,"addCC":0,"addFollow":0,"copyComments":0, }}
4. Sự kiện trên SmartDialer
SmartDialer
// Cuộc gọi kết thúc từ chiến dịch auto call{"object":"smart_dialer","action":"ad_end_call","call_info": {"call_id":"","line":"","phone_number":"","call_attempt_index":0,"max_attempt":1,"campaign_id":0,"customer_id":0,"customer_name":"","campaign_data_id":0,"start_time":0,//Time in millis"connect_time":0,//Time in millis"end_time":0,//Time in millis"ring_customer_duration":0,//seconds"call_duration":0,//seconds"status_code":"","customer_input_dtmf":"",//dữ liệu bấm phím ivr nếu có }}
SmartDialer
//Cuộc gọi kết thúc từ chiến dịch predictive call{"object":"smart_dialer","action":"pd_end_call","call_info": {"call_id":"","line":"","phone_number":"","call_attempt_index":0,"max_attempt":1,"campaign_id":0,"customer_id":0,"customer_name":"","campaign_data_id":0,"start_time":0,//Time in millis"connect_time":0,//Time in millis"end_time":0,//Time in millis"ring_customer_duration":0,//seconds"call_duration":0,//seconds"agent_user_id":0,"agent_id":0,"agent_ring_time":0,//Time in millis"agent_connect_time":0,//Time in millis"ring_agent_duration":0,//seconds"status_code":"" }}
5. Sự kiện cập nhật trạng thái cuộc gọi vào
Đăng ký nhận sự kiện này nếu bạn muốn tích hợp chi tiết tất cả các sự kiện xảy ra trong quá trình gọi vào từ lúc cuộc gọi bắt đầu, tới lúc đổ chuông chuyên viên và kết thúc cuộc gọi.
Cuộc gọi vào
//1. Sự kiện bắt đầu cuộc gọi{"object":"call_in","action":"call_in_start","call_info": {"event_name":"call_in_start","call_id":"","account_id":0,"direction":"inbound","caller":"",//SĐT khách hàng"called":"",//Đầu số"event_time":000//Time in millis }}
Cuộc gọi vào
//2. Sự kiện đổ chuông tới Agent{"object":"call_in","action":"call_in_agent_ring","call_info": {"event_name":"call_in_agent_ring","call_id":"","account_id":0,"direction":"inbound","caller":"",//SĐT khách hàng"called":"",//Đầu số"agent_id":"","event_time":000//Time in millis }}
Cuộc gọi vào
//3. Sự kiện trượt qua Agent{"object":"call_in","action":"call_in_agent_miss","call_info": {"event_name":"call_in_agent_miss","call_id":"","account_id":0,"direction":"inbound","caller":"",//SĐT khách hàng"called":"",//Đầu số"agent_id":"","event_time":000//Time in millis }}
Cuộc gọi vào
//4. Sự kiện Agent bắt máy{"object":"call_in","action":"call_in_agent_answer","call_info": {"event_name":"call_in_agent_answer","call_id":"","account_id":0,"direction":"inbound","caller":"",//SĐT khách hàng"called":"",//Đầu số"agent_id":"","event_time":000//Time in millis }}
Cuộc gọi vào
//5. Sự kiện Agent kết thúc cuộc gọi{"object":"call_in","action":"call_in_agent_end","call_info": {"event_name":"call_in_agent_end","call_id":"","account_id":0,"direction":"inbound","caller":"",//SĐT khách hàng"called":"",//Đầu số"agent_id":"","event_time":000//Time in millis }}
Cuộc gọi vào
//6. Sự kiện Khách hàng kết thúc cuộc gọi{"object":"call_in","action":"call_in_customer_end","call_info": {"event_name":"call_in_customer_end","call_id":"","account_id":0,"direction":"inbound","caller":"",//SĐT khách hàng"called":"",//Đầu số"agent_id":"","event_time":000//Time in millis }}
Cuộc gọi vào
//7. Sự kiện cuộc gọi kết thúc{"object":"call_in","action":"call_in_end","call_info": {"event_name":"call_in_end","call_id":"","account_id":0,"direction":"inbound","caller":"",//SĐT khách hàng"called":"",//Đầu số"agent_id":"","event_time":000//Time in millis"call_start_time": 0,//Time in millis"call_answer_time":0,//Time in millis"call_end_time":0,//Time in millis"call_end_time":0,//Time in millis"call_duration":0,//Time in seconds"status":"answered|miss",//Trạng thái gặp agent hay không"answer_duration":0,//Time in seconds - status answered"record_url":""//Link file ghi âm - status answered }}
6. Sự kiện trên Lead
6.1. Lead được tạo
// lead created event payload{"account_id":1,"activity_source":"AGENT","action":"create","lead": {"lead_id":414856712,"name":"Lead name","last_change_status_at":1713150362091,"lead_status_id":525,"estimated_closed_date":1713200399000,"addition_fields": [ {"field":"addition_field6","id":4373,"label":"Reasons Unqualified","value_id":"","type":3,"value":"" } ],"source":"Web","created_at":1713150362013,"updated_at":1713150362091,"activity": {"updated_at":1713150362124,"commentator_id":63216138,"is_public":0,"created_at":1713150362124,"comment":"first comment","ticket_id":414856712,"type":0 },"requester_id":63216138,"assignee_id":1 },"object":"lead"}
6.2. Lead được convert từ đối tượng khác
// Lead converted from Ticket payload{"account_id":1,"activity_source":"AGENT","action":"convert","updated_properties": [ {"field":"lead_status_id","value":525 } ],"convert_from_object":"ticket","lead": {"lead_id":414856714,"name":"Lead name sample","last_change_status_at":1713153062000,"lead_status_id":525,"addition_fields": [ {"field":"addition_field9","id":4376,"label":"Custom field abc","type":2,"value":"" } ],"source":"Web","created_at":1713153062000,"updated_at":1713153076734,"activity": {"updated_at":1713153076732,"commentator_id":1,"is_public":0,"created_at":1713153076732,"comment":"Chuyển đổi dữ liệu thành dạng Lead","source":"Web","lead_id":414856714,"type":1 },"requester_id":1,"assignee_id":1 },"object":"lead"}
6.3. Lead được cập nhật
// lead updated event payload{"account_id":1,"activity_source":"AGENT","action":"update","updated_properties": [ {"field":"addition_field19","value":"value sample" } ],"lead": {"lead_id":414856712,"name":"Lead name","last_change_status_at":1713150362000,"lead_status_id":525,"estimated_closed_date":1713200399000,"addition_fields": [ {"field":"addition_field6","id":4373,"label":"Reasons Unqualified","value_id":"","type":3,"value":"" }, {"field":"addition_field19","id":4406,"label":"Kí tự nhỏ hơn 20","type":0,"value":"value sample" } ],"source":"Web","created_at":1713150362000,"updated_at":1713152406418,"activity": {"updated_at":1713152406442,"commentator_id":1,"is_public":0,"created_at":1713152406442,"comment":"update","ticket_id":414856712,"type":1 },"requester_id":63216138,"assignee_id":1 },"object":"lead"}
Sự kiện Lead chuyển đổi thành Deal xem tại Sự kiện 7.2. Deal được convert từ đối tượng khác
Định dạng json array. VD: [{id:1234, field:addition_field1", label: "Tên trường động", value: "Giá trị dạng text"},...]
follower_id
ID nhân viên xử lý
created_from
Nguồn tạo KH
city_id
ID tỉnh / thành phố
district_id
ID quận / huyện
6. Tham số tổ chức organization
Tham số tổ chức (organization)
Mô tả
Ghi chú
organization_id
ID tổ chức
organization_name
Tên tổ chức
organization_domain
Website
details
Chi tiết
note
Ghi chú
addition_fields
Trường động tổ chức
Định dạng json array. VD: [{id:1234, field:addition_field1", label: "Tên trường động", value: "Giá trị dạng text"},...]
7. Tham số cuộc gọi SmartDialer call_info
Đối với cuộc gọi smart dialer. Khi object trả về "smart_dialer" thì dữ liệu đối tượng call_info theo thông tin mô tả dưới đây.
Tham số
Mô tả
campaign_id
ID chiến dịch
customer_id
ID khách hàng
customer_name
Tên khách hàng
campaign_data_id
ID Data
call_id
Mã cuộc gọi
line
Đầu số gọi ra
phone_number
SĐT nhận cuộc gọi
call_attempt_index
Số lần retry hiện tại
max_attempt
Số lần retry tối đa
start_time
Thời điểm bắt đầu cuộc gọi (millis)
connect_time
Thời điểm bắt máy
end_time
Thời điểm kết thúc
ring_customer_duration
Thời gian đổ chuông (giây)
call_duration
Thời lượng cuộc gọi (giây)
status_code
Mã lỗi cuộc gọi (Thành công = 200)
customer_input_dtmf
Dữ liệu bấm phím (nếu cuộc gọi là IVR)
agent_user_id
ID chuyên viên (Cuộc gọi predictive call - object = pd_end_call)
agent_id
IP Phone chuyên viên (Cuộc gọi predictive call)
agent_ring_time
Thời điểm đổ chuông tới chuyên viên (Preditive call)
agent_connect_time
Thời điểm kết nối tới chuyên viên (Predictive call)
ring_agent_duration
Thời lượng chuông tới chuyên viên (Predictive call)
IV. Mẫu sự kiện
1. Ticket Cuộc gọi vào nhỡ
{"account_id":9999,"ticket": {"ticket_status":"new","ticket_subject":"Cuộc gọi nhỡ từ 0889999999","ticket_priority":"Normal","ticket_source":"Voice","created_at":1633489861000,"ticket_id":9999,"updated_at":1633489912859,"ticket_comment": {"updated_at":1633489912859,"commentator_id":666,"is_public":1,"created_at":1633489861017, "comment": "<b>Cuộc gọi vào<\/b><br/>ID cuộc gọi: 20211006101009-HRFZNHMV-9999<br/>Số điện thoại gọi tới: 0889999999<br/>Đầu số gọi: 1019002267<br/>Dịch vụ: Gọi vào 1999999- Gặp NV hỗ trợ<br/>Thời gian bắt đầu: 2021-10-06 10:11:00<br/>Thời gian kết thúc: 2021-10-06 10:11:52<br/>Thời gian gọi: 00:00:51<br/>Cuộc gọi bị nhỡ",
"source":"MissCall","ticket_id":9999,"type":0 },"ticket_no":888,"ticket_source_end_status":1,"service_id":9999,"requester_id":999,"assignee_id":-1 },"action":"update","call_info": {"answer_time":0,"start_time":1633489860000,"caller":"0889999999","status_code":0,"called":"1999999","end_time":1633489912861,"call_id":"20211006101009-HRFZNHMV-9999" },"object":"ticket"}
2. Cuộc gọi vào IVR (Không chuyển ACD):
{"account_id":9999,"ticket": {"ticket_status":"new","updated_at":1633488353675,"ticket_comment": {"updated_at":"Wed Oct 06 09:45:53 ICT 2021","commentator_id":123391762,"created_at":"Wed Oct 06 09:45:53 ICT 2021", "comment": "Cuộc gọi vào IVR <\/br>Số gọi đến: 0889999999<\/br>Đầu số: 19009999<\/br>Id cuộc gọi: 20211006094514-HRFZNHMV-9999<\/br>Thời gian bắt đầu: 2021-10-06 09:45:14<\/br>Thời gian kết thúc: 2021-10-06 09:45:53<\/br>NodeName: Gọi vào<\/br>Dtmf: -2-#",
"source":"IVR","ticket_id":259312810,"type":0 },"ticket_subject":"Cuộc gọi vào IVR từ : 0889999999","ticket_no":45028,"service_id":0,"ticket_priority":"Normal","ticket_source":"IVR","created_at":1633488353675,"ticket_id":259312810,"requester_id":123391762 },"action":"update","call_info": {"start_time":1633488314064,"caller":"0889999999","called":"19009999","dtmf":"-2-#","end_time":1633488353669,"node_name":"Gọi vào","call_id":"20211006094514-HRFZNHMV-9999" },"object":"ticket"}
3. Ticket Cuộc gọi ra
{ "account_id":9999,"ticket": {"ticket_status":"solved","ticket_subject":"Cuộc gọi ra gặp khách hàng tới 0889999999","ticket_priority":"Normal","ticket_source":"Voice Out","created_at":1633489494000,"ticket_id":9999,"updated_at":1633489530561,"ticket_comment": {"updated_at":1633489530561,"commentator_id":4444,"is_public":1,"created_at":1633489494488, "comment": "<b>Cuộc gọi ra<\/b><br/>Người gọi ra: (admin@caresoft.vn)<br/>ID cuộc gọi: 20211006100454-EXGPSDDQ-9999<br/>Số điện thoại gọi tới: 0889999999<br/>Đầu số gọi ra: 1999999<br/>Thời gian bắt đầu: 2021-10-06 10:04:54<br/>Khách hàng trả lời cuộc gọi<br/>Thời gian trả lời: 2021-10-06 10:05:01<br/>Agent kết thúc cuộc gọi<br/>Thời gian kết thúc: 2021-10-06 10:05:30<br/>Thời lượng cuộc gọi: 00:00:29",
"source":"Voice Out","ticket_id":9999,"type":0 },"ticket_no":9999,"ticket_source_end_status":0,"service_id":8888,"requester_id":113245755,"assignee_id":3333 },"action":"update","call_info": {"answer_time":1633489501551,"start_time":1633489494000,"caller":"0889999999","status_code":200,"called":"1999999","end_time":1633489530561,"call_id":"20211006100454-EXGPSDDQ-9999" },"object":"ticket"}
{"account_id":1, "mergeOption": {"copyComments":0,"secondaryTickets":[316708],"addCC":1,"primaryComment":"Phiếu ghi #220760 đã được đóng và hợp nhất vào phiếu ghi này","addFollow":1,"primaryIsPublic":0,"primaryTicket":316707,"secondaryComment":"Phiếu ghi này đã được đóng và hợp nhất vào phiếu ghi #220759","secondaryIsPublic":0},
"action":"merge","object":"ticket"}