curl --request POST \
--url https://api.wondeya.com/v1/agents/{agentId}/chat \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"message": "<string>",
"locale": "es",
"conversationId": "<string>"
}
'import requests
url = "https://api.wondeya.com/v1/agents/{agentId}/chat"
payload = {
"message": "<string>",
"locale": "es",
"conversationId": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({message: '<string>', locale: 'es', conversationId: '<string>'})
};
fetch('https://api.wondeya.com/v1/agents/{agentId}/chat', 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://api.wondeya.com/v1/agents/{agentId}/chat",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'message' => '<string>',
'locale' => 'es',
'conversationId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.wondeya.com/v1/agents/{agentId}/chat"
payload := strings.NewReader("{\n \"message\": \"<string>\",\n \"locale\": \"es\",\n \"conversationId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.wondeya.com/v1/agents/{agentId}/chat")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"message\": \"<string>\",\n \"locale\": \"es\",\n \"conversationId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wondeya.com/v1/agents/{agentId}/chat")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"message\": \"<string>\",\n \"locale\": \"es\",\n \"conversationId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"conversationId": "<string>",
"reply": "<string>",
"components": [
{
"slot": "<string>",
"props": {}
}
],
"cached": true
}Chatea con un agente (headless)
Ejecuta un turno generativo y consume un crédito de mensaje de forma atómica (D-16). JSON por defecto; envía Accept: text/event-stream para SSE. Continúa una conversación con conversationId. Idempotency-Key (modo JSON) hace que un reintento reproduzca la primera respuesta sin consumir un segundo crédito.
curl --request POST \
--url https://api.wondeya.com/v1/agents/{agentId}/chat \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"message": "<string>",
"locale": "es",
"conversationId": "<string>"
}
'import requests
url = "https://api.wondeya.com/v1/agents/{agentId}/chat"
payload = {
"message": "<string>",
"locale": "es",
"conversationId": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({message: '<string>', locale: 'es', conversationId: '<string>'})
};
fetch('https://api.wondeya.com/v1/agents/{agentId}/chat', 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://api.wondeya.com/v1/agents/{agentId}/chat",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'message' => '<string>',
'locale' => 'es',
'conversationId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.wondeya.com/v1/agents/{agentId}/chat"
payload := strings.NewReader("{\n \"message\": \"<string>\",\n \"locale\": \"es\",\n \"conversationId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.wondeya.com/v1/agents/{agentId}/chat")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"message\": \"<string>\",\n \"locale\": \"es\",\n \"conversationId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wondeya.com/v1/agents/{agentId}/chat")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"message\": \"<string>\",\n \"locale\": \"es\",\n \"conversationId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"conversationId": "<string>",
"reply": "<string>",
"components": [
{
"slot": "<string>",
"props": {}
}
],
"cached": true
}Autorizaciones
Una clave de API del espacio de trabajo: wdy_live_… / wdy_test_…. Se crea en POST /workspaces/{tenantId}/keys y se muestra exactamente una vez.
Parámetros de ruta
Cuerpo
La pregunta del visitante que responde el agente.
1 - 1000es, en Continúa una conversación: pasa el conversationId que devolvió un turno anterior. Omítelo para iniciar una nueva; el servidor es dueño de la transcripción.
Respuesta
La conversación, propiedad del servidor, en la que está este turno.
La respuesta de texto del asistente.
Los componentes de generative-UI que el agente eligió renderizar.
Show child attributes
Show child attributes
True cuando el turno se reprodujo desde la caché (no gastó crédito).