Bericht publiceren
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
Bericht publiceren
Stuur een nieuw bericht naar een bestaande chat om het gesprek voort te zetten
POST
/
api
/
chat
/
{chatId}
/
publish
Bericht publiceren
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_bodyStuurt een nieuw bericht naar een bestaande chat, waarmee het gesprek wordt voortgezet.
JSON-respons (bij
U kunt vervolgens het endpoint Status ophalen opvragen om te wachten tot de verwerking is voltooid.
Streamingrespons (bij
Verzoek
POST /api/chat/{chatId}/publish
Headers
| Header | Vereist | Beschrijving |
|---|---|---|
Authorization | Ja | Bearer macaly_... |
Content-Type | Ja | application/json |
Padparameters
| Parameter | Type | Beschrijving |
|---|---|---|
chatId | string | De chat-ID |
Bodyparameters
| Veld | Type | Vereist | Standaard | Beschrijving |
|---|---|---|---|---|
content | string | Voorwaardelijk | - | Het bericht van de gebruiker. Vereist tenzij resume true is |
stream | boolean | Nee | true | Als false, retourneert JSON in plaats van een stream |
agentMode | "auto" | "fast" | "smart" | Nee | "auto" | Bepaalt de snelheid/kwaliteitsafweging van de AI-agent |
executionMode | "auto" | "planning" | "build" | Nee | "auto" | Bepaalt hoe de AI de taak benadert |
model | "sonnet-4-5" | "sonnet-4-6" | "opus-4-5" | "opus-4-6" | Nee | - | AI-model om te gebruiken. Standaard het geconfigureerde model van het team |
reasoningEffort | "medium" | "high" | Nee | - | Bepaalt hoe diep de AI nadenkt over de taak |
resume | boolean | Nee | false | Als true, hervat een gestopt gesprek zonder nieuwe inhoud toe te voegen |
experimental_attachments | array | Nee | [] | Bestandsbijlagen (zie Chat aanmaken voor het formaat) |
Wanneer
resume true is, kunt u geen content of experimental_attachments meesturen. Dit wordt gebruikt om een eerder gestopt gesprek te hervatten.Voorbeeldverzoek
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()
Respons
JSON-respons (bij stream: false)
{
"chatId": "abc123def456",
"streamId": "stream_xyz789",
"assistantMessageId": "msg_123"
}
Streamingrespons (bij stream: true, standaard)
2:[{"chatId":"abc123def456"}]
0:"Analyzing your request..."
...
Statuscodes
| Status | Beschrijving |
|---|---|
| 200 | Succes - Bericht verzonden |
| 400 | Ongeldig verzoek |
| 401 | Ongeldige of ontbrekende API-sleutel |
| 402 | Onvoldoende credits |
| 403 | Chat behoort niet tot dit team |
| 404 | Chat niet gevonden |
| 429 | Limiet bereikt |
| 500 | Serverfout |
| 503 | Service niet beschikbaar - De AI-werkruimte is bezig, probeer het zo opnieuw |
Workflow
Voor gebruik zonder streaming is de typische workflow:- Stuur een bericht met
stream: false - Controleer de status met
GET /api/chat/{chatId}/statustotcompleted - Herhaal voor extra berichten
Was deze pagina nuttig?