API Reference
This page covers general information about the Message Center API, including error handling, standards and business logic.
Error Handling
The API uses standard HTTP status codes to indicate whether a request was successful or failed.
- 401 Unauthorized: Your HMAC signature is invalid or missing. Please check the authentication headers.
- 404 Not Found: The requested resource (e.g., a Chat or Order) could not be found.
- 422 Unprocessable Entity: The request Body is invalid. The response will contain details about the validation errors.
Example 422 Validation Error:
{
"status": "error",
"message": "Validation failed",
"errors": {
"message": [
"The message field is required."
]
}
}
Standards
- Request and response format: All API requests and responses are expected to use the JSON format, except in cases where
multipart/form-datais explicitly required (e.g., for file uploads). - URL encoding: All URLs must be properly encoded to ensure safe and accurate transmission of parameters.
- Date and time format: All date and time values follow the
RFC 3339standard, e.g.,2019-10-12T07:20:50.52+00:00.
Appendix
Automatic ‘Mark as Seen’ Behavior
When a Seller interacts with Chat’s Messages, any unread messages from the BUYER within that Chat are automatically marked as read/seen.
This behavior includes the following actions:
In both cases, the seenAt field for all messages where senderUserType is BUYER and seenAt is null will be updated to the current timestamp.
Additionally, the Chat’s isSeen field will be set to true.
Chat Business Rules
- A
Chatis unique for eachorganization.id,order.id, andcategory.idcombination. - Sellers and Buyers are notified by email when new unread messages are available.
- Sellers are also notified by email when a Chat reaches
OVER_SLAstatus.
CLOSED Status Flow
-
A
Chatcan transition toCLOSEDin two ways:- The
BUYERmanually sets the Chat as resolved (CLOSED). - The system automatically sets the Chat to
CLOSEDafter 72 hours of inactivity.
- The
-
When a reply is sent to a
CLOSEDChat, the Chat reopens and its status changes toWAITING_FOR_BUYERorWAITING_FOR_SELLER, depending on thesenderUserType. If no further reply is sent, the system automatically sets the Chat toCLOSEDagain after another 72 hours of inactivity.