AIRBNB
FRONTEND GUIDE FOR AI CODING AGENTS - PART 7 - 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"
}
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 | Secret | Description |
|---|---|---|---|---|---|
messageCount |
Integer | false | Yes | No | - |
isOpen |
Boolean | false | Yes | No | - |
guestId |
ID | false | Yes | No | - |
lastMessageAt |
Date | false | Yes | No | - |
listingId |
ID | false | No | No | - |
hostId |
ID | false | Yes | No | - |
reservationId |
ID | false | No | No | - |
- 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 | Secret | Description |
|---|---|---|---|---|---|
reportedBy |
ID | false | Yes | No | - |
reportReason |
String | false | Yes | No | - |
moderationStatus |
Enum | false | Yes | No | - |
messageId |
ID | false | Yes | No | - |
adminId |
ID | false | No | No | - |
reportedAt |
Date | false | Yes | No | - |
resolutionNotes |
Text | false | No | No | - |
- 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 | Secret | Description |
|---|---|---|---|---|---|
threadId |
ID | false | Yes | No | - |
content |
Text | false | Yes | No | - |
senderId |
ID | false | Yes | No | - |
sentAt |
Date | false | Yes | No | - |
messageType |
Enum | false | Yes | No | - |
mediaUrl |
String | false | No | No | - |
isModerated |
Boolean | false | Yes | No | - |
isFlagged |
Boolean | false | Yes | No | - |
flaggedBy |
ID | false | No | No | - |
flagReason |
String | false | No | No | - |
isRead |
Boolean | false | Yes | No | - |
- 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
Default CRUD APIs
For each data object, the backend architect may designate default APIs for standard operations (create, update, delete, get, list). These are the APIs that frontend CRUD forms and AI agents should use for basic record management. If no default is explicitly set (isDefaultApi), the frontend generator auto-discovers the most general API for each operation.
MessageThread Default APIs
| Operation | API Name | Route | Explicitly Set |
|---|---|---|---|
| Create | createMessageThread |
/v1/messagethreads |
Auto |
| Update | updateMessageThread |
/v1/messagethreads/:messageThreadId |
Auto |
| Delete | deleteMessageThread |
/v1/messagethreads/:messageThreadId |
Auto |
| Get | getMessageThread |
/v1/messagethreads/:messageThreadId |
Auto |
| List | listMessageThreads |
/v1/messagethreads |
Auto |
MessageReport Default APIs
| Operation | API Name | Route | Explicitly Set |
|---|---|---|---|
| Create | createMessageReport |
/v1/messagereports |
Auto |
| Update | updateMessageReport |
/v1/messagereports/:messageReportId |
Auto |
| Delete | none | - | Auto |
| Get | getMessageReport |
/v1/messagereports/:messageReportId |
Auto |
| List | listMessageReports |
/v1/messagereports |
Auto |
Message Default APIs
| Operation | API Name | Route | Explicitly Set |
|---|---|---|---|
| Create | createMessage |
/v1/messages |
Auto |
| Update | updateMessage |
/v1/messages/:messageId |
Auto |
| Delete | deleteMessage |
/v1/messages/:messageId |
Auto |
| Get | getMessage |
/v1/messages/:messageId |
Auto |
| List | getThreadMessages |
/v1/threadmessages/:threadId |
Auto |
When building CRUD forms for a data object, use the default create/update APIs listed above. The form fields should correspond to the API’s body parameters. For relation fields, render a dropdown loaded from the related object’s list API using the display label property.
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 regular 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 regular 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 : | |||
| isOpen : | |||
| guestId : | |||
| lastMessageAt : | |||
| listingId : | |||
| hostId : | |||
| reservationId : |
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 regular 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 : | |||
| mediaUrl : | |||
| isModerated : | |||
| isFlagged : | |||
| flaggedBy : | |||
| flagReason : | |||
| isRead : |
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 regular 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 : | |||
| isOpen : | |||
| lastMessageAt : | |||
| listingId : | |||
| reservationId : |
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 regular 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 regular 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 : | |||
| content : | |||
| senderId : | |||
| sentAt : | |||
| messageType : | |||
| mediaUrl : | |||
| isModerated : | |||
| isFlagged : | |||
| flaggedBy : | |||
| flagReason : |
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 regular 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 regular 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 regular 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": {},
"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 regular request parameter
| Parameter | Type | Required | Population |
|---|---|---|---|
| threadId | ID | true | request.params?.[“threadId”] |
| threadId : undefined. The parameter is used to query data. |
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 regular 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 : | |||
| reportReason : | |||
| moderationStatus : | |||
| messageId : | |||
| adminId : | |||
| reportedAt : | |||
| resolutionNotes : |
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 regular 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 : | |||
| adminId : | |||
| resolutionNotes : |
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 regular 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.