Skip to content
TriedDocs
Public endpoints

Send widget chat message

Send a visitor's message in a widget chat and get the agent's reply.

POSThttps://api.tried.com.au/public/chat/{chat_id}/message

Adds the visitor's message to a chat started with Start widget chat, runs one agent turn and returns the new items. The chat_token from the start response authorises the request.

When the chat was started with a public key that still exists, the Origin header must match that key's allowed_domains. The public key's rate limits and reCAPTCHA are not checked again here; the per-IP limit for all routes still applies.

Request#

Path parameters#

Parameter Type Required Description
chat_id string Yes The chat_id from Start widget chat.

Body#

Field Type Required Description
chat_token string Yes The chat_token from Start widget chat.
content string Yes The visitor's message, 1 to 4000 characters.

Example request#

curl -X POST "https://api.tried.com.au/public/chat/chat_0a1b2c3d4e5f6a7b8c9d0e1f/message" \
  -H "Origin: https://www.example.com" \
  -H "Content-Type: application/json" \
  -d '{
  "chat_token": "Xq3v9mZ0b1Rk2LpT8wYc4nHs6aGd5eFj7uQi0oPl1Ns",
  "content": "Do you have anything on Saturday?"
}'
// Runs in the browser on an allowed domain.
const res = await fetch(`https://api.tried.com.au/public/chat/${chat.chat_id}/message`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    chat_token: chat.chat_token,
    content: "Do you have anything on Saturday?",
  }),
});
const { messages } = await res.json();
import requests

res = requests.post(
    "https://api.tried.com.au/public/chat/chat_0a1b2c3d4e5f6a7b8c9d0e1f/message",
    headers={"Origin": "https://www.example.com"},
    json={
        "chat_token": "Xq3v9mZ0b1Rk2LpT8wYc4nHs6aGd5eFj7uQi0oPl1Ns",
        "content": "Do you have anything on Saturday?",
    },
)
messages = res.json()["messages"]

Response#

200 OK

{
  "messages": [
    { "role": "agent", "content": "Yes, Saturday at 9 am or 11 am. Which suits you?", "created_timestamp": 1792310461200 }
  ]
}

messages holds the items produced in this turn, in the message item shape, including any tool call items. The visitor's message is not repeated.

Errors#

Status When
400 Validation failed (for example empty content or more than 4000 characters), or This chat has ended.
403 Invalid chat token, or Origin not allowed.
404 Chat not found.
429 Per-IP rate limit exceeded. See Rate limits.

See Errors for the body format.