Send Message
Description
Section titled “Description”POST /admin/message
Sends a message to a specific conversation. The message can include text, attachments, and optional metadata. All online participants of the conversation will receive the message in real-time.
Authorization
Section titled “Authorization”{ Admin-Api-Key: {{ HTTP_ADMIN_API_KEY }} }
Request
Section titled “Request”Content-Type: application/json
{ "organizationId": "680a2fae96cc69d78861f101", "senderId": "63480e68f4794709f802a2fa", "message": { "id": "5а34p21m0xj23", "body": "hey how is going?", "cid": "63480e68f4794709f802a2fa", "x": { "param1": "value", "param2": "value" }, "attachments": [ { "name": "file_1", "size": 240, "content_type": "type" }, { "name": "file_2", "size": 126, "content_type": "type" } ] }}
Request Parameters
Section titled “Request Parameters”Field | Type | Description |
---|---|---|
organizationId | string | OrganizationId performing request |
senderId | string | User ID of the sender |
message.id | string | Unique message ID received from the server** (i.e., server_mid from a previous response), used for tracking and acknowledgment |
message.body | string | The message text |
message.cid | string | Conversation ID the message belongs to |
message.x | object | Custom parameters, e.g. { "new_friend_connected": true } |
message.attachments | array of object | Array of attachment metadata |
Successful Response
Section titled “Successful Response”{ "ask": { "mid": "5а34p21m0xj23", "server_mid": "63480e68f4794709f802a2fd", "t": 15673838834 }}
Real-time Message
Section titled “Real-time Message”Broadcasted to Online Participants
{ "message": { "_id": "63480e68f4794709f802a2fa", "t": 15673838833, "from": "634ec51c0b65918393dca5bf", "body": "hey how is going?", "cid": "63480e68f4794709f802a2fa", "x": { "param1": "value", "param2": "value" }, "attachments": [ { "file_id": "123123_file_1", "file_name": "file_1" }, { "file_id": "653534_file_2", "file_name": "file_2" } ], "created_at": "2023-07-04T07:23:53.308Z" }}