Endpoint #
POST /wp-json/rtcl/v1/my/chat/message
Description #
Send a new message in an existing conversation.
Authentication & Permission #
This endpoint is protected and requires:
- REST API enabled (
allow_rest_api) - Valid API Key
- Valid JWT/Bearer authentication
Required Headers #
| Header | Value |
|---|---|
| Authorization | Bearer YOUR_JWT_TOKEN |
| X-API-KEY | YOUR_API_KEY |
| Content-Type | application/json |
Request Parameters #
| Parameter | Type | Required | Description |
|---|---|---|---|
| con_id | integer | ✅ Yes | Conversation ID |
| listing_id | integer | ✅ Yes | Listing ID |
| text | string | ✅ Yes | Message text |
| temp_id | number | ❌ No | Temporary message ID (frontend use) |
| files[] | file[] | ❌ No | Image or attachment files |
cURL Example (Send Message) #
curl -X POST "https://demo-site.com/wp-json/rtcl/v1/my/chat/message" \
-H "Authorization: Bearer DEMO_JWT_TOKEN" \
-F "con_id=101" \
-F "listing_id=5001" \
-F "text=Is this property still available?" \
-F "temp_id=987654"
Demo Success Response #
{
"message_id": 9001,
"con_id": 101,
"source_id": 200,
"type": "text",
"message": "Is this property still available?",
"attachments": [],
"meta": null,
"is_read": 0,
"created_at": "2026-01-01 12:00:00",
"temp_id": 987654
}
Error Responses #
Not Logged In #
{
"code": "FORBIDDEN",
"message": "You are not logged in.",
"data": {
"status": 400,
"temp_id": 987654
}
}
Conversation Not Found #
{
"code": "FORBIDDEN",
"message": "Conversation not found.",
"data": {
"status": 403,
"temp_id": 987654
}
}
REST API Disabled (403) #
{
"code": "DENIED_REST_API",
"message": "Denied api call"
}
Missing / Invalid Authentication (401) #
{
"status": "error",
"error": "INVALID_API_KEY",
"code": "401",
"error_message": "Invalid API key or authorization token."
}
Missing Authorization Header #
{
"status": "error",
"error": "MISSING_AUTHORIZATION_HEADER",
"code": "401",
"error_message": "Authorization header not received. Either authorization header was not sent or it was removed by your server due to security reasons."
}
Invalid Authorization Token Type #
{
"status": "error",
"error": "INVALID_AUTHORIZATION_HEADER_TOKEN_TYPE",
"code": "401",
"error_message": "Authorization header must be type of Bearer Token."
}
Invalid JWT Format (Segment Fault) #
{
"status": "error",
"error": "SEGMENT_FAULT",
"code": "401",
"error_message": "Incorrect JWT Format."
}
Invalid JWT Signature #
{
"status": "error",
"error": "INVALID_TOKEN",
"code": "401",
"error_message": "JWT signature verification failed."
}