Send a question

To send a question from within an agent you need to open a connection to the WebSocket endpoint and then use JSON to send the message payload in the expected format.

Before you start

Ask your Squiz account team for:

  • the DXP region for your DXP Organization (au, uk, or us);
  • your DXP Organization ID;
  • the chatbot ID for the enabled agent; and
  • confirmation that the website domain is registered with your DXP Organization.

Do not use a chatbot ID, DXP Organization ID, or endpoint from another DXP Organization. These values identify the DXP Organization and agent that the client connects to.

Open a connection

No API key or authorization header is required for a browser connection. Browser access is checked using the request Origin header, so the website domain must be registered with your DXP Organization. A browser sets this header automatically; client-side JavaScript cannot set it manually.

Use wss:// as the protocol.

Do not put credentials, API keys, or visitor information in the WebSocket URL.

The chatbot and DXP Organization identifiers are configuration values, not secrets.

The WebSocket endpoint uses this pattern:

wss://dxp.squiz.cloud/__dxp/REGION/search-conversations/ORGANIZATION_ID/ws/v2/CHATBOT_ID

Some website implementations prefer to use the DXP frontend worker route instead:

wss://YOUR_SITE_DOMAIN/__dxp/service/search-conversations/ws/v2/CHATBOT_ID

Replace the placeholders with the values supplied for your DXP Organization:

YOUR_SITE_DOMAIN

The domain of your frontend website.

REGION

The DXP region, such as au, uk, or us

ORGANIZATION_ID

The configuraton value for the DXP Organization identifier

CHATBOT_ID

The configuration value for the UUID of the enabled agent. 

Use the endpoint and deployment approach supplied for your implementation. The /ws/v2/ path selects the streaming protocol.

Send a question

Send JSON messages with an action field. To ask a question, send a chat message:

{
  "action": "chat",
  "text": "What is your return policy?"
}

To continue an existing conversation, include the threadId returned by the service:

{
  "action": "chat",
  "text": "How long will my refund take?",
  "threadId": "[THREAD_ID]"
}

Omit threadId for the first question in a new conversation. WebSocket applies the live environment internally; a client does not need to send the type: "live" field.

action

Must be chat.

text

The visitor’s question.

threadId

Optional for the first question in a conversation.

Include the identifier to continue an existing thread.