Chuyển tới nội dung chính

Nâng cấp Customer Service API lên 202309

Ánh xạ

Ánh xạ đường dẫn (path)

CS API v1.0 (cũ)CS API v2.0 (mới)
[POST]/api/seller/im/send_message[POST]/customer_service/202309/conversations/:conversation_id/messages
[GET]/api/seller/im/customer_service/status[GET]/customer_service/202309/agents/settings
[POST]/api/seller/im/customer_service/status/update[PUT]/customer_service/202309/agents/settings
[POST]/api/seller/im/list_conversations[GET]/customer_service/202309/conversations
[POST]/api/seller/im/get_conversation_messages[GET]/customer_service/202309/conversations/:conversation_id/messages
[POST]/api/seller/im/img/upload[POST]/customer_service/202309/images/upload
[POST]/api/seller/im/mark_read[POST]/customer_service/202309/conversations/:conversation_id/messages/read
[POST]/api/seller/im/create_conversation[POST]/customer_service/202309/conversations

Ánh xạ trường (field)

[POST]/api/seller/im/send_message

Đường dẫn mới: [POST]/customer_service/202309/conversations/:conversation_id/messages

Tham số request

OldOld typeNewNew typeMô tả
conv_short_idstringconversation_idstringChuyển sang biến đường dẫn (path variable)
msg_typestringtypestring(enum)Ánh xạ enum:
text->TEXT
file_image->IMAGE
goods_card->PRODUCT_CARD
order_card->ORDER_CARD
contentstringcontentstringtext:
cũ:
{
"content": "simple text"
}

mới: { "content": "simple text" }

file_image: cũ: { "imageHeight": "290", "imageUrl": "https://tosv.boei18n.byted.org/obj/temai-im/FszkJ53nSapYG6KDaJQmqR3jjoZGwww304-290", "imageWidth": "304" }

mới: { "height": 290, "url": "https://tosv.boei18n.byted.org/obj/temai-im/FszkJ53nSapYG6KDaJQmqR3jjoZGwww304-290", "width": 304 }

goods_card: cũ: { "goods_id": "7494560109732334267" }

mới: { "product_id": "7494560109732334267" }

order_card: cũ: { "order_id": "7494560109732334267" }

mới: { "order_id": "7494560109732334267" } |

Response

OldOld typeNewNew typeMô tả
msg_idstringmessage_idstring

[GET]/api/seller/im/customer_service/status

Đường dẫn mới: [GET]/customer_service/202309/agents/settings

Tham số request

không có

Response

OldOld typeNewNew typeMô tả
statusintcan_accept_chatboolÁnh xạ giá trị:
1->true
0->false
2->false

Các giá trị cũ 0 và 2 nghĩa là nhân viên customer service sẽ không tiếp nhận chat nào. |

[POST]/api/seller/im/customer_service/status/update

Đường dẫn mới: [PUT]/customer_service/202309/agents/settings

Tham số request

OldOld typeNewNew typeMô tả
statusintcan_accept_chatboolÁnh xạ giá trị:
1->true
0->false

Response

Không có

[POST]/api/seller/im/list_conversations

Đường dẫn mới: [GET]/customer_service/202309/conversations

Request

OldOld typeNewNew typeMô tả
cursorstringpage_tokenstring
limitintpage_sizeint
languagestringlocalestring

Response

OldOld typeNewNew typeMô tả
next_cursorstringnext_page_tokenstring2 trường cũ được gộp thành 1 trường mới.
page_token rỗng nghĩa là has_more bằng false.
has_morebool
conv_with_last_msgObject[]conversationsObject[]
conv_with_last_msg[].conv_info.conv_short_idstringconversations[].idstring
conv_with_last_msg[].conv_info.app_idintDeleted
conv_with_last_msg[].conv_info.member_countintconversations[].participant_countint
conv_with_last_msg[].conv_info.can_send_messageboolconversations[].can_send_messagebool
conv_with_last_msg[].conv_info.unread_countintconversations[].unread_countint
conv_with_last_msg[].conv_info.participantsObject[]conversations[].participantsObject[]
conv_with_last_msg[].conv_info.participants[].participant_idstringconversations[].participants[].im_user_idstring
conv_with_last_msg[].conv_info.participants[].roleintconversations[].participants[].rolestring(enum)Ánh xạ enum:
1->BUYER
2->SHOP
3->CUSTOMER_SERVICE
conv_with_last_msg[].conv_info.participants[].nickstringconversations[].participants[].nicknamestring
conv_with_last_msg[].conv_info.participants[].avatarstringconversations[].participants[].avatarstring
conv_with_last_msg[].conv_info.participants[].outer_idstringconversations[].participants[].user_idstring
conv_with_last_msg[].latest_msgObjectconversations[].latest_messageObject
conv_with_last_msg[].latest_msg.conv_short_idstringDeleted
conv_with_last_msg[].latest_msg.msg_idstringconversations[].latest_message.idstring
Newly addedconversations[].latest_message.senderObject
conv_with_last_msg[].latest_msg.sender_idstringconversations[].latest_message.sender.im_user_idstring
conv_with_last_msg[].latest_msg.sender_roleintDeleted
conv_with_last_msg[].latest_msg.sender_role_v2intconversations[].latest_message.sender.rolestring(enum)Ánh xạ enum:
1->BUYER
2->SHOP
3->CUSTOMER_SERVICE
4(deprecated)
5->SYSTEM
6->ROBOT
conv_with_last_msg[].latest_msg.sender_nickstringconversations[].latest_message.sender.nicknamestring
conv_with_last_msg[].latest_msg.sender_avatarstringconversations[].latest_message.sender.avatarstring
conv_with_last_msg[].latest_msg.ref_msg_infoObjectDeleted
conv_with_last_msg[].latest_msg.msg_typestring(enum)conversations[].latest_message.typestring(enum)Ánh xạ enum:
text->TEXT
file_image->IMAGE
allocated_service->ALLOCATED_SERVICE
notification->NOTIFICATION
use_enter_from_transfer->BUYER_ENTER_FROM_TRANSFER
user_enter_from_goods->BUYER_ENTER_FROM_PRODUCT
user_enter_from_order->BUYER_ENTER_FROM_ORDER
goods_card->PRODUCT_CARD
order_card->ORDER_CARD
emoticons->EMOTICONS
video->VIDEO
other->OTHER
conv_with_last_msg[].latest_msg.contentstringconversations[].latest_message.contentstringtext, allocated_service, notification, user_enter_from_transfer:
cũ:
{
"content": "simple text"
}

mới: { "content": "simple text" }

file_image: cũ: { "imageHeight": "290", "imageUrl": "https://tosv.boei18n.byted.org/obj/temai-im/FszkJ53nSapYG6KDaJQmqR3jjoZGwww304-290", "imageWidth": "304" }

mới: { "height": 290, "url": "https://tosv.boei18n.byted.org/obj/temai-im/FszkJ53nSapYG6KDaJQmqR3jjoZGwww304-290", "width": 304 }

goods_card, user_enter_from_goods: cũ: { "goods_id": "7494560109732334274" }

mới: { "product_id": "7494560109732334274" }

order_card, user_enter_from_orders: cũ: { "order_id": "7494560109732336829" }

mới: { "order_id": "7494560109732336829" }

video: cũ: { "video_info": "{"videoUrl":"https://v16m-default.akamaized.net/f4d97c4ca9018602e423366c40e9ccec/660fc8a9/video/tos/alisg/tos-alisg-v-2ea863-sg/okIEwc9EIW4OAJyZTiBOc6iIoB4xf3YEoQA2Po","coverUrl":"https://p16-oec-sg.ibyteimg.com/tos-alisg-v-2ea863-sg/oA29Bf4OciNoIyOEIAywiAToE6oBYbIZzAl4WF~tplv-aphluv4xwc-origin-jpeg.jpeg?from=3431008404","videoWidth":1920,"videoHeight":960,"videoDuration":127.254,"vid":"v10394g5000ccnk3m7fog65o44qog4cg","videoExpireTime":1712310441,"videoFormat":"mp4","videoSize":9309252,"videoBitRate":585239,"videoQuality":"original","codecType":"h264","nonOriginal":""}" }

mới: { "url": "https://v16m-default.akamaized.net/f4d97c4ca9018602e423366c40e9ccec/660fc8a9/video/tos/alisg/tos-alisg-v-2ea863-sg/okIEwc9EIW4OAJyZTiBOc6iIoB4xf3YEoQA2Po", "width": 1920, "height": 960, "duration": "127.254", "vid": "v10394g5000ccnk3m7fog65o44qog4cg", "expire_time": 1712310441, "format": "mp4", "size": 9309252, "bit_rate": 585239, "quality": "original", "codec_type": "h264" } | | conv_with_last_msg[].latest_msg.index_in_conversation | string | Deleted | | | | conv_with_last_msg[].latest_msg.is_visible | bool | conversations[].latest_message.is_visible | bool | | | conv_with_last_msg[].latest_msg.create_time | int | conversations[].latest_message.create_time | int | |

[POST]/api/seller/im/get_conversation_messages

Đường dẫn mới: [GET]/customer_service/202309/conversations/:conversation_id/messages

Tham số request

OldOld typeNewNew typeMô tả
conv_short_idstringconversation_idstringChuyển sang biến đường dẫn (path variable)
pull_directionintsort_orderstring(enum)Ánh xạ enum:
0->ASC
1->DESC

Trong API cũ, tin nhắn luôn được sắp xếp từ cũ nhất đến mới nhất. Trong API mới, tin nhắn sẽ được sắp xếp từ cũ nhất đến mới nhất nếu "sort_order" là "ASC", và từ mới nhất đến cũ nhất nếu "sort_order" là "DESC". | | Newly added | | sort_field | string | Sắp xếp tin nhắn theo Giá trị khả dụng: create_time (mặc định) | | cursor | string | page_token | string | | | limit | int | page_size | int | | | language | string | locale | string | |

Response

OldOld typeNewNew typeMô tả
next_cursorstringnext_page_tokenstring2 trường cũ được gộp thành 1 trường mới.
page_token rỗng nghĩa là has_more bằng false.
has_morebool
unsupport_msg_tipsstringunsupported_msg_tipsstring
msgsObject[]messagesObject[]
msgs[].conv_short_idstringDeleted
msgs[].msg_idstringmessages[].idstring
Newly addedmessages[].senderObject
msgs[].sender_idstringmessages[].sender.im_user_idstring
msgs[].sender_roleintDeleted
msgs[].sender_role_v2intmessages[].sender.rolestring(enum)Ánh xạ enum:
1->BUYER
2->SHOP
3->CUSTOMER_SERVICE
4(deprecated)
5->SYSTEM
6->ROBOT
msgs[].sender_nickstringmessages[].sender.nicknamestring
msgs[].sender_avatarstringmessages[].sender.avatarstring
msgs[].ref_msg_infoObjectDeleted
msgs[].msg_typestring(enum)messages[].typestring(enum)Ánh xạ enum:
text->TEXT
file_image->IMAGE
allocated_service->ALLOCATED_SERVICE
notification->NOTIFICATION
use_enter_from_transfer->BUYER_ENTER_FROM_TRANSFER
user_enter_from_goods->BUYER_ENTER_FROM_PRODUCT
user_enter_from_order->BUYER_ENTER_FROM_ORDER
goods_card->PRODUCT_CARD
order_card->ORDER_CARD
emoticons->EMOTICONS
video->VIDEO
other->OTHER
msgs[].contentstringmessages[].contentstringtext, allocated_service, notification, user_enter_from_transfer:
cũ:
{
"content": "simple text"
}

mới: { "content": "simple text" }

file_image: cũ: { "imageHeight": "290", "imageUrl": "https://tosv.boei18n.byted.org/obj/temai-im/FszkJ53nSapYG6KDaJQmqR3jjoZGwww304-290", "imageWidth": "304" }

mới: { "height": 290, "url": "https://tosv.boei18n.byted.org/obj/temai-im/FszkJ53nSapYG6KDaJQmqR3jjoZGwww304-290", "width": 304 }

goods_card, user_enter_from_goods: cũ: { "goods_id": "7494560175032334583" }

mới: { "product_id": "7494560175032334583" }

order_card, user_enter_from_orders: cũ: { "order_id": "7494560109732337395" }

mới: { "order_id": "7494560109732337395" }

video: cũ: { "video_info": "{"videoUrl":"https://v16m-default.akamaized.net/f4d97c4ca9018602e423366c40e9ccec/660fc8a9/video/tos/alisg/tos-alisg-v-2ea863-sg/okIEwc9EIW4OAJyZTiBOc6iIoB4xf3YEoQA2Po","coverUrl":"https://p16-oec-sg.ibyteimg.com/tos-alisg-v-2ea863-sg/oA29Bf4OciNoIyOEIAywiAToE6oBYbIZzAl4WF~tplv-aphluv4xwc-origin-jpeg.jpeg?from=3431008404","videoWidth":1920,"videoHeight":960,"videoDuration":127.254,"vid":"v10394g5000ccnk3m7fog65o44qog4cg","videoExpireTime":1712310441,"videoFormat":"mp4","videoSize":9309252,"videoBitRate":585239,"videoQuality":"original","codecType":"h264","nonOriginal":""}" }

mới: { "url": "https://v16m-default.akamaized.net/f4d97c4ca9018602e423366c40e9ccec/660fc8a9/video/tos/alisg/tos-alisg-v-2ea863-sg/okIEwc9EIW4OAJyZTiBOc6iIoB4xf3YEoQA2Po", "width": 1920, "height": 960, "duration": "127.254", "vid": "v10394g5000ccnk3m7fog65o44qog4cg", "expire_time": 1712310441, "format": "mp4", "size": 9309252, "bit_rate": 585239, "quality": "original", "codec_type": "h264" } | | msgs[].index_in_conversation | string | Deleted | | | | msgs[].is_visible | bool | messages[].is_visible | bool | | | msgs[].create_time | int | messages[].create_time | int | |

[POST]/api/seller/im/img/upload

Đường dẫn mới: [POST]/customer_service/202309/images/upload

Tham số request

OldOld typeNewNew typeMô tả
datastringdatabinaryTrong API cũ, bạn cần mã hóa hình ảnh thành chuỗi BASE64, sau đó đưa vào body của request dưới dạng JSON.

Trong API mới, bạn cần đưa dữ liệu nhị phân (binary) của hình ảnh vào body của request, với "Content-Type=multipart/form-data" và một khóa form có tên "data". |

Response

OldOld typeNewNew typeMô tả
urlstringurlstring
widthintwidthint
heightintheightint

[POST]/api/seller/im/mark_read

Đường dẫn mới: [POST]/customer_service/202309/conversations/:conversation_id/messages/read

Tham số request

OldOld typeNewNew typeMô tả
conv_short_idstringconversation_idstringChuyển sang biến đường dẫn (path variable).

Response

Không có

[POST]/api/seller/im/create_conversation

Đường dẫn mới: [POST]/customer_service/202309/conversations

Tham số request

OldOld typeNewNew typeMô tả
buyer_idstringbuyer_user_idstring

Response

OldOld typeNewNew typeMô tả
conv_short_idstringconversation_idstring

Webhook

Ánh xạ loại (type)

Sự kiệnOld typeNew type
New conversation813
New messages914

Ánh xạ trường (field)

New Conversation

OldOld typeNewNew typeMô tả
conv_short_idstringconversation_idstring
create_timeintcreate_timeint

New Messages

OldOld typeNewNew typeMô tả
message_idstringmessage_idstring
conv_short_idstringconversation_idstring
contentstringcontentstringtext, allocated_service, notification, user_enter_from_transfer:
cũ:
{
"content": "simple text"
}

mới: { "content": "simple text" }

file_image: cũ: { "imageHeight": "290", "imageUrl": "https://tosv.boei18n.byted.org/obj/temai-im/FszkJ53nSapYG6KDaJQmqR3jjoZGwww304-290", "imageWidth": "304" }

mới: { "height": 290, "url": "https://tosv.boei18n.byted.org/obj/temai-im/FszkJ53nSapYG6KDaJQmqR3jjoZGwww304-290", "width": 304 }

goods_card, user_enter_from_goods: cũ: { "goods_id": "7494560175032334583" }

mới: { "product_id": "7494560175032334583" }

order_card, user_enter_from_orders: cũ: { "order_id": "7494560109732337395" }

mới: { "order_id": "7494560109732337395" }

video: cũ: { "video_info": "{"videoUrl":"https://v16m-default.akamaized.net/f4d97c4ca9018602e423366c40e9ccec/660fc8a9/video/tos/alisg/tos-alisg-v-2ea863-sg/okIEwc9EIW4OAJyZTiBOc6iIoB4xf3YEoQA2Po","coverUrl":"https://p16-oec-sg.ibyteimg.com/tos-alisg-v-2ea863-sg/oA29Bf4OciNoIyOEIAywiAToE6oBYbIZzAl4WF~tplv-aphluv4xwc-origin-jpeg.jpeg?from=3431008404","videoWidth":1920,"videoHeight":960,"videoDuration":127.254,"vid":"v10394g5000ccnk3m7fog65o44qog4cg","videoExpireTime":1712310441,"videoFormat":"mp4","videoSize":9309252,"videoBitRate":585239,"videoQuality":"original","codecType":"h264","nonOriginal":""}" }

mới: { "url": "https://v16m-default.akamaized.net/f4d97c4ca9018602e423366c40e9ccec/660fc8a9/video/tos/alisg/tos-alisg-v-2ea863-sg/okIEwc9EIW4OAJyZTiBOc6iIoB4xf3YEoQA2Po", "width": 1920, "height": 960, "duration": "127.254", "vid": "v10394g5000ccnk3m7fog65o44qog4cg", "expire_time": 1712310441, "format": "mp4", "size": 9309252, "bit_rate": 585239, "quality": "original", "codec_type": "h264" } | | is_visible | bool | is_visible | bool | | | msg_type | string | type | string(enum) | Ánh xạ enum: text->TEXT file_image->IMAGE allocated_service->ALLOCATED_SERVICE notification->NOTIFICATION use_enter_from_transfer->BUYER_ENTER_FROM_TRANSFER user_enter_from_goods->BUYER_ENTER_FROM_PRODUCT user_enter_from_order->BUYER_ENTER_FROM_ORDER goods_card->PRODUCT_CARD order_card->ORDER_CARD emoticons->EMOTICONS video->VIDEO other->OTHER | | Newly added | | sender | Object | | | sender_id | string | sender.im_user_id | string | | | sender_role | int | Deleted | | | | sender_role_v2 | int | sender.role | string(enum) | Ánh xạ enum: 1->BUYER 2->SHOP 3->CUSTOMER_SERVICE 4(deprecated) 5->SYSTEM 6->ROBOT | | create_time | int | create_time | int | |