Skip to content

Send Message

POST /api/v1/message

Sends a user message to a specific chatbot and streams back plain‑text response chunks (Content-Type: text/plain).

{
"chatbotId": "test101",
"email": "user@example.com",
"message": "Hello, can you help me?"
}
  • Streamed text response body, chunked.
  • 400: { "message": "invalid request body" }
  • 401: { "message": "api key expired|invalid|missing" }
  • 404: { "message": "Chatbot not found|email missing|no context" }
  • 500: { "message": "failed to stream response" }
const resp = await fetch('https://message.geneline-x.net/api/v1/message', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': process.env.GENISTUDIO_API_KEY!,
},
body: JSON.stringify({ chatbotId, email, message })
});
const reader = resp.body?.getReader();
let text = '';
while (true) {
const { done, value } = await reader.read();
if (done) break;
text += new TextDecoder().decode(value);
}
console.log(text);