AIRBNB
FRONTEND GUIDE FOR AI CODING AGENTS - PART 5 - Messaging Service
This document is a part of a REST API guide for the airbnb project. It is designed for AI agents that will generate frontend code to consume the project’s backend.
This document provides extensive instruction for the usage of messaging
Service Access
Messaging service management is handled through service specific base urls.
Messaging service may be deployed to the preview server, staging server, or production server. Therefore,it has 3 access URLs. The frontend application must support all deployment environments during development, and the user should be able to select the target API server on the login page (already handled in first part.).
For the messaging service, the base URLs are:
-
Preview:
https://airbnb3.prw.mindbricks.com/messaging-api -
Staging:
https://airbnb3-stage.mindbricks.co/messaging-api -
Production:
https://airbnb3.mindbricks.co/messaging-api
Scope
Messaging Service Description
Enables secure in-app messaging between guests and hosts. Handles threads, messages (with text/media/system types), abuse flagging, and admin moderation for resolution..
Messaging service provides apis and business logic for following data objects in airbnb application. Each data object may be either a central domain of the application data structure or a related helper data object for a central concept. Note that data object concept is equal to table concept in the database, in the service database each data object is represented as a db table scheme and the object instances as table rows.
messageThread
Data Object: Thread/conversation between guest and host, optionally linked
to a listing/reservation. Tracks participants, context, state, and
stats.
messageReport
Data Object: Report/in-app abuse complaint filed for a message by a user.
Tracks status, admin handling, and resolution notes. Only visible
to involved parties and admins.
message
Data Object: Single message within a thread (text/media/system). Includes
metadata for flagging/moderation. Linked to sender, thread, and
content type.
API Structure
Object Structure of a Successful Response
When the service processes requests successfully, it wraps the requested resource(s) within a JSON envelope. This envelope includes the data and essential metadata such as configuration details and pagination information, providing context to the client.
HTTP Status Codes:
- 200 OK: Returned for successful GET, LIST, UPDATE, or DELETE operations, indicating that the request was processed successfully.
- 201 Created: Returned for CREATE operations, indicating that the resource was created successfully.
Success Response Format:
For successful operations, the response includes a
"status": "OK"
property, signaling that the request executed successfully. The
structure of a successful response is outlined below:
{
"status":"OK",
"statusCode": 200,
"elapsedMs":126,
"ssoTime":120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName":"products",
"method":"GET",
"action":"list",
"appVersion":"Version",
"rowCount":3,
"products":[{},{},{}],
"paging": {
"pageNumber":1,
"pageRowCount":25,
"totalRowCount":3,
"pageCount":1
},
"filters": [],
"uiPermissions": []
}
-
products: In this example, this key contains the actual response content, which may be a single object or an array of objects depending on the operation.
Additional Data
Each API may include additional data besides the main data object, depending on the business logic of the API. These will be provided in each API’s response signature.
Error Response
If a request encounters an issue—whether due to a logical fault or a technical problem—the service responds with a standardized JSON error structure. The HTTP status code indicates the nature of the error, using commonly recognized codes for clarity:
- 400 Bad Request: The request was improperly formatted or contained invalid parameters.
- 401 Unauthorized: The request lacked a valid authentication token; login is required.
- 403 Forbidden: The current token does not grant access to the requested resource.
- 404 Not Found: The requested resource was not found on the server.
- 500 Internal Server Error: The server encountered an unexpected condition.
Each error response is structured to provide meaningful insight into the problem, assisting in efficient diagnosis and resolution.
{
"result": "ERR",
"status": 400,
"message": "errMsg_organizationIdisNotAValidID",
"errCode": 400,
"date": "2024-03-19T12:13:54.124Z",
"detail": "String"
}
Bucket Management
(This information is also given in PART 1 prompt.)
This application has a bucket service used to store user files and other object-related files. The bucket service is login-agnostic, so for write operations or private reads, include a bucket token (provided by services) in the request’s Authorization header as a Bearer token.
Please note that all other business services require the access token in the Bearer header, while the bucket service expects a bucket token because it is login-agnostic. Ensure you manage the required token injection properly; any auth interceptor should not replace the bucket token with the access token.
User Bucket This bucket stores public user files for each user.
When a user logs in—or in the
/currentuser
response—there is a
userBucketToken
to use when sending user-related public files to the bucket
service.
{
//...
"userBucketToken": "e56d...."
}
To upload a file
POST {baseUrl}/bucket/upload
The request body is form-data which includes the
bucketId
and the file binary in the
files
field.
{
bucketId: "{userId}-public-user-bucket",
files: {binary}
}
Response status is 200 on success, e.g., body:
{
"success": true,
"data": [
{
"fileId": "9da03f6d-0409-41ad-bb06-225a244ae408",
"originalName": "test (10).png",
"mimeType": "image/png",
"size": 604063,
"status": "uploaded",
"bucketName": "f7103b85-fcda-4dec-92c6-c336f71fd3a2-public-user-bucket",
"isPublic": true,
"downloadUrl": "https://babilcom.mindbricks.co/bucket/download/9da03f6d-0409-41ad-bb06-225a244ae408"
}
]
}
To download a file from the bucket, you need its
fileId. If you upload an avatar or other asset, ensure the download URL
or the
fileId
is stored in the backend.
Buckets are mostly used in object creations that require an additional file, such as a product image or user avatar. After uploading your image to the bucket, insert the returned download URL into the related property of the target object record.
Application Bucket
This Airbnb application also includes a common public bucket that
anyone can read, but only users with the
superAdmin,
admin, or
saasAdmin
roles can write (upload) to it.
When a user with one of these admin roles is logged in, the
/login
response or the
/currentuser
response also returns an
applicationBucketToken
field, which is used when uploading any file to the application
bucket.
{
//...
"applicationBucketToken": "e23fd...."
}
The common public application bucket ID is
"airbnb3-public-common-bucket"
In certain admin areas—such as product management pages—since the user already has the application bucket token, they will be able to upload related object images.
Please configure your UI to upload files to the application bucket using this bucket token whenever needed.
Object Buckets Some objects may also return a bucket token for uploading or accessing files related to that object. For example, in a project management application, when you fetch a project’s data, a public or private bucket token may be provided to upload or download project-related files.
These buckets will be used as described in the relevant object definitions.
MessageThread Data Object
Thread/conversation between guest and host, optionally linked to a listing/reservation. Tracks participants, context, state, and stats.
MessageThread Data Object Properties
MessageThread data object has got following properties that are represented as table fields in the database scheme. These properties don't stand just for data storage, but each may have different settings to manage the business logic.
| Property | Type | IsArray | Required | Description |
|---|---|---|---|---|
messageCount
|
Integer | false | Yes | Total number of messages in thread. |
isOpen
|
Boolean | false | Yes | Thread is open for messaging (not closed/archived). |
guestId
|
ID | false | Yes | Guest user in this thread. |
lastMessageAt
|
Date | false | Yes | Last message sent in thread. |
listingId
|
ID | false | No | Listing related to this thread if any. |
hostId
|
ID | false | Yes | Host user in this thread. |
reservationId
|
ID | false | No | Reservation related to thread if any. |
- Required properties are mandatory for creating objects and must be provided in the request body if no default value, formula or session bind is set.
Relation Properties
guestId
listingId
hostId
reservationId
Mindbricks supports relations between data objects, allowing you to define how objects are linked together. The relations may reference to a data object either in this service or in another service. Id the reference is remote, backend handles the relations through service communication or elastic search. These relations should be respected in the frontend so that instaead of showing the related objects id, the frontend should list human readable values from other data objects. If the relation points to another service, frontend should use the referenced service api in case it needs related data. The relation logic is montly handled in backend so the api responses feeds the frontend about the relational data. In mmost cases the api response will provide the relational data as well as the main one.
In frontend, please ensure that,
1- instaead of these relational ids you show the main human readable field of the related target data (like name), 2- if this data object needs a user input of these relational ids, you should provide a combobox with the list of possible records or (a searchbox) to select with the realted target data object main human readable field.
-
guestId: ID Relation to
user.id
The target object is a parent object, meaning that the relation is a one-to-many relationship from target to this object.
Required: Yes
-
listingId: ID Relation to
listing.id
The target object is a parent object, meaning that the relation is a one-to-many relationship from target to this object.
Required: No
-
hostId: ID Relation to
user.id
The target object is a parent object, meaning that the relation is a one-to-many relationship from target to this object.
Required: Yes
-
reservationId: ID Relation to
reservation.id
The target object is a parent object, meaning that the relation is a one-to-many relationship from target to this object.
Required: No
MessageReport Data Object
Report/in-app abuse complaint filed for a message by a user. Tracks status, admin handling, and resolution notes. Only visible to involved parties and admins.
MessageReport Data Object Properties
MessageReport data object has got following properties that are represented as table fields in the database scheme. These properties don't stand just for data storage, but each may have different settings to manage the business logic.
| Property | Type | IsArray | Required | Description |
|---|---|---|---|---|
reportedBy
|
ID | false | Yes | User reporting this message. |
reportReason
|
String | false | Yes | Reporter-supplied reason for report/abuse claim. |
moderationStatus
|
Enum | false | Yes | Status of admin moderation/response. |
messageId
|
ID | false | Yes | Message being reported (abuse/inappropriate). |
adminId
|
ID | false | No | Admin assigned/reviewing this report (if any). |
reportedAt
|
Date | false | Yes | Datetime when report was filed. |
resolutionNotes
|
Text | false | No | Admin/moderator notes regarding outcome/resolution. |
- Required properties are mandatory for creating objects and must be provided in the request body if no default value, formula or session bind is set.
Enum Properties
Enum properties are defined with a set of allowed values, ensuring that only valid options can be assigned to them. The enum options value will be stored as strings in the database, but when a data object is created an additional property with the same name plus an idx suffix will be created, which will hold the index of the selected enum option. You can use the {fieldName_idx} property to sort by the enum value or when your enum options represent a hiyerarchy of values. In the frontend input components, enum type properties should only accept values from an option component that lists the enum options.
- moderationStatus: [pending, reviewed, closed]
Relation Properties
reportedBy
messageId
adminId
Mindbricks supports relations between data objects, allowing you to define how objects are linked together. The relations may reference to a data object either in this service or in another service. Id the reference is remote, backend handles the relations through service communication or elastic search. These relations should be respected in the frontend so that instaead of showing the related objects id, the frontend should list human readable values from other data objects. If the relation points to another service, frontend should use the referenced service api in case it needs related data. The relation logic is montly handled in backend so the api responses feeds the frontend about the relational data. In mmost cases the api response will provide the relational data as well as the main one.
In frontend, please ensure that,
1- instaead of these relational ids you show the main human readable field of the related target data (like name), 2- if this data object needs a user input of these relational ids, you should provide a combobox with the list of possible records or (a searchbox) to select with the realted target data object main human readable field.
-
reportedBy: ID Relation to
user.id
The target object is a parent object, meaning that the relation is a one-to-many relationship from target to this object.
Required: Yes
-
messageId: ID Relation to
message.id
The target object is a parent object, meaning that the relation is a one-to-many relationship from target to this object.
Required: Yes
-
adminId: ID Relation to
user.id
The target object is a parent object, meaning that the relation is a one-to-many relationship from target to this object.
Required: No
Message Data Object
Single message within a thread (text/media/system). Includes metadata for flagging/moderation. Linked to sender, thread, and content type.
Message Data Object Properties
Message data object has got following properties that are represented as table fields in the database scheme. These properties don't stand just for data storage, but each may have different settings to manage the business logic.
| Property | Type | IsArray | Required | Description |
|---|---|---|---|---|
threadId
|
ID | false | Yes | Thread this message belongs to. |
content
|
Text | false | Yes | Message content (text or system message). |
senderId
|
ID | false | Yes | User who sent this message (must be guest/host in thread). |
sentAt
|
Date | false | Yes | When this message was sent (from client/server). |
messageType
|
Enum | false | Yes | Message type: text/media/system. |
mediaUrl
|
String | false | No | URL of media if type=media (optional, else null). |
isModerated
|
Boolean | false | Yes | True if message reviewed by admin (can be marked in moderation). |
isFlagged
|
Boolean | false | Yes | Message flagged as abuse/inappropriate. |
flaggedBy
|
ID | false | No | User who flagged, if any. |
flagReason
|
String | false | No | Reason for flagging, if provided. |
isRead
|
Boolean | false | Yes | marks a last array point if message is read or not |
- Required properties are mandatory for creating objects and must be provided in the request body if no default value, formula or session bind is set.
Enum Properties
Enum properties are defined with a set of allowed values, ensuring that only valid options can be assigned to them. The enum options value will be stored as strings in the database, but when a data object is created an additional property with the same name plus an idx suffix will be created, which will hold the index of the selected enum option. You can use the {fieldName_idx} property to sort by the enum value or when your enum options represent a hiyerarchy of values. In the frontend input components, enum type properties should only accept values from an option component that lists the enum options.
- messageType: [text, media, system]
Relation Properties
threadId
senderId
flaggedBy
Mindbricks supports relations between data objects, allowing you to define how objects are linked together. The relations may reference to a data object either in this service or in another service. Id the reference is remote, backend handles the relations through service communication or elastic search. These relations should be respected in the frontend so that instaead of showing the related objects id, the frontend should list human readable values from other data objects. If the relation points to another service, frontend should use the referenced service api in case it needs related data. The relation logic is montly handled in backend so the api responses feeds the frontend about the relational data. In mmost cases the api response will provide the relational data as well as the main one.
In frontend, please ensure that,
1- instaead of these relational ids you show the main human readable field of the related target data (like name), 2- if this data object needs a user input of these relational ids, you should provide a combobox with the list of possible records or (a searchbox) to select with the realted target data object main human readable field.
-
threadId: ID Relation to
messagethread.id
The target object is a parent object, meaning that the relation is a one-to-many relationship from target to this object.
Required: Yes
-
senderId: ID Relation to
user.id
The target object is a parent object, meaning that the relation is a one-to-many relationship from target to this object.
Required: Yes
-
flaggedBy: ID Relation to
user.id
The target object is a parent object, meaning that the relation is a one-to-many relationship from target to this object.
Required: No
API Reference
Delete Message
API
Soft-delete (hide) a message. Sender or admin only. Message remains for logs/audit, only hidden for sender/recipient.
Rest Route
The
deleteMessage
API REST controller can be triggered via the following route:
/v1/messages/:messageId
Rest Request Parameters
The
deleteMessage
api has got 1 request parameter
| Parameter | Type | Required | Population |
|---|---|---|---|
| messageId | ID | true | request.params?.messageId |
| messageId : This id paremeter is used to select the required data object that will be deleted |
REST Request To access the api you can use the REST controller with the path DELETE /v1/messages/:messageId
axios({
method: 'DELETE',
url: `/v1/messages/${messageId}`,
data: {
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "message",
"method": "DELETE",
"action": "delete",
"appVersion": "Version",
"rowCount": 1,
"message": {
"id": "ID",
"threadId": "ID",
"content": "Text",
"senderId": "ID",
"sentAt": "Date",
"messageType": "Enum",
"messageType_idx": "Integer",
"mediaUrl": "String",
"isModerated": "Boolean",
"isFlagged": "Boolean",
"flaggedBy": "ID",
"flagReason": "String",
"isRead": "Boolean",
"isActive": false,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Create Messagethread
API
Create a new message thread between a guest and host (optionally for specific listing/reservation). Users must be sender or recipient. Prevent duplicate open threads on same context with composite index.
Rest Route
The
createMessageThread
API REST controller can be triggered via the following route:
/v1/messagethreads
Rest Request Parameters
The
createMessageThread
api has got 7 request parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| messageCount | Integer | true | request.body?.messageCount |
| isOpen | Boolean | true | request.body?.isOpen |
| guestId | ID | true | request.body?.guestId |
| lastMessageAt | Date | true | request.body?.lastMessageAt |
| listingId | ID | false | request.body?.listingId |
| hostId | ID | true | request.body?.hostId |
| reservationId | ID | false | request.body?.reservationId |
| messageCount : Total number of messages in thread. | |||
| isOpen : Thread is open for messaging (not closed/archived). | |||
| guestId : Guest user in this thread. | |||
| lastMessageAt : Last message sent in thread. | |||
| listingId : Listing related to this thread if any. | |||
| hostId : Host user in this thread. | |||
| reservationId : Reservation related to thread if any. |
REST Request To access the api you can use the REST controller with the path POST /v1/messagethreads
axios({
method: 'POST',
url: '/v1/messagethreads',
data: {
messageCount:"Integer",
isOpen:"Boolean",
guestId:"ID",
lastMessageAt:"Date",
listingId:"ID",
hostId:"ID",
reservationId:"ID",
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "messageThread",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"messageThread": {
"id": "ID",
"messageCount": "Integer",
"isOpen": "Boolean",
"guestId": "ID",
"lastMessageAt": "Date",
"listingId": "ID",
"hostId": "ID",
"reservationId": "ID",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Update Message
API
Allows sender or admin to edit a message (rare; only content/flag fields allowed). Use-case: correct typo, retract flag. Not for full message overwrite.
Rest Route
The
updateMessage
API REST controller can be triggered via the following route:
/v1/messages/:messageId
Rest Request Parameters
The
updateMessage
api has got 8 request parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| messageId | ID | true | request.params?.messageId |
| content | Text | false | request.body?.content |
| mediaUrl | String | false | request.body?.mediaUrl |
| isModerated | Boolean | false | request.body?.isModerated |
| isFlagged | Boolean | false | request.body?.isFlagged |
| flaggedBy | ID | false | request.body?.flaggedBy |
| flagReason | String | false | request.body?.flagReason |
| isRead | Boolean | false | request.body?.isRead |
| messageId : This id paremeter is used to select the required data object that will be updated | |||
| content : Message content (text or system message). | |||
| mediaUrl : URL of media if type=media (optional, else null). | |||
| isModerated : True if message reviewed by admin (can be marked in moderation). | |||
| isFlagged : Message flagged as abuse/inappropriate. | |||
| flaggedBy : User who flagged, if any. | |||
| flagReason : Reason for flagging, if provided. | |||
| isRead : marks a last array point if message is read or not |
REST Request To access the api you can use the REST controller with the path PATCH /v1/messages/:messageId
axios({
method: 'PATCH',
url: `/v1/messages/${messageId}`,
data: {
content:"Text",
mediaUrl:"String",
isModerated:"Boolean",
isFlagged:"Boolean",
flaggedBy:"ID",
flagReason:"String",
isRead:"Boolean",
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "message",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"message": {
"id": "ID",
"threadId": "ID",
"content": "Text",
"senderId": "ID",
"sentAt": "Date",
"messageType": "Enum",
"messageType_idx": "Integer",
"mediaUrl": "String",
"isModerated": "Boolean",
"isFlagged": "Boolean",
"flaggedBy": "ID",
"flagReason": "String",
"isRead": "Boolean",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Update Messagethread
API
Update thread state (e.g. isOpen=false to close), only guest, host, or admin can update.
Rest Route
The
updateMessageThread
API REST controller can be triggered via the following route:
/v1/messagethreads/:messageThreadId
Rest Request Parameters
The
updateMessageThread
api has got 6 request parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| messageThreadId | ID | true | request.params?.messageThreadId |
| messageCount | Integer | false | request.body?.messageCount |
| isOpen | Boolean | false | request.body?.isOpen |
| lastMessageAt | Date | false | request.body?.lastMessageAt |
| listingId | ID | false | request.body?.listingId |
| reservationId | ID | false | request.body?.reservationId |
| messageThreadId : This id paremeter is used to select the required data object that will be updated | |||
| messageCount : Total number of messages in thread. | |||
| isOpen : Thread is open for messaging (not closed/archived). | |||
| lastMessageAt : Last message sent in thread. | |||
| listingId : Listing related to this thread if any. | |||
| reservationId : Reservation related to thread if any. |
REST Request To access the api you can use the REST controller with the path PATCH /v1/messagethreads/:messageThreadId
axios({
method: 'PATCH',
url: `/v1/messagethreads/${messageThreadId}`,
data: {
messageCount:"Integer",
isOpen:"Boolean",
lastMessageAt:"Date",
listingId:"ID",
reservationId:"ID",
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "messageThread",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"messageThread": {
"id": "ID",
"messageCount": "Integer",
"isOpen": "Boolean",
"guestId": "ID",
"lastMessageAt": "Date",
"listingId": "ID",
"hostId": "ID",
"reservationId": "ID",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Delete Messagethread
API
Soft-delete (archive/close) a thread. Only allowed for guest/host or admin; marks isActive=false.
Rest Route
The
deleteMessageThread
API REST controller can be triggered via the following route:
/v1/messagethreads/:messageThreadId
Rest Request Parameters
The
deleteMessageThread
api has got 1 request parameter
| Parameter | Type | Required | Population |
|---|---|---|---|
| messageThreadId | ID | true | request.params?.messageThreadId |
| messageThreadId : This id paremeter is used to select the required data object that will be deleted |
REST Request To access the api you can use the REST controller with the path DELETE /v1/messagethreads/:messageThreadId
axios({
method: 'DELETE',
url: `/v1/messagethreads/${messageThreadId}`,
data: {
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "messageThread",
"method": "DELETE",
"action": "delete",
"appVersion": "Version",
"rowCount": 1,
"messageThread": {
"id": "ID",
"messageCount": "Integer",
"isOpen": "Boolean",
"guestId": "ID",
"lastMessageAt": "Date",
"listingId": "ID",
"hostId": "ID",
"reservationId": "ID",
"isActive": false,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Create Message
API
Create/send a message to a thread (guest/host only, must be participant). Sets sentAt, and updates thread.lastMessageAt/messageCount atomically.
Rest Route
The
createMessage
API REST controller can be triggered via the following route:
/v1/messages
Rest Request Parameters
The
createMessage
api has got 10 request parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| threadId | ID | true | request.body?.threadId |
| content | Text | true | request.body?.content |
| senderId | ID | true | request.body?.senderId |
| sentAt | Date | true | request.body?.sentAt |
| messageType | Enum | true | request.body?.messageType |
| mediaUrl | String | false | request.body?.mediaUrl |
| isModerated | Boolean | true | request.body?.isModerated |
| isFlagged | Boolean | true | request.body?.isFlagged |
| flaggedBy | ID | false | request.body?.flaggedBy |
| flagReason | String | false | request.body?.flagReason |
| threadId : Thread this message belongs to. | |||
| content : Message content (text or system message). | |||
| senderId : User who sent this message (must be guest/host in thread). | |||
| sentAt : When this message was sent (from client/server). | |||
| messageType : Message type: text/media/system. | |||
| mediaUrl : URL of media if type=media (optional, else null). | |||
| isModerated : True if message reviewed by admin (can be marked in moderation). | |||
| isFlagged : Message flagged as abuse/inappropriate. | |||
| flaggedBy : User who flagged, if any. | |||
| flagReason : Reason for flagging, if provided. |
REST Request To access the api you can use the REST controller with the path POST /v1/messages
axios({
method: 'POST',
url: '/v1/messages',
data: {
threadId:"ID",
content:"Text",
senderId:"ID",
sentAt:"Date",
messageType:"Enum",
mediaUrl:"String",
isModerated:"Boolean",
isFlagged:"Boolean",
flaggedBy:"ID",
flagReason:"String",
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "message",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"message": {
"id": "ID",
"threadId": "ID",
"content": "Text",
"senderId": "ID",
"sentAt": "Date",
"messageType": "Enum",
"messageType_idx": "Integer",
"mediaUrl": "String",
"isModerated": "Boolean",
"isFlagged": "Boolean",
"flaggedBy": "ID",
"flagReason": "String",
"isRead": "Boolean",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Get Messagethread
API
Get a message thread with participant/context enrichment. Only guest, host, or admin may view.
Rest Route
The
getMessageThread
API REST controller can be triggered via the following route:
/v1/messagethreads/:messageThreadId
Rest Request Parameters
The
getMessageThread
api has got 1 request parameter
| Parameter | Type | Required | Population |
|---|---|---|---|
| messageThreadId | ID | true | request.params?.messageThreadId |
| messageThreadId : This id paremeter is used to query the required data object. |
REST Request To access the api you can use the REST controller with the path GET /v1/messagethreads/:messageThreadId
axios({
method: 'GET',
url: `/v1/messagethreads/${messageThreadId}`,
data: {
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "messageThread",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"messageThread": {
"id": "ID",
"messageCount": "Integer",
"isOpen": "Boolean",
"guestId": "ID",
"lastMessageAt": "Date",
"listingId": "ID",
"hostId": "ID",
"reservationId": "ID",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Get Message
API
Get a message (guest/host must be in thread, or admin). Enrich with sender info.
Rest Route
The
getMessage
API REST controller can be triggered via the following route:
/v1/messages/:messageId
Rest Request Parameters
The
getMessage
api has got 1 request parameter
| Parameter | Type | Required | Population |
|---|---|---|---|
| messageId | ID | true | request.params?.messageId |
| messageId : This id paremeter is used to query the required data object. |
REST Request To access the api you can use the REST controller with the path GET /v1/messages/:messageId
axios({
method: 'GET',
url: `/v1/messages/${messageId}`,
data: {
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "message",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"message": {
"id": "ID",
"threadId": "ID",
"content": "Text",
"senderId": "ID",
"sentAt": "Date",
"messageType": "Enum",
"messageType_idx": "Integer",
"mediaUrl": "String",
"isModerated": "Boolean",
"isFlagged": "Boolean",
"flaggedBy": "ID",
"flagReason": "String",
"isRead": "Boolean",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
List Messagethreads
API
List threads for user; only show where session user is guest or host, or admin role.
Rest Route
The
listMessageThreads
API REST controller can be triggered via the following route:
/v1/messagethreads
Rest Request Parameters The
listMessageThreads
api has got no request parameters.
REST Request To access the api you can use the REST controller with the path GET /v1/messagethreads
axios({
method: 'GET',
url: '/v1/messagethreads',
data: {
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "messageThreads",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"messageThreads": [
{
"id": "ID",
"messageCount": "Integer",
"isOpen": "Boolean",
"guestId": "ID",
"lastMessageAt": "Date",
"listingId": "ID",
"hostId": "ID",
"reservationId": "ID",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"listingDets": [
{
"title": "String",
"address": "String",
"propertyType": "Enum",
"propertyType_idx": "Integer",
"location": "Object"
},
{},
{}
],
"rezDets": [
{
"bookingStatus": "Enum",
"bookingStatus_idx": "Integer",
"checkOut": "Date",
"checkIn": "Date"
},
{},
{}
]
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
Get Threadmessages
API
List messages in a thread (participants only, or admin). Sorted by sentAt ASC. Includes sender info for display.
Rest Route
The
getThreadMessages
API REST controller can be triggered via the following route:
/v1/threadmessages/:threadId
Rest Request Parameters
The
getThreadMessages
api has got 1 request parameter
| Parameter | Type | Required | Population |
|---|---|---|---|
| threadId | ID | true | request.params?.threadId |
| threadId : |
REST Request To access the api you can use the REST controller with the path GET /v1/threadmessages/:threadId
axios({
method: 'GET',
url: `/v1/threadmessages/${threadId}`,
data: {
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "messages",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"messages": [
{
"id": "ID",
"threadId": "ID",
"content": "Text",
"senderId": "ID",
"sentAt": "Date",
"messageType": "Enum",
"messageType_idx": "Integer",
"mediaUrl": "String",
"isModerated": "Boolean",
"isFlagged": "Boolean",
"flaggedBy": "ID",
"flagReason": "String",
"isRead": "Boolean",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": [],
"thread": {
"listingId": "ID"
},
"listing": {
"title": "String",
"amenityIds": "ID",
"mainPhoto": "String",
"photos": "String",
"address": "String",
"description": "Text"
},
"amenities": {}
}
Gotthread Messages
API
Rest Route
The
gotthreadMessages
API REST controller can be triggered via the following route:
/v1/gotthreadmessages/:threadId
Rest Request Parameters
The
gotthreadMessages
api has got 1 request parameter
| Parameter | Type | Required | Population |
|---|---|---|---|
| threadId | String | true | request.params?.threadId |
| threadId : This parameter will be used to select the data objects that want to be listed |
REST Request To access the api you can use the REST controller with the path GET /v1/gotthreadmessages/:threadId
axios({
method: 'GET',
url: `/v1/gotthreadmessages/${threadId}`,
data: {
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "messages",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"messages": [
{
"id": "ID",
"threadId": "ID",
"content": "Text",
"senderId": "ID",
"sentAt": "Date",
"messageType": "Enum",
"messageType_idx": "Integer",
"mediaUrl": "String",
"isModerated": "Boolean",
"isFlagged": "Boolean",
"flaggedBy": "ID",
"flagReason": "String",
"isRead": "Boolean",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
List Messagereports
API
List message reports. Reporter, admin, or (involved) sender may see. Admin sees all, others see those they filed or are involved in. Intended for moderation/admin panel and user reporting history.
Rest Route
The
listMessageReports
API REST controller can be triggered via the following route:
/v1/messagereports
Rest Request Parameters The
listMessageReports
api has got no request parameters.
REST Request To access the api you can use the REST controller with the path GET /v1/messagereports
axios({
method: 'GET',
url: '/v1/messagereports',
data: {
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "messageReports",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"messageReports": [
{
"id": "ID",
"reportedBy": "ID",
"reportReason": "String",
"moderationStatus": "Enum",
"moderationStatus_idx": "Integer",
"messageId": "ID",
"adminId": "ID",
"reportedAt": "Date",
"resolutionNotes": "Text",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
Create Messagereport
API
User files report on a message for abuse/moderation. Links to message & reporter. Sets status=pending, visible to reporter, admin, and message sender (for defense/appeal).
Rest Route
The
createMessageReport
API REST controller can be triggered via the following route:
/v1/messagereports
Rest Request Parameters
The
createMessageReport
api has got 7 request parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| reportedBy | ID | true | request.body?.reportedBy |
| reportReason | String | true | request.body?.reportReason |
| moderationStatus | Enum | true | request.body?.moderationStatus |
| messageId | ID | true | request.body?.messageId |
| adminId | ID | false | request.body?.adminId |
| reportedAt | Date | true | request.body?.reportedAt |
| resolutionNotes | Text | false | request.body?.resolutionNotes |
| reportedBy : User reporting this message. | |||
| reportReason : Reporter-supplied reason for report/abuse claim. | |||
| moderationStatus : Status of admin moderation/response. | |||
| messageId : Message being reported (abuse/inappropriate). | |||
| adminId : Admin assigned/reviewing this report (if any). | |||
| reportedAt : Datetime when report was filed. | |||
| resolutionNotes : Admin/moderator notes regarding outcome/resolution. |
REST Request To access the api you can use the REST controller with the path POST /v1/messagereports
axios({
method: 'POST',
url: '/v1/messagereports',
data: {
reportedBy:"ID",
reportReason:"String",
moderationStatus:"Enum",
messageId:"ID",
adminId:"ID",
reportedAt:"Date",
resolutionNotes:"Text",
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "messageReport",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"messageReport": {
"id": "ID",
"reportedBy": "ID",
"reportReason": "String",
"moderationStatus": "Enum",
"moderationStatus_idx": "Integer",
"messageId": "ID",
"adminId": "ID",
"reportedAt": "Date",
"resolutionNotes": "Text",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Update Messagereport
API
Admin moderator updates report: assign adminId, update status, add resolution notes. Only admin role allowed.
Rest Route
The
updateMessageReport
API REST controller can be triggered via the following route:
/v1/messagereports/:messageReportId
Rest Request Parameters
The
updateMessageReport
api has got 4 request parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| messageReportId | ID | true | request.params?.messageReportId |
| moderationStatus | Enum | false | request.body?.moderationStatus |
| adminId | ID | false | request.body?.adminId |
| resolutionNotes | Text | false | request.body?.resolutionNotes |
| messageReportId : This id paremeter is used to select the required data object that will be updated | |||
| moderationStatus : Status of admin moderation/response. | |||
| adminId : Admin assigned/reviewing this report (if any). | |||
| resolutionNotes : Admin/moderator notes regarding outcome/resolution. |
REST Request To access the api you can use the REST controller with the path PATCH /v1/messagereports/:messageReportId
axios({
method: 'PATCH',
url: `/v1/messagereports/${messageReportId}`,
data: {
moderationStatus:"Enum",
adminId:"ID",
resolutionNotes:"Text",
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "messageReport",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"messageReport": {
"id": "ID",
"reportedBy": "ID",
"reportReason": "String",
"moderationStatus": "Enum",
"moderationStatus_idx": "Integer",
"messageId": "ID",
"adminId": "ID",
"reportedAt": "Date",
"resolutionNotes": "Text",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Get Messagereport
API
Get a message report. Reporter, admin, or message sender may view report. Includes message, admin, and involved user info via selectJoins for moderation view.
Rest Route
The
getMessageReport
API REST controller can be triggered via the following route:
/v1/messagereports/:messageReportId
Rest Request Parameters
The
getMessageReport
api has got 1 request parameter
| Parameter | Type | Required | Population |
|---|---|---|---|
| messageReportId | ID | true | request.params?.messageReportId |
| messageReportId : This id paremeter is used to query the required data object. |
REST Request To access the api you can use the REST controller with the path GET /v1/messagereports/:messageReportId
axios({
method: 'GET',
url: `/v1/messagereports/${messageReportId}`,
data: {
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "messageReport",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"messageReport": {
"id": "ID",
"reportedBy": "ID",
"reportReason": "String",
"moderationStatus": "Enum",
"moderationStatus_idx": "Integer",
"messageId": "ID",
"adminId": "ID",
"reportedAt": "Date",
"resolutionNotes": "Text",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
After this prompt, the user may give you new instructions to update the output of this prompt or provide subsequent prompts about the project.