CloudChat
API Developer

Dokumentasi API V.1.0

Unified Developer API — integrasikan WhatsApp, Telegram, Messenger, dan Instagram ke aplikasi Anda menggunakan satu API tunggal yang terpadu. Kelola percakapan, kirim broadcast, dan handle webhook dengan mudah.

Rate Limits 60 requests / menit / App
Base URL https://app.cloudchat.id/api/public/v1
Protocols HTTPS (TLS 1.2+) & JSON
Channels WhatsApp · Telegram · IG · FB

Overview

CloudChat menyediakan REST API terpadu untuk mengelola percakapan dari berbagai channel chat populer. Satu API key, banyak channel, satu inbox.

WhatsApp Unofficial & Cloud API
Telegram Bot API
Messenger Page Inbox
Instagram DM API

Authentication

Authenticate request menggunakan header Authorization dengan API Key Anda.

Keep your API Key secret!

Jangan share di client-side code (browser/aplikasi). Jika kompromised, generate ulang di App Settings.

Authorization: Bearer sk_live_xxxxxxxxxxxxxxxxxxxxxxxx

Send Messages

Kirim pesan teks atau media ke channel apa pun yang didukung. Sistem otomatis menangani logic per-channel.

POST /api/public/v1/messages
<?php
$curl = curl_init();
curl_setopt_array($curl, [
  CURLOPT_URL => 'https://app.cloudchat.id/api/public/v1/messages',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_POST => true,
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer sk_live_xxxxxxxxxxxxxxxxxxxxxxxx',
    'Content-Type: application/json',
  ],
  CURLOPT_POSTFIELDS => json_encode([
    'channel'  => 'whatsapp',
    'to'       => '6281234567890',
    'type'     => 'text',
    'text'     => 'Halo dari CloudChat API!',
  ]),
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
// Node.js (axios)
import axios from 'axios';

const res = await axios.post(
  'https://app.cloudchat.id/api/public/v1/messages',
  {
    channel: 'whatsapp',
    to:      '6281234567890',
    type:    'text',
    text:    'Halo dari CloudChat API!',
  },
  {
    headers: {
      Authorization: 'Bearer sk_live_xxxxxxxxxxxxxxxxxxxxxxxx',
      'Content-Type': 'application/json',
    },
  }
);
console.log(res.data);

Webhooks

Daftarkan URL webhook untuk menerima event real-time saat pesan masuk, status berubah, dll.

1. Event Payload

Contoh payload event pesan masuk:

{
  "event": "message.received",
  "id": "evt_123456",
  "timestamp": 1700000000,
  "channel": "whatsapp",
  "session_id": "uuid-session-001",
  "data": {
    "from":     "6281234567890",
    "pushName": "John Doe",
    "text":     "Halo, saya tertarik produk Anda",
    "media":    null
  }
}

2. Verifikasi Webhook

Setiap event mengandung header X-CloudChat-Signature berupa HMAC-SHA256 dari body. Verifikasi sebelum memproses event di server Anda.

3. Retry Policy

  • Kami expect respons 200 OK dalam 5 detik.
  • Jika server Anda fail (5xx) atau timeout, kami retry 3 kali.
  • Retries menggunakan exponential backoff: 2s, 4s, 8s.

Error Reference

Semua error mengikuti format JSON konsisten dengan kode dan pesan jelas.

CodeNameDescription
400Bad RequestBody tidak valid atau parameter wajib hilang.
401UnauthorizedAPI key tidak valid atau hilang.
403ForbiddenAkses ditolak — periksa scope key Anda.
404Not FoundResource tidak ditemukan.
429Rate LimitMelebihi 60 req/min — terapkan exponential backoff.
500Server ErrorInternal server error — coba ulang dengan backoff.
Butuh dukungan developer?

Email kami di care@cloudchat.id atau hubungi via Pusat Bantuan.