Hoppa till innehållet

Shoppingassistent

The shopping assistant: a server-sent event stream that answers product questions against the channel's own catalogue and content.

1 anrop POST Bas-URL https://api.erp.fluit.cloud/ecom

Autentisering, felkoder, rate limits, idempotens och paginering gäller alla anrop och står samlade under Kom igång.

POST /chat/stream

Ask the shopping assistant

Answers a shopper's question against the channel's own catalogue and content, and streams the reply as server-sent events rather than returning a body. Each event is a `data:` line carrying a JSON fragment; concatenate the text fragments as they arrive and stop at the terminating event.

Visa hela beskrivningen

Because the response is a stream, the 200 has no schema to document — read the event format from the frames themselves. Requires a session, and is enabled per channel through the enableChatAssistant feature flag. Tool results carry only product cards (id, name, slug, image, and price and stock when the channel shows them), and an error event carries a generic message rather than the underlying one.

Headers

Fält Typ Beskrivning
X-Language string Language for translated content, as an ISO 639-1 code ("sv", "en"). Omitting it answers in the channel's default language, and so does a language the channel does not publish — this never fails the request. The channel decides which languages exist; read them from the session response.

Body krävs

Fält Typ Beskrivning
content string · nullable
currentCategory string · nullable Kod eller slug för kategorin besökaren står i.
currentProductId string · nullable Id eller slug för produkten besökaren står på.
currentProductName string · nullable Ignoreras. Namnet slås upp i kanalens katalog från CurrentProductId; fältet ligger kvar så att äldre klienter inte får 400.
history ChatMessageDto[] · nullable
pricesIncludingVat boolean · nullable Om besökaren ser priser inklusive moms. Utelämnat = kanalens standard.

Svar

200 Tom body.

Standardfel: 400 401 429 Felhantering

Exempel

curl
curl -X POST "https://api.erp.fluit.cloud/ecom/chat/stream" \
  -H "Authorization: Bearer $SESSION_TOKEN" \
  -H "X-Tenant-Id: $FLUIT_TENANT_ID" \
  -H "X-Channel: web" \
  -H "X-Language: …" \
  -H "Content-Type: application/json" \
  -d @body.json

Bas-URL https://api.erp.fluit.cloud/ecom.

Scheman

Objekten som gruppens anrop refererar till. Fälttabellerna ovan går ett steg djupt och länkar hit i stället för att upprepa samma schema på varje endpoint.

ChatMessageDto

EcomChatMessageDto
Fält Typ
content string · nullable
role string · nullable