获取聊天消息历史记录
方法适用于所有模式.
如果您使用API-Key令牌,调用该方法时需要具备列表中可用权限之一
- communication — 与买家沟通
- all-methods — 全面管理账户
- all-methods:read-only — 查看所有数据
返回与买家聊天中消息的历史记录。
| ⚙️ 限制: 每小时10,000次请求 |
|---|
Request
POST
https://api.partner.market.yandex.ru/v2/businesses/{businessId}/chats/history
Path parameters
|
Name |
Description |
|
businessId |
Type: integer 内阁ID。 要找到答案,请使用请求 GET v2/campaigns. Min value: |
Query parameters
|
Name |
Description |
|
chatId |
Type: integer 的聊天ID。 Min value: |
|
limit |
Type: integer 每页的值数。 Min value: |
|
page_token |
Type: string 结果页面的ID。 如果省略该参数,则返回第一页。 我们建议传输输出参数的值 如果设置 Example: |
Body
application/json
{
"messageIdFrom": 1
}
|
Name |
Description |
|
messageIdFrom |
Type: integer 从接收所有后续消息的消息的ID。 Min value: |
Responses
200 OK
消息历史记录。
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
响应的类型。 可能的值:
OK— 没有错误。ERROR— 处理请求时出错。
Enum:
OK,ERROR服务器响应的标准包装器。
Example
{ "status": "OK" } -
Type: object
result
Type: object
context
Type: object
type
Type: string
上下文类型:
ORDER— 根据要求聊天。 关于订单和退款的聊天RETURN— 退款聊天(FBY, FBS 和 Express). 关于订单和退款的聊天DIRECT— 客户开始的聊天。 来自客户的信息
Enum:
ORDER,RETURN,DIRECTcampaignId
Type: integer
广告系列(商店)的ID — 通过API工作时,代表您在Yandex市场系统中的商店的技术标识符。 它与您的商店唯一链接,但仅用于自动交互。
您可以使用查询找到它 GET v2/campaigns 或者在市场上的卖家办公室找到它。 点击您的帐户图标→ 设置 在左边的菜单中,选择 Api和模块:
- 座 运动ID;
- 标签 查询日志 →块中的下拉列表 显示日志.
⚠️ 不要把它与:
- 商店的标识符,显示在商家的个人帐户中。
- 广告活动。
Min value:
1customer
Type: object
name
Type: string
买方在Yandex Passport中的公开名称,显示在Yandex services中。
Min length:
1Example:
examplepublicId
Type: string
Yandex Passport中的公共用户ID。
使用它的例子
- 市场:
https://market.yandex.ru/user/{public-id}/reviews - 禅宗:
https://zen.yandex.ru/user/{public-id} - 检讨报告:
https://yandex.ru/user/{public-id}
阅读更多关于公共数据的信息 Yandex ID文档.
Min length:
1Example:
example聊天中有关买家的信息。
Example
{ "name": "example", "publicId": "example" }orderId
Type: integer
的订单ID。
它被退回的订单和退款。
Min value:
1returnId
Type: integer
退款ID。
它仅用于退款。
Min value:
1有关开始聊天的订单或退款的信息。
Example
{ "type": "ORDER", "customer": { "name": "example", "publicId": "example" }, "campaignId": 1, "orderId": 1, "returnId": 1 }messages
Type: object[]
createdAt
Type: string<date-time>
创建消息的日期和时间。
日期格式: ISO 8601 具有相对于 UTC.
Example:
2017-11-21T00:00:00+03:00messageId
Type: integer
消息的ID。
Min value:
1sender
Type: string
谁发的消息:
PARTNER— 商店。CUSTOMER— 买方。MARKET— 市场(自动讯息).SUPPORT— Yandex的员工。市场支持服务。
Enum:
PARTNER,CUSTOMER,MARKET,SUPPORTmessage
Type: string
消息的文本。
如果返回参数,可选参数
payload.Example:
examplepayload
Type: object[]
name
Type: string
的文件名。
Example:
examplesize
Type: integer
以字节为单位的文件大小。
url
Type: string
Min length:
1Max length:
2000Example:
example附加到消息的文件的信息。
如果返回参数,可选参数
message.Min items:
1Example
[ { "name": "example", "url": "example", "size": 0 } ]消息的信息。
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
的订单ID。
paging
Type: object
nextPageToken
Type: string
下一个结果页面的ID。
Example:
example下一页的ID。
Example
{ "nextPageToken": "example" }消息的信息。
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
请求包含不正确的数据。 有关错误的更多信息
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
响应的类型。 可能的值:
OK— 没有错误。ERROR— 处理请求时出错。
Enum:
OK,ERROR服务器响应的标准包装器。
Example
{ "status": "OK" } -
Type: object
errors
Type: object[]
code
Type: string
的错误代码。
Example:
examplemessage
Type: string
错误的描述。
Example:
example错误列表。
Min items:
1Example
[ { "code": "example", "message": "example" } ]Example
{ "errors": [ { "code": "example", "message": "example" } ] }
服务器错误的标准包装器。
Example
{ "status": "OK", "errors": [ { "code": "example", "message": "example" } ] } -
401 Unauthorized
请求中未指定授权数据。 有关错误的更多信息
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
响应的类型。 可能的值:
OK— 没有错误。ERROR— 处理请求时出错。
Enum:
OK,ERROR服务器响应的标准包装器。
Example
{ "status": "OK" } -
Type: object
errors
Type: object[]
code
Type: string
的错误代码。
Example:
examplemessage
Type: string
错误的描述。
Example:
example错误列表。
Min items:
1Example
[ { "code": "example", "message": "example" } ]Example
{ "errors": [ { "code": "example", "message": "example" } ] }
服务器错误的标准包装器。
Example
{ "status": "OK", "errors": [ { "code": "example", "message": "example" } ] } -
403 Forbidden
授权数据不正确或禁止访问资源。 有关错误的更多信息
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
响应的类型。 可能的值:
OK— 没有错误。ERROR— 处理请求时出错。
Enum:
OK,ERROR服务器响应的标准包装器。
Example
{ "status": "OK" } -
Type: object
errors
Type: object[]
code
Type: string
的错误代码。
Example:
examplemessage
Type: string
错误的描述。
Example:
example错误列表。
Min items:
1Example
[ { "code": "example", "message": "example" } ]Example
{ "errors": [ { "code": "example", "message": "example" } ] }
服务器错误的标准包装器。
Example
{ "status": "OK", "errors": [ { "code": "example", "message": "example" } ] } -
404 Not Found
找不到请求的资源。 有关错误的更多信息
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
响应的类型。 可能的值:
OK— 没有错误。ERROR— 处理请求时出错。
Enum:
OK,ERROR服务器响应的标准包装器。
Example
{ "status": "OK" } -
Type: object
errors
Type: object[]
code
Type: string
的错误代码。
Example:
examplemessage
Type: string
错误的描述。
Example:
example错误列表。
Min items:
1Example
[ { "code": "example", "message": "example" } ]Example
{ "errors": [ { "code": "example", "message": "example" } ] }
服务器错误的标准包装器。
Example
{ "status": "OK", "errors": [ { "code": "example", "message": "example" } ] } -
420 Method Failure
已超出资源访问限制。 有关错误的更多信息
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
响应的类型。 可能的值:
OK— 没有错误。ERROR— 处理请求时出错。
Enum:
OK,ERROR服务器响应的标准包装器。
Example
{ "status": "OK" } -
Type: object
errors
Type: object[]
code
Type: string
的错误代码。
Example:
examplemessage
Type: string
错误的描述。
Example:
example错误列表。
Min items:
1Example
[ { "code": "example", "message": "example" } ]Example
{ "errors": [ { "code": "example", "message": "example" } ] }
服务器错误的标准包装器。
Example
{ "status": "OK", "errors": [ { "code": "example", "message": "example" } ] } -
500 Internal Server Error
Yandex中的内部错误。 市场。 有关错误的更多信息
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
响应的类型。 可能的值:
OK— 没有错误。ERROR— 处理请求时出错。
Enum:
OK,ERROR服务器响应的标准包装器。
Example
{ "status": "OK" } -
Type: object
errors
Type: object[]
code
Type: string
的错误代码。
Example:
examplemessage
Type: string
错误的描述。
Example:
example错误列表。
Min items:
1Example
[ { "code": "example", "message": "example" } ]Example
{ "errors": [ { "code": "example", "message": "example" } ] }
服务器错误的标准包装器。
Example
{ "status": "OK", "errors": [ { "code": "example", "message": "example" } ] } -
No longer supported, please use an alternative and newer version.
例如, 请不要向客户询问联系人,不要发送链接到其他网站。 当聊天室的通信规则被违反时,我们会看到通信并将商品隐藏在展示柜中。