Skip to main content
POST
/
messages
Send Message
curl --request POST \
  --url https://{appId}.api-{region}.cometchat.io/v3/messages \
  --header 'Content-Type: application/json' \
  --header 'apikey: <api-key>' \
  --data '
{
  "receiver": "<string>",
  "muid": "<string>",
  "receiverType": "user",
  "category": "message",
  "type": "text",
  "data": {
    "text": "<string>",
    "metadata": {},
    "attachments": [
      {
        "url": "<string>",
        "name": "<string>",
        "mimeType": "<string>",
        "extension": "<string>",
        "size": "<string>"
      }
    ]
  },
  "multipleReceivers": {
    "uids": [
      "<string>"
    ],
    "guids": [
      "<string>"
    ]
  },
  "tags": [
    "<string>"
  ]
}
'
{
  "data": {
    "id": "1",
    "conversationId": "cometchat-uid-3_user_cometchat-uid-5",
    "sender": "cometchat-uid-3",
    "receiverType": "user",
    "receiver": "cometchat-uid-5",
    "category": "message",
    "type": "text",
    "data": {
      "text": "test     hello",
      "metadata": {
        "key1": "val1"
      },
      "entities": {
        "sender": {
          "entity": {
            "uid": "cometchat-uid-3",
            "name": "Nancy Grace",
            "avatar": "https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-3.webp",
            "status": "offline",
            "role": "default",
            "createdAt": 1638361550
          },
          "entityType": "user"
        },
        "receiver": {
          "entity": {
            "uid": "cometchat-uid-5",
            "name": "John Paul",
            "avatar": "https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-5.webp",
            "status": "offline",
            "role": "default",
            "createdAt": 1638361550,
            "conversationId": "cometchat-uid-3_user_cometchat-uid-5"
          },
          "entityType": "user"
        }
      }
    },
    "sentAt": 1638423490,
    "updatedAt": 1638423490
  }
}

Documentation Index

Fetch the complete documentation index at: https://www.cometchat.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

Constraints

ItemConstraintNotes
Maximum message size65 KB (~65,536 characters including metadata)Total size limit for the entire message payload
File size per message100 MBApplies to the uploaded file associated with the message
Message data object10 KB max (UTF8mb4)Keys with special meaning: text, attachments, customData, metadata
TagsUp to 25 tags, 100 characters each (UTF8mb4)Tags can be in any language
User mentionsUp to 10 distinct usersFormat: <@uid:{uid of the user}>
ReactionsMax 25 distinct reactions, 45 characters each (UTF8mb4)Emoji supported (may use multiple code points)
Unread message count (groups)Up to 300 membersNot updated for larger groups
Message receipts (groups)Up to 300 online usersDelivery/read receipts disabled in large groups
For the complete error reference, see Error Guide.

Authorizations

apikey
string
header
required

API Key with fullAccess scope(i.e. Rest API Key from the Dashboard).

Headers

onBehalfOf
string

UID of the user on whose behalf the action is performed.

Body

application/json
receiver
string

The receiver of the message.

muid
string

The muid will be a unique Identifier of the message.

receiverType
enum<string>

The receiverType of the message. either user or group

Available options:
user,
group
category
enum<string>
default:message

Category of the message. The available categories are message and custom.

Available options:
message
type
enum<string>
default:text

Type of the message. The available values are text, image, file, audio, video.

Available options:
text,
image,
file,
audio,
video
data
object

JSON containing message attributes.

multipleReceivers
object

JSON containing array of UIDs and GUID for whom the message must be sent. Format for multiple receivers - {"uids": ["uid1","uid2"], "guids":["guid1"]}

tags
string[]

A list of tags to identify specific messages.

Response

200 - application/json

Create Message

data
object