Get Chat Message
HTTP Request
POST /v5/p2p/order/message/listpage
Request Parameters
| Parameter | Required | Type | Comments |
|---|---|---|---|
| orderId | true | string | Order ID |
| currentPage | false | string | Current page number |
| size | true | string | Page size |
Response Parameters
| Parameter | Type | Comments |
|---|---|---|
| id | string | Message ID |
| message | string | Message content. Text or image/pdf/video url |
| userId | string | The person who sent the message |
| msgType | int | Message type
|
| msgCode | int | System message code |
| createDate | string | Message sending time |
| contentType | string | Message content type
|
| orderId | string | Order ID |
| msgUuid | string | Client message UUID |
| nickName | string | Nickname of the person sending the message |
| fileName | string | Image/pdf/video filename |
| accountId | string | Account ID |
| isRead | int | 1: read, 0: unread |
| roleType | string | Role type, sys-system message |
| onlyForCustomer | int | Only sent to customer, 1: true; 0: false |
Request Example
- HTTP
- Python
POST /v5/p2p/order/message/listpage HTTP/1.1
Host: api-testnet.bybit.com
X-BAPI-SIGN: XXXXX
X-BAPI-API-KEY: xxxxxxxxxxxxxxxxxx
X-BAPI-TIMESTAMP: 1675866354698
X-BAPI-RECV-WINDOW: 5000
Content-Type: application/json
{
"orderId":"1898976123321221120",
"size":"1"
}
from bybit_p2p import P2P
api = P2P(
testnet=True,
api_key="xxxxxxxxxxxxxxxxxx",
api_secret="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
)
print(api.get_chat_messages(
orderId="1898976123321221120",
size=1
))
Response Example
{
"ret_code": 0,
"ret_msg": "SUCCESS",
"result": [
{
"id": "3000835348",
"accountId": "290120",
"message": "hi, test",
"msgType": 1,
"msgCode": 0,
"createDate": "1741763625000",
"isRead": 0,
"contentType": "str",
"roleType": "user",
"userId": "290118",
"orderId": "1898976123321221120",
"msgUuid": "",
"nickName": "cjmtest",
"read": 0,
"fileName": "",
"onlyForCustomer": 0
}
],
"ext_code": "",
"ext_info": {},
"time_now": "1741765371.720331"
}