Indax

Chat

Dax answers visitors from the catalog, word by word. Server-Sent Events or WebSocket.

Ask Dax a question and watch the answer stream. Follow-ups keep the conversation. Code has the request and every frame the API sent.

Dax

Ask me about mpechicago.com's products. I can help with:

Two ways to connect

POST /v1/chat (Server-Sent Events)wss://api.indax.net/v1/chat (WebSocket)
Best forServers, one-off turns, the playground aboveA chat window in the browser
AuthAuthorization: Bearer headerkey in the first hello frame
Follow-upsSend conversation_id (from done or the x-conversation-id header)Same socket; send another message

Both send the same objects, in this order: status (searching), one or more results, status (answering), many delta, then done. An error can replace any of them and ends the turn.

Request (POST)

FieldTypeWhat it does
textstring, ≤2,000 chars, requiredThe visitor's message. Send only the new message; the server keeps the history.
domainstringThe company Dax answers about. Default: your own.
conversation_idstringContinue a conversation: from done, or the x-conversation-id response header.
options.lengthshort standard detailedDefault: your setting in the Indax app.
options.languagee.g. es, de, jaDefault: the visitor's language.
contextobjectSee Page context.
instructionsstring, ≤500 charsServer-only keys: a note for this turn, e.g. "returning customer".

What comes back

ObjectFieldsMeaning
statusstatesearching (Dax is looking things up), then answering (the text is about to stream). Optional to show.
resultsitems[]: id, type, title, url, image, snippetPages and products Dax found. Can arrive several times in one turn, each with new items only (no repeats): append them. Show as cards or links.
deltatextThe next piece of the answer. Append it, as plain text or Markdown with HTML off.
doneconversation_id, credits_used, timingThe turn is over. timing in ms: first_frame_ms, first_results_ms, first_token_ms, total_ms.
errorcode, messagemessage is safe to show the visitor.

WebSocket

const ws = new WebSocket("wss://api.indax.net/v1/chat");
ws.onopen = () => ws.send(JSON.stringify({ type: "hello", key: "indax_live_...", domain: "mpechicago.com" }));
ws.onmessage = (e) => {
  const m = JSON.parse(e.data);
  if (m.type === "ready") ws.send(JSON.stringify({ type: "message", text: "Which grinder fits activated carbon?" }));
  if (m.type === "delta") answer.textContent += m.text;
  if (m.type === "results") addCards(m.items); // may arrive more than once: append
  if (m.type === "done") console.log("credits:", m.credits_used);
};
You sendWhen
hello { key, domain?, conversation_id?, context? }First, within 10 s. Use a key that allows your website.
message { text, options?, context? }After ready, one at a time (wait for done).
context { context }The visitor moved to another page.
abortStop the current answer.

ready returns conversation_id (store it in sessionStorage and send it in hello after a reload), plus the greeting and suggested_questions your admins set, for your chat window.

Close codeMeaning
4401Missing, invalid or revoked key.
4403This website is not on the key's allowed websites.
4402Credits used up. Show a contact link.
4404domain is not on the Indax network.
4400A frame was not valid JSON.

Any other close: reconnect after 2 s with the same conversation_id.

Steer Dax

Try it above: Steer opens length, language and instructions.

WhereWhat you setApplies to
Portal › Dax in the Indax appTone, answer length, hand-off to sales (and the link), topics to avoid, extra instructions (up to 1,000 characters), greeting, suggested questionsEvery chat about your own company, on your portal and through the API
options on a messagelength, languageThat message
instructions on a messageA note for this turn, up to 500 characters: who the visitor is, what to offer, how long to answerThat message. Server-only keys only: a website key's instructions are ignored, because anyone can read a key in page code.
{
  "text": "Which grinder fits activated carbon?",
  "instructions": "The visitor came from our trade-show page. Answer in two sentences and offer a free material test."
}

Indax's own rules always come first, then your Portal settings, then instructions, then the visitor's message. Steering changes how Dax answers, never what it may read or claim: it answers only from the company's catalog and website, links the page it used, and never invents a product, spec, price or certification, or promises stock or lead times.

On this page