Integration API ยท WhatsApp Unofficial

Send WhatsApp via Integration API

A stateless endpoint to send WhatsApp messages from your app or system using a Local API Key โ€” no JWT, no login flow. Built for backend integrations, automation tools (Zapier/n8n), or custom webhooks.

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

  1. Sign in to the cshub panel at /app.
  2. Open Settings โ†’ API Key (or Profile โ†’ Integration).
  3. 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.

POST 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_keystringโœ…Per-business Local API Key (UUID). Grab it from Settings in the cshub panel.
phonestringโœ…Recipient phone in international format without "+" (e.g. 6281234567890), or a group JID when `is_group` is true.
methodstringโœ…text, template
textstringmethod=textMessage body. Required when method = text.
templatestringmethod=templateMessage Template ID created in the cshub panel. Required when method = template.
variablesobjectโ€”Literal `{placeholder: value}` object for template substitution. Example: `{"$name":"Budi"}` replaces every `$name` in the template message with "Budi".
device_keystringdepends *UUID of the WhatsApp device to send from.
is_groupbooleanโ€”Set true if `phone` is a group JID (e.g. 120363...@g.us).

Request examples

1. Send a simple text message

cURL
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
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
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)

200 OK
{
  "status": true,
  "message": "berhasil mengirim pesan"
}

Error codes & fixes

Status Cause Fix
401Api Key Cannot be recognizedVerify the api_key is correct (copy again from the panel) and the business is not suspended.
401Device tidak di temukanCheck device_key is valid and the device is active. Re-pair the device via QR/pair code in the panel if needed.
401Template tidak dikenaliVerify the template ID is correct and belongs to your business (template list lives in panel โ†’ Master Data โ†’ Templates).
422Daily send limit habisWait for the daily reset (00:00 WIB) or switch to another device. Raise the limit_per_day on the device if needed.
422Validation gagal (phone/method/text)Ensure phone is international format without "+" and method is one of text/template.
502WhatsApp service unavailableWhatsApp 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
AudienceBackend developers, Zapier, n8n, custom integrationscshub-fe web panel, cshub-mobile app
URL/integration/whatsapp/send-message/app/device/{id}/chats/send
Authapi_key di bodyJWT 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.