📡 KUGA API Anahtarı ve Kullanım Örnekleri

Aşağıdaki örnekleri kullanarak toplu mesaj gönderimi ve tekli grup mesajı gönderimi API’lerini kullanabilirsiniz.


📤 Toplu Grup Mesajı Gönderimi (`/send-message-all`)
PHP:

$payload = json_encode([
  'userId' => 'KULLANICI_ID',
  'message' => 'Mesaj içeriği',
  'groups' => ['grup1', 'grup2']
]);

$ch = curl_init('http://*********/send-message-all');
curl_setopt_array($ch, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_POST => true,
  CURLOPT_POSTFIELDS => $payload,
  CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
  CURLOPT_SSL_VERIFYPEER => false,
  CURLOPT_SSL_VERIFYHOST => false,
]);
$response = curl_exec($ch);
echo $response;
curl_close($ch);
      
Node.js (fetch):

fetch('http://*********/send-message-all', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    userId: 'KULLANICI_ID',
    message: 'Mesaj içeriği',
    groups: ['grup1', 'grup2']
  })
})
.then(res => res.json())
.then(console.log)
.catch(console.error);
      
Python:

import requests

payload = {
  'userId': 'KULLANICI_ID',
  'message': 'Mesaj içeriği',
  'groups': ['grup1', 'grup2']
}

response = requests.post(
  'http://*********/send-message-all',
  json=payload,
  verify=False
)

print(response.text)
      
C#:

using System.Net.Http;
using System.Text;

var client = new HttpClient();
var content = new StringContent(
  "{ \\\"userId\\\": \\\"KULLANICI_ID\\\", \\\"message\\\": \\\"Mesaj içeriği\\\", \\\"groups\\\": [\\\"grup1\\\"] }",
  Encoding.UTF8,
  "application/json"
);

var response = await client.PostAsync("http://*********/send-message-all", content);
var result = await response.Content.ReadAsStringAsync();
      

📥 Tekli Grup Mesajı Gönderimi (`/send-message`)
PHP:

$payload = json_encode([
  'userId' => 'KULLANICI_ID',
  'groupId' => 'GRUP_ID',
  'groupName' => 'GRUP_ADI',
  'message' => 'Mesaj içeriği'
]);

$ch = curl_init('http://*********/send-message');
curl_setopt_array($ch, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_POST => true,
  CURLOPT_POSTFIELDS => $payload,
  CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
  CURLOPT_SSL_VERIFYPEER => false,
  CURLOPT_SSL_VERIFYHOST => false,
]);

$response = curl_exec($ch);
echo $response;
curl_close($ch);
      
Node.js:

fetch('http://*********/send-message', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    userId: 'KULLANICI_ID',
    groupId: 'GRUP_ID',
    groupName: 'GRUP_ADI',
    message: 'Mesaj içeriği'
  })
})
.then(res => res.json())
.then(console.log)
.catch(console.error);
      
Python:

import requests

payload = {
  'userId': 'KULLANICI_ID',
  'groupId': 'GRUP_ID',
  'groupName': 'GRUP_ADI',
  'message': 'Mesaj içeriği'
}

response = requests.post(
  'http://*********/send-message',
  json=payload,
  verify=False
)

print(response.text)
      
C#:

using System.Net.Http;
using System.Text;

var client = new HttpClient();
var content = new StringContent(
  "{ \\\"userId\\\": \\\"KULLANICI_ID\\\", \\\"groupId\\\": \\\"GRUP_ID\\\", \\\"groupName\\\": \\\"GRUP_ADI\\\", \\\"message\\\": \\\"Mesaj içeriği\\\" }",
  Encoding.UTF8,
  "application/json"
);

var response = await client.PostAsync("http://*********/send-message", content);
var result = await response.Content.ReadAsStringAsync();