Publish message
curl --request POST \
--url https://macaly.com/api/chat/{chatId}/publish \
--header 'Authorization: Bearer <token>'import requests
url = "https://macaly.com/api/chat/{chatId}/publish"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://macaly.com/api/chat/{chatId}/publish', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://macaly.com/api/chat/{chatId}/publish",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://macaly.com/api/chat/{chatId}/publish"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://macaly.com/api/chat/{chatId}/publish")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://macaly.com/api/chat/{chatId}/publish")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_bodyEndpoint'ler
Publish message
Konuşmayı sürdürmek için mevcut bir sohbete yeni bir mesaj gönderin
POST
/
api
/
chat
/
{chatId}
/
publish
Publish message
curl --request POST \
--url https://macaly.com/api/chat/{chatId}/publish \
--header 'Authorization: Bearer <token>'import requests
url = "https://macaly.com/api/chat/{chatId}/publish"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://macaly.com/api/chat/{chatId}/publish', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://macaly.com/api/chat/{chatId}/publish",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://macaly.com/api/chat/{chatId}/publish"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://macaly.com/api/chat/{chatId}/publish")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://macaly.com/api/chat/{chatId}/publish")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_bodyMevcut bir sohbete yeni bir mesaj göndererek konuşmayı sürdürür.
JSON yanıtı (
Ardından tamamlanmayı beklemek için Get Status endpoint’i üzerinden durumu takip edebilirsiniz.
Stream yanıtı (
İstek
POST /api/chat/{chatId}/publish
Başlıklar
| Header | Zorunlu | Açıklama |
|---|---|---|
Authorization | Evet | Bearer macaly_... |
Content-Type | Evet | application/json |
Yol parametreleri
| Parametre | Tür | Açıklama |
|---|---|---|
chatId | string | Sohbet kimliği |
İstek gövdesi parametreleri
| Alan | Tür | Zorunlu | Varsayılan | Açıklama |
|---|---|---|---|---|
content | string | Koşullu | - | Kullanıcının mesajı. resume true olmadıkça zorunludur |
stream | boolean | Hayır | true | false ise stream yerine JSON döndürür |
agentMode | "auto" | "fast" | "smart" | Hayır | "auto" | Agent’ın hız ve kalite dengesini belirler |
executionMode | "auto" | "planning" | "build" | Hayır | "auto" | Yapay zekanın göreve nasıl yaklaşacağını belirler |
model | "gpt-5.6-terra" | "gpt-6.1-sol" | "gpt-6-luna" | "grok-4-6" | "kimi-k3" | "sonnet-5-5" | "opus-5-5" | "blueai-glm-5-3" | "blueai-glm-5-3-flash" | Hayır | - | Kullanılacak yapay zeka modeli. Varsayılan olarak ekip için yapılandırılmış model kullanılır |
reasoningEffort | "medium" | "high" | Hayır | - | Yapay zekanın görev üzerinde ne kadar derin düşüneceğini belirler |
resume | boolean | Hayır | false | true ise, yeni içerik eklemeden durdurulmuş bir konuşmayı sürdürür |
experimental_attachments | array | Hayır | [] | Dosya ekleri (format için bkz. Create Chat) |
resume true olduğunda content veya experimental_attachments gönderemezsiniz. Bu, daha önce durdurulmuş bir konuşmaya devam etmek için kullanılır.Örnek istek
curl -X POST "https://www.macaly.com/api/chat/abc123def456/publish" \
-H "Authorization: Bearer macaly_abc123..." \
-H "Content-Type: application/json" \
-d '{
"content": "Add a dark mode toggle to the header",
"stream": false
}'
const response = await fetch(
`https://www.macaly.com/api/chat/${chatId}/publish`,
{
method: 'POST',
headers: {
'Authorization': 'Bearer macaly_abc123...',
'Content-Type': 'application/json',
},
body: JSON.stringify({
content: 'Add a dark mode toggle to the header',
stream: false,
}),
}
);
const data = await response.json();
import requests
response = requests.post(
f'https://www.macaly.com/api/chat/{chat_id}/publish',
headers={
'Authorization': 'Bearer macaly_abc123...',
'Content-Type': 'application/json',
},
json={
'content': 'Add a dark mode toggle to the header',
'stream': False,
},
)
data = response.json()
Yanıt
JSON yanıtı (stream: false olduğunda)
{
"chatId": "abc123def456",
"streamId": "stream_xyz789",
"assistantMessageId": "msg_123"
}
Stream yanıtı (stream: true, varsayılan)
2:[{"chatId":"abc123def456"}]
0:"Analyzing your request..."
...
Durum kodları
| Durum | Açıklama |
|---|---|
| 200 | Başarılı - Mesaj gönderildi |
| 400 | Geçersiz istek gövdesi |
| 401 | Geçersiz veya eksik API anahtarı |
| 402 | Yetersiz kredi |
| 403 | Sohbet bu ekibe ait değil |
| 404 | Sohbet bulunamadı |
| 429 | İstek limiti aşıldı |
| 500 | Sunucu hatası |
| 503 | Hizmet kullanılamıyor - Yapay zeka çalışma alanı meşgul, kısa süre sonra tekrar deneyin |
Süreç
Stream kullanmadığınızda tipik süreç şöyledir:- Mesaj gönderin -
stream: falseile - Durumu takip edin -
completedolana kadarGET /api/chat/{chatId}/statusile - Tekrarlayın - Sonraki mesajlar için
Bu sayfa yararlı mıydı?