Getting the chat message history
The method is available for all models.
If you are using an API Key token, one of the accesses in the list is required to call the method
- communication — Customer communication
- all-methods — Full account management
- all-methods:read-only — View all data
Returns the history of messages in the chat with the buyer.
| ⚙️ Limit: 10,000 requests per hour |
|---|
Request
POST
https://api.partner.market.yandex.ru/v2/businesses/{businessId}/chats/history
Path parameters
|
Name |
Description |
|
businessId |
Type: integer Cabinet ID. To find out, use the request GET v2/campaigns. ℹ️ What is a cabinet and a store on the Market? Min value: |
Query parameters
|
Name |
Description |
|
chatId |
Type: integer The chat ID. Min value: |
|
limit |
Type: integer The number of values per page. Min value: |
|
page_token |
Type: string ID of the results page. If the parameter is omitted, the first page is returned. We recommend transmitting the value of the output parameter If set Example: |
Body
application/json
{
"messageIdFrom": 1
}
|
Name |
Description |
|
messageIdFrom |
Type: integer The ID of the message to receive all subsequent messages from. Min value: |
Responses
200 OK
Message history.
Body
application/json
{
"status": "OK",
"result": {
"orderId": 0,
"context": {
"type": "ORDER",
"customer": {
"name": "example",
"publicId": "example"
},
"campaignId": 1,
"orderId": 1,
"returnId": 1
},
"messages": [
{
"messageId": 1,
"createdAt": "2017-11-21T00:00:00+03:00",
"sender": "PARTNER",
"message": "example",
"payload": [
null
]
}
],
"paging": {
"nextPageToken": "example"
}
}
}
Type: object
All of 2 types
-
Type: object
status
Type: string
The type of response. Possible values:
OK— There are no errors.ERROR— an error occurred while processing the request.
Enum:
OK,ERRORThe standard wrapper for server responses.
Example
{ "status": "OK" } -
Type: object
result
Type: object
context
Type: object
type
Type: string
Type of context:
ORDER— chat on request. Chats about orders and refundsRETURN— refund chat (FBY, FBS and Express). Chats about orders and refundsDIRECT— the chat that the customer started. Messages from customers
Enum:
ORDER,RETURN,DIRECTcampaignId
Type: integer
The ID of the campaign (store) — The technical identifier that represents your store in the Yandex Market system when working through the API. It is uniquely linked to your store, but it is intended only for automated interaction.
You can find it using a query GET v2/campaigns or find it in the seller's office on the Market. Click on your account icon → Settings and in the menu on the left, select APIs and modules:
- block Campaign ID;
- tab Query log → drop-down list in the block Show logs.
⚠️ Do not confuse it with:
- the store's identifier, which is displayed in the merchant's personal account.
- advertising campaigns.
Min value:
1customer
Type: object
name
Type: string
The buyer's public name in Yandex Passport, which is displayed in Yandex services.
Min length:
1Example:
examplepublicId
Type: string
The public user ID in Yandex Passport.
Examples where it is used
- The market:
https://market.yandex.ru/user/{public-id}/reviews - Zen:
https://zen.yandex.ru/user/{public-id} - Reviews:
https://yandex.ru/user/{public-id}
Read more about public data in Yandex ID documentation.
Min length:
1Example:
exampleInformation about the buyer in the chat.
Example
{ "name": "example", "publicId": "example" }orderId
Type: integer
The order ID.
It is returned for orders and refunds.
Min value:
1returnId
Type: integer
The refund ID.
It is returned only for refunds.
Min value:
1Information about the order or refund for which the chat was started.
Example
{ "type": "ORDER", "customer": { "name": "example", "publicId": "example" }, "campaignId": 1, "orderId": 1, "returnId": 1 }messages
Type: object[]
createdAt
Type: string<date-time>
The date and time when the message was created.
Date format: ISO 8601 with an offset relative to UTC.
Example:
2017-11-21T00:00:00+03:00messageId
Type: integer
The ID of the message.
Min value:
1sender
Type: string
Who sent the message:
PARTNER— shop.CUSTOMER— buyer.MARKET— Market (automatic message).SUPPORT— an employee of the Yandex.Market support service.
Enum:
PARTNER,CUSTOMER,MARKET,SUPPORTmessage
Type: string
The text of the message.
Optional parameter if the parameter is returned
payload.Example:
examplepayload
Type: object[]
name
Type: string
The file name.
Example:
examplesize
Type: integer
The file size in bytes.
url
Type: string
Min length:
1Max length:
2000Example:
exampleInformation about the files attached to the message.
Optional parameter if the parameter is returned
message.Min items:
1Example
[ { "name": "example", "url": "example", "size": 0 } ]Information about messages.
Example
[ { "messageId": 1, "createdAt": "2017-11-21T00:00:00+03:00", "sender": "PARTNER", "message": "example", "payload": [ { "name": "example", "url": "example", "size": 0 } ] } ]orderId
Type: integer
The order ID.
paging
Type: object
nextPageToken
Type: string
ID of the next results page.
Example:
exampleThe ID of the next page.
Example
{ "nextPageToken": "example" }Information about messages.
Example
{ "orderId": 0, "context": { "type": "ORDER", "customer": { "name": "example", "publicId": "example" }, "campaignId": 1, "orderId": 1, "returnId": 1 }, "messages": [ { "messageId": 1, "createdAt": "2017-11-21T00:00:00+03:00", "sender": "PARTNER", "message": "example", "payload": [ { "name": "example", "url": "example", "size": 0 } ] } ], "paging": { "nextPageToken": "example" } }Example
{ "result": { "orderId": 0, "context": { "type": "ORDER", "customer": { "name": "example", "publicId": "example" }, "campaignId": 1, "orderId": 1, "returnId": 1 }, "messages": [ { "messageId": 1, "createdAt": "2017-11-21T00:00:00+03:00", "sender": "PARTNER", "message": "example", "payload": [ {} ] } ], "paging": { "nextPageToken": "example" } } }
400 Bad Request
The request contains incorrect data. More information about the error
Body
application/json
{
"status": "OK",
"errors": [
{
"code": "example",
"message": "example"
}
]
}
Type: object
All of 1 type
-
Type: object
All of 2 types
-
Type: object
status
Type: string
The type of response. Possible values:
OK— There are no errors.ERROR— an error occurred while processing the request.
Enum:
OK,ERRORThe standard wrapper for server responses.
Example
{ "status": "OK" } -
Type: object
errors
Type: object[]
code
Type: string
The error code.
Example:
examplemessage
Type: string
Description of the error.
Example:
exampleA list of errors.
Min items:
1Example
[ { "code": "example", "message": "example" } ]Example
{ "errors": [ { "code": "example", "message": "example" } ] }
A standard wrapper for server errors.
Example
{ "status": "OK", "errors": [ { "code": "example", "message": "example" } ] } -
401 Unauthorized
The authorization data is not specified in the request. More information about the error
Body
application/json
{
"status": "OK",
"errors": [
{
"code": "example",
"message": "example"
}
]
}
Type: object
All of 1 type
-
Type: object
All of 2 types
-
Type: object
status
Type: string
The type of response. Possible values:
OK— There are no errors.ERROR— an error occurred while processing the request.
Enum:
OK,ERRORThe standard wrapper for server responses.
Example
{ "status": "OK" } -
Type: object
errors
Type: object[]
code
Type: string
The error code.
Example:
examplemessage
Type: string
Description of the error.
Example:
exampleA list of errors.
Min items:
1Example
[ { "code": "example", "message": "example" } ]Example
{ "errors": [ { "code": "example", "message": "example" } ] }
A standard wrapper for server errors.
Example
{ "status": "OK", "errors": [ { "code": "example", "message": "example" } ] } -
403 Forbidden
The authorization data is incorrect or access to the resource is prohibited. More information about the error
Body
application/json
{
"status": "OK",
"errors": [
{
"code": "example",
"message": "example"
}
]
}
Type: object
All of 1 type
-
Type: object
All of 2 types
-
Type: object
status
Type: string
The type of response. Possible values:
OK— There are no errors.ERROR— an error occurred while processing the request.
Enum:
OK,ERRORThe standard wrapper for server responses.
Example
{ "status": "OK" } -
Type: object
errors
Type: object[]
code
Type: string
The error code.
Example:
examplemessage
Type: string
Description of the error.
Example:
exampleA list of errors.
Min items:
1Example
[ { "code": "example", "message": "example" } ]Example
{ "errors": [ { "code": "example", "message": "example" } ] }
A standard wrapper for server errors.
Example
{ "status": "OK", "errors": [ { "code": "example", "message": "example" } ] } -
404 Not Found
The requested resource was not found. More information about the error
Body
application/json
{
"status": "OK",
"errors": [
{
"code": "example",
"message": "example"
}
]
}
Type: object
All of 1 type
-
Type: object
All of 2 types
-
Type: object
status
Type: string
The type of response. Possible values:
OK— There are no errors.ERROR— an error occurred while processing the request.
Enum:
OK,ERRORThe standard wrapper for server responses.
Example
{ "status": "OK" } -
Type: object
errors
Type: object[]
code
Type: string
The error code.
Example:
examplemessage
Type: string
Description of the error.
Example:
exampleA list of errors.
Min items:
1Example
[ { "code": "example", "message": "example" } ]Example
{ "errors": [ { "code": "example", "message": "example" } ] }
A standard wrapper for server errors.
Example
{ "status": "OK", "errors": [ { "code": "example", "message": "example" } ] } -
420 Method Failure
The resource access limit has been exceeded. More information about the error
Body
application/json
{
"status": "OK",
"errors": [
{
"code": "example",
"message": "example"
}
]
}
Type: object
All of 1 type
-
Type: object
All of 2 types
-
Type: object
status
Type: string
The type of response. Possible values:
OK— There are no errors.ERROR— an error occurred while processing the request.
Enum:
OK,ERRORThe standard wrapper for server responses.
Example
{ "status": "OK" } -
Type: object
errors
Type: object[]
code
Type: string
The error code.
Example:
examplemessage
Type: string
Description of the error.
Example:
exampleA list of errors.
Min items:
1Example
[ { "code": "example", "message": "example" } ]Example
{ "errors": [ { "code": "example", "message": "example" } ] }
A standard wrapper for server errors.
Example
{ "status": "OK", "errors": [ { "code": "example", "message": "example" } ] } -
500 Internal Server Error
Internal error of the Market. More information about the error
Body
application/json
{
"status": "OK",
"errors": [
{
"code": "example",
"message": "example"
}
]
}
Type: object
All of 1 type
-
Type: object
All of 2 types
-
Type: object
status
Type: string
The type of response. Possible values:
OK— There are no errors.ERROR— an error occurred while processing the request.
Enum:
OK,ERRORThe standard wrapper for server responses.
Example
{ "status": "OK" } -
Type: object
errors
Type: object[]
code
Type: string
The error code.
Example:
examplemessage
Type: string
Description of the error.
Example:
exampleA list of errors.
Min items:
1Example
[ { "code": "example", "message": "example" } ]Example
{ "errors": [ { "code": "example", "message": "example" } ] }
A standard wrapper for server errors.
Example
{ "status": "OK", "errors": [ { "code": "example", "message": "example" } ] } -
No longer supported, please use an alternative and newer version.
For example, Please do not ask customers for contacts, do not send links to other sites. We see the correspondence and hide the goods from the showcase when the rules of communication in chat rooms are violated.