Skip to main content

Upgrade Customer Service API to 202309

Mapping

Path mapping

CS API v1.0 (old)CS API v2.0 (new)
[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

Field mapping

[POST]/api/seller/im/send_message

New path: [POST]/customer_service/202309/conversations/:conversation_id/messages

Request param

OldOld typeNewNew typeDescription
conv_short_idstringconversation_idstringMove to path variable
msg_typestringtypestring(enum)Enum mapping:
text->TEXT
file_image->IMAGE
goods_card->PRODUCT_CARD
order_card->ORDER_CARD
contentstringcontentstringtext:
old:
{
"content": "simple text"
}

new: { "content": "simple text" }

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

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

goods_card: old: { "goods_id": "7494560109732334267" }

new: { "product_id": "7494560109732334267" }

order_card: old: { "order_id": "7494560109732334267" }

new: { "order_id": "7494560109732334267" } |

Response

OldOld typeNewNew typeDescription
msg_idstringmessage_idstring

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

New path: [GET]/customer_service/202309/agents/settings

Request param

none

Response

OldOld typeNewNew typeDescription
statusintcan_accept_chatboolValue mapping:
1->true
0->false
2->false

The old values 0 and 2 mean the customer service agent won't accept any chats. |

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

New path: [PUT]/customer_service/202309/agents/settings

Request param

OldOld typeNewNew typeDescription
statusintcan_accept_chatboolValue mapping:
1->true
0->false

Response

None

[POST]/api/seller/im/list_conversations

New path: [GET]/customer_service/202309/conversations

Request

OldOld typeNewNew typeDescription
cursorstringpage_tokenstring
limitintpage_sizeint
languagestringlocalestring

Response

OldOld typeNewNew typeDescription
next_cursorstringnext_page_tokenstring2 old fields are mixed to 1 new field.
An empty page_token means has_more is 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)Enum mapping:
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)Enum mapping:
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)Enum mapping:
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:
old:
{
"content": "simple text"
}

new: { "content": "simple text" }

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

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

goods_card, user_enter_from_goods: old: { "goods_id": "7494560109732334274" }

new: { "product_id": "7494560109732334274" }

order_card, user_enter_from_orders: old: { "order_id": "7494560109732336829" }

new: { "order_id": "7494560109732336829" }

video: old: { "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":""}" }

new: { "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

New path: [GET]/customer_service/202309/conversations/:conversation_id/messages

Request param

OldOld typeNewNew typeDescription
conv_short_idstringconversation_idstringMove to path variable
pull_directionintsort_orderstring(enum)Enum mapping:
0->ASC
1->DESC

In the old API, messages will always be sorted from oldest to latest. In the new API, messages will be sorted from oldest to latest if the "sort_order" is "ASC", while they will be sorted from latest to oldest if "sort_order" is "DESC". | | Newly added | | sort_field | string | Sort messages by Available value: create_time (default) | | cursor | string | page_token | string | | | limit | int | page_size | int | | | language | string | locale | string | |

Response

OldOld typeNewNew typeDescription
next_cursorstringnext_page_tokenstring2 old fields are mixed to 1 new field.
An empty page_token means has_more is 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)Enum mapping:
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)Enum mapping:
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:
old:
{
"content": "simple text"
}

new: { "content": "simple text" }

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

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

goods_card, user_enter_from_goods: old: { "goods_id": "7494560175032334583" }

new: { "product_id": "7494560175032334583" }

order_card, user_enter_from_orders: old: { "order_id": "7494560109732337395" }

new: { "order_id": "7494560109732337395" }

video: old: { "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":""}" }

new: { "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

New path: [POST]/customer_service/202309/images/upload

Request param

OldOld typeNewNew typeDescription
datastringdatabinaryIn the old API, you should encode your image into BASE64 string, then put it in to a JSON request body.

In the new API, you should put your image binary data into the request body, with "Content-Type=multipart/form-data" and a form key named "data". |

Response

OldOld typeNewNew typeDescription
urlstringurlstring
widthintwidthint
heightintheightint

[POST]/api/seller/im/mark_read

New path: [POST]/customer_service/202309/conversations/:conversation_id/messages/read

Request param

OldOld typeNewNew typeDescription
conv_short_idstringconversation_idstringMove to path variable.

Response

None

[POST]/api/seller/im/create_conversation

New path: [POST]/customer_service/202309/conversations

Request param

OldOld typeNewNew typeDescription
buyer_idstringbuyer_user_idstring

Response

OldOld typeNewNew typeDescription
conv_short_idstringconversation_idstring

Webhook

Type mapping

EventOld typeNew type
New conversation813
New messages914

Field mapping

New Conversation

OldOld typeNewNew typeDescription
conv_short_idstringconversation_idstring
create_timeintcreate_timeint

New Messages

OldOld typeNewNew typeDescription
message_idstringmessage_idstring
conv_short_idstringconversation_idstring
contentstringcontentstringtext, allocated_service, notification, user_enter_from_transfer:
old:
{
"content": "simple text"
}

new: { "content": "simple text" }

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

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

goods_card, user_enter_from_goods: old: { "goods_id": "7494560175032334583" }

new: { "product_id": "7494560175032334583" }

order_card, user_enter_from_orders: old: { "order_id": "7494560109732337395" }

new: { "order_id": "7494560109732337395" }

video: old: { "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":""}" }

new: { "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) | Enum mapping: 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) | Enum mapping: 1->BUYER 2->SHOP 3->CUSTOMER_SERVICE 4(deprecated) 5->SYSTEM 6->ROBOT | | create_time | int | create_time | int | |