Client recipes
Nyeti does not require a client SDK. Call the authenticated HTTP endpoint from your backend with the standard client for your language.
Node / TypeScript
TypeScript
export async function analyze(message: string) {
const res = await fetch("https://api.bactlabs.africa/v1/analyze", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.NYETI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ message }),
});
if (!res.ok) throw new Error(`Nyeti request failed: ${res.status}`);
return res.json();
}Python
Python
import os
import requests
def analyze(message: str) -> dict:
response = requests.post(
"https://api.bactlabs.africa/v1/analyze",
headers={"Authorization": f"Bearer {os.environ['NYETI_API_KEY']}"},
json={"message": message},
timeout=10,
)
response.raise_for_status()
return response.json()Correlate a conversation
Keep the ordinary one-message request shape. Send turns in order with the same conversation_id and identify whether each turn came from the customer or agent.
TypeScript
async function analyzeTurn(
message: string,
conversationId: string,
speaker: "customer" | "agent",
) {
const res = await fetch("https://api.bactlabs.africa/v1/analyze", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.NYETI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
message,
conversation_id: conversationId,
speaker,
}),
});
if (!res.ok) throw new Error(`Nyeti request failed: ${res.status}`);
return res.json();
}
await analyzeTurn("How can I help?", "ticket_123", "agent");
await analyzeTurn("My order still has not arrived.", "ticket_123", "customer");
await analyzeTurn("It is on its way, so this is resolved.", "ticket_123", "agent");
const result = await analyzeTurn(
"You said that last time and nobody has helped me.",
"ticket_123",
"customer",
);
if (result.conversation?.review_status === "needs_review") {
queueForHumanReview(result.conversation);
}Safety routing
Treat CRISIS_SUPPORT as a signal to enter your established human safety workflow. Do not treat Nyeti as an emergency service or diagnosis tool.
TypeScript
const result = await analyze(userMessage);
if (result.routing.response_posture === "CRISIS_SUPPORT") {
return handOffToTrainedResponder({ messageId, result });
}
return continueNormalFlow(result.routing);Completed voice calls
For completed conversations, use a supported signed integration channel instead of writing a transcript replay loop yourself.