Send & Receive Message
Description
Section titled “Description”wss message
So, it’s pretty simple: it makes a message on the server and sends it to everyone else.
Request Parameters
Section titled “Request Parameters”Name | Type | Description |
---|---|---|
id | string | Identifier of the message |
cid | string | Conversation ID the message belongs to |
x | object | Optional extra parameters for the message |
body | string | Text content of the message |
attachments | array[object] | List of attachments (files, images, etc.) |
replied_message_id | string | ID of the message being replied to (optional) |
forwarded_message_id | string | ID of the message being forwarded (optional) |
deleted_for | array[string] | List of user IDs for whom the message is deleted (optional) |
Required: either body
or attachments
Response Fields
Section titled “Response Fields”On each message sent to server - a server will deliver back to client a simple packet with message id and timestamp at which the message was stored in DB so both sender & recipient will have same date sent time stored:
{ ack: { mid: "63480e68f4794709f802a2fa", server_mid: "63480e68f4794709f802a2fa", t: 15673838833, modified: { body: "new body", ... } }}
Example
Section titled “Example”{ "message": { "id": "5а34p21m0xj23", "body": "hey how is going?", "cid": "63480e68f4794709f802a2fa", "x": { "param1": "value", "param2": "value" }, "attachments": [{ "file_id": "15c64c2b988f13a2d821d76c", "file_name": "image_6.png", "file_blur_hash": "U27nLE$*00_N^k,@s9xu#7$2$%xtVD-B-pkW", "file_content_type": "image/png", "file_width": 370, "file_height": 754 }, { "file_id": "15c64c2b988f13a2d821d86s", "file_name": "video_1.png", "file_content_type": "image/video", "file_width": 589, "file_height": 354 }, ... ] }}
All conversation’s participants who is online will receive the following message in real-time:
{ "message": { "_id": "63480e68f4794709f802a2fa", "t": 15673838833, "from": "634ec51c0b65918393dca5bf", "body": "hey how is going?", "cid": "63480e68f4794709f802a2fa", "x": { "param1": "value", "param2": "value" }, "attachments": [{ "file_id": "15c64c2b988f13a2d821d76c", "file_name": "image_6.png", "file_blur_hash": "U27nLE$*00_N^k,@s9xu#7$2$%xtVD-B-pkW", "file_content_type": "image/png", "file_width": 370, "file_height": 754 }, { "file_id": "15c64c2b988f13a2d821d86s", "file_name": "video_1.png", "file_content_type": "image/video", "file_width": 589, "file_height": 354 }, ... ] "created_at": "2025-08-13T05:51:44.733Z", }}
Additionally, all conversation’s participants who is offline will receive the following push notification:
{ "title": "UserName", "body": "MessageText", "firstAttachmentUrl": "url", "cid": "63480e68f4794709f802a2fa"}
All offline participants can retrieve the messages via below List messages
API.
See Also
Section titled “See Also” SAMA chat server API: Messages Based on ease of use, and with easy-to-understand documentation and articles on how to set up and use our APIs, we want to show that it is REAL to build communication into your application.
DataBase Records Collection of complete objects stored in the database.