Send a visitor message and read the event stream

Create a conversation first. message/send, task control, Provider interaction responses, and feedback data branches are unsupported. Preadmission failures may return regular public JSON or JSON-RPC errors. After SSE opens, errors appear in frames. HTTP 200 does not mean task completion. Stream disconnection after persistent admission does not cancel the task; read messages/events again.

POST https://api.moi.matrixorigin.cn/v5/public/webapp/a2a

Before you call this API

BASE_URL uses the product API prefix https://api.moi.matrixorigin.cn/v5. For a dedicated deployment, use its corresponding product API address.

Prepare links and visitor identity in the same environment. Do not supply a product PAT or Workspace request header.

Request

curl --no-buffer --request POST \
  "$BASE_URL/public/webapp/a2a?webapp=$AGENT_ID&t=$WEBAPP_TOKEN&s=$WEBAPP_SESSION" \
  --header "Content-Type: application/json" \
  --data @- <<JSON
{"jsonrpc": "2.0", "id": "request-example", "method": "message/stream", "params": {"message": {"messageId": "message-example", "contextId": "${CONVERSATION_ID}", "role": "user", "parts": [{"kind": "text", "text": "你好"}]}, "idempotencyKey": "example-turn-key"}}
JSON

Parameter

Location

Type

Required

Description

webapp

Query

string

Yes

Agent ID corresponding to the link.

t

Query

string

Yes

Current valid publication token. For short-code links, resolve first and use the short code as t.

s

Query

string

Yes

Visitor session credentials under the same publication.

jsonrpc

Body

string

Yes

Fixed2.0.

method

Body

string

Yes

message/stream only.

id

Body

JSON

No

JSON-RPC request identifier.

params.message

Body

object

Yes

Includes messageId, an already-created conversation contextId, role=user, and nonempty parts containing nonempty text or attachments.

params.idempotencyKey

Body

string

No

Reuse when retrying the same logical request. Changed content requires a new message ID/key.

params.model

Body

string

No

Model selection, still constrained by agent/runtime configuration.

params.llm_backend_id

Body

integer

No

Backend selection; verify actual compatibility during execution.

params.metadata

Body

object

No

Metadata and canonical attachment credentials, not arbitrary file authorization.

Successful response

Response is text/event-stream. Each data: frame carries a JSON-RPC result/error. Determine results from task states and terminal frames.

This entry point returns byte/event streams. Follow this page and stream and file boundaries.

Error response

Public errors and identity handling distinguishes unavailable links, disablement, invalid sessions, parameters, and system failures.

Last updated on