Skip to main content
POST
/
notifications
/
messages
Send a notification using a template
curl --request POST \
  --url https://{appId}.api-{region}.cometchat.io/v3/campaigns/notifications/messages \
  --header 'Content-Type: application/json' \
  --header 'apikey: <api-key>' \
  --header 'appid: <appid>' \
  --data '
{
  "templateId": "order_update",
  "receivers": [
    "<string>"
  ],
  "variables": {
    "user_42": {
      "user_name": "John",
      "order_id": "12345"
    },
    "user_43": {
      "user_name": "Sarah",
      "order_id": "12346"
    }
  },
  "tag": "<string>"
}
'

Authorizations

apikey
string
header
required

Your CometChat REST API Key.

Headers

appid
string
required

Tenant application ID

Body

application/json
templateId
string
required

Template CUID or templateId slug. Template must be in approved status.

Example:

"order_update"

receivers
string[]
required

Array of target user IDs. 1–10 = realtime (synchronous, returns notificationId immediately). 11–10,000 = batch (asynchronous, returns batchId; processing happens via queue).

Required array length: 1 - 10000 elements
variables
object

Per-user variables. Keyed by userId; values are { variableName: value } objects. Variables are applied to the template content at delivery time.

Example:
{
"user_42": { "user_name": "John", "order_id": "12345" },
"user_43": { "user_name": "Sarah", "order_id": "12346" }
}
tag
string

Optional analytics tag attached to the send (passes through to delivery records).

Response

Realtime: { notificationId, channels[], mode: "realtime" }. Batch: { batchId, total, channels[], mode: "batch" }.