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_bodyEndpointy
Publish message
Odeslání nové zprávy do chatu
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_bodyOdešle novou zprávu do existujícího chatu a pokračuje v konverzaci.
JSON odpověď (při
Následně můžete sledovat průběh pomocí endpointu Get Status.
Streaming odpověď (při
Požadavek
POST /api/chat/{chatId}/publish
Hlavičky
| Hlavička | Povinná | Popis |
|---|---|---|
Authorization | Ano | Bearer macaly_... |
Content-Type | Ano | application/json |
Parametry cesty
| Parametr | Typ | Popis |
|---|---|---|
chatId | string | ID chatu |
Parametry těla požadavku
| Pole | Typ | Povinné | Výchozí hodnota | Popis |
|---|---|---|---|---|
content | string | Podmíněně | - | Zpráva / prompt uživatele. Povinné, pokud resume není true |
stream | boolean | Ne | true | Pokud false, vrátí JSON místo streamu |
agentMode | "auto" | "fast" | "smart" | Ne | "auto" | Poměr mezi rychlostí a kvalitou AI agenta |
executionMode | "auto" | "planning" | "build" | Ne | "auto" | Režim, v jakém AI agent pracuje |
model | "sonnet-4-5" | "sonnet-4-6" | "opus-4-5" | "opus-4-6" | Ne | - | Konkrétní AI model. Pokud neupřesníte, použije se model nastavený pro tým |
reasoningEffort | "medium" | "high" | Ne | - | Určuje, jak hluboce má model přemýšlet |
resume | boolean | Ne | false | Pokud true, obnoví zastavenou konverzaci bez přidání nového obsahu |
experimental_attachments | array | Ne | [] | Přílohy souborů (formát viz Create Chat) |
Pokud je
resume nastaveno na true, nelze současně posílat content ani experimental_attachments. Slouží k obnovení dříve zastavené konverzace.Příklad požadavku
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()
Odpověď
JSON odpověď (při stream: false)
{
"chatId": "abc123def456",
"streamId": "stream_xyz789",
"assistantMessageId": "msg_123"
}
Streaming odpověď (při stream: true, výchozí)
2:[{"chatId":"abc123def456"}]
0:"Analyzing your request..."
...
Stavové kódy
| Kód | Popis |
|---|---|
| 200 | Úspěch – zpráva odeslána |
| 400 | Neplatný požadavek |
| 401 | Neplatný nebo chybějící API klíč |
| 402 | Nedostatek kreditů |
| 403 | Chat nepatří tomuto týmu |
| 404 | Chat nenalezen |
| 429 | Překročen limit požadavků |
| 500 | Chyba serveru |
| 503 | Server je zaneprázdněn, zkuste to za chvíli |
Postup
Typický postup bez použití streamování:- Odešlete zprávu s
stream: false - Sledujte průběh pomocí
GET /api/chat/{chatId}/status, dokud není stavcompleted - Opakujte pro další zprávy
Byla tato stránka užitečná?
⌘I