Overview
The cshub Integration API is the external path for sending WhatsApp messages from your backend or automation tools. It uses a per-business Local API Key for authentication (matching the whatscrmhub Laravel behaviour). This endpoint is separate from the internal endpoints used by the cshub panel + mobile app.
Base URL
https://api.cshub.id/api/v1
Content-Type
application/json
Authentication
Auth uses a Local API Key inside the request body (`api_key` field), not an HTTP header. Each business has one Local API Key (UUID) that is generated automatically when the business is created.
No JWT, no token headers
Unlike the internal panel endpoints, you just put `api_key` in the body and the server resolves the business from there. Treat your Local API Key like a password โ never commit it to public repos or expose it in frontend code.
How to get the Local API Key
- Sign in to the cshub panel at /app.
- Open Settings โ API Key (or Profile โ Integration).
- Copy the Local API Key. You can regenerate it anytime โ the old key becomes invalid immediately.
Endpoint
A single endpoint covers every WhatsApp Unofficial (whatsmeow) send. Pick method = text for free-form messages, or method = template to send a template you already configured in the panel.
https://api.cshub.id/api/v1/integration/whatsapp/send-message
Auth
Local API Key in body (`api_key`)
Rate limit
Per-device (follows device daily_send limit)
Body fields
Body is JSON. Fields below are parity with whatscrmhub Laravel โ migrating from the older version, the request shape is identical.
| Field | Type | Required | Description |
|---|---|---|---|
| api_key | string | โ | Per-business Local API Key (UUID). Grab it from Settings in the cshub panel. |
| phone | string | โ | Recipient phone in international format without "+" (e.g. 6281234567890), or a group JID when `is_group` is true. |
| method | string | โ | text, template |
| text | string | method=text | Message body. Required when method = text. |
| template | string | method=template | Message Template ID created in the cshub panel. Required when method = template. |
| variables | object | โ | Literal `{placeholder: value}` object for template substitution. Example: `{"$name":"Budi"}` replaces every `$name` in the template message with "Budi". |
| device_key | string | depends * | UUID of the WhatsApp device to send from. |
| is_group | boolean | โ | Set true if `phone` is a group JID (e.g. 120363...@g.us). |
Request examples
1. Send a simple text message
curl -X POST "https://api.cshub.id/api/v1/integration/whatsapp/send-message" \
-H "Content-Type: application/json" \
-d '{
"api_key": "<LOCAL_API_KEY>",
"device_key": "<DEVICE_ID>",
"phone": "6281234567890",
"method": "text",
"text": "Halo, makasih udah order ya!"
}'
2. Send a template with variable substitution
curl -X POST "https://api.cshub.id/api/v1/integration/whatsapp/send-message" \
-H "Content-Type: application/json" \
-d '{
"api_key": "<LOCAL_API_KEY>",
"device_key": "<DEVICE_ID>",
"phone": "6281234567890",
"method": "template",
"template": "<TEMPLATE_ID>",
"variables": {
"$name": "Pak Budi",
"$order_id": "INV-20260602-001"
}
}'
3. Send to a group (use group JID)
curl -X POST "https://api.cshub.id/api/v1/integration/whatsapp/send-message" \
-H "Content-Type: application/json" \
-d '{
"api_key": "<LOCAL_API_KEY>",
"device_key": "<DEVICE_ID>",
"phone": "120363012345678901@g.us",
"method": "text",
"text": "Pengumuman: order minggu ini ditutup pukul 17:00.",
"is_group": true
}'
Success response (200 OK)
{
"status": true,
"message": "berhasil mengirim pesan"
}
Error codes & fixes
| Status | Cause | Fix |
|---|---|---|
| 401 | Api Key Cannot be recognized | Verify the api_key is correct (copy again from the panel) and the business is not suspended. |
| 401 | Device tidak di temukan | Check device_key is valid and the device is active. Re-pair the device via QR/pair code in the panel if needed. |
| 401 | Template tidak dikenali | Verify the template ID is correct and belongs to your business (template list lives in panel โ Master Data โ Templates). |
| 422 | Daily send limit habis | Wait for the daily reset (00:00 WIB) or switch to another device. Raise the limit_per_day on the device if needed. |
| 422 | Validation gagal (phone/method/text) | Ensure phone is international format without "+" and method is one of text/template. |
| 502 | WhatsApp service unavailable | WhatsApp service is down. Retry in a few minutes or check the device status in the panel. |
Notes & limits
- There is a daily_send limit per device. Avoid blasting more than ~10 messages/second from a single device to avoid WhatsApp bans.
- If your business has `api_device_use = required`, the `device_key` field is mandatory. With it optional, the server picks an active device based on the `whatsapp_sender_notif` setting (`sequence` / `spin` / `random`).
- Variable substitution uses literal `str_replace` โ placeholders can be any string (e.g. `$name`, `{name}`, `[NAME]`). It just needs to match the text inside the template message exactly.
- Always format without "+" and without spaces/dashes. Example: 6281234567890 (Indonesia), 60123456789 (Malaysia). For groups, use the full JID with the `@g.us` suffix.
- MVP iteration: binary file upload via multipart/form-data is not supported yet. To send media, use method=template with a template that already has an image configured in the panel.
Integration API vs Internal Panel API
cshub deliberately keeps two send-message paths. The Integration API is for third-party developers and automation; the Internal API powers the cshub web panel and mobile app. Different audience, different auth, different response shape.
| Integration API | Internal Panel API | |
|---|---|---|
| Audience | Backend developers, Zapier, n8n, custom integrations | cshub-fe web panel, cshub-mobile app |
| URL | /integration/whatsapp/send-message | /app/device/{id}/chats/send |
| Auth | api_key di body | JWT Bearer + X-Business-ID + CSRF |
| Response shape | {status, message} | {success, message, data} |
Ready to integrate?
Sign in to the cshub panel, grab your Local API Key from Settings, and start sending WhatsApp from your system.