Get up and running with the Business Messaging API in under five minutes. This guide walks you through the three core steps: creating a delivery channel, designing a message template, and sending a notification.
You need your CometChat appId and apiKey before starting. Find them in the CometChat Dashboard.
Step 1: Create a channel
A channel defines how notifications are delivered — in-app, push, email, SMS, WhatsApp, or a custom transport.
curl -X POST https://{appId}.api-{region}.cometchat.io/v3/business-messaging/api/channels \
-H "appid: YOUR_APP_ID" \
-H "apikey: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "In-App Alerts",
"type": "in_app",
"templateType": "ui",
"enabled": true
}'
The response includes the channel id and a generated key slug. You’ll use the channel ID when creating templates.
Step 2: Create a template with variables
Templates define the content of your notifications. Link them to one or more channels and declare variables for per-user personalization.
curl -X POST https://{appId}.api-{region}.cometchat.io/v3/business-messaging/api/templates \
-H "appid: YOUR_APP_ID" \
-H "apikey: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Order Confirmation",
"channelIds": ["CHANNEL_ID"],
"variableSchema": {
"customerName": { "type": "string" },
"orderId": { "type": "string" },
"viewOrderUrl": { "type": "action" }
}
}'
Variables use {{placeholder}} syntax in your template content. The three variable types are string, image, and action.
After creating a template, set its status to approved before sending notifications. Draft templates cannot be used for delivery.
Step 3: Send a notification
Use the one-call send endpoint to deliver a personalized notification. Pass the template key, target users, and variable values.
curl -X POST https://{appId}.api-{region}.cometchat.io/v3/business-messaging/api/notifications/send \
-H "appid: YOUR_APP_ID" \
-H "apikey: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"template": {
"key": "order-confirmation",
"variables": {
"customerName": "Jane",
"orderId": "ORD-12345",
"viewOrderUrl": "https://example.com/orders/12345"
}
},
"targets": ["user-jane-123"],
"mode": "realtime",
"title": "Order Confirmed"
}'
The response returns a notificationId you can use for tracking.
What’s next?