Skip to main content

Version Docs Updated

Purpose

The Messaging API describes the endpoints used to manage communication between customers, vendors, and system administrators.

πŸ’¬ Messaging and Communication API

The Rentiva messaging system is built on an asynchronous "Thread" architecture. All endpoints use the Messages service class and MessageFormatter helpers.


πŸ—οΈ 1. Module Architecture​

Registration point: MHMRentiva\Admin\Messages\REST\Messages::register()

The system serves through two main namespaces:

  • Admin Endpoints: /v1/admin/messages/*
  • Customer/Vendor Endpoints: /v1/portal/messages/*

πŸ‘¨β€πŸ’Ό 2. Admin Endpoints​

The section where system administrators monitor and respond to all communication traffic.

EndpointMethodFunction
/admin/messagesGETLists all message threads.
/admin/messages/{id}GETReturns the full message history for a specific thread.
/admin/messages/{id}/replyPOSTSends a reply to the thread on behalf of the administrator.
/admin/messages/{id}/statusPUTMarks the thread as "Closed" or "Resolved".

πŸ‘€ 3. Customer and Vendor Endpoints​

The section where users communicate with each other or with the support team.

EndpointMethodFunction
/portal/messages/createPOSTStarts a new message thread.
/portal/messages/threadsGETLists active threads the user is part of.
/portal/messages/replyPOSTAdds a new message to an existing thread.

πŸ›‘οΈ 4. Permission and Security (Ownership)​

The messaging system applies Ownership control beyond authentication:

  1. Ownership Check: Before fetching a thread's messages, Messages::verify_access() verifies that the requesting user is a party to that thread (Sender or Recipient).
  2. Role Verification: Admin endpoints are only accessible to users with the manage_options capability.
  3. Content Sanitization: All message content is sanitized with wp_kses() to remove harmful HTML tags before being saved.

πŸ“€ 5. Response Example (Formatted Message)​

{
"success": true,
"data": {
"thread_id": 45,
"subject": "Regarding Vehicle Booking",
"messages": [
{
"author_name": "Ahmet Y.",
"content": "Is a child seat available in the vehicle?",
"created_at": "2026-03-19 14:30:00",
"is_read": true
}
]
}
}

Section Summary​

  • The Messaging API provides a thread-based communication model.
  • Admin and portal/customer responsibilities are separated by clear boundaries.
  • Data security and privacy are maintained at the highest level via the verify_access() layer.

Changelog​

DateVersionNote
23.04.20264.27.2English translation added.
19.03.20264.21.2Thread architecture, Ownership control, and formatted response structure added.