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_bodyEndpoints
Publish message
Skicka ett nytt meddelande till en befintlig chatt och fortsätt konversationen
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_bodySkickar ett nytt meddelande till en befintlig chatt och fortsätter konversationen.
JSON-svar (när
Därefter kan du kontrollera endpointen Get Status tills chatten är klar.
Streamat svar (när
Anrop
POST /api/chat/{chatId}/publish
Headers
| Header | Obligatorisk | Beskrivning |
|---|---|---|
Authorization | Ja | Bearer macaly_... |
Content-Type | Ja | application/json |
Sökvägsparametrar
| Parameter | Typ | Beskrivning |
|---|---|---|
chatId | string | Chatt-ID |
Parametrar i request body
| Fält | Typ | Obligatoriskt | Standardvärde | Beskrivning |
|---|---|---|---|---|
content | string | Villkorligt | - | Användarens meddelande. Krävs om inte resume är true |
stream | boolean | Nej | true | Om false returneras JSON i stället för en stream |
agentMode | "auto" | "fast" | "smart" | Nej | "auto" | Styr avvägningen mellan hastighet och kvalitet hos AI-agenten |
executionMode | "auto" | "planning" | "build" | Nej | "auto" | Styr hur AI:n angriper uppgiften |
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" | Nej | - | AI-modell som ska användas. Om du inte anger någon används teamets konfigurerade modell |
reasoningEffort | "medium" | "high" | Nej | - | Styr hur djupt AI:n resonerar kring uppgiften |
resume | boolean | Nej | false | Om true återupptas en stoppad konversation utan nytt innehåll |
experimental_attachments | array | Nej | [] | Filbilagor (format finns i Create Chat) |
När
resume är true kan du inte skicka med content eller experimental_attachments. Det används för att fortsätta en konversation som tidigare har stoppats.Exempelanrop
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()
Svar
JSON-svar (när stream: false)
{
"chatId": "abc123def456",
"streamId": "stream_xyz789",
"assistantMessageId": "msg_123"
}
Streamat svar (när stream: true, standard)
2:[{"chatId":"abc123def456"}]
0:"Analyzing your request..."
...
Statuskoder
| Status | Beskrivning |
|---|---|
| 200 | Lyckades, meddelandet skickades |
| 400 | Ogiltig request body |
| 401 | Ogiltig eller saknad API-nyckel |
| 402 | Otillräckligt med krediter |
| 403 | Chatten tillhör inte det här teamet |
| 404 | Chatten hittades inte |
| 429 | För många anrop |
| 500 | Serverfel |
| 503 | Tjänsten är inte tillgänglig, AI-arbetsytan är upptagen. Försök igen om en stund |
Arbetsflöde
Utan streaming ser arbetsflödet vanligtvis ut så här:- Skicka meddelandet med
stream: false - Kontrollera statusen med
GET /api/chat/{chatId}/statustills den ärcompleted - Upprepa för fler meddelanden
Var denna sida till hjälp?