获取聊天消息历史记录

方法适用于所有模式.

如果您使用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<int64>

内阁ID。 要找到答案,请使用请求 :no-translate[GET v2/campaigns].

ℹ️ 什么是市场上的橱柜和商店?

Min value: 1

Query parameters

Name

Description

chatId*

Type: integer<int64>

的聊天ID。

Min value: 1

limit

Type: integer<int32>

每页的值数。

Min value: 1
Example: 20

page_token

Type: string

结果页面的ID。

如果省略该参数,则返回第一页。

我们建议传输输出参数的值 nextPageToken,在最后一次请求期间接收。

如果设置 page_token 并且请求有参数 pagepageSize 它们被忽略了。
Example: eyBuZXh0SWQ6IDIzNDIgfQ==

Body

application/json
{
    "messageIdFrom": 0
}

Name

Description

messageIdFrom

Type: integer<int64>

从接收所有后续消息的消息的ID。

Min value: 1

Responses

200 OK

消息历史记录。

Body

application/json
{
    "status": "OK",
    "result": {
        "orderId": 0,
        "context": {
            "type": "ORDER",
            "customer": {
                "name": "string",
                "publicId": "string"
            },
            "campaignId": 0,
            "orderId": 0,
            "returnId": 0
        },
        "messages": [
            {
                "messageId": 0,
                "createdAt": "2017-11-21T00:00:00+03:00",
                "sender": "PARTNER",
                "message": "string",
                "payload": [
                    {
                        "name": "string",
                        "url": "string",
                        "size": 0
                    }
                ]
            }
        ],
        "paging": {
            "nextPageToken": "string"
        }
    }
}

Name

Description

status*

Type: ApiResponseStatusType

响应的类型。 可能的值:

  • OK -没有错误。
  • ERROR -处理请求时发生错误。

Enum: OK, ERROR

result

Type: ChatMessagesResultDTO

消息的信息。

ApiResponseStatusType

响应的类型。 可能的值:

  • OK -没有错误。
  • ERROR -处理请求时发生错误。

Type

Description

ApiResponseStatusType

Enum: OK, ERROR

ChatMessagesResultDTO

消息的信息。

Name

Description

context*

Type: ChatFullContextDTO

有关开始聊天的订单或退款的信息。

messages*

Type: ChatMessageDTO[]

消息的信息。
消息的信息。

orderId

Type: integer<int64>

的订单ID。

paging

Type: ForwardScrollingPagerDTO

下一页的ID。

ChatFullContextDTO

有关开始聊天的订单或退款的信息。

Name

Description

type*

Type: ChatContextType

上下文类型:

Enum: ORDER, RETURN, DIRECT

campaignId

Type: integer<int64>

活动ID。

它被退回的订单和退款。

customer

Type: ChatCustomerDTO

Информация о покупателе.

orderId

Type: integer<int64>

的订单ID。

它被退回的订单和退款。

Min value: 1

returnId

Type: integer<int64>

退款ID。

它仅用于退款。

Min value: 1

ChatMessageDTO

消息的信息。

Name

Description

createdAt*

Type: string<date-time>

创建消息的日期和时间。

日期格式: ISO 8601 具有相对于 UTC.

Example: 2017-11-21T00:00:00+03:00

messageId*

Type: integer<int64>

消息的ID。

Min value: 1

sender*

Type: ChatMessageSenderType

Отправитель.

Enum: PARTNER, CUSTOMER, MARKET, SUPPORT

message

Type: string

消息的文本。

如果返回参数,可选参数 payload.

payload

Type: ChatMessagePayloadDTO[]

附加到消息的文件的信息。

如果返回参数,可选参数 message.
附加到消息的文件的信息。

Min items: 1

ForwardScrollingPagerDTO

下一页的ID。

Name

Description

nextPageToken

Type: string

下一个结果页面的ID。

ChatContextType

上下文类型:

Type

Description

ChatContextType

Enum: ORDER, RETURN, DIRECT

ChatCustomerDTO

聊天中有关买家的信息。

Name

Description

name

Type: string

买方在Yandex Passport中的公开名称,显示在Yandex services中。

Min length: 1

publicId

Type: string

Yandex Passport中的公共用户ID。

使用它的例子
  • 燕基科斯. 街市: :没有-翻译[https://market.yandex.ru/user/{public-id}/评论]
  • 禅宗: :没有-翻译[https://zen.yandex.ru/user/{公共id}]
  • 检讨报告: :没有-翻译[https://yandex.ru/user/{公共id}]

阅读更多关于公共数据的信息 Yandex ID文档.

Min length: 1

ChatMessageSenderType

谁发的消息:

  • PARTNER -商店。
  • CUSTOMER -买方。
  • MARKET -市场(自动消息).
  • SUPPORT -一个Yandex的。 市场支持员工。

Type

Description

ChatMessageSenderType

Enum: PARTNER, CUSTOMER, MARKET, SUPPORT

ChatMessagePayloadDTO

附加到消息的文件的信息。

Name

Description

name*

Type: string

的文件名。

size*

Type: integer<int32>

以字节为单位的文件大小。

url*

Type: string

下载文件的链接。

Min length: 1

Max length: 2000

400 Bad Request

请求包含不正确的数据。 有关错误的更多信息

Body

application/json
{
    "status": "OK",
    "errors": [
        {
            "code": "string",
            "message": "string"
        }
    ]
}

Name

Description

errors

Type: ApiErrorDTO[]

错误列表。
一般错误格式。

Min items: 1

status

Type: ApiResponseStatusType

响应的类型。 可能的值:

  • OK -没有错误。
  • ERROR -处理请求时发生错误。

Enum: OK, ERROR

ApiErrorDTO

一般错误格式。

Name

Description

code*

Type: string

的错误代码。

message

Type: string

错误的描述。

401 Unauthorized

请求中未指定授权数据。 有关错误的更多信息

Body

application/json
{
    "status": "OK",
    "errors": [
        {
            "code": "string",
            "message": "string"
        }
    ]
}

Name

Description

errors

Type: ApiErrorDTO[]

错误列表。
一般错误格式。

Min items: 1

status

Type: ApiResponseStatusType

响应的类型。 可能的值:

  • OK -没有错误。
  • ERROR -处理请求时发生错误。

Enum: OK, ERROR

403 Forbidden

授权数据不正确或禁止访问资源。 有关错误的更多信息

Body

application/json
{
    "status": "OK",
    "errors": [
        {
            "code": "string",
            "message": "string"
        }
    ]
}

Name

Description

errors

Type: ApiErrorDTO[]

错误列表。
一般错误格式。

Min items: 1

status

Type: ApiResponseStatusType

响应的类型。 可能的值:

  • OK -没有错误。
  • ERROR -处理请求时发生错误。

Enum: OK, ERROR

404 Not Found

找不到请求的资源。 有关错误的更多信息

Body

application/json
{
    "status": "OK",
    "errors": [
        {
            "code": "string",
            "message": "string"
        }
    ]
}

Name

Description

errors

Type: ApiErrorDTO[]

错误列表。
一般错误格式。

Min items: 1

status

Type: ApiResponseStatusType

响应的类型。 可能的值:

  • OK -没有错误。
  • ERROR -处理请求时发生错误。

Enum: OK, ERROR

420 Method Failure

已超出资源访问限制。 有关错误的更多信息

Body

application/json
{
    "status": "OK",
    "errors": [
        {
            "code": "string",
            "message": "string"
        }
    ]
}

Name

Description

errors

Type: ApiErrorDTO[]

错误列表。
一般错误格式。

Min items: 1

status

Type: ApiResponseStatusType

响应的类型。 可能的值:

  • OK -没有错误。
  • ERROR -处理请求时发生错误。

Enum: OK, ERROR

500 Internal Server Error

Yandex的内部错误。 市场。 有关错误的更多信息

Body

application/json
{
    "status": "OK",
    "errors": [
        {
            "code": "string",
            "message": "string"
        }
    ]
}

Name

Description

errors

Type: ApiErrorDTO[]

错误列表。
一般错误格式。

Min items: 1

status

Type: ApiResponseStatusType

响应的类型。 可能的值:

  • OK -没有错误。
  • ERROR -处理请求时发生错误。

Enum: OK, ERROR

No longer supported, please use an alternative and newer version.

Например, Пожалуйста, не запрашивайте у покупателей контакты, не присылайте ссылки на другие сайты. Мы видим переписку и скрываем товары с витрины, когда правила общения в чатах нарушаются.