Send Message
tip
Rate limit:
- Global: 50 QPS
- Per User: 5 requests/second
HTTP Request
POST /v5/p2p/chat/message/send
Request Parameters
| Parameter | Required | Type | Comments |
|---|---|---|---|
| message | true | string | Chat message. Is either: the text of the message you send, or the URL of the file you want to send |
| contentType | true | string | Chat message type.
|
| sessionId | true | string | Session ID |
Response Parameters
None
Request Example
- HTTP
- Python
POST /v5/p2p/chat/message/send 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
{
"message": "hi, test",
"contentType": "STR",
"sessionId": "rl8BAkdDTQDgSTg+FGrPjr6Vc06F1TWGGU7rg1oLqPDKtM0VNXvL1I7Oo1aPYKKWVbnEEZRclyY+/w=="
}
from bybit_p2p import P2P
api = P2P(
testnet=True,
api_key="xxxxxxxxxxxxxxxxxx",
api_secret="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
)
print(api.send_message(
message="hi, test",
contentType="STR",
sessionId="rl8BAkdDTQDgSTg+FGrPjr6Vc06F1TWGGU7rg1oLqPDKtM0VNXvL1I7Oo1aPYKKWVbnEEZRclyY+/w=="
))
Response Example
{
"ret_code": 0,
"ret_msg": "SUCCESS",
"result": null,
"ext_code": "",
"ext_info": {},
"time_now": "1773866621.838588"
}