### Response example for GET /api/agency/packages Source: https://docs.starsender.online/docs/agency-api/list-paket Shows the JSON structure returned by the API. The data field is empty in this example, but the message indicates success. ```json { "success": true, "data": {}, "message": "Success to get agency packages" } ``` -------------------------------- ### E-commerce Integration Webhook Example (PHP) Source: https://docs.starsender.online/docs/message-api/kirim-rotator PHP example for a webhook receiver that triggers on new orders, builds messages with delay, and sends them via the rotator API with round_robin mode and multiple devices. ```php // Webhook receiver: trigger saat ada order baru $customers_to_notify = [ ["nomor" => "08111222333", "nama" => "Andi", "produk" => "Kemeja Batik"], ["nomor" => "08111222334", "nama" => "Budi", "produk" => "Sepatu Casual"], // ... bisa ratusan ]; $messages = []; foreach ($customers_to_notify as $c) { $messages[] = [ "to" => $c["nomor"], "body" => "Halo {$c['nama']}, terima kasih sudah order {$c['produk']}! Pesanan akan diproses 1x24 jam.", "delay" => 30, ]; } $payload = [ "mode" => "round_robin", "devices" => [ ["device_id" => 1641, "limit" => 100], ["device_id" => 42800, "limit" => 100], ["device_id" => 53921, "limit" => 100], ], "messages" => $messages, ]; // Kirim via API dengan Authorization User Token ``` -------------------------------- ### API response example for listing WhatsApp groups Source: https://docs.starsender.online/docs/whatsapp-api/list-group-whatsapp Shows the JSON response returned by the endpoint when the request is successful. The data field is empty in this example, and the message confirms the operation. ```json { "success": true, "data": {}, "message": "Success to get whatsapp groups" } ``` -------------------------------- ### PHP cURL implementation for GET /api/agency/packages Source: https://docs.starsender.online/docs/agency-api/list-paket Uses cURL to send a GET request to the agency packages endpoint. Requires an API key in the Authorization header. Outputs the raw response. ```php 'https://api.starsender.online/api/agency/packages', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => array( 'Content-Type:application/json', 'Authorization: YOUR API KEY' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ``` -------------------------------- ### Success Response Example Source: https://docs.starsender.online/docs/message-api/kirim-rotator Example JSON response when the rotator API successfully distributes messages. Shows the round_robin mode, distribution details per device, and message IDs. ```json { "success": true, "message": "Distributed 2 messages to 2 devices via round_robin mode", "data": { "mode": "round_robin", "total_messages": 2, "distribution": [ { "device_id": 1641, "device_name": "server wa", "count": 1, "limit": 50 }, { "device_id": 42800, "device_name": "marketing 1", "count": 1, "limit": 50 } ], "messages": [ { "message_id": 265612345, "to": "628123456789", "device_id": 1641, "device_name": "server wa" }, { "message_id": 265612346, "to": "628987654321", "device_id": 42800, "device_name": "marketing 1" } ] } } ``` -------------------------------- ### PHP: Mengambil detail device dengan cURL Source: https://docs.starsender.online/docs/device-api/detail-device Contoh implementasi PHP menggunakan cURL untuk memanggil endpoint GET /api/devices/{id}. Ganti 'YOUR API KEY' dengan kunci API dari menu profile. Variabel $idDevice harus diisi dengan ID device yang diinginkan. ```php 'https://api.starsender.online/api/devices/'.$idDevice, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => array( 'Content-Type:application/json', 'Authorization: YOUR API KEY' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ``` -------------------------------- ### GET /api/devices Source: https://docs.starsender.online/docs/device-api/list-device Endpoint untuk mengambil daftar device. Memerlukan header Authorization dengan API key. Mengembalikan respon JSON dengan status sukses dan data device. ```APIDOC ## GET /api/devices ### Description API untuk mengambil list device. ### Method GET ### Endpoint https://api.starsender.online/api/devices ### Parameters #### Header Parameters - **Authorization** (string) - Required - Account API key, anda bisa dapatkan di menu profile ### Request Example ```php 'https://api.starsender.online/api/devices', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => array( 'Content-Type:application/json', 'Authorization: YOUR API KEY' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ``` ### Response #### Success Response - **success** (boolean) - Status keberhasilan - **data** (object) - Data device - **message** (string) - Pesan sukses #### Response Example ```json { "success": true, "data": {}, "message": "Success to get devices" } ``` ``` -------------------------------- ### Error Response: Device Not Found or Not Owned Source: https://docs.starsender.online/docs/message-api/kirim-rotator Example error response when a device ID is not found or does not belong to the user. The message includes the device ID. ```json { "success": false, "message": "Device not found or not owned by user: 9999", "data": {} } ``` -------------------------------- ### API Response: Success to get blacklist Source: https://docs.starsender.online/docs/chat-gpt-api/list-blacklist Example JSON response from the blacklist endpoint. Contains a success flag, the blacklist array with record details, total_records, and a success message. ```json { "success": true, "data": { "blacklist": [ { "id": 1, "chat_gpt_id": 1, "number": "6281234567890", "user_id": 1, "created_at": 1234567890000, "updated_at": 1234567890000 } ], "total_records": 1 }, "message": "Success to get blacklist" } ``` -------------------------------- ### PHP cURL implementation for Relog Device Source: https://docs.starsender.online/docs/device-api/relog-device PHP example using cURL to call the Relog Device endpoint. Set $idDevice to the target device ID and replace 'YOUR API KEY' with your account API key from the profile menu. The response is printed with echo. ```php 'https://api.starsender.online/api/devices/'.$idDevice.'/relog', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => json_encode($pesan), CURLOPT_HTTPHEADER => array( 'Content-Type:application/json', 'Authorization: YOUR API KEY' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ``` -------------------------------- ### Implementasi PHP untuk List Device Source: https://docs.starsender.online/docs/device-api/list-device Contoh kode PHP menggunakan cURL untuk memanggil endpoint GET /api/devices. Header Authorization harus diisi dengan API key dari menu profile. Output adalah respon JSON dari API. ```php 'https://api.starsender.online/api/devices', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => array( 'Content-Type:application/json', 'Authorization: YOUR API KEY' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ``` -------------------------------- ### PHP cURL untuk GET /api/groups Source: https://docs.starsender.online/docs/contact-api/list-group-kontak Implementasi PHP menggunakan cURL untuk memanggil endpoint GET https://api.starsender.online/api/groups. Header Authorization harus diisi dengan API key dari menu profile. Output dari respon API akan dicetak dengan echo. ```php 'https://api.starsender.online/api/groups', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => array( 'Content-Type:application/json', 'Authorization: YOUR API KEY' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ``` -------------------------------- ### Respon API untuk GET /api/groups Source: https://docs.starsender.online/docs/contact-api/list-group-kontak Contoh respon JSON yang dikembalikan oleh endpoint GET /api/groups. Menunjukkan struktur respon dengan properti success, data, dan message. ```json { "success": true, "data": {}, "message": "Success to get contact group lists" } ``` -------------------------------- ### API response for message detail Source: https://docs.starsender.online/docs/message-api/detail-pesan Example JSON response returned by the endpoint. It includes success flag, data object, and a success message. ```json { "success": true, "data": {}, "message": "Success to get message detail" } ``` -------------------------------- ### GET /api/agency/packages Source: https://docs.starsender.online/docs/agency-api/list-paket Retrieves the list of agency packages. Requires an API key in the Authorization header. ```APIDOC ## GET /api/agency/packages ### Description Retrieves the list of agency packages. ### Method GET ### Endpoint https://api.starsender.online/api/agency/packages ### Parameters #### Header Parameters - **Authorization** (string) - Required - Account API key, available in the profile menu. ### Request Example ```php 'https://api.starsender.online/api/agency/packages', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => array( 'Content-Type:application/json', 'Authorization: YOUR API KEY' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **data** (object) - The agency packages data. - **message** (string) - Success message. #### Response Example ```json { "success": true, "data": {}, "message": "Success to get agency packages" } ``` ``` -------------------------------- ### API response example for successful send Source: https://docs.starsender.online/docs/grup-api/kirim-pesan Shows the JSON response returned by the API after a successful message send. Contains success flag, data object, and message string. ```json { "success": true, "data": {}, "message": "Success sent message" } ``` -------------------------------- ### Ambil Status Koneksi Device dengan PHP (GET /api/devices) Source: https://docs.starsender.online/docs/device-api/create-dan-scan-device Mengambil daftar device dan menampilkan status koneksi untuk device yang namanya cocok dengan 'Device Tes'. Gunakan setelah membuat device untuk memeriksa status koneksi. ```php "Device Tes" ]; $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://api.starsender.online/api/devices', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => array( 'Content-Type:application/json', 'Authorization: YOUR API KEY' ), )); $response = curl_exec($curl); curl_close($curl); $res = json_decode($response, true); foreach ($res['data']['devices'] as $objek=>$device) { if($device['name'] == $pesan['name']) echo "Status koneksi device {$pesan['name']} dengan id {$device['id']} adalah {$device['status']}"; } ``` -------------------------------- ### Error Response: Invalid API Key Source: https://docs.starsender.online/docs/message-api/kirim-rotator Example error response when the API key is invalid. Returns success false and an empty data object. ```json { "success": false, "message": "Invalid API Key", "data": {} } ``` -------------------------------- ### GET /api/devices/{id} Source: https://docs.starsender.online/docs/device-api/detail-device Retrieves the details of a specific device by its ID. Requires an API key in the Authorization header and the device ID as a path parameter. ```APIDOC ## GET /api/devices/{id} ### Description Retrieves the details of a specific device by its ID. Requires an API key in the Authorization header and the device ID as a path parameter. ### Method GET ### Endpoint `https://api.starsender.online/api/devices/{id}` ### Parameters #### Header Parameters - **Authorization** (string) - Required - Account API key, available in the profile menu. #### Path Parameters - **id** (integer) - Required - ID of the device. ### Request Example ```php 'https://api.starsender.online/api/devices/'.$idDevice, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => array( 'Content-Type:application/json', 'Authorization: YOUR API KEY' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **data** (object) - Device details. - **message** (string) - Success message. #### Response Example ```json { "success": true, "data": {}, "message": "Success to get device detail" } ``` ``` -------------------------------- ### PHP: list_blacklist.php - GET ChatGPT blacklist Source: https://docs.starsender.online/docs/chat-gpt-api/list-blacklist PHP cURL script to call the blacklist endpoint with limit and page query parameters. Requires the device API key in the Authorization header. The device must be linked to ChatGPT, otherwise the API returns 'No ChatGPT linked to this device'. ```php 'https://api.starsender.online/api/chat-gpt/blacklist?limit=10&page=1', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', 'Authorization: YOUR_DEVICE_KEY' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ``` -------------------------------- ### PHP cURL implementation for listing WhatsApp groups Source: https://docs.starsender.online/docs/whatsapp-api/list-group-whatsapp Use this PHP script to call the GET /api/whatsapp/groups endpoint. It sets the Authorization header with your device API key and outputs the response. Replace 'YOUR API KEY' with your actual key. ```php 'https://api.starsender.online/api/whatsapp/groups', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => array( 'Content-Type:application/json', 'Authorization: YOUR API KEY' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ``` -------------------------------- ### Implementasi PHP untuk Tambah Blacklist ChatGPT Source: https://docs.starsender.online/docs/chat-gpt-api/tambah-blacklist Contoh kode PHP menggunakan cURL untuk mengirim POST request ke endpoint blacklist. Ganti 'YOUR_DEVICE_KEY' dengan Device API key dari menu Device -> Detail -> Device Key. Nomor contoh '08123456789' dapat diganti dengan nomor WhatsApp yang akan diblacklist. ```php "08123456789" ]; curl_setopt_array($curl, array( CURLOPT_URL => 'https://api.starsender.online/api/chat-gpt/blacklist', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => json_encode($data), CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', 'Authorization: YOUR_DEVICE_KEY' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ``` -------------------------------- ### Buat Device dan Scan QR dengan PHP (POST /api/devices/create/scan) Source: https://docs.starsender.online/docs/device-api/create-dan-scan-device Membuat device baru dan menampilkan QR code dari respons API. Ganti 'YOUR API KEY' dengan kunci API dari menu profile. Jika berhasil, respons berisi kode_gambar base64; jika gagal, tampilkan pesan error. ```php "Device Tes" ]; curl_setopt_array($curl, array( CURLOPT_URL => 'https://api.starsender.online/api/devices/create/scan', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => json_encode($pesan), CURLOPT_HTTPHEADER => array( 'Content-Type:application/json', 'Authorization: YOUR API KEY' ), )); $response = curl_exec($curl); curl_close($curl); $res = json_decode($response, true); if(isset($res['data']['kode_gambar'])){ $kode_gambar = $res['data']['kode_gambar']; echo ""; }else{ echo $res['message']; } ``` ```json { "success": true, "data": {"kode_gambar":"data:image/png;base64,iVBORw0KGgoAAAANSU"}, "message": "Sukses mengambil QR" } ``` -------------------------------- ### Implementasi dengan PHP (agency.php) Source: https://docs.starsender.online/docs/agency-api/buat-user-agency%20copy Contoh kode PHP untuk memperpanjang paket user agency. Menggunakan cURL untuk mengirim permintaan POST ke endpoint /api/agency/users/extend dengan header Authorization dan body berisi email serta day_extend. Ganti 'YOUR API KEY' dengan kunci API Anda. ```php "email_unik@email.com", "day_extend" => 31 ]; curl_setopt_array($curl, array( CURLOPT_URL => 'https://api.starsender.online/api/agency/users/extend', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => json_encode($data), CURLOPT_HTTPHEADER => array( 'Content-Type:application/json', 'Authorization: YOUR API KEY' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ``` -------------------------------- ### POST /api/devices/create/scan Source: https://docs.starsender.online/docs/device-api/create-dan-scan-device Endpoint untuk membuat device baru dan mengembalikan QR code yang dapat dipindai untuk menghubungkan device. ```APIDOC ## POST /api/devices/create/scan ### Description Membuat device baru dan mengembalikan QR code untuk proses scan. ### Method POST ### Endpoint https://api.starsender.online/api/devices/create/scan ### Parameters #### Header Parameters - **Authorization** (string) - Required - Account API key, didapat dari menu profile. #### Request Body - **name** (string) - Required - Nama device yang akan dibuat. ### Request Example { "name": "Device Tes" } ### Response #### Success Response (200) - **success** (boolean) - Status keberhasilan. - **data.kode_gambar** (string) - Data URL gambar QR code. - **message** (string) - Pesan sukses. #### Response Example { "success": true, "data": {"kode_gambar":"data:image/png;base64,iVBORw0KGgoAAAANSU"}, "message": "Sukses mengambil QR" } ``` -------------------------------- ### Implementasi PHP untuk Membuat User Agency Source: https://docs.starsender.online/docs/agency-api/buat-user-agency Contoh kode PHP menggunakan cURL untuk mengirim permintaan POST ke endpoint /api/agency/users. Ganti 'YOUR API KEY' dengan kunci API dari menu profile. Body request berisi data user agency seperti name, username, email, phone, password, dan package_id. ```php "Nama user agency", "username" => "username_unik", "email" => "email_unik@email.com", "phone" => "08123456789", "password" => "123456", "package_id" => 1 ]; curl_setopt_array($curl, array( CURLOPT_URL => 'https://api.starsender.online/api/agency/users', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => json_encode($data), CURLOPT_HTTPHEADER => array( 'Content-Type:application/json', 'Authorization: YOUR API KEY' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ``` -------------------------------- ### PHP: Membuat campaign dengan cURL Source: https://docs.starsender.online/docs/campaign-api/buat-campaign Contoh implementasi PHP menggunakan cURL untuk membuat campaign. Kirim POST ke https://api.starsender.online/api/campaigns dengan header Authorization berisi API key dan body JSON berisi device_api_key, name, syntax, welcome_message, dan number. Perhatikan bahwa dalam contoh, kunci body menggunakan snake_case, sedangkan dokumentasi parameter menggunakan PascalCase. ```php "1543vfdd4e443t5gtr6", "name" => "Campaign satu", "syntax" => "Registrasi#Nama#Alamat", "welcome_message" => "Halo terimakasih telah subscribe campaign" "number" => "08123456789" ]; curl_setopt_array($curl, array( CURLOPT_URL => 'https://api.starsender.online/api/campaigns', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => json_encode($data), CURLOPT_HTTPHEADER => array( 'Content-Type:application/json', 'Authorization: YOUR API KEY' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ``` -------------------------------- ### GET /api/groups Source: https://docs.starsender.online/docs/contact-api/list-group-kontak Retrieves a list of contact groups. Requires an API key in the Authorization header. ```APIDOC ## GET /api/groups ### Description Retrieves a list of contact groups. ### Method GET ### Endpoint https://api.starsender.online/api/groups ### Parameters #### Header Parameters - **Authorization** (string) - Required - Account API key, obtainable from the profile menu. ### Request Example ```php 'https://api.starsender.online/api/groups', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => array( 'Content-Type:application/json', 'Authorization: YOUR API KEY' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **data** (object) - Contains the contact group data. - **message** (string) - Success message. #### Response Example ```json { "success": true, "data": {}, "message": "Success to get contact group lists" } ``` ``` -------------------------------- ### Respon API: Campaign created Source: https://docs.starsender.online/docs/campaign-api/buat-campaign Contoh respon JSON yang dikembalikan oleh API setelah campaign berhasil dibuat. Menunjukkan struktur respon dengan properti success, data, dan message. ```json { "success": true, "data": {}, "message": "Campaign created" } ``` -------------------------------- ### GET /api/whatsapp/groups Source: https://docs.starsender.online/docs/whatsapp-api/list-group-whatsapp Retrieves a list of WhatsApp groups. Requires an Authorization header with the device API key. ```APIDOC ## GET /api/whatsapp/groups ### Description API untuk mengambil list group whatsapp. ### Method GET ### Endpoint https://api.starsender.online/api/whatsapp/groups ### Parameters #### Header Parameters - **Authorization** (string) - Required - Device API key, anda bisa dapatkan di menu device ### Request Example ```php 'https://api.starsender.online/api/whatsapp/groups', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => array( 'Content-Type:application/json', 'Authorization: YOUR API KEY' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful - **data** (object) - Contains the list of WhatsApp groups - **message** (string) - Success message #### Response Example ```json { "success": true, "data": {}, "message": "Success to get whatsapp groups" } ``` ``` -------------------------------- ### Error Response: Device Disconnected Source: https://docs.starsender.online/docs/message-api/kirim-rotator Example error response when a device is not connected. The message includes the device name and ID. ```json { "success": false, "message": "Device server wa (id=1641) is not connected", "data": {} } ``` -------------------------------- ### Create Contact with PHP cURL (kontak.php) Source: https://docs.starsender.online/docs/contact-api/buat-kontak PHP implementation using cURL to create a contact via POST to https://api.starsender.online/api/contacts. The body includes name, number, optional variabel array, and optional group_id. Requires your API key in the Authorization header. The response is echoed after execution. ```php "Budi", "number" => "08123456789", "variabel" => [ "Variabel 1", "Variabel 2", ], //OPSIONAL "group_id" => 1 //OPSIONAL ]; curl_setopt_array($curl, array( CURLOPT_URL => 'https://api.starsender.online/api/contacts', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => json_encode($pesan), CURLOPT_HTTPHEADER => array( 'Content-Type:application/json', 'Authorization: YOUR API KEY' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ``` -------------------------------- ### POST /api/send Source: https://docs.starsender.online/docs/message-api/kirim-pesan Mengirim pesan teks atau media ke nomor tujuan melalui API STARSENDER. Endpoint ini memerlukan API key pada header Authorization dan body JSON dengan parameter yang sesuai. ```APIDOC ## POST /api/send ### Description Mengirim pesan teks atau media ke nomor tujuan melalui API STARSENDER. Endpoint ini memerlukan API key pada header Authorization dan body JSON dengan parameter yang sesuai. ### Method POST ### Endpoint https://api.starsender.online/api/send ### Parameters #### Header Parameters - **Authorization** (string) - Required - Device API key, dapat diperoleh di menu device. #### Body Parameters - **messageType** (string) - Required - Definisi tipe pesan: text atau media. - **to** (string) - Required - Nomor tujuan pengiriman pesan, dapat berawalan 0 ataupun kode negara. - **body** (string) - Optional - Pesan yang akan dikirimkan. - **file** (string) - Optional - URL file yang akan dikirimkan. - **delay** (integer) - Optional - Fitur delay pesan dalam satuan detik. - **schedule** (integer) - Optional - Jadwal pengiriman pesan dalam format unix milis. ### Request Example ```json { "messageType": "text", "to": "08123456789", "body": "Your Message", "file": "https://file-url.com", "delay": 10, "schedule": 1665408510000 } ``` ### Response #### Success Response (200) - **success** (boolean) - Indikator keberhasilan. - **data** (object) - Data tambahan (jika ada). - **message** (string) - Pesan status, contoh: "Success sent message". #### Response Example ```json { "success": true, "data": {}, "message": "Success sent message" } ``` ``` -------------------------------- ### Respon API: Sukses mendapatkan detail device Source: https://docs.starsender.online/docs/device-api/detail-device Contoh respon JSON yang dikembalikan oleh API ketika permintaan berhasil. Menunjukkan struktur respon dengan properti success, data, dan message. ```json { "success": true, "data": {}, "message": "Success to get device detail" } ``` -------------------------------- ### POST /api/send/grup Source: https://docs.starsender.online/docs/grup-api/kirim-pesan Mengirim pesan ke grup WhatsApp melalui API STARSENDER. Endpoint ini menerima tipe pesan, nama atau ID grup, dan konten pesan, serta opsi file, delay, dan jadwal pengiriman. ```APIDOC ## POST /api/send/grup ### Description Mengirim pesan ke grup melalui API STARSENDER. Endpoint ini digunakan untuk mengirim pesan teks atau media ke grup WhatsApp. ### Method POST ### Endpoint https://api.starsender.online/api/send/grup ### Parameters #### Header Parameters - **Authorization** (string) - Required - Device API key, dapat diperoleh dari menu device. #### Body Parameters - **MessageType** (string) - Required - Definisi tipe pesan, nilai: text / media. - **To** (string) - Required - Nama Grup / id Grup. - **Body** (string) - Optional - Pesan yang akan dikirimkan. - **File** (string) - Optional - URL File yang akan dikirimkan. - **Delay** (number) - Optional - Fitur delay pesan dalam satuan detik. - **Schedule** (number) - Optional - Jadwal pengiriman pesan dalam format unix milis. ### Request Example ```json { "messageType": "text", "to": "Nama Grup", "body": "Your Message", "file": "https://file-url.com", "delay": 10, "schedule": 1665408510000 } ``` ### Response #### Success Response (200) - **success** (boolean) - Status keberhasilan. - **data** (object) - Data respons. - **message** (string) - Pesan keterangan. #### Response Example ```json { "success": true, "data": {}, "message": "Success sent message" } ``` ``` -------------------------------- ### GET /api/messages/{id} Source: https://docs.starsender.online/docs/message-api/detail-pesan Retrieves the details of a specific message using its ID. Requires an API key in the Authorization header and the message ID as a path parameter. ```APIDOC ## GET /api/messages/{id} ### Description Retrieves the details of a specific message using its ID. ### Method GET ### Endpoint https://api.starsender.online/api/messages/{id} ### Parameters #### Header Parameters - **Authorization** (string) - Required - Account API key, available in the profile menu. #### Path Parameters - **id** (integer) - Required - ID of the message. ### Request Example ```php 'https://api.starsender.online/api/messages/'.$idPesan, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => array( 'Content-Type:application/json', 'Authorization: YOUR API KEY' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **data** (object) - The message details. - **message** (string) - Success message. #### Response Example ```json { "success": true, "data": {}, "message": "Success to get message detail" } ``` ``` -------------------------------- ### API Response: Success to delete blacklist Source: https://docs.starsender.online/docs/chat-gpt-api/hapus-blacklist Example JSON response returned when the blacklist deletion succeeds. The data field is empty and the message confirms the deletion. ```json { "success": true, "data": {}, "message": "Success to delete blacklist" } ``` -------------------------------- ### PHP: Pindah kontak dari group (kontak.php) Source: https://docs.starsender.online/docs/contact-api/pindah-group-kontak Contoh implementasi menggunakan PHP cURL untuk memanggil endpoint POST /api/groups/contacts/change. Perhatikan bahwa variabel $pesan tidak didefinisikan dalam kode, sehingga contoh ini mungkin tidak berjalan tanpa mendefinisikannya. Ganti 'YOUR API KEY' dengan kunci API Anda. ```php "08123456789", "group_id_from" => 1 "group_id_to" => 2 ]; curl_setopt_array($curl, array( CURLOPT_URL => 'https://api.starsender.online/api/groups/contacts/change', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => json_encode($pesan), CURLOPT_HTTPHEADER => array( 'Content-Type:application/json', 'Authorization: YOUR API KEY' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ``` -------------------------------- ### Error Response: Messages Exceed Total Capacity Source: https://docs.starsender.online/docs/message-api/kirim-rotator Example error response when the number of messages exceeds the total capacity of all devices. The data includes total_messages and total_capacity. ```json { "success": false, "message": "Messages (200) exceed total capacity (150). Add more devices or increase limits.", "data": { "total_messages": 200, "total_capacity": 150 } } ``` -------------------------------- ### Implementasi PHP dengan cURL untuk mengirim pesan Source: https://docs.starsender.online/docs/message-api/kirim-pesan Contoh lengkap pengiriman pesan menggunakan PHP dan cURL. Memerlukan API key pada header Authorization. Mengirim data JSON dengan parameter messageType, to, body, file, delay, dan schedule. Menampilkan respons dari API. ```php "text", "to" => "08123456789", "body" => "Your Message", "file" => "https://file-url.com", "delay" => 10, "schedule" => 1665408510000 ]; curl_setopt_array($curl, array( CURLOPT_URL => 'https://api.starsender.online/api/send', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => json_encode($pesan), CURLOPT_HTTPHEADER => array( 'Content-Type:application/json', 'Authorization: YOUR API KEY' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ``` -------------------------------- ### Webhook Data Processing (PHP) Source: https://docs.starsender.online/docs/webhook/webhook_premium Example PHP code to process incoming webhook data. It reads the JSON payload from the request body and demonstrates how to access each field of the webhook message. ```APIDOC ## Webhook Data Processing (PHP) ### Description This code snippet shows how to receive and process webhook data from StarSender. It reads the JSON payload from the request body and outputs each field of the message. ### Method POST ### Endpoint (Webhook URL provided by StarSender) ### Request Body - **device_id** (string) - Required - ID device StarSender - **device** (string) - Required - Device name and number in format: nama - nomor device - **device_name** (string) - Required - Device name in StarSender - **chat_type** (string) - Required - Type of chat: personal or group - **message_id** (string) - Required - Message ID from WhatsApp - **from** (string) - Required - Phone number or group ID - **push_name** (string) - Required - Contact name of sender or group name - **message** (string) - Required - Text message content - **file** (string) - Required - File attachment (if any) - **is_group** (boolean) - Required - Whether the message is from a group - **is_me** (boolean) - Required - Whether the message was sent by the user - **is_mentioned** (boolean) - Required - Whether the message mentions the user (or is from a group) - **quoted_message** (string) - Optional - The quoted message content (if any) - **timestamp** (string) - Required - Timestamp of the message ### Request Example ```json { "device_id": "12345", "device": "MyDevice - 628123456789", "device_name": "MyDevice", "chat_type": "personal", "message_id": "ABC123", "from": "628123456789", "push_name": "John Doe", "message": "Hello", "file": "", "is_group": false, "is_me": false, "is_mentioned": false, "quoted_message": "", "timestamp": "2023-01-01T00:00:00Z" } ``` ### Response #### Success Response (200) - No specific response body is documented. The webhook endpoint is expected to return a 200 status to acknowledge receipt. #### Response Example (No response body is documented.) ``` -------------------------------- ### Cek blacklist ChatGPT dengan PHP Source: https://docs.starsender.online/docs/chat-gpt-api/cek-blacklist Gunakan untuk memeriksa status blacklist nomor WhatsApp pada ChatGPT. Ganti YOUR_DEVICE_KEY dengan Device API key dari menu Device -> Detail -> Device Key. Respons menampilkan status blacklisted dan data blacklist jika nomor diblacklist. ```php 'https://api.starsender.online/api/chat-gpt/blacklist/' . urlencode($number), CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', 'Authorization: YOUR_DEVICE_KEY' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ``` ```json { "success": true, "data": { "blacklisted": false }, "message": "Number is not blacklisted" } ``` ```json { "success": true, "data": { "blacklisted": true, "blacklist": { "id": 1, "chat_gpt_id": 1, "number": "6281234567890", "user_id": 1, "created_at": 1234567890000, "updated_at": 1234567890000 } }, "message": "Number is blacklisted" } ``` -------------------------------- ### Relog Device API response Source: https://docs.starsender.online/docs/device-api/relog-device Example JSON response returned by the Relog Device endpoint. The success field indicates whether the request succeeded, and the message field provides a status message. ```json { "success": true, "data": {}, "message": "Contact created" } ```