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
Envía un mensaje nuevo a un chat existente para continuar la conversación
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_bodyEnvía un mensaje nuevo a un chat existente y continúa la conversación.
Respuesta JSON (con
Después puedes consultar el endpoint Get Status para esperar a que termine.
Respuesta en streaming (con
Solicitud
POST /api/chat/{chatId}/publish
Encabezados
| Encabezado | Obligatorio | Descripción |
|---|---|---|
Authorization | Sí | Bearer macaly_... |
Content-Type | Sí | application/json |
Parámetros de ruta
| Parámetro | Tipo | Descripción |
|---|---|---|
chatId | string | El ID del chat |
Parámetros del cuerpo de la solicitud
| Campo | Tipo | Obligatorio | Predeterminado | Descripción |
|---|---|---|---|---|
content | string | Condicional | - | El mensaje del usuario. Es obligatorio salvo que resume sea true |
stream | boolean | No | true | Si es false, devuelve JSON en lugar de un stream |
agentMode | "auto" | "fast" | "smart" | No | "auto" | Determina el equilibrio entre velocidad y calidad del agente de IA |
executionMode | "auto" | "planning" | "build" | No | "auto" | Determina cómo aborda la IA la tarea |
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 | - | Modelo de IA que se va a usar. Si no se especifica, se usa el modelo configurado para el equipo |
reasoningEffort | "medium" | "high" | No | - | Determina cuánto razona la IA sobre la tarea |
resume | boolean | No | false | Si es true, reanuda una conversación detenida sin añadir contenido nuevo |
experimental_attachments | array | No | [] | Archivos adjuntos (consulta el formato en Create Chat) |
Cuando
resume es true, no puedes incluir content ni experimental_attachments. Se usa para continuar una conversación que se detuvo anteriormente.Solicitud de ejemplo
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()
Respuesta
Respuesta JSON (con stream: false)
{
"chatId": "abc123def456",
"streamId": "stream_xyz789",
"assistantMessageId": "msg_123"
}
Respuesta en streaming (con stream: true, valor predeterminado)
2:[{"chatId":"abc123def456"}]
0:"Analyzing your request..."
...
Códigos de estado
| Código | Descripción |
|---|---|
| 200 | Correcto: mensaje enviado |
| 400 | Cuerpo de la solicitud no válido |
| 401 | Clave API no válida o ausente |
| 402 | Créditos insuficientes |
| 403 | El chat no pertenece a este equipo |
| 404 | Chat no encontrado |
| 429 | Límite de solicitudes alcanzado |
| 500 | Error del servidor |
| 503 | Servicio no disponible: el espacio de trabajo de IA está ocupado, inténtalo de nuevo en breve |
Proceso
Para un uso sin streaming, el proceso habitual es:- Envía el mensaje con
stream: false - Consulta el estado con
GET /api/chat/{chatId}/statushasta que seacompleted - Repite para mensajes adicionales
¿Esta página le ayudó?