Chats with customers
The Yandex.Market API allows you to communicate with your customers in chats.
How to start a chat
-
Check if there is a chat with the buyer. — POST businesses/{businessId}/chats. In the request, specify the chat type and the ID of the order or refund to which it relates.
If there is no chat, create it using a request. POST businesses/{businessId}/chats/new.
How to start a test chat
In the debugging interface, create a test order, and then click Create a test chat or make a request POST businesses/{businessId}/chats/new.
Learn more about working with test orders
Please note:
-
such a chat can only be created for an order, not a refund;
-
There are no customer responses in the test chats.
-
-
Send a message with a request POST businesses/{businessId}/chats/message. If you need to send a file to the buyer, for example, an additional photo of the product, use a request. POST businesses/{businessId}/chats/file/send.
-
Check new messages from the buyer. — POST businesses/{businessId}/chats/history. Use a filter based on the ID of the last message in the request to receive only new messages and not re-upload those that you already have.
How to reply to a message
-
Find the chats where your answer is needed. To do this, make a request POST businesses/{businessId}/chats. In the request, send the status "Store response needed" ("statuses": ["WAITING_FOR_PARTNER"]).
-
To get the chat message history, use a request POST businesses/{businessId}/chats/history, where pass the chat ID.
-
Send a message using a request POST businesses/{businessId}/chats/message. If you need to send a file to the buyer, for example, an additional photo of the product, use a request. POST businesses/{businessId}/chats/file/send.
How to check if there are new chats or messages
Enable API notifications
Yandex.Market will send you a request. POST notification when a new chat or message appears.
To receive chats or messages, use the following methods:
- GET businesses/{businessId}/chat — for one chat;
- POST businesses/{businessId}/chats — for the chat list;
- GET businesses/{businessId}/chats/message — for the message;
- POST businesses/{businessId}/chats/history — for the message history.