Talk
Sends a text message to an active session, allowing the avatar to forward the query to an LLM and speak the generated response.
POST/api/v2/sessions/{sessionId}/talk
Headers
| Header | Value |
|---|---|
| Authorization | Bearer {session_token} |
| Content-Type | application/json |
Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| message | string | required | User text (server-side max length enforced) |
| type | string | optional | Reserved for future use (defaults are fine; no need to set) |
Notes
- Sessions are scoped to the
appIdthey were created with. - You cannot access a
sessionIdthat belongs to a differentappId.
Tip: You can use [FIRST_MESSAGE] when you already have the exact text the avatar should say and want to inject that response directly.
Examples
- cURL
- Node.js
- Python
curl https://ai-streamer.deepbrain.io/api/v2/sessions/${SESSION_ID}/talk \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${SESSION_TOKEN}" \
-X POST \
-d '{
"message": "Hello."
}'
import axios from "axios";
const sessionId = "${SESSION_ID}";
const sessionToken = "${SESSION_TOKEN}";
axios
.post(
`https://ai-streamer.deepbrain.io/api/v2/sessions/${sessionId}/talk`,
{
message: "Hello.",
},
{
headers: {
Authorization: `Bearer ${sessionToken}`,
"Content-Type": "application/json",
},
},
)
.then((res) => {
console.log(res.data);
})
.catch((error) => {
console.error(error);
});
import requests
session_id = '${SESSION_ID}'
session_token = '${SESSION_TOKEN}'
url = f'https://ai-streamer.deepbrain.io/api/v2/sessions/{session_id}/talk'
headers = {
'Authorization': f'Bearer {session_token}',
'Content-Type': 'application/json'
}
body = {
'message': 'Hello.'
}
response = requests.post(url, headers=headers, json=body)
print(response.json())
Success (code: 1000)
{
"code": 1000,
"data": null,
"message": "Message sent successfully"
}
Next step
Call this API repeatedly to continue the conversation. Use List Sessions or Get Session Detail to manage sessions when needed, and call Stop Session to end the conversation.