Documentation menu

Chats and text

Support chats

Chats in which your agents and a customer each write in their own language, with voice messages.

A support chat is a conversation between your agents and one customer, each writing (or speaking a voice message) in their own language. Every message is translated for the other side as it is posted.

Two ways to use it#

  1. Spiiksi's chat page. Send the customer customer_url; they chat in a page that needs no account. Your agents answer in Spiiksi's support desk, or you post their answers through the API.
  2. Your own chat. Your chat or helpdesk posts both sides' messages and shows each side what Spiiksi returns. Spiiksi translates and keeps the transcript.

Start a chat#

Shell
curl https://api.spiiksi.fi/v1/sessions \
  -H "Authorization: Bearer $SPIIKSI_KEY" -H "Content-Type: application/json" \
  -d '{"agent_language": "fi", "agent_name": "Acme Support",
       "external_id": "ticket-1234", "metadata": {"queue": "billing"}}'

The answer includes customer_url, given only now. Leave out customer_language and it is learned from the customer's first message; agents' earlier messages are then translated into it.

Post messages#

Shell
curl https://api.spiiksi.fi/v1/sessions/$ID/messages \
  -H "Authorization: Bearer $SPIIKSI_KEY" -H "Content-Type: application/json" \
  -d '{"sender": "customer", "text": "Mi pedido no ha llegado"}'
JSON
{"id": 41, "sender": "customer", "language": "es",
 "text": "Mi pedido no ha llegado",
 "translations": {"fi": "Tilaukseni ei ole saapunut"},
 "agent_text": "Tilaukseni ei ole saapunut",
 "customer_text": "Mi pedido no ha llegado", …}

Show agent_text to agents and customer_text to the customer. author_name sets who wrote it (an agent's own name, say). Voice messages go to POST /v1/sessions/{id}/voice as multipart audio (WebM, Ogg, MP4/M4A, MP3 or WAV, up to two minutes).

Follow a chat#

  • Messages after a cursor: GET /v1/sessions/{id}/messages?after=41, oldest first.
  • Live: GET /v1/sessions/{id}/stream (server-sent events), or GET /v1/events for every chat and call of the organization.
  • Webhooks: session.created, message.created, session.closed; see Webhooks.
  • Typing: POST /v1/sessions/{id}/typing with {"sender": "agent"} shows the customer that someone is writing.
  • POST /v1/sessions/{id}/close ends it; nobody can post after.
  • POST /v1/sessions/{id}/customer-link gives the customer a new link; the old one stops working.
  • Messages are kept retention_days (1–365, default 30). DELETE /v1/sessions/{id} erases a chat and everything said in it at once.

Pricing#

Text: €10 per million characters translated, counted from the original message once for each language it is translated into. A message already in the reader's language costs nothing. Voice messages: €0.20 a minute, including their translation. Prices exclude VAT; other currencies follow your organization's price list.