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
Publish message
Invio di un nuovo messaggio a una chat esistente per proseguire la conversazione
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_bodyInvia un nuovo messaggio a una chat esistente e prosegue la conversazione.
Risposta JSON (con
Puoi quindi seguire l’avanzamento tramite l’endpoint Get Status fino al completamento.
Risposta in streaming (con
Richiesta
POST /api/chat/{chatId}/publish
Header
| Header | Obbligatorio | Descrizione |
|---|---|---|
Authorization | Sì | Bearer macaly_... |
Content-Type | Sì | application/json |
Parametri del percorso
| Parametro | Tipo | Descrizione |
|---|---|---|
chatId | string | L’ID della chat |
Parametri del corpo della richiesta
| Campo | Tipo | Obbligatorio | Predefinito | Descrizione |
|---|---|---|---|---|
content | string | Condizionale | - | Il messaggio dell’utente. Obbligatorio a meno che resume non sia true |
stream | boolean | No | true | Se false, restituisce JSON invece di uno stream |
agentMode | "auto" | "fast" | "smart" | No | "auto" | Determina il compromesso tra velocità e qualità dell’agente |
executionMode | "auto" | "planning" | "build" | No | "auto" | Determina come l’IA affronta il compito |
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" | No | - | Modello AI da utilizzare. Se non specificato, viene usato il modello configurato per il team |
reasoningEffort | "medium" | "high" | No | - | Determina quanto a fondo il modello ragiona sul compito |
resume | boolean | No | false | Se true, riprende una conversazione interrotta senza aggiungere nuovo contenuto |
experimental_attachments | array | No | [] | Allegati di file (per il formato vedi Create Chat) |
Quando
resume è true, non puoi includere content o experimental_attachments. Questa opzione serve a proseguire una conversazione interrotta in precedenza.Esempio di richiesta
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()
Risposta
Risposta JSON (con stream: false)
{
"chatId": "abc123def456",
"streamId": "stream_xyz789",
"assistantMessageId": "msg_123"
}
Risposta in streaming (con stream: true, predefinito)
2:[{"chatId":"abc123def456"}]
0:"Analyzing your request..."
...
Codici di stato
| Codice | Descrizione |
|---|---|
| 200 | Operazione riuscita: messaggio inviato |
| 400 | Corpo della richiesta non valido |
| 401 | Chiave API non valida o mancante |
| 402 | Crediti insufficienti |
| 403 | La chat non appartiene a questo team |
| 404 | Chat non trovata |
| 429 | Limite di richieste raggiunto |
| 500 | Errore del server |
| 503 | Servizio non disponibile: il workspace dell’IA è occupato, riprova a breve |
Processo tipico
Senza streaming, il processo tipico è il seguente:- Invia il messaggio con
stream: false - Segui l’avanzamento con
GET /api/chat/{chatId}/statusfinché lo stato non ècompleted - Ripeti per i messaggi successivi
Questa pagina è stata utile?